diff --git a/.devcontainer/devcontainer.json b/.devcontainer/android/devcontainer.json similarity index 75% rename from .devcontainer/devcontainer.json rename to .devcontainer/android/devcontainer.json index 76c4e10..117ed0d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/android/devcontainer.json @@ -3,13 +3,13 @@ "remoteEnv": { "NUGET_NAME": "gitlab", "NUGET_SOURCE": "https://gitlab.com/api/v4/projects/51467465/packages/nuget/index.json", - "VCPKG_VERSION": "2024.07.12", + "VCPKG_VERSION": "2024.10.21", "VCPKG_ROOT": "${containerWorkspaceFolder}/vcpkg", "VCPKG_BINARY_SOURCES": "clear;nuget,gitlab,readwrite", "GITLAB_USER": "${localEnv:GITLAB_USER}", "GITLAB_USER_TOKEN": "${localEnv:GITLAB_USER_TOKEN}", "WORKSPACE_DIR": "${containerWorkspaceFolder}", - "PATH": "${containerEnv:PATH}:${containerWorkspaceFolder}/vcpkg:${containerWorkspaceFolder}/vcpkg/downloads/tools/cmake-3.29.2-linux/cmake-3.29.2-linux-x86_64/bin:${containerEnv:ANDROID_HOME}/cmdline-tools/latest/bin:${containerEnv:ANDROID_HOME}/platform-tools:${containerEnv:ANDROID_HOME}/emulator" + "PATH": "${containerEnv:PATH}:${containerWorkspaceFolder}/vcpkg:${containerWorkspaceFolder}/vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/bin:${containerWorkspaceFolder}/vcpkg/downloads/tools/ninja-1.11.1-linux:${containerEnv:ANDROID_HOME}/cmdline-tools/latest/bin:${containerEnv:ANDROID_HOME}/platform-tools:${containerEnv:ANDROID_HOME}/emulator" }, "runArgs": [ "--gpus", @@ -29,5 +29,5 @@ } }, "overrideCommand": true, - "postCreateCommand": "bash .devcontainer/postcreate.sh" + "postCreateCommand": "bash .devcontainer/android/postcreate.sh" } \ No newline at end of file diff --git a/.devcontainer/postcreate.sh b/.devcontainer/android/postcreate.sh similarity index 91% rename from .devcontainer/postcreate.sh rename to .devcontainer/android/postcreate.sh index b153095..6068c16 100644 --- a/.devcontainer/postcreate.sh +++ b/.devcontainer/android/postcreate.sh @@ -9,12 +9,13 @@ fi ./vcpkg/bootstrap-vcpkg.sh ./vcpkg/vcpkg fetch nuget ./vcpkg/vcpkg fetch cmake +./vcpkg/vcpkg fetch ninja echo "mono ./vcpkg/downloads/tools/nuget-6.10.0-linux/nuget.exe sources add -source $NUGET_SOURCE -name $NUGET_NAME -username $GITLAB_USER -password $GITLAB_USER_TOKEN" mono ./vcpkg/downloads/tools/nuget-6.10.0-linux/nuget.exe sources add -source $NUGET_SOURCE -name $NUGET_NAME -username $GITLAB_USER -password $GITLAB_USER_TOKEN sdkmanager "emulator" -sdkmanager "system-images;android-34;google_apis;x86_64" +sdkmanager "system-images;android-34;google_apis;x86_64;arm64-v8a" apt install -y libpulse-dev if [ ! -d "$WORKSPACE_DIR/avd" ]; then diff --git a/.devcontainer/linux/devcontainer.json b/.devcontainer/linux/devcontainer.json new file mode 100644 index 0000000..ec96f97 --- /dev/null +++ b/.devcontainer/linux/devcontainer.json @@ -0,0 +1,33 @@ +{ + "image": "registry.gitlab.com/asxa86/images/ubuntu-dev:latest", + "remoteEnv": { + "NUGET_NAME": "gitlab", + "NUGET_SOURCE": "https://gitlab.com/api/v4/projects/51467465/packages/nuget/index.json", + "VCPKG_VERSION": "2024.10.21", + "VCPKG_ROOT": "${containerWorkspaceFolder}/vcpkg", + "VCPKG_BINARY_SOURCES": "clear;nuget,gitlab,readwrite", + "GITLAB_USER": "${localEnv:GITLAB_USER}", + "GITLAB_USER_TOKEN": "${localEnv:GITLAB_USER_TOKEN}", + "WORKSPACE_DIR": "${containerWorkspaceFolder}", + "PATH": "${containerEnv:PATH}:${containerWorkspaceFolder}/vcpkg:${containerWorkspaceFolder}/vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/bin:${containerWorkspaceFolder}/vcpkg/downloads/tools/ninja-1.11.1-linux" + }, + "runArgs": [ + "--gpus", + "all", + "--device", + "/dev/kvm" + ], + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cmake-tools", + "twxs.cmake", + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "bbenoist.QML" + ] + } + }, + "overrideCommand": true, + "postCreateCommand": "bash .devcontainer/linux/postcreate.sh" +} \ No newline at end of file diff --git a/.devcontainer/linux/postcreate.sh b/.devcontainer/linux/postcreate.sh new file mode 100644 index 0000000..44a9796 --- /dev/null +++ b/.devcontainer/linux/postcreate.sh @@ -0,0 +1,15 @@ +#! /bin/bash + +if [ -d "$VCPKG_ROOT" ]; then + echo "$VCPKG_ROOT already exists. Skipping clone." +else + git clone https://github.com/microsoft/vcpkg.git $VCPKG_ROOT --depth 1 --branch $VCPKG_VERSION +fi + +./vcpkg/bootstrap-vcpkg.sh +./vcpkg/vcpkg fetch nuget +./vcpkg/vcpkg fetch cmake +./vcpkg/vcpkg fetch ninja + +echo "mono ./vcpkg/downloads/tools/nuget-6.10.0-linux/nuget.exe sources add -source $NUGET_SOURCE -name $NUGET_NAME -username $GITLAB_USER -password $GITLAB_USER_TOKEN" +mono ./vcpkg/downloads/tools/nuget-6.10.0-linux/nuget.exe sources add -source $NUGET_SOURCE -name $NUGET_NAME -username $GITLAB_USER -password $GITLAB_USER_TOKEN diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f156951..57a9f3d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,9 +9,9 @@ default: variables: NUGET_SOURCE: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/nuget/index.json" NUGET_NAME: gitlab - VCPKG_VERSION: 2024.07.12 + VCPKG_VERSION: 2024.10.21 VCPKG_BINARY_SOURCES: "clear;nuget,${NUGET_NAME},readwrite" - CMAKE_COMMAND: ${CI_PROJECT_DIR}/vcpkg/downloads/tools/cmake-3.29.2-linux/cmake-3.29.2-linux-x86_64/bin/cmake + CMAKE_COMMAND: ${CI_PROJECT_DIR}/vcpkg/downloads/tools/cmake-3.30.1-linux/cmake-3.30.1-linux-x86_64/bin/cmake NUGET_COMMAND: ${CI_PROJECT_DIR}/vcpkg/downloads/tools/nuget-6.10.0-linux/nuget.exe .get-vcpkg: &get-vcpkg @@ -20,6 +20,8 @@ variables: - ./vcpkg/bootstrap-vcpkg.sh - ./vcpkg/vcpkg fetch nuget --x-wait-for-lock - ./vcpkg/vcpkg fetch cmake --x-wait-for-lock + - ./vcpkg/vcpkg fetch ninja --x-wait-for-lock + - export PATH=$PATH:${CI_PROJECT_DIR}/vcpkg/downloads/tools/ninja-1.11.1-linux # Configure NuGet - mono ${NUGET_COMMAND} sources add -source ${NUGET_SOURCE} -name ${NUGET_NAME} -username gitlab-ci-token -password $CI_JOB_TOKEN @@ -37,13 +39,13 @@ lint-clang-tidy: - *get-vcpkg # Configure Aspire - - ${CMAKE_COMMAND} --preset clang-debug + - ${CMAKE_COMMAND} --preset x64-linux-gcc-debug # Build to force generate moc files. - - ${CMAKE_COMMAND} --build --preset clang-debug + - ${CMAKE_COMMAND} --build --preset x64-linux-gcc-debug # Run Clang Tidy - - find module/ app/ -type f -name "*.cpp" -print0 | xargs -0 -P $(nproc --all) clang-tidy-18 -p build-debug + - find app/ -type f -name "*.cpp" -print0 | xargs -0 -P $(nproc --all) clang-tidy-18 -p build .build-base: image: $CI_REGISTRY/asxa86/images/ubuntu-dev:latest @@ -65,48 +67,35 @@ lint-clang-tidy: # paths: # - vcpkg/buildtrees/**/*.txt # - vcpkg/buildtrees/**/*.log - -build-clang-debug: - extends: .build-base - variables: - CMAKE_PRESET: clang-debug artifacts: expire_in: 1 day paths: - - build-debug + - build + exclude: + - build/vcpkg_installed/**/* + +build-gcc-debug: + extends: .build-base + variables: + CMAKE_PRESET: x64-linux-gcc-debug build-gcc-release: extends: .build-base variables: - CMAKE_PRESET: gcc-release - artifacts: - expire_in: 1 day - paths: - - build-release + CMAKE_PRESET: x64-linux-gcc-release build-android-x64-debug: image: $CI_REGISTRY/asxa86/images/android-build:latest extends: .build-base variables: - CMAKE_PRESET: android-x64-debug - artifacts: - expire_in: 1 day - paths: - - build-debug - exclude: - - build-debug/vcpkg_installed/**/* + CMAKE_PRESET: x64-android-debug + build-android-armg64-debug: image: $CI_REGISTRY/asxa86/images/android-build:latest extends: .build-base variables: - CMAKE_PRESET: android-arm64-debug - artifacts: - expire_in: 1 day - paths: - - build-debug - exclude: - - build-debug/vcpkg_installed/**/* + CMAKE_PRESET: arm64-android-debug build-gcc-debug-sonar: image: $CI_REGISTRY/asxa86/images/ubuntu-dev:latest @@ -118,7 +107,7 @@ build-gcc-debug-sonar: - docker - large variables: - CMAKE_PRESET: gcc-debug + CMAKE_PRESET: x64-linux-gcc-debug script: # Download sonar-scanner - curl -sSLo ./sonar-scanner.zip 'https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.1.0.4477-linux-x64.zip' @@ -134,11 +123,11 @@ build-gcc-debug-sonar: # Run the sonar-scanner in the same stage as the build - sonar-scanner/bin/sonar-scanner -Dsonar.host.url="${SONAR_HOST_URL}" -Dsonar.token="${SONAR_TOKEN}" -Dsonar.cfamily.compile-commands=bw-output/compile_commands.json -test-clang-debug: +test-gcc-debug: image: $CI_REGISTRY/asxa86/images/ubuntu-dev:latest stage: test needs: - - build-clang-debug + - build-gcc-debug tags: # - saas-linux-medium-amd64 - shelley @@ -146,4 +135,4 @@ test-clang-debug: - large script: - *get-vcpkg - - ${CMAKE_COMMAND} --build --preset clang-debug --target test + - ${CMAKE_COMMAND} --build --preset x64-linux-gcc-debug --target test diff --git a/.vscode/tasks.json b/.vscode/tasks.json deleted file mode 100644 index 05054c5..0000000 --- a/.vscode/tasks.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "tasks": [ - { - "type": "cppbuild", - "label": "C/C++: g++ build active file", - "command": "/usr/bin/g++", - "args": [ - "-fdiagnostics-color=always", - "-g", - "${file}", - "-o", - "${fileDirname}/${fileBasenameNoExtension}" - ], - "options": { - "cwd": "${fileDirname}" - }, - "problemMatcher": [ - "$gcc" - ], - "group": { - "kind": "build", - "isDefault": true - }, - "detail": "Task generated by Debugger." - } - ], - "version": "2.0.0" -} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 146da2a..dd7f685 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,22 +1,16 @@ cmake_minimum_required(VERSION 3.27) -enable_language(CXX) set_property(GLOBAL PROPERTY USE_FOLDERS ON) -include(GenerateExportHeader) -include(CMakePackageConfigHelpers) -include(GNUInstallDirs) -include(cmake/project_compile_options.cmake) -include(cmake/project_add_library.cmake) -include(cmake/project_add_executable.cmake) -include(cmake/project_add_module.cmake) -include(cmake/project_gen_export.cmake) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/installed) -set(PROJECT_ROOT_NAME aspire) -project(${PROJECT_ROOT_NAME}) +project(aspire) + +enable_language(CXX) +include(GenerateExportHeader) +include(CMakePackageConfigHelpers) +include(GNUInstallDirs) include(CTest) include(GoogleTest) @@ -33,18 +27,11 @@ include_directories(SYSTEM ${CMAKE_CURRENT_BINARY_DIR}) # Qt fails to find this path for android when it invokes Qt6AndroidMacros.cmake. set(QT_ANDROID_PATH_CMAKE_DIR_${ANDROID_ABI} ${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share) -find_package(Qt6 CONFIG REQUIRED COMPONENTS Quick) +find_package(Qt6 6.7 CONFIG REQUIRED COMPONENTS Quick) -qt_standard_project_setup() +qt_standard_project_setup(REQUIRES 6.7) set(CMAKE_AUTOMOC ON) add_subdirectory(app) -add_subdirectory(module) - -# set(PROJECT_CONFIG_VERSION ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_ROOT_NAME}-config-version.cmake) -# write_basic_package_version_file(${PROJECT_CONFIG_VERSION} VERSION 0.0.0 COMPATIBILITY SameMajorVersion) - -# install(EXPORT ${PROJECT_ROOT_NAME}-config DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}) -# install(DIRECTORY include/${PROJECT_ROOT_NAME} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -# install(FILES ${PROJECT_CONFIG_VERSION} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}) +# add_subdirectory(module) diff --git a/CMakePresets.json b/CMakePresets.json index 7dd5161..673f67e 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,304 +1,251 @@ { "version": 6, + "include": [ + "cmake/preset/config-arm64-android.json", + "cmake/preset/config-arm64-osx.json", + "cmake/preset/config-arm64-windows.json", + "cmake/preset/config-debug.json", + "cmake/preset/config-release.json", + "cmake/preset/config-relwithdebinfo.json", + "cmake/preset/config-x64-android.json", + "cmake/preset/config-x64-linux.json", + "cmake/preset/config-x64-windows.json", + "cmake/preset/default-build-dir.json", + "cmake/preset/default-linux.json", + "cmake/preset/default-osx.json", + "cmake/preset/default-windows.json", + "cmake/preset/use-clang.json", + "cmake/preset/use-gcc.json", + "cmake/preset/use-msvc.json", + "cmake/preset/use-ninja.json", + "cmake/preset/use-vcpkg.json" + ], "configurePresets": [ { - "name": "default", - "displayName": "Default", - "binaryDir": "${sourceDir}/build/", - "toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake", - "environment": { - "VCPKG_FEATURE_FLAGS": "-compilertracking" - }, - "cacheVariables": { - "CMAKE_COMPILE_WARNING_AS_ERROR": true, - "VCPKG_APPLOCAL_DEPS": false - } - }, - { - "name": "linux", - "inherits": "default", - "displayName": "Linux Default", - "generator": "Unix Makefiles", - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Linux" - }, - "cacheVariables": { - "VCPKG_TARGET_TRIPLET": "x64-linux-aspire", - "VCPKG_HOST_TRIPLET": "x64-linux-aspire" - } - }, - { - "name": "gcc-debug", - "inherits": "linux", - "displayName": "GCC Debug", - "binaryDir": "${sourceDir}/build-debug", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_CXX_COMPILER": "g++", - "CMAKE_C_COMPILER": "gcc" - } - }, - { - "name": "gcc-release", - "inherits": "gcc-debug", - "displayName": "GCC Release", - "binaryDir": "${sourceDir}/build-release", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release" - } - }, - { - "name": "clang-debug", - "inherits": "linux", - "displayName": "Clang Debug", - "binaryDir": "${sourceDir}/build-debug", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_CXX_COMPILER": "/usr/bin/clang++-18", - "CMAKE_C_COMPILER": "/usr/bin/clang-18", - "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" - } - }, - { - "name": "windows", - "inherits": "default", - "generator": "Visual Studio 17 2022", - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Windows" - } - }, - { - "name": "x64-windows-debug", - "inherits": "windows", - "binaryDir": "${sourceDir}/build-debug", - "cacheVariables": { - "CMAKE_CONFIGURATION_TYPES": "Debug", - "CMAKE_TRY_COMPILE_CONFIGURATION": "Debug", - "VCPKG_TARGET_TRIPLET": "x64-windows-aspire", - "VCPKG_HOST_TRIPLET": "x64-windows-aspire" - } - }, - { - "name": "x64-windows-relwithdebinfo", - "inherits": "x64-windows-debug", - "binaryDir": "${sourceDir}/build-relwithdebinfo", - "cacheVariables": { - "CMAKE_CONFIGURATION_TYPES": "RelWithDebInfo", - "CMAKE_TRY_COMPILE_CONFIGURATION": "RelWithDebInfo" - } - }, - { - "name": "x64-windows-release", - "inherits": "x64-windows-debug", - "binaryDir": "${sourceDir}/build-release", - "cacheVariables": { - "CMAKE_CONFIGURATION_TYPES": "Release", - "CMAKE_TRY_COMPILE_CONFIGURATION": "Release" - } - }, - { - "name": "arm64-windows-debug", - "inherits": "windows", - "binaryDir": "${sourceDir}/build-debug", - "cacheVariables": { - "CMAKE_CONFIGURATION_TYPES": "Debug", - "CMAKE_TRY_COMPILE_CONFIGURATION": "Debug", - "VCPKG_TARGET_TRIPLET": "arm64-windows-aspire", - "VCPKG_HOST_TRIPLET": "arm64-windows-aspire" - } - }, - { - "name": "arm64-windows-relwithdebinfo", - "inherits": "arm64-windows-debug", - "binaryDir": "${sourceDir}/build-relwithdebinfo", - "cacheVariables": { - "CMAKE_CONFIGURATION_TYPES": "RelWithDebInfo", - "CMAKE_TRY_COMPILE_CONFIGURATION": "RelWithDebInfo" - } - }, - { - "name": "arm64-windows-release", - "inherits": "arm64-windows-debug", - "binaryDir": "${sourceDir}/build-release", - "cacheVariables": { - "CMAKE_CONFIGURATION_TYPES": "Release", - "CMAKE_TRY_COMPILE_CONFIGURATION": "Release" - } - }, - { - "name": "osx", - "inherits": "default", - "generator": "Unix Makefiles", - "condition": { - "type": "equals", - "lhs": "${hostSystemName}", - "rhs": "Darwin" - }, - "cacheVariables": { - "BUILD_SHARED_LIBS": false, - "BUILD_ENABLE_HARDENED": false, - "CMAKE_CXX_COMPILER": "clang++", - "CMAKE_C_COMPILER": "clang", - "VCPKG_TARGET_TRIPLET": "arm64-osx-aspire", - "VCPKG_HOST_TRIPLET": "arm64-osx-aspire" - } - }, - { - "name": "osx-debug", - "inherits": "osx", - "displayName": "OSX Debug", - "binaryDir": "${sourceDir}/build-debug", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" - } - }, - { - "name": "osx-release", - "inherits": "osx", - "displayName": "OSX Release", - "binaryDir": "${sourceDir}/build-release", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release" - } - }, - { - "name": "android", - "inherits": "linux", - "cacheVariables": { - "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/toolchains/android.cmake", - "ANDROID_STL": "c++_shared", - "ANDROID_SDK_ROOT": "$env{ANDROID_HOME}", - "VCPKG_KEEP_ENV_VARS": "ANDROID_HOME;ANDROID_NDK_HOME", - "VCPKG_INSTALL_OPTIONS": "--allow-unsupported", - "ANDROID_PLATFORM": "34", - "BUILD_TESTING": "OFF" - } - }, - { - "name": "android-x64", - "inherits": "android", - "displayName": "Android x64", - "cacheVariables": { - "VCPKG_TARGET_TRIPLET": "x64-android-aspire", - "VCPKG_HOST_TRIPLET": "x64-linux-aspire", - "ANDROID_ABI": "x86_64" - } - }, - { - "name": "android-x64-debug", - "inherits": "android-x64", - "binaryDir": "${sourceDir}/build-debug", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" - } - }, - { - "name": "android-x64-release", - "inherits": "android-x64", - "binaryDir": "${sourceDir}/build-release", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release" - } - }, - { - "name": "android-arm64-v8a", - "inherits": "android", - "displayName": "Android arm64", - "cacheVariables": { - "VCPKG_TARGET_TRIPLET": "arm64-android-aspire", - "VCPKG_HOST_TRIPLET": "x64-linux-aspire", - "ANDROID_ABI": "arm64-v8a" - } - }, - { - "name": "android-arm64-debug", - "inherits": "android-arm64-v8a", - "displayName": "Android Arm64 (Debug)", - "binaryDir": "${sourceDir}/build-debug", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug" - } - }, - { - "name": "android-arm64-release", - "inherits": "android-arm64-v8a", - "displayName": "Android Arm64 (Release)", - "binaryDir": "${sourceDir}/build-release", - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release" - } + "name": "x64-windows-msvc-debug", + "inherits": [ + "config-debug", + "config-x64-windows", + "default-build-dir", + "default-windows", + "use-msvc", + "use-ninja", + "use-vcpkg" + ] + }, + { + "name": "x64-windows-msvc-relwithdebinfo", + "inherits": [ + "config-relwithdebinfo", + "config-x64-windows", + "default-build-dir", + "default-windows", + "use-msvc", + "use-ninja", + "use-vcpkg" + ] + }, + { + "name": "x64-windows-msvc-release", + "inherits": [ + "config-release", + "config-x64-windows", + "default-build-dir", + "default-windows", + "use-msvc", + "use-ninja", + "use-vcpkg" + ] + }, + { + "name": "arm64-windows-msvc-debug", + "inherits": [ + "config-debug", + "config-arm64-windows", + "default-build-dir", + "default-windows", + "use-msvc", + "use-ninja", + "use-vcpkg" + ] + }, + { + "name": "arm64-windows-msvc-relwithdebinfo", + "inherits": [ + "config-relwithdebinfo", + "config-arm64-windows", + "default-build-dir", + "default-windows", + "use-msvc", + "use-ninja", + "use-vcpkg" + ] + }, + { + "name": "arm64-windows-msvc-release", + "inherits": [ + "config-release", + "config-arm64-windows", + "default-build-dir", + "default-windows", + "use-msvc", + "use-ninja", + "use-vcpkg" + ] + }, + { + "name": "arm64-osx-clang-debug", + "inherits": [ + "config-debug", + "config-arm64-osx", + "default-build-dir", + "default-osx", + "use-clang", + "use-ninja", + "use-vcpkg" + ] + }, + { + "name": "arm64-osx-clang-release", + "inherits": [ + "config-release", + "config-arm64-osx", + "default-build-dir", + "default-osx", + "use-clang", + "use-ninja", + "use-vcpkg" + ] + }, + { + "name": "x64-linux-gcc-debug", + "inherits": [ + "config-debug", + "config-x64-linux", + "default-build-dir", + "default-linux", + "use-gcc", + "use-ninja", + "use-vcpkg" + ] + }, + { + "name": "x64-linux-gcc-release", + "inherits": [ + "config-release", + "config-x64-linux", + "default-build-dir", + "default-linux", + "use-gcc", + "use-ninja", + "use-vcpkg" + ] + }, + { + "name": "x64-android-debug", + "inherits": [ + "config-debug", + "config-x64-android", + "default-build-dir", + "default-linux", + "use-gcc", + "use-ninja", + "use-vcpkg" + ] + }, + { + "name": "x64-android-release", + "inherits": [ + "config-release", + "config-x64-android", + "default-build-dir", + "default-linux", + "use-gcc", + "use-ninja", + "use-vcpkg" + ] + }, + { + "name": "arm64-android-debug", + "inherits": [ + "config-debug", + "config-arm64-android", + "default-build-dir", + "default-linux", + "use-gcc", + "use-ninja", + "use-vcpkg" + ] + }, + { + "name": "arm64-android-release", + "inherits": [ + "config-release", + "config-arm64-android", + "default-build-dir", + "default-linux", + "use-gcc", + "use-ninja", + "use-vcpkg" + ] } ], "buildPresets": [ { - "name": "gcc-debug", - "configurePreset": "gcc-debug" - }, - { - "name": "gcc-release", - "configurePreset": "gcc-release" + "name": "x64-windows-msvc-debug", + "configurePreset": "x64-windows-msvc-debug" }, { - "name": "clang-debug", - "configurePreset": "clang-debug" + "name": "x64-windows-msvc-relwithdebinfo", + "configurePreset": "x64-windows-msvc-relwithdebinfo" }, { - "name": "x64-windows-debug", - "configurePreset": "x64-windows-debug", - "configuration": "Debug" + "name": "x64-windows-msvc-release", + "configurePreset": "x64-windows-msvc-release" }, { - "name": "x64-windows-release", - "configurePreset": "x64-windows-release", - "configuration": "Release" + "name": "arm64-windows-msvc-debug", + "configurePreset": "arm64-windows-msvc-debug" }, { - "name": "x64-windows-relwithdebinfo", - "configurePreset": "x64-windows-relwithdebinfo", - "configuration": "RelWithDebInfo" + "name": "arm64-windows-msvc-relwithdebinfo", + "configurePreset": "arm64-windows-msvc-relwithdebinfo" }, { - "name": "arm64-windows-debug", - "configurePreset": "arm64-windows-debug", - "configuration": "Debug" + "name": "arm64-windows-msvc-release", + "configurePreset": "arm64-windows-msvc-release" }, { - "name": "arm64-windows-release", - "configurePreset": "arm64-windows-release", - "configuration": "Release" + "name": "arm64-osx-clang-debug", + "configurePreset": "arm64-osx-clang-debug" }, { - "name": "arm64-windows-relwithdebinfo", - "configurePreset": "arm64-windows-relwithdebinfo", - "configuration": "RelWithDebInfo" + "name": "arm64-osx-clang-release", + "configurePreset": "arm64-osx-clang-release" }, { - "name": "osx-debug", - "configurePreset": "osx-debug" + "name": "x64-linux-gcc-debug", + "configurePreset": "x64-linux-gcc-debug" }, { - "name": "osx-release", - "configurePreset": "osx-release" + "name": "x64-linux-gcc-release", + "configurePreset": "x64-linux-gcc-release" }, { - "name": "android-x64-debug", - "configurePreset": "android-x64-debug" + "name": "x64-android-debug", + "configurePreset": "x64-android-debug" }, { - "name": "android-x64-release", - "configurePreset": "android-x64-release" + "name": "x64-android-release", + "configurePreset": "x64-android-release" }, { - "name": "android-arm64-debug", - "configurePreset": "android-arm64-debug" + "name": "arm64-android-debug", + "configurePreset": "arm64-android-debug" }, { - "name": "android-arm64-release", - "configurePreset": "android-arm64-release" + "name": "arm64-android-release", + "configurePreset": "arm64-android-release" } ] } \ No newline at end of file diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index ac7ef95..cc97d79 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,2 +1 @@ -add_subdirectory(edit) -add_subdirectory(edh) +add_subdirectory(pong) diff --git a/app/edh/CMakeLists.txt b/app/edh/CMakeLists.txt deleted file mode 100644 index 377cd08..0000000 --- a/app/edh/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -project(aspire-edh) - -project_add_executable(${PROJECT_NAME}) - -target_sources(${PROJECT_NAME} PRIVATE - main.cpp -) - -target_link_libraries(${PROJECT_NAME} PRIVATE - Qt::Quick - aspireplugin -) diff --git a/app/edh/Main.qml b/app/edh/Main.qml deleted file mode 100644 index b7f3f22..0000000 --- a/app/edh/Main.qml +++ /dev/null @@ -1,57 +0,0 @@ -import QtQuick -import aspire - -Rectangle { - width: 1280 - height: 720 - anchors.fill: parent - color: "blue" - border.width: 4 - border.color: "grey" - - Counter { - color: "red" - width: parent.width / 2 - height: parent.height / 2 - rotation: 180 - value: 40 - } - - Counter { - color: "blue" - x: parent.width / 2 - width: parent.width / 2 - height: parent.height / 2 - rotation: 180 - value: 40 - } - - Counter { - color: "green" - y: parent.height / 2 - width: parent.width / 2 - height: parent.height / 2 - value: 40 - } - - Counter { - color: "brown" - y: parent.height / 2 - x: parent.width / 2 - width: parent.width / 2 - height: parent.height / 2 - value: 40 - } - - FrameMetrics { - id: metrics - - thread: FrameMetrics.Thread.Render - } - - Text { - text: metrics.fpsRolling.toFixed(2) - color: "white" - font.pixelSize: 50 - } -} \ No newline at end of file diff --git a/app/edh/main.cpp b/app/edh/main.cpp deleted file mode 100644 index f0cee4b..0000000 --- a/app/edh/main.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include - -int main(int argc, char** argv) -{ - const QGuiApplication app{argc, argv}; - - QQuickView window{}; - - constexpr auto width{1280}; - constexpr auto height{720}; - window.setWidth(width); - window.setHeight(height); - window.setTitle("Aspire EDH"); - window.engine()->addImportPath(":/"); - window.setSource(QUrl{"qrc:/aspire/edh/Main.qml"}); - window.show(); - - return QGuiApplication::exec(); -} \ No newline at end of file diff --git a/app/edit/CMakeLists.txt b/app/edit/CMakeLists.txt deleted file mode 100644 index 6717af3..0000000 --- a/app/edit/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -project(aspire-edit) - -project_add_executable(${PROJECT_NAME}) - -target_sources(${PROJECT_NAME} PRIVATE - main.cpp -) - -target_link_libraries(${PROJECT_NAME} PRIVATE - Qt::Quick - aspireplugin -) diff --git a/app/edit/Main.qml b/app/edit/Main.qml deleted file mode 100644 index afbf157..0000000 --- a/app/edit/Main.qml +++ /dev/null @@ -1,35 +0,0 @@ -import QtQuick -import aspire - -Rectangle { - anchors.fill: parent - color: "blue" - border.width: 4 - border.color: "grey" - - Square { - id: square - x: 300 - y: 40 - rotation: 30 - - MouseArea { - anchors.fill: parent - - drag.target: square - } - } - - FrameMetrics { - id: metrics - - thread: FrameMetrics.Thread.Render - } - - Text { - anchors.centerIn: parent - text: metrics.fpsRolling.toFixed(2) - color: "white" - font.pixelSize: 50 - } -} \ No newline at end of file diff --git a/app/edit/main.cpp b/app/edit/main.cpp deleted file mode 100644 index 0bff2a5..0000000 --- a/app/edit/main.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include - -int main(int argc, char** argv) -{ - const QGuiApplication app{argc, argv}; - - QQuickView window{}; - - constexpr auto width{1280}; - constexpr auto height{720}; - window.setWidth(width); - window.setHeight(height); - window.setTitle("Aspire Edit"); - window.engine()->addImportPath(":/"); - window.setSource(QUrl{"qrc:/aspire/edit/Main.qml"}); - window.show(); - - return QGuiApplication::exec(); -} \ No newline at end of file diff --git a/app/pong/CMakeLists.txt b/app/pong/CMakeLists.txt new file mode 100644 index 0000000..abb9dc7 --- /dev/null +++ b/app/pong/CMakeLists.txt @@ -0,0 +1,35 @@ +project(pong) + +qt_add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE + main.cpp +) + +qt_add_qml_module(${PROJECT_NAME} + URI app.${PROJECT_NAME} + VERSION 1.0 + QML_FILES + Main.qml +) + +target_link_libraries(${PROJECT_NAME} PRIVATE + Qt::Core + Qt::Quick +) + +if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL Android) + install(TARGETS ${PROJECT_NAME} + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + + qt_generate_deploy_qml_app_script( + TARGET ${PROJECT_NAME} + OUTPUT_SCRIPT deploy_script + MACOS_BUNDLE_POST_BUILD + NO_UNSUPPORTED_PLATFORM_ERROR + DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM + ) + + install(SCRIPT ${deploy_script}) +endif() diff --git a/app/pong/Main.qml b/app/pong/Main.qml new file mode 100644 index 0000000..f19902c --- /dev/null +++ b/app/pong/Main.qml @@ -0,0 +1,9 @@ +import QtQuick + +Window { + width: 1280 + height: 720 + visible: true + color: "blue" + title: "Pong" +} diff --git a/app/pong/main.cpp b/app/pong/main.cpp new file mode 100644 index 0000000..d362bc6 --- /dev/null +++ b/app/pong/main.cpp @@ -0,0 +1,14 @@ +#include +#include + +int main(int argc, char** argv) +{ + const QGuiApplication app(argc, argv); + + QQmlApplicationEngine engine; + QObject::connect( + &engine, &QQmlApplicationEngine::objectCreationFailed, &app, [] { QCoreApplication::exit(-1); }, Qt::QueuedConnection); + engine.loadFromModule("app.pong", "Main"); + + return QGuiApplication::exec(); +} diff --git a/cmake/preset/config-arm64-android.json b/cmake/preset/config-arm64-android.json new file mode 100644 index 0000000..648174f --- /dev/null +++ b/cmake/preset/config-arm64-android.json @@ -0,0 +1,20 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "config-arm64-android", + "hidden": true, + "cacheVariables": { + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/toolchains/android.cmake", + "VCPKG_HOST_TRIPLET": "x64-linux-aspire", + "VCPKG_TARGET_TRIPLET": "arm64-android-aspire", + "VCPKG_INSTALL_OPTIONS": "--allow-unsupported", + "VCPKG_KEEP_ENV_VARS": "ANDROID_HOME;ANDROID_NDK_HOME", + "ANDROID_STL": "c++_shared", + "ANDROID_SDK_ROOT": "$env{ANDROID_HOME}", + "ANDROID_PLATFORM": "34", + "ANDROID_ABI": "arm64-v8a" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/config-arm64-osx.json b/cmake/preset/config-arm64-osx.json new file mode 100644 index 0000000..1e4a9de --- /dev/null +++ b/cmake/preset/config-arm64-osx.json @@ -0,0 +1,13 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "config-arm64-osx", + "hidden": true, + "cacheVariables": { + "VCPKG_HOST_TRIPLET": "arm64-osx-release", + "VCPKG_TARGET_TRIPLET": "arm64-osx-release" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/config-arm64-windows.json b/cmake/preset/config-arm64-windows.json new file mode 100644 index 0000000..bdfcf78 --- /dev/null +++ b/cmake/preset/config-arm64-windows.json @@ -0,0 +1,13 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "config-arm64-windows", + "hidden": true, + "cacheVariables": { + "VCPKG_HOST_TRIPLET": "arm64-windows-aspire", + "VCPKG_TARGET_TRIPLET": "arm64-windows-aspire" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/config-debug.json b/cmake/preset/config-debug.json new file mode 100644 index 0000000..190386d --- /dev/null +++ b/cmake/preset/config-debug.json @@ -0,0 +1,12 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "config-debug", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/config-release.json b/cmake/preset/config-release.json new file mode 100644 index 0000000..e6142a6 --- /dev/null +++ b/cmake/preset/config-release.json @@ -0,0 +1,12 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "config-release", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/config-relwithdebinfo.json b/cmake/preset/config-relwithdebinfo.json new file mode 100644 index 0000000..403b57c --- /dev/null +++ b/cmake/preset/config-relwithdebinfo.json @@ -0,0 +1,12 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "config-relwithdebinfo", + "hidden": true, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/config-x64-android.json b/cmake/preset/config-x64-android.json new file mode 100644 index 0000000..a543c28 --- /dev/null +++ b/cmake/preset/config-x64-android.json @@ -0,0 +1,20 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "config-x64-android", + "hidden": true, + "cacheVariables": { + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/toolchains/android.cmake", + "VCPKG_HOST_TRIPLET": "x64-linux-aspire", + "VCPKG_TARGET_TRIPLET": "x64-android-aspire", + "VCPKG_INSTALL_OPTIONS": "--allow-unsupported", + "VCPKG_KEEP_ENV_VARS": "ANDROID_HOME;ANDROID_NDK_HOME", + "ANDROID_STL": "c++_shared", + "ANDROID_SDK_ROOT": "$env{ANDROID_HOME}", + "ANDROID_PLATFORM": "34", + "ANDROID_ABI": "x86_64" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/config-x64-linux.json b/cmake/preset/config-x64-linux.json new file mode 100644 index 0000000..471b164 --- /dev/null +++ b/cmake/preset/config-x64-linux.json @@ -0,0 +1,13 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "config-x64-linux", + "hidden": true, + "cacheVariables": { + "VCPKG_HOST_TRIPLET": "x64-linux-aspire", + "VCPKG_TARGET_TRIPLET": "x64-linux-aspire" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/config-x64-windows.json b/cmake/preset/config-x64-windows.json new file mode 100644 index 0000000..5f500b2 --- /dev/null +++ b/cmake/preset/config-x64-windows.json @@ -0,0 +1,13 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "config-x64-windows", + "hidden": true, + "cacheVariables": { + "VCPKG_HOST_TRIPLET": "x64-windows-aspire", + "VCPKG_TARGET_TRIPLET": "x64-windows-aspire" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/default-build-dir.json b/cmake/preset/default-build-dir.json new file mode 100644 index 0000000..632aaa8 --- /dev/null +++ b/cmake/preset/default-build-dir.json @@ -0,0 +1,10 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "default-build-dir", + "hidden": true, + "binaryDir": "${sourceDir}/build" + } + ] +} \ No newline at end of file diff --git a/cmake/preset/default-linux.json b/cmake/preset/default-linux.json new file mode 100644 index 0000000..d0a4ed5 --- /dev/null +++ b/cmake/preset/default-linux.json @@ -0,0 +1,14 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "default-linux", + "hidden": true, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/default-osx.json b/cmake/preset/default-osx.json new file mode 100644 index 0000000..bfe3d38 --- /dev/null +++ b/cmake/preset/default-osx.json @@ -0,0 +1,13 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "default-osx", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/default-windows.json b/cmake/preset/default-windows.json new file mode 100644 index 0000000..38159e7 --- /dev/null +++ b/cmake/preset/default-windows.json @@ -0,0 +1,14 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "default-windows", + "hidden": true, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/use-clang.json b/cmake/preset/use-clang.json new file mode 100644 index 0000000..d1ad7a1 --- /dev/null +++ b/cmake/preset/use-clang.json @@ -0,0 +1,14 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "use-clang", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "clang++", + "CMAKE_C_COMPILER": "clang", + "CMAKE_EXPORT_COMPILE_COMMANDS": true + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/use-gcc.json b/cmake/preset/use-gcc.json new file mode 100644 index 0000000..9e10038 --- /dev/null +++ b/cmake/preset/use-gcc.json @@ -0,0 +1,14 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "use-gcc", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "g++", + "CMAKE_C_COMPILER": "gcc", + "CMAKE_EXPORT_COMPILE_COMMANDS": true + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/use-msvc.json b/cmake/preset/use-msvc.json new file mode 100644 index 0000000..a1a5a34 --- /dev/null +++ b/cmake/preset/use-msvc.json @@ -0,0 +1,13 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "use-msvc", + "hidden": true, + "cacheVariables": { + "CMAKE_CXX_COMPILER": "cl", + "CMAKE_C_COMPILER": "cl" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/use-ninja.json b/cmake/preset/use-ninja.json new file mode 100644 index 0000000..4d96285 --- /dev/null +++ b/cmake/preset/use-ninja.json @@ -0,0 +1,14 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "use-ninja", + "hidden": true, + "generator": "Ninja", + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CMAKE_COMPILE_WARNING_AS_ERROR": "ON" + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/use-vcpkg.json b/cmake/preset/use-vcpkg.json new file mode 100644 index 0000000..a62f001 --- /dev/null +++ b/cmake/preset/use-vcpkg.json @@ -0,0 +1,10 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "use-vcpkg", + "hidden": true, + "toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake" + } + ] +} \ No newline at end of file diff --git a/module/CMakeLists.txt b/module/CMakeLists.txt deleted file mode 100644 index 12541c6..0000000 --- a/module/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(aspire) diff --git a/module/aspire/Aspire.cpp b/module/aspire/Aspire.cpp deleted file mode 100644 index 18e02ae..0000000 --- a/module/aspire/Aspire.cpp +++ /dev/null @@ -1,9 +0,0 @@ -#include - -using aspire::Aspire; - -// NOLINTNEXTLINE(readability-convert-member-functions-to-static) -aspire::Meters Aspire::meters(double x) const noexcept -{ - return Meters{x}; -} diff --git a/module/aspire/Aspire.h b/module/aspire/Aspire.h deleted file mode 100644 index 34e5274..0000000 --- a/module/aspire/Aspire.h +++ /dev/null @@ -1,18 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace aspire -{ - class Aspire : public QObject - { - Q_OBJECT - QML_ELEMENT - QML_SINGLETON - - public: - Q_INVOKABLE Meters meters(double x) const noexcept; - }; -} \ No newline at end of file diff --git a/module/aspire/CMakeLists.txt b/module/aspire/CMakeLists.txt deleted file mode 100644 index 400dd90..0000000 --- a/module/aspire/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -project(aspire) - -project_add_module( - SOURCES - Aspire.cpp - Aspire.h - FrameMetrics.cpp - FrameMetrics.h - Meters.cpp - Meters.h - QML_FILES - Counter.qml - Square.qml - IMPORTS - QtQuick -) - -target_link_libraries(${PROJECT_NAME} PUBLIC - Qt::Quick -) - -if(BUILD_TESTING) - add_subdirectory(test) -endif() diff --git a/module/aspire/Counter.qml b/module/aspire/Counter.qml deleted file mode 100644 index def1fa0..0000000 --- a/module/aspire/Counter.qml +++ /dev/null @@ -1,45 +0,0 @@ -import QtQuick - -Rectangle { - id: root - - property int value: 0 - - border.color: "red" - border.width: 2 - color: Qt.rgba(0.5, 0.5, 0.5, 0.5) - - Text { - id: text - - anchors.fill: text.parent - text: root.value.toString() - font.pixelSize: text.height - color: "white" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - - MouseArea { - id: left - - height: root.height - width: root.width / 2 - - onClicked: { - root.value -= 1; - } - } - - MouseArea { - id: right - - x: root.width / 2 - height: root.height - width: root.width / 2 - - onClicked: { - root.value += 1; - } - } -} diff --git a/module/aspire/FrameMetrics.cpp b/module/aspire/FrameMetrics.cpp deleted file mode 100644 index 2aa3c3f..0000000 --- a/module/aspire/FrameMetrics.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include - -using aspire::FrameMetrics; - -FrameMetrics::FrameMetrics(QQuickItem* parent) : QQuickItem{parent} -{ - this->setFlag(QQuickItem::Flag::ItemHasContents); - - QObject::connect(&this->timer, &QTimer::timeout, this, [this] { this->measure(); }); -} - -auto FrameMetrics::setRollingCount(int x) noexcept -> void -{ - this->rollingCount = x; -} - -auto FrameMetrics::getRollingCount() const noexcept -> int -{ - return this->rollingCount; -} - -auto FrameMetrics::setThread(Thread x) noexcept -> void -{ - this->thread = x; -} - -auto FrameMetrics::getThread() const noexcept -> Thread -{ - return this->thread; -} - -auto FrameMetrics::componentComplete() -> void -{ - this->QQuickItem::componentComplete(); - - switch(this->thread) - { - case Thread::Main: - this->timer.start(); - break; - - case Thread::Render: - this->setFlag(QQuickItem::Flag::ItemHasContents); - break; - - default: - break; - } -} - -auto FrameMetrics::updatePaintNode(QSGNode* /*unused*/, UpdatePaintNodeData* /*unused*/) -> QSGNode* -{ - this->update(); - this->measure(); - - return nullptr; -} - -auto FrameMetrics::measure() -> void -{ - const auto now = std::chrono::steady_clock::now(); - const auto elapsed = std::chrono::duration(now - this->start); - this->frames.emplace_back(elapsed); - this->framesRolling.emplace_back(elapsed); - - while(static_cast(this->framesRolling.size()) >= this->rollingCount) - { - this->framesRolling.pop_front(); - } - - this->fpsCurrent = 1.0 / elapsed.count(); - this->fpsMin = std::min(this->fpsMin, this->fpsCurrent); - this->fpsMax = std::max(this->fpsMax, this->fpsCurrent); - auto sum = std::accumulate(std::begin(this->framesRolling), std::end(this->framesRolling), std::chrono::duration::zero()); - this->fpsRolling = 1.0 / (sum.count() / static_cast(this->framesRolling.size())); - - sum = std::accumulate(std::begin(this->frames), std::end(this->frames), std::chrono::duration::zero()); - this->fpsMean = 1.0 / (sum.count() / static_cast(this->frames.size())); - this->frameCount = static_cast(this->frames.size()); - - this->fpsCurrentChanged(this->fpsCurrent); - this->fpsMinChanged(this->fpsMin); - this->fpsMaxChanged(this->fpsMax); - this->fpsRollingChanged(this->fpsRolling); - this->fpsMeanChanged(this->fpsMean); - this->frameCountChanged(this->frameCount); - - this->start = now; -} \ No newline at end of file diff --git a/module/aspire/FrameMetrics.h b/module/aspire/FrameMetrics.h deleted file mode 100644 index b805a27..0000000 --- a/module/aspire/FrameMetrics.h +++ /dev/null @@ -1,69 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace aspire -{ - class ASPIRE_EXPORT FrameMetrics : public QQuickItem - { - Q_OBJECT - Q_PROPERTY(double fpsCurrent MEMBER fpsCurrent NOTIFY fpsCurrentChanged) - Q_PROPERTY(double fpsMean MEMBER fpsMean NOTIFY fpsMeanChanged) - Q_PROPERTY(double fpsRolling MEMBER fpsRolling NOTIFY fpsRollingChanged) - Q_PROPERTY(double fpsMin MEMBER fpsMin NOTIFY fpsMinChanged) - Q_PROPERTY(double fpsMax MEMBER fpsMax NOTIFY fpsMaxChanged) - Q_PROPERTY(int rollingCount READ getRollingCount WRITE setRollingCount) - Q_PROPERTY(int frameCount MEMBER frameCount NOTIFY frameCountChanged) - Q_PROPERTY(Thread thread READ getThread WRITE setThread) - Q_CLASSINFO("RegisterEnumClassesUnscoped", "false") - QML_ELEMENT - - public: - enum class Thread : int - { - Main, - Render - }; - Q_ENUM(Thread) - - static constexpr auto DefaultRollingCount{200}; - - explicit FrameMetrics(QQuickItem* parent = nullptr); - - auto setRollingCount(int x) noexcept -> void; - [[nodiscard]] auto getRollingCount() const noexcept -> int; - - auto setThread(Thread x) noexcept -> void; - [[nodiscard]] auto getThread() const noexcept -> Thread; - - auto componentComplete() -> void override; - auto updatePaintNode(QSGNode* /*unused*/, UpdatePaintNodeData* /*unused*/) -> QSGNode* override; - - signals: - void fpsCurrentChanged(double); - void fpsMeanChanged(double); - void fpsRollingChanged(double); - void fpsMinChanged(double); - void fpsMaxChanged(double); - void frameCountChanged(int); - - private: - auto measure() -> void; - - std::deque> framesRolling; - std::deque> frames; - QTimer timer; - std::chrono::steady_clock::time_point start{std::chrono::steady_clock::now()}; - double fpsCurrent{}; - double fpsRolling{}; - double fpsMean{}; - double fpsMin{std::numeric_limits::max()}; - double fpsMax{}; - int frameCount{}; - int rollingCount{DefaultRollingCount}; - Thread thread{Thread::Main}; - }; -} diff --git a/module/aspire/Meters.cpp b/module/aspire/Meters.cpp deleted file mode 100644 index bf3a59f..0000000 --- a/module/aspire/Meters.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include - -using aspire::Meters; - -Meters::Meters(double x) noexcept : value{x} -{ -} - -double Meters::toDouble() const noexcept -{ - return this->value; -} - -QString Meters::toString() const -{ - return QString::number(this->value); -} diff --git a/module/aspire/Meters.h b/module/aspire/Meters.h deleted file mode 100644 index f6f5e13..0000000 --- a/module/aspire/Meters.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#include -#include -#include - -namespace aspire -{ - class ASPIRE_EXPORT Meters - { - Q_GADGET - QML_VALUE_TYPE(meters) - - public: - Meters() noexcept = default; - explicit Meters(double x) noexcept; - Q_INVOKABLE [[nodiscard]] double toDouble() const noexcept; - Q_INVOKABLE [[nodiscard]] QString toString() const; - - private: - double value{}; - }; -} diff --git a/module/aspire/Square.qml b/module/aspire/Square.qml deleted file mode 100644 index a544525..0000000 --- a/module/aspire/Square.qml +++ /dev/null @@ -1,10 +0,0 @@ -import QtQuick - -Rectangle { - color: "pink" - border.color: "green" - border.width: 2 - width: 32 - height: 32 - rotation: 30 -} diff --git a/module/aspire/test/CMakeLists.txt b/module/aspire/test/CMakeLists.txt deleted file mode 100644 index 084940d..0000000 --- a/module/aspire/test/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -project(aspire-test) - -add_executable(${PROJECT_NAME}) - -project_compile_exe() - -target_sources(${PROJECT_NAME} PRIVATE - main.cpp - Meters.test.cpp -) - -find_package(GTest CONFIG REQUIRED) - -target_link_libraries(${PROJECT_NAME} PRIVATE - GTest::gtest - aspire -) - -gtest_discover_tests(${PROJECT_NAME} - XML_OUTPUT_DIR ${CMAKE_BINARY_DIR}/Testing -) diff --git a/module/aspire/test/Meters.test.cpp b/module/aspire/test/Meters.test.cpp deleted file mode 100644 index 0e5131f..0000000 --- a/module/aspire/test/Meters.test.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include - -using aspire::Meters; - -TEST(Meters, toDouble) -{ - const Meters meters{std::numeric_limits::max()}; - EXPECT_DOUBLE_EQ(meters.toDouble(), std::numeric_limits::max()); -} diff --git a/module/aspire/test/main.cpp b/module/aspire/test/main.cpp deleted file mode 100644 index 9476d2b..0000000 --- a/module/aspire/test/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -int main(int argc, char** argv) -{ - const QCoreApplication app{argc, argv}; - - testing::InitGoogleTest(&argc, argv); - - return ::RUN_ALL_TESTS(); -} \ No newline at end of file diff --git a/triplets/arm64-android-aspire.cmake b/triplets/arm64-android-aspire.cmake index ae9236f..4974eae 100644 --- a/triplets/arm64-android-aspire.cmake +++ b/triplets/arm64-android-aspire.cmake @@ -1,15 +1,16 @@ -set(VCPKG_LIBRARY_LINKAGE static) - -if(${PORT} MATCHES "qt") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() - set(VCPKG_TARGET_ARCHITECTURE arm64) set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) set(VCPKG_CMAKE_SYSTEM_NAME Android) set(VCPKG_MAKE_BUILD_TRIPLET "--host=aarch64-linux-android") set(VCPKG_CMAKE_CONFIGURE_OPTIONS -DANDROID_ABI=arm64-v8a) set(VCPKG_BUILD_TYPE release) +# Only use Qt as shared libraries. +if(${PORT} MATCHES "qt") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() + # Qt requires that the ANDROID_SDK_ROOT is defined when compiling. set(ANDROID_SDK_ROOT "$ENV{ANDROID_HOME}") +set(ANDROID_PLATFORM 34) diff --git a/triplets/arm64-windows-aspire.cmake b/triplets/arm64-windows-aspire.cmake index 25a155e..bd18be8 100644 --- a/triplets/arm64-windows-aspire.cmake +++ b/triplets/arm64-windows-aspire.cmake @@ -1,4 +1,8 @@ set(VCPKG_LIBRARY_LINKAGE static) set(VCPKG_TARGET_ARCHITECTURE arm64) set(VCPKG_CRT_LINKAGE dynamic) -set(VCPKG_BUILD_TYPE release) + +# Only use Qt as shared libraries. +if(${PORT} MATCHES "qt") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() diff --git a/triplets/x64-android-aspire.cmake b/triplets/x64-android-aspire.cmake index 41d8270..6531d40 100644 --- a/triplets/x64-android-aspire.cmake +++ b/triplets/x64-android-aspire.cmake @@ -1,15 +1,16 @@ -set(VCPKG_LIBRARY_LINKAGE static) - -if(${PORT} MATCHES "qt") - set(VCPKG_LIBRARY_LINKAGE dynamic) -endif() - set(VCPKG_TARGET_ARCHITECTURE x64) set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE static) set(VCPKG_CMAKE_SYSTEM_NAME Android) set(VCPKG_MAKE_BUILD_TRIPLET "--host=x86_64-linux-android") set(VCPKG_CMAKE_CONFIGURE_OPTIONS -DANDROID_ABI=x86_64) set(VCPKG_BUILD_TYPE release) +# Only use Qt as shared libraries. +if(${PORT} MATCHES "qt") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() + # Qt requires that the ANDROID_SDK_ROOT is defined when compiling. set(ANDROID_SDK_ROOT "$ENV{ANDROID_HOME}") +set(ANDROID_PLATFORM 34) diff --git a/triplets/x64-windows-aspire.cmake b/triplets/x64-windows-aspire.cmake index 18188f6..81c738f 100644 --- a/triplets/x64-windows-aspire.cmake +++ b/triplets/x64-windows-aspire.cmake @@ -1,4 +1,8 @@ set(VCPKG_LIBRARY_LINKAGE static) set(VCPKG_TARGET_ARCHITECTURE x64) set(VCPKG_CRT_LINKAGE dynamic) -# set(VCPKG_BUILD_TYPE release) + +# Only use Qt as shared libraries. +if(${PORT} MATCHES "qt") + set(VCPKG_LIBRARY_LINKAGE dynamic) +endif() diff --git a/vcpkg.json b/vcpkg.json index 181b374..1f8fef3 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,10 +1,15 @@ { "name": "aspire", - "version-string": "2023.10.22", + "version-string": "2024.11.2", "port-version": 1, - "description": "QtQuick Game Engine", - "homepage": "https://gitlab.com/amshelley86/aspire", + "description": "ASxa86's Personal Integration and Rendering Engine", + "homepage": "https://gitlab.com/asxa86/aspire", "dependencies": [ + { + "name": "qtbase", + "default-features": false, + "host": true + }, { "name": "qtbase", "default-features": false,