This commit is contained in:
Shaun Reed 2023-03-11 13:24:51 -05:00
parent 5bde82d956
commit bf137bc788
6 changed files with 114 additions and 157 deletions

View File

@ -8,7 +8,7 @@ on:
jobs: jobs:
Build-Qtk: Build-Qtk:
env: env:
CONFIG: -DQTK_UPDATE_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_ENABLE_CCACHE=OFF -DQTK_INSTALL_GUI=ON -DQTK_INSTALL_LIB=ON -DQTK_INSTALL_PLUGINS=OFF CONFIG: -DQTK_UPDATE_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_ENABLE_CCACHE=OFF -DQTK_BUILD_GUI=ON -DQTK_INSTALL_LIBRARY=ON -DQTK_INSTALL_PLUGINS=OFF
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -70,11 +70,11 @@ jobs:
shell: bash shell: bash
run: cmake --build build/ --target package --config Release run: cmake --build build/ --target package --config Release
# - uses: actions/upload-artifact@v3 - name: Upload Qtk install directory
# if: always() uses: actions/upload-artifact@v3
# with: with:
# name: qtk-${{ matrix.os }}-install name: qtk-${{ matrix.os }}-install
# path: install/* path: install/*
# TODO: Enable after trimming resources. # TODO: Enable after trimming resources.
# - name: Package Qtk Application Sources # - name: Package Qtk Application Sources
@ -82,27 +82,18 @@ jobs:
# shell: bash # shell: bash
# run: | # run: |
# cmake --build build/ --target package_source # cmake --build build/ --target package_source
#
# - name: Upload package artifacts # - name: Upload package artifacts
# uses: actions/upload-artifact@v3 # uses: actions/upload-artifact@v3
# if: always()
# with: # with:
# name: qtk-packages-${{ matrix.os }} # name: qtk-${{ matrix.os }}-packages
# path: | # path: |
# build/packages/ # build/packages/*
# !build/packages/_CPack_Packages/* # !build/packages/_CPack_Packages/*
- name: Upload logs on failure
uses: actions/upload-artifact@v3
if: ${{ failure() && matrix.os == 'windows-latest' }}
with:
name: qtk-failed-packages-${{ matrix.os }}
path: |
build/_CPack_Packages/win64/NSIS/NSISOutput.log
Build-Qtk-Library: Build-Qtk-Library:
env: env:
CONFIG: -DQTK_UPDATE_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_ENABLE_CCACHE=OFF -DQTK_INSTALL_GUI=OFF -DQTK_INSTALL_LIB=ON -DQTK_INSTALL_PLUGINS=OFF CONFIG: -DQTK_UPDATE_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_ENABLE_CCACHE=OFF -DQTK_BUILD_GUI=OFF -DQTK_INSTALL_LIBRARY=ON -DQTK_INSTALL_PLUGINS=OFF
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -164,32 +155,25 @@ jobs:
shell: bash shell: bash
run: cmake --build build/ --target package --config Release run: cmake --build build/ --target package --config Release
# - uses: actions/upload-artifact@v3 - name: Upload libqtk install
# if: always()
# with:
# name: libqtk-${{ matrix.os }}-install
# path: install/*
# - name: Upload package artifacts
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: libqtk-packages-${{ matrix.os }}
# path: |
# build/packages/
# !build/packages/_CPack_Packages/*
- name: Upload logs on failure
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
if: ${{ failure() && matrix.os == 'windows-latest' }} if: always()
with: with:
name: libqtk-failed-packages-${{ matrix.os }} name: libqtk-${{ matrix.os }}-install
path: install/*
- name: Upload package artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: libqtk-packages-${{ matrix.os }}
path: | path: |
build/_CPack_Packages/win64/NSIS/NSISOutput.log build/packages/
!build/packages/_CPack_Packages/*
Build-Qtk-Plugins: Build-Qtk-Plugins:
env: env:
CONFIG: -DQTK_UPDATE_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_ENABLE_CCACHE=OFF -DQTK_INSTALL_GUI=OFF -DQTK_INSTALL_LIB=OFF -DQTK_INSTALL_PLUGINS=ON CONFIG: -DQTK_UPDATE_SUBMODULES=ON -DQTK_DEBUG=OFF -DQTK_ENABLE_CCACHE=OFF -DQTK_BUILD_GUI=OFF -DQTK_INSTALL_LIBRARY=OFF -DQTK_INSTALL_PLUGINS=ON
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
@ -278,25 +262,3 @@ jobs:
shell: bash shell: bash
run: | run: |
sudo apt install libassimp-dev sudo apt install libassimp-dev
- name: Build Qtk
if: matrix.os == 'windows-latest'
shell: bash
run: |
cmake -B build/ ${{ matrix.cmake }} -DQTK_DEBUG=OFF -DQTK_ENABLE_CCACHE=OFF
cmake --build build/ --config Release
- name: Build Qtk
if: matrix.os != 'windows-latest'
shell: bash
run: |
cmake -B build/ ${{ matrix.cmake }} -DQTK_DEBUG=OFF -DQTK_ENABLE_CCACHE=OFF
cmake --build build/ --config Release -- -j $(nproc)
# TODO: Enable with tag only when done testing
# Release-Qtk:
# needs: Build-Qtk
# strategy:
# fail-fast: false
# matrix:
# os: [ubuntu-latest, windows-latest, macos-latest]

View File

@ -23,6 +23,7 @@ if(WIN32)
set(CMAKE_COMPILE_WARNING_AS_ERROR OFF) set(CMAKE_COMPILE_WARNING_AS_ERROR OFF)
add_compile_options(/wd4131 /wd4127) add_compile_options(/wd4131 /wd4127)
endif() endif()
#add_compile_options(-fPIC)
################################################################################ ################################################################################
# Project # Project
@ -46,8 +47,8 @@ include(GNUInstallDirs)
################################################################################ ################################################################################
option(QTK_DEBUG "Enable debugger" OFF) option(QTK_DEBUG "Enable debugger" OFF)
option(QTK_UPDATE_SUBMODULES "Update external project (assimp) submodule" OFF) option(QTK_UPDATE_SUBMODULES "Update external project (assimp) submodule" OFF)
option(QTK_INSTALL_GUI "Build the Qtk desktop application" ON) option(QTK_BUILD_GUI "Build the Qtk desktop application" ON)
option(QTK_INSTALL_LIB "Install libqtk to CMAKE_INSTALL_PREFIX path." ON) option(QTK_INSTALL_LIBRARY "Install libqtk to CMAKE_INSTALL_PREFIX path." ON)
option(QTK_INSTALL_PLUGINS "Install Qtk plugin collection to Qt Creator." OFF) option(QTK_INSTALL_PLUGINS "Install Qtk plugin collection to Qt Creator." OFF)
option(QTK_BUILD_EXAMPLE "Build the Qtk example desktop application" ON) option(QTK_BUILD_EXAMPLE "Build the Qtk example desktop application" ON)
option(QTK_ENABLE_CCACHE "Enable ccache" ON) option(QTK_ENABLE_CCACHE "Enable ccache" ON)

View File

@ -92,7 +92,7 @@ using libqtk.
Below is an example of installing on a system path. Below is an example of installing on a system path.
```bash ```bash
cmake -S qtk/ -B qtk/build/ -DCMAKE_PREFIX_PATH=$HOME/Qt/6.5.0/gcc_64 -DQTK_INSTALL_GUI=OFF -DQTK_INSTALL_PLUGINS=OFF -DQTK_DEBUG=OFF cmake -S qtk/ -B qtk/build/ -DCMAKE_PREFIX_PATH=$HOME/Qt/6.5.0/gcc_64 -DQTK_BUILD_GUI=OFF -DQTK_INSTALL_PLUGINS=OFF -DQTK_DEBUG=OFF
cmake --build qtk/build/ -j $(nproc --ignore=2) cmake --build qtk/build/ -j $(nproc --ignore=2)
sudo cmake --install . --prefix=/usr/local sudo cmake --install . --prefix=/usr/local
-- Install configuration: "Release" -- Install configuration: "Release"
@ -133,7 +133,7 @@ interfaces.
To build and install the Qtk plugin collection - To build and install the Qtk plugin collection -
```bash ```bash
cmake -S /path/to/qtk -B /path/to/qtk/build -DCMAKE_PREFIX_PATH=$HOME/Qt/6.5.0/gcc_64 -DQTK_INSTALL_PLUGINS=ON -DQTK_INSTALL_GUI=OFF -DQTK_INSTALL_LIB=OFF cmake -S /path/to/qtk -B /path/to/qtk/build -DCMAKE_PREFIX_PATH=$HOME/Qt/6.5.0/gcc_64 -DQTK_INSTALL_PLUGINS=ON -DQTK_BUILD_GUI=OFF -DQTK_INSTALL_LIBRARY=OFF
cmake --build /path/to/qtk/build cmake --build /path/to/qtk/build
cmake --install /path/to/qtk/build cmake --install /path/to/qtk/build
``` ```
@ -278,10 +278,11 @@ Any of the above options can be appended with `--trace-expand` to debug package
generation issues. generation issues.
The contents of all packages will depend on how the build was configured. The contents of all packages will depend on how the build was configured.
If we are generating packages for *only* libqtk, we set `-DQTK_INSTALL_LIB=ON` If we are generating packages for *only* libqtk, we
set `-DQTK_INSTALL_LIBRARY=ON`
during the cmake configuration step. during the cmake configuration step.
To generate packages for Qtk desktop application, we should To generate packages for Qtk desktop application, we should
set `-DQTK_INSTALL_GUI=ON`, and optionally `-DQTK_INSTALL_LIB=ON` if we would set `-DQTK_BUILD_GUI=ON`, and optionally `-DQTK_INSTALL_LIBRARY=ON` if we would
like to bundle libqtk with the desktop application. like to bundle libqtk with the desktop application.
The NSIS installer will allow component-specific path modification for all of The NSIS installer will allow component-specific path modification for all of
@ -295,6 +296,8 @@ Some useful links and resources that I have found while working on this project.
[QtPlugin Import / Export plugins](https://doc.qt.io/qt-6/qtplugin.html) [QtPlugin Import / Export plugins](https://doc.qt.io/qt-6/qtplugin.html)
[KDAB](https://www.kdab.com/)
## Model Artists ## Model Artists
"Alien Hominid" (https://skfb.ly/onStx) by Nwilly_art is licensed under Creative "Alien Hominid" (https://skfb.ly/onStx) by Nwilly_art is licensed under Creative

View File

@ -6,14 +6,43 @@
################################################################################ ################################################################################
# Qtk Library # Qtk Library
# We always build libqtk since the plugins and GUI both depend on it.
add_subdirectory(qtk) add_subdirectory(qtk)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
COMPONENT libqtk
DESTINATION lib/cmake/${PROJECT_NAME}
)
install(
EXPORT qtk_export
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}::
COMPONENT libqtk
DESTINATION lib/cmake/${PROJECT_NAME}
)
# System install for qtk_library
install(
TARGETS qtk_library
# Associate qtk_library target with qtk-export
EXPORT qtk_export
COMPONENT libqtk
FILE_SET HEADERS DESTINATION include
INCLUDES DESTINATION include
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
RUNTIME DESTINATION bin
)
# Qtk Application # Qtk Application
if (QTK_INSTALL_GUI OR QTK_INSTALL_PLUGINS) if (QTK_BUILD_GUI OR QTK_INSTALL_PLUGINS)
add_subdirectory(app) add_subdirectory(app)
endif()
# Install custom Qtk plugins for Qt Designer.
if(QTK_INSTALL_PLUGINS) if(QTK_INSTALL_PLUGINS)
# Optionally install custom Qtk plugins for Qt Designer.
install( install(
TARGETS qtk_library qtk_plugin_library TARGETS qtk_library qtk_plugin_library
COMPONENT qtk_collection COMPONENT qtk_collection
@ -30,9 +59,9 @@ if (QTK_INSTALL_GUI OR QTK_INSTALL_PLUGINS)
) )
endif() endif()
if(QTK_INSTALL_GUI) if(QTK_BUILD_GUI)
install( install(
TARGETS qtk_app qtk_library TARGETS qtk_app
COMPONENT qtk COMPONENT qtk
BUNDLE DESTINATION . BUNDLE DESTINATION .
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
@ -70,7 +99,6 @@ if (QTK_INSTALL_GUI OR QTK_INSTALL_PLUGINS)
endif() endif()
endif() endif()
endif() endif()
endif()
write_basic_package_version_file( write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
@ -82,35 +110,6 @@ configure_package_config_file(
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME} INSTALL_DESTINATION lib/cmake/${PROJECT_NAME}
) )
if (QTK_INSTALL_LIB)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
COMPONENT libqtk
DESTINATION lib/cmake/${PROJECT_NAME}
)
install(
EXPORT qtk_export
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}::
COMPONENT libqtk
DESTINATION lib/cmake/${PROJECT_NAME}
)
# System install for qtk_library
install(
TARGETS qtk_library
# Associate qtk_library target with qtk-export
EXPORT qtk_export
COMPONENT libqtk
FILE_SET HEADERS DESTINATION include
INCLUDES DESTINATION include
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
RUNTIME DESTINATION bin
)
endif()
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")

View File

@ -54,13 +54,6 @@ set(
main.cpp main.cpp
) )
qt6_add_big_resources(QTK_APP_SOURCES "${QTK_RESOURCES}/resources.qrc")
configure_file(
resources.h.in
"${CMAKE_CURRENT_BINARY_DIR}/resources.h"
@ONLY
)
qt_add_executable(qtk_app ${QTK_APP_SOURCES}) qt_add_executable(qtk_app ${QTK_APP_SOURCES})
target_link_libraries(qtk_app PRIVATE qtk_plugin_library) target_link_libraries(qtk_app PRIVATE qtk_plugin_library)

View File

@ -7,7 +7,6 @@
##############################################################################*/ ##############################################################################*/
#include "qtkscene.h" #include "qtkscene.h"
#include "resources.h"
using namespace Qtk; using namespace Qtk;