From a47fb9d2a49a008b2acce43f84fd849319c6d254 Mon Sep 17 00:00:00 2001 From: Aaron Shelley Date: Sun, 10 Nov 2024 09:56:57 -0500 Subject: [PATCH 1/2] Support static linkage of module plugins for static builds. --- .vscode/launch.json | 16 +++------------- CMakeLists.txt | 2 +- CMakePresets.json | 3 +++ app/pong/CMakeLists.txt | 8 ++++++++ cmake/preset/host-arm64-osx.json | 3 +-- cmake/preset/target-arm64-osx.json | 13 +++++++++++++ cmake/preset/target-x64-linux.json | 3 ++- 7 files changed, 31 insertions(+), 17 deletions(-) create mode 100644 cmake/preset/target-arm64-osx.json diff --git a/.vscode/launch.json b/.vscode/launch.json index ba6774b..e4e2705 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,23 +5,13 @@ "version": "0.2.0", "configurations": [ { - "name": "(Windows) Aspire Edit Debug", + "name": "(Windows) Pong Debug", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/build-debug/installed/bin/aspire-edit.exe", + "program": "${workspaceFolder}/build/installed/bin/pong.exe", "args": [], "stopAtEntry": false, - "cwd": "${workspaceFolder}/build-debug/installed/bin", - "console": "externalTerminal" - }, - { - "name": "(Windows) Aspire EDH Debug", - "type": "cppvsdbg", - "request": "launch", - "program": "${workspaceFolder}/build-debug/installed/bin/aspire-edh.exe", - "args": [], - "stopAtEntry": false, - "cwd": "${workspaceFolder}/build-debug/installed/bin", + "cwd": "${workspaceFolder}/build/installed/bin", "console": "externalTerminal" } ] diff --git a/CMakeLists.txt b/CMakeLists.txt index cbff31f..5c6c66a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,5 +34,5 @@ qt_standard_project_setup(REQUIRES 6.7) set(CMAKE_AUTOMOC ON) -add_subdirectory(app) add_subdirectory(module) +add_subdirectory(app) diff --git a/CMakePresets.json b/CMakePresets.json index f805ae1..0efe276 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -10,6 +10,7 @@ "cmake/preset/host-x64-linux.json", "cmake/preset/host-x64-windows.json", "cmake/preset/target-arm64-android.json", + "cmake/preset/target-arm64-osx.json", "cmake/preset/target-arm64-windows.json", "cmake/preset/target-x64-android.json", "cmake/preset/target-x64-linux.json", @@ -97,6 +98,7 @@ "name": "arm64-osx-clang-debug", "inherits": [ "host-arm64-osx", + "target-arm64-osx", "config-debug", "config-build-dir", "use-clang", @@ -108,6 +110,7 @@ "name": "arm64-osx-clang-release", "inherits": [ "host-arm64-osx", + "target-arm64-osx", "config-release", "config-build-dir", "use-clang", diff --git a/app/pong/CMakeLists.txt b/app/pong/CMakeLists.txt index 37e5704..24cc638 100644 --- a/app/pong/CMakeLists.txt +++ b/app/pong/CMakeLists.txt @@ -20,6 +20,14 @@ target_link_libraries(${PROJECT_NAME} PRIVATE Qt::Quick ) +# Link against plugins for static builds. +if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin OR ${CMAKE_SYSTEM_NAME} STREQUAL Linux) + target_link_libraries(${PROJECT_NAME} PRIVATE + aspireplugin + ) +endif() + +# Android APKs are handle separately within Qt cmake scripts. if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL Android) install(TARGETS ${PROJECT_NAME} BUNDLE DESTINATION . diff --git a/cmake/preset/host-arm64-osx.json b/cmake/preset/host-arm64-osx.json index 5c7c0ed..89ad809 100644 --- a/cmake/preset/host-arm64-osx.json +++ b/cmake/preset/host-arm64-osx.json @@ -10,8 +10,7 @@ "rhs": "Darwin" }, "cacheVariables": { - "VCPKG_HOST_TRIPLET": "arm64-osx-release", - "VCPKG_TARGET_TRIPLET": "arm64-osx-release" + "VCPKG_HOST_TRIPLET": "arm64-osx-aspire" } } ] diff --git a/cmake/preset/target-arm64-osx.json b/cmake/preset/target-arm64-osx.json new file mode 100644 index 0000000..8c97e63 --- /dev/null +++ b/cmake/preset/target-arm64-osx.json @@ -0,0 +1,13 @@ +{ + "version": 6, + "configurePresets": [ + { + "name": "target-arm64-osx", + "hidden": true, + "cacheVariables": { + "VCPKG_TARGET_TRIPLET": "arm64-osx-aspire", + "BUILD_SHARED_LIBS": false + } + } + ] +} \ No newline at end of file diff --git a/cmake/preset/target-x64-linux.json b/cmake/preset/target-x64-linux.json index ba4d5a2..3818e24 100644 --- a/cmake/preset/target-x64-linux.json +++ b/cmake/preset/target-x64-linux.json @@ -5,7 +5,8 @@ "name": "target-x64-linux", "hidden": true, "cacheVariables": { - "VCPKG_TARGET_TRIPLET": "x64-linux-aspire" + "VCPKG_TARGET_TRIPLET": "x64-linux-aspire", + "BUILD_SHARED_LIBS": false } } ] From 72673a92e194980d514e149272b8c03fcbc0a1a1 Mon Sep 17 00:00:00 2001 From: Aaron Shelley Date: Sun, 10 Nov 2024 10:30:29 -0500 Subject: [PATCH 2/2] Attempt to remove unit testing from APK generation. --- module/aspire/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/aspire/test/CMakeLists.txt b/module/aspire/test/CMakeLists.txt index 786d8fe..66bc16a 100644 --- a/module/aspire/test/CMakeLists.txt +++ b/module/aspire/test/CMakeLists.txt @@ -1,6 +1,6 @@ project(aspire-test) -qt_add_executable(${PROJECT_NAME}) +add_executable(${PROJECT_NAME}) target_sources(${PROJECT_NAME} PRIVATE main.cpp