From be69d2d2428245aa970abaecc594e160412bf50f Mon Sep 17 00:00:00 2001 From: Shaun Reed Date: Sun, 2 Apr 2023 11:43:59 -0400 Subject: [PATCH] Add packaging for example app + Update CI workflows --- .github/workflows/all-builds.yml | 36 +++++++++++++------------------- CMakeLists.txt | 2 +- example-app/CMakeLists.txt | 14 +++++++++++-- 3 files changed, 28 insertions(+), 24 deletions(-) diff --git a/.github/workflows/all-builds.yml b/.github/workflows/all-builds.yml index 88af81e..e2064f9 100644 --- a/.github/workflows/all-builds.yml +++ b/.github/workflows/all-builds.yml @@ -6,9 +6,9 @@ on: workflow_dispatch: jobs: - Build-Qtk: + Qtk: env: - CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=ON -DQTK_LIBRARY=ON -DQTK_PLUGINS=OFF + CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=ON -DQTK_LIBRARY=ON -DQTK_PLUGINS=OFF -DQTK_EXAMPLE=ON strategy: fail-fast: false matrix: @@ -44,24 +44,18 @@ jobs: sudo apt update -y sudo apt install libxcb-cursor0 -y - - name: Configure Qtk Application (Windows) - if: matrix.os == 'windows-latest' + - name: Configure Qtk Application shell: bash run: cmake -B build/ ${{ matrix.cmake }} - name: Build Qtk Application (Windows) if: matrix.os == 'windows-latest' shell: bash - run: cmake --build build/ --config Release + run: cmake --build build/ --config Release --target qtk_gui # OSX / Linux - - name: Configure Qtk Application (OSX / Linux) - if: matrix.os != 'windows-latest' - shell: bash - run: cmake -B build/ ${{ matrix.cmake }} - - - name: Build Qtk Application (OSX / Linux) + - name: Build Qtk Application if: matrix.os != 'windows-latest' shell: bash run: cmake --build build/ --config Release --target qtk_gui -- -j $(nproc) @@ -87,7 +81,7 @@ jobs: if: matrix.os == 'ubuntu-latest' uses: actions/upload-artifact@v3 with: - name: qtk-app-${{ matrix.os }} + name: qtk-gui-${{ matrix.os }} path: | build/packages/*.deb @@ -102,7 +96,7 @@ jobs: if: matrix.os == 'windows-latest' uses: actions/upload-artifact@v3 with: - name: qtk-app-${{ matrix.os }} + name: qtk-gui-${{ matrix.os }} path: | build/packages/*.exe @@ -117,14 +111,14 @@ jobs: if: matrix.os == 'macos-latest' uses: actions/upload-artifact@v3 with: - name: qtk-app-${{ matrix.os }} + name: qtk-gui-${{ matrix.os }} path: | build/packages/*.tar.gz - name: Upload Qtk install directory uses: actions/upload-artifact@v3 with: - name: qtk-app-${{ matrix.os }}-install + name: qtk-gui-${{ matrix.os }}-installdir path: install/* # TODO: Enable after trimming resources. @@ -142,9 +136,9 @@ jobs: # build/packages/* # !build/packages/_CPack_Packages/* - Build-Qtk-Library: + Qtk-Library: env: - CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=OFF -DQTK_LIBRARY=ON -DQTK_PLUGINS=OFF + CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=OFF -DQTK_LIBRARY=ON -DQTK_PLUGINS=OFF -DQTK_EXAMPLE=OFF strategy: fail-fast: false matrix: @@ -255,12 +249,12 @@ jobs: uses: actions/upload-artifact@v3 if: always() with: - name: libqtk-${{ matrix.os }}-install + name: libqtk-${{ matrix.os }}-installdir path: install/* - Build-Qtk-Plugins: + Qtk-Plugins: env: - CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=OFF -DQTK_LIBRARY=OFF -DQTK_PLUGINS=ON + CONFIG: -DQTK_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_CCACHE=OFF -DQTK_GUI=OFF -DQTK_LIBRARY=OFF -DQTK_PLUGINS=ON -DQTK_EXAMPLE=OFF strategy: fail-fast: false matrix: @@ -318,7 +312,7 @@ jobs: shell: bash run: cmake --install build/ --config Release --prefix=$(pwd)/install --component qtk_plugins - Build-Qtk-Assimp-Targets: + Qtk-Assimp-Targets: strategy: fail-fast: false matrix: diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c8cdb2..92588ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -172,5 +172,5 @@ add_subdirectory(src) if(QTK_EXAMPLE) # Create a namespaced alias for linking with qtk_library in the example. add_library(${PROJECT_NAME}::qtk_library ALIAS qtk_library) - add_subdirectory(example-app) + add_subdirectory(example-app EXCLUDE_FROM_ALL) endif() diff --git a/example-app/CMakeLists.txt b/example-app/CMakeLists.txt index acd7503..fb92b2c 100644 --- a/example-app/CMakeLists.txt +++ b/example-app/CMakeLists.txt @@ -22,7 +22,11 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") endif() # If you did not install Qtk on a system path, point cmake to installation. -set(QTK_PATH ../build/install/lib/cmake/Qtk CACHE PATH "Path to installation of Qtk" FORCE) +set( + QTK_PATH ../build/install/lib/cmake/Qtk + CACHE PATH "Path to installation of Qtk" + FORCE +) # If you did not install Qt6 on a system path, point cmake to installation. set(QT_INSTALL_DIR "$ENV{HOME}/Qt/6.5.0/gcc_64/" CACHE PATH "Path to Qt6") @@ -71,7 +75,7 @@ configure_file( @ONLY ) -add_executable(qtk_example ${EXAMPLE_SOURCES}) +qt_add_executable(qtk_example ${EXAMPLE_SOURCES}) target_link_libraries(qtk_example PUBLIC Qt6::Widgets Qt6::OpenGLWidgets Qt6::Core) target_link_libraries(qtk_example PUBLIC Qtk::qtk_library) target_include_directories(qtk_example PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") @@ -84,3 +88,9 @@ install( ARCHIVE DESTINATION lib/static RUNTIME DESTINATION bin ) +qt_generate_deploy_app_script( + TARGET qtk_example + OUTPUT_SCRIPT QTK_EXAMPLE_DEPLOY_SCRIPT + NO_UNSUPPORTED_PLATFORM_ERROR +) +install(SCRIPT ${QTK_EXAMPLE_DEPLOY_SCRIPT} COMPONENT qtk_example)