Improve UI #13
|
@ -92,7 +92,7 @@ jobs:
|
||||||
name: qtk-packages-${{ matrix.os }}
|
name: qtk-packages-${{ matrix.os }}
|
||||||
path: |
|
path: |
|
||||||
build/packages/
|
build/packages/
|
||||||
!build/packages/_cpack_packages/*
|
!build/packages/_CPack_Packages/*
|
||||||
|
|
||||||
Build-Qtk-Assimp-Targets:
|
Build-Qtk-Assimp-Targets:
|
||||||
strategy:
|
strategy:
|
||||||
|
|
|
@ -6,12 +6,6 @@
|
||||||
################################################################################
|
################################################################################
|
||||||
cmake_minimum_required(VERSION 3.23)
|
cmake_minimum_required(VERSION 3.23)
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# Includes
|
|
||||||
################################################################################
|
|
||||||
include("${CMAKE_SOURCE_DIR}/cmake/include/git_submodule.cmake")
|
|
||||||
include(CMakePackageConfigHelpers)
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Constants
|
# Constants
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -40,15 +34,31 @@ project(
|
||||||
LANGUAGES CXX C
|
LANGUAGES CXX C
|
||||||
)
|
)
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Includes
|
||||||
|
################################################################################
|
||||||
|
include("${CMAKE_SOURCE_DIR}/cmake/include/git_submodule.cmake")
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Options
|
# Options
|
||||||
################################################################################
|
################################################################################
|
||||||
option(QTK_DEBUG "Enable debugger" ON)
|
option(QTK_DEBUG "Enable debugger" OFF)
|
||||||
option(QTK_BUILD_GUI "Build the Qtk desktop application" ON)
|
|
||||||
option(QTK_BUILD_EXAMPLE "Build the Qtk example desktop application" ON)
|
|
||||||
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_INSTALL_LIB "Install libqtk to CMAKE_INSTALL_PREFIX path." ON)
|
||||||
|
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_ENABLE_CCACHE "Enable ccache" ON)
|
||||||
|
|
||||||
|
if (QTK_ENABLE_CCACHE)
|
||||||
|
set(CMAKE_CXX_COMPILER_LAUNCHER ccache)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Install Qtk for use within Qt Creator projects only, instead of system-wide.
|
# Install Qtk for use within Qt Creator projects only, instead of system-wide.
|
||||||
option(QTK_PREFIX_QTCREATOR "Install Qtk to Qt Creator." OFF)
|
option(QTK_PREFIX_QTCREATOR "Install Qtk to Qt Creator. Untested." OFF)
|
||||||
|
|
||||||
# Option for bringing your own assimp installation; Otherwise not needed
|
# Option for bringing your own assimp installation; Otherwise not needed
|
||||||
# + If assimp is available system-wide we can just set QTK_UPDATE_SUBMODULES OFF
|
# + If assimp is available system-wide we can just set QTK_UPDATE_SUBMODULES OFF
|
||||||
option(
|
option(
|
||||||
|
@ -63,40 +73,44 @@ else()
|
||||||
set(CMAKE_BUILD_TYPE Debug)
|
set(CMAKE_BUILD_TYPE Debug)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(QT_DIR "$ENV{HOME}/Qt/" CACHE PATH "Path to Qt6")
|
# This should be set to your Qt6 installation directory.
|
||||||
|
set(QT_INSTALL_DIR "$ENV{HOME}/Qt/6.5.0/gcc_64" CACHE PATH "Path to Qt6 install.")
|
||||||
|
# Point CMAKE_PREFIX_PATH to Qt6 install directory
|
||||||
|
# If Qtk is built within Qt Creator this is not required.
|
||||||
|
list(APPEND CMAKE_PREFIX_PATH "${QT_INSTALL_DIR}")
|
||||||
|
# TODO: Remove if not using sdlibdeps.
|
||||||
|
#set(CMAKE_INSTALL_RPATH "${QT_INSTALL_DIR}/lib")
|
||||||
|
if (QTK_PREFIX_QTCREATOR)
|
||||||
|
# TODO: This might be a bit strange and needs more testing.
|
||||||
|
set(CMAKE_INSTALL_PREFIX "${QT_INSTALL_DIR}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(
|
||||||
|
QT_CREATOR_DIR
|
||||||
|
"${QT_INSTALL_DIR}/../../Tools/QtCreator"
|
||||||
|
CACHE PATH "Qt Creator path used to install Qtk plugins for Qt Designer."
|
||||||
|
)
|
||||||
# Qt Designer will look in different locations if WIN / Unix.
|
# Qt Designer will look in different locations if WIN / Unix.
|
||||||
# These paths are for using Qt Designer integrated within Qt Creator.
|
# These paths are for using Qt Designer integrated within Qt Creator.
|
||||||
# Standalone Qt Designer may use different paths.
|
# Standalone Qt Designer may use different paths.
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
# These paths may be different on windows. I have not tested this.
|
# These paths may be different on windows. I have not tested this.
|
||||||
set(QT_PLUGIN_INSTALL_DIR "${QT_DIR}/Tools/QtCreator/bin/plugins/designer")
|
set(QT_PLUGIN_INSTALL_DIR "${QT_CREATOR_DIR}/bin/plugins/designer")
|
||||||
set(QT_PLUGIN_LIBRARY_DIR "${QT_DIR}/Tools/QtCreator/lib/Qt/lib")
|
set(QT_PLUGIN_LIBRARY_DIR "${QT_CREATOR_DIR}/lib/Qt/lib")
|
||||||
else()
|
else()
|
||||||
set(QT_PLUGIN_INSTALL_DIR "${QT_DIR}/Tools/QtCreator/lib/Qt/plugins/designer")
|
set(QT_PLUGIN_INSTALL_DIR "${QT_CREATOR_DIR}/lib/Qt/plugins/designer")
|
||||||
set(QT_PLUGIN_LIBRARY_DIR "${QT_DIR}/Tools/QtCreator/lib/Qt/lib")
|
set(QT_PLUGIN_LIBRARY_DIR "${QT_CREATOR_DIR}/lib/Qt/lib")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# This should be set to your Qt6 installation directory.
|
|
||||||
set(QT_INSTALL_DIR "${QT_DIR}/6.5.0/gcc_64" CACHE PATH "Path to Qt6 install")
|
|
||||||
# Point CMAKE_PREFIX_PATH to Qt6 install directory
|
|
||||||
# If Qtk is built within Qt Creator this is not required.
|
|
||||||
list(APPEND CMAKE_PREFIX_PATH "${QT_INSTALL_DIR}")
|
|
||||||
|
|
||||||
set(QTK_PLUGIN_LIBRARY_DIR "${QT_PLUGIN_LIBRARY_DIR}")
|
set(QTK_PLUGIN_LIBRARY_DIR "${QT_PLUGIN_LIBRARY_DIR}")
|
||||||
set(QTK_PLUGIN_INSTALL_DIR "${QT_PLUGIN_INSTALL_DIR}")
|
set(QTK_PLUGIN_INSTALL_DIR "${QT_PLUGIN_INSTALL_DIR}")
|
||||||
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install")
|
|
||||||
if (QTK_PREFIX_QTCREATOR)
|
|
||||||
# TODO: This might be a bit strange and needs more testing.
|
|
||||||
set(CMAKE_INSTALL_PREFIX "${QT_INSTALL_DIR}")
|
|
||||||
endif()
|
|
||||||
message(STATUS "[Qtk] CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
|
message(STATUS "[Qtk] CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
|
||||||
set(QTK_RESOURCES "${CMAKE_SOURCE_DIR}/resources")
|
set(QTK_RESOURCES "${CMAKE_SOURCE_DIR}/resources")
|
||||||
set(QTK_OSX_ICONS ${CMAKE_SOURCE_DIR}/resources/icons/osx/kilroy.icns)
|
set(QTK_OSX_ICONS ${CMAKE_SOURCE_DIR}/resources/icons/osx/kilroy.icns)
|
||||||
|
|
||||||
# Print all QTK options and their values.
|
# Print all QTK options and their values.
|
||||||
get_cmake_property(VAR_NAMES VARIABLES)
|
get_cmake_property(VAR_NAMES VARIABLES)
|
||||||
list(FILTER VAR_NAMES INCLUDE REGEX "^QTK_.*$")
|
list(FILTER VAR_NAMES INCLUDE REGEX "^Q[tT][kK]_.*$")
|
||||||
list(SORT VAR_NAMES)
|
list(SORT VAR_NAMES)
|
||||||
foreach(VAR_NAME ${VAR_NAMES})
|
foreach(VAR_NAME ${VAR_NAMES})
|
||||||
message(STATUS "[Qtk] ${VAR_NAME}=${${VAR_NAME}}")
|
message(STATUS "[Qtk] ${VAR_NAME}=${${VAR_NAME}}")
|
||||||
|
@ -120,15 +134,26 @@ if(NOT Qt6_FOUND)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Find Assimp
|
# Find Assimp.
|
||||||
set(ASSIMP_BUILD_TESTS OFF CACHE STRING "Do not build assimp tests." FORCE)
|
|
||||||
set(ASSIMP_INSTALL ON CACHE STRING "Use assimp as a submodule." FORCE)
|
|
||||||
set(ASSIMP_WARNINGS_AS_ERRORS OFF CACHE STRING "No warnings as errors." FORCE)
|
|
||||||
set(BUILD_SHARED_LIBS OFF CACHE STRING "Build static assimp libs" FORCE)
|
|
||||||
if(QTK_UPDATE_SUBMODULES)
|
if(QTK_UPDATE_SUBMODULES)
|
||||||
|
# Required to statically link.
|
||||||
|
add_compile_options(-fPIC)
|
||||||
|
set(BUILD_SHARED_LIBS OFF CACHE STRING "Build static assimp libs" FORCE)
|
||||||
|
set(ASSIMP_BUILD_ZLIB ON CACHE STRING "Build Zlib with assimp." FORCE)
|
||||||
|
set(
|
||||||
|
ASSIMP_INSTALL
|
||||||
|
OFF CACHE STRING "Disable to use assimp as a submodule."
|
||||||
|
FORCE
|
||||||
|
)
|
||||||
|
set(ASSIMP_NO_EXPORT ON CACHE STRING "Disable to export assimp." FORCE)
|
||||||
|
set(ASSIMP_WARNINGS_AS_ERRORS OFF CACHE STRING "No warnings as errors." FORCE)
|
||||||
|
set(ASSIMP_BUILD_TESTS OFF CACHE STRING "Do not build assimp tests." FORCE)
|
||||||
message(STATUS "[Qtk] Updating submodules...")
|
message(STATUS "[Qtk] Updating submodules...")
|
||||||
submodule_update("${CMAKE_CURRENT_SOURCE_DIR}/extern/assimp/assimp/")
|
submodule_update("${CMAKE_CURRENT_SOURCE_DIR}/extern/assimp/assimp/")
|
||||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/extern/assimp/assimp/")
|
add_subdirectory(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/extern/assimp/assimp/"
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
)
|
||||||
else()
|
else()
|
||||||
find_package(assimp REQUIRED)
|
find_package(assimp REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
78
README.md
78
README.md
|
@ -38,14 +38,15 @@ This project has been ported to **Qt 6.5.0**, which is not yet available in Ubun
|
||||||
To run this project, you will *need* to install [Qt6 Open Source Binaries](https://www.qt.io/download-qt-installer) for your system, **version 6.5.0** or later.
|
To run this project, you will *need* to install [Qt6 Open Source Binaries](https://www.qt.io/download-qt-installer) for your system, **version 6.5.0** or later.
|
||||||
Be sure to take note of the Qt6 installation directory, as we will need it to correctly set our `CMAKE_PREFIX_PATH` in the next steps.
|
Be sure to take note of the Qt6 installation directory, as we will need it to correctly set our `CMAKE_PREFIX_PATH` in the next steps.
|
||||||
|
|
||||||
#### Linux
|
#### Qtk GUI
|
||||||
|
|
||||||
Once Qt6 is installed, to build and run `qtk` on Ubuntu -
|
Once Qt6 is installed, to build and run `qtk` on Ubuntu -
|
||||||
```bash
|
```bash
|
||||||
sudo apt update -y && sudo apt install libassimp-dev cmake build-essential git
|
sudo apt update -y && sudo apt install libassimp-dev cmake build-essential git ccache
|
||||||
git clone https://github.com/shaunrd0/qtk
|
git clone https://github.com/shaunrd0/qtk
|
||||||
cmake -DCMAKE_PREFIX_PATH=$HOME/Qt/6.3.1/gcc_64 -S qtk/ -B qtk/build/ && cmake --build qtk/build/ -j $(nproc --ignore=2) --target qtk-main
|
cmake -S qtk/ -B qtk/build/ -DCMAKE_PREFIX_PATH=$HOME/Qt/6.5.0/gcc_64
|
||||||
./qtk/build/qtk-main
|
cmake --build qtk/build/ -j $(nproc --ignore=2)
|
||||||
|
./qtk/build/bin/qtk-main
|
||||||
```
|
```
|
||||||
|
|
||||||
By default, the build will not initialize Assimp as a git submodule and build from source.
|
By default, the build will not initialize Assimp as a git submodule and build from source.
|
||||||
|
@ -54,10 +55,9 @@ Building using this option will fetch and build Assimp for us, but builds will t
|
||||||
Using `-DQTK_UPDATE_SUBMODULES=ON` supports providing assimp on cross-platform builds (Windows / Mac / Linux) and may be easier to configure.
|
Using `-DQTK_UPDATE_SUBMODULES=ON` supports providing assimp on cross-platform builds (Windows / Mac / Linux) and may be easier to configure.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo apt update -y && sudo apt install freeglut3-dev libassimp-dev cmake build-essential git
|
cmake -S qtk/ -B qtk/build/ -DQTK_UPDATE_SUBMODULES=ON -DCMAKE_PREFIX_PATH=$HOME/Qt/6.5.0/gcc_64
|
||||||
git clone https://gitlab.com/shaunrd0/qtk
|
cmake --build qtk/build/ -j $(nproc --ignore=2)
|
||||||
cmake -DQTK_UPDATE_SUBMODULES=ON -DCMAKE_PREFIX_PATH=$HOME/Qt/6.3.1/gcc_64 -S qtk/ -B qtk/build/ && cmake --build qtk/build/ -j $(nproc --ignore=2) --target qtk-main
|
./qtk/build/bin/qtk-main
|
||||||
./qtk/build/qtk-main
|
|
||||||
```
|
```
|
||||||
|
|
||||||
If any errors are encountered loading plugins, we can debug plugin loading by setting the following environment variable -
|
If any errors are encountered loading plugins, we can debug plugin loading by setting the following environment variable -
|
||||||
|
@ -66,14 +66,40 @@ If any errors are encountered loading plugins, we can debug plugin loading by se
|
||||||
QT_DEBUG_PLUGINS=1 ./qtk-main
|
QT_DEBUG_PLUGINS=1 ./qtk-main
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Windows / MacOS
|
#### Qtk Library
|
||||||
|
|
||||||
|
Qtk provides a simple library for working with QOpenGL.
|
||||||
|
We can install this library on a system path or a custom path and then set `CMAKE_PREFIX_PATH` to point to this location when building an application using libqtk.
|
||||||
|
|
||||||
|
Below is an example of installing on a system path.
|
||||||
|
|
||||||
If you are building on **Windows / Mac** and bringing your own installation of Assimp, consider setting the `-DASSIMP_NEW_INTERFACE` build flag.
|
|
||||||
```bash
|
```bash
|
||||||
cmake -S qtk/ -B qtk/build/ -DASSIMP_NEW_INTERFACE=ON -DCMAKE_PREFIX_PATH=$HOME/Qt/6.3.1/gcc_64;/path/to/assimp/ && cmake --build qtk/build/ -j $(nproc --ignore=2) --target qtk-main
|
cmake -S qtk/ -B qtk/build/ -DCMAKE_PREFIX_PATH=$HOME/Qt/6.5.0/gcc_64 -DQTK_INSTALL_GUI=OFF -DQTK_INSTALL_PLUGINS=OFF
|
||||||
|
cmake --build qtk/build/ -j $(nproc --ignore=2)
|
||||||
|
sudo cmake --install . --prefix=/usr/local
|
||||||
|
-- Install configuration: "Release"
|
||||||
|
-- Installing: /usr/local/lib/cmake/Qtk/QtkConfig.cmake
|
||||||
|
-- Installing: /usr/local/lib/cmake/Qtk/QtkConfigVersion.cmake
|
||||||
|
-- Installing: /usr/local/lib/cmake/Qtk/QtkTargets.cmake
|
||||||
|
-- Installing: /usr/local/lib/cmake/Qtk/QtkTargets-release.cmake
|
||||||
|
-- Installing: /usr/local/lib/static/libqtk_library.a
|
||||||
|
-- Installing: /usr/local/include/qtk/camera3d.h
|
||||||
|
-- Installing: /usr/local/include/qtk/input.h
|
||||||
|
-- Installing: /usr/local/include/qtk/meshrenderer.h
|
||||||
|
-- Installing: /usr/local/include/qtk/model.h
|
||||||
|
-- Installing: /usr/local/include/qtk/modelmesh.h
|
||||||
|
-- Installing: /usr/local/include/qtk/object.h
|
||||||
|
-- Installing: /usr/local/include/qtk/qtkapi.h
|
||||||
|
-- Installing: /usr/local/include/qtk/qtkiostream.h
|
||||||
|
-- Installing: /usr/local/include/qtk/qtkiosystem.h
|
||||||
|
-- Installing: /usr/local/include/qtk/scene.h
|
||||||
|
-- Installing: /usr/local/include/qtk/shape.h
|
||||||
|
-- Installing: /usr/local/include/qtk/skybox.h
|
||||||
|
-- Installing: /usr/local/include/qtk/texture.h
|
||||||
|
-- Installing: /usr/local/include/qtk/transform3D.h
|
||||||
```
|
```
|
||||||
|
|
||||||
### Qtk Plugin Collection
|
#### Qtk Plugin Collection
|
||||||
|
|
||||||
This project defines a collection of widget plugins for use with Qt Designer.
|
This project defines a collection of widget plugins for use with Qt Designer.
|
||||||
These plugins were used to build the interface for the Qtk desktop application.
|
These plugins were used to build the interface for the Qtk desktop application.
|
||||||
|
@ -84,8 +110,8 @@ The widgets in the Qtk collection were created by implementing the [QDesignerCus
|
||||||
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.3.1/gcc_64
|
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 --build /path/to/qtk/build --target qtk-collection
|
cmake --build /path/to/qtk/build
|
||||||
cmake --install /path/to/qtk/build
|
cmake --install /path/to/qtk/build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -95,6 +121,14 @@ xargs rm < build/install_manifest.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### Windows / MacOS
|
||||||
|
|
||||||
|
If you are building on **Windows / Mac**, consider setting the `-DASSIMP_NEW_INTERFACE` build flag.
|
||||||
|
```bash
|
||||||
|
cmake -S qtk/ -B qtk/build/ -DASSIMP_NEW_INTERFACE=ON -DCMAKE_PREFIX_PATH=$HOME/Qt/6.5.0/gcc_64;/path/to/assimp/
|
||||||
|
cmake --build qtk/build/ -j $(nproc --ignore=2)
|
||||||
|
```
|
||||||
|
|
||||||
### Controls
|
### Controls
|
||||||
|
|
||||||
You can fly around the scene if you hold the right mouse button and use WASD.
|
You can fly around the scene if you hold the right mouse button and use WASD.
|
||||||
|
@ -198,12 +232,24 @@ Alternatively, we can use `cpack` directly -
|
||||||
cd /path/to/qtk && cmake -B build
|
cd /path/to/qtk && cmake -B build
|
||||||
# Generate all install packages
|
# Generate all install packages
|
||||||
cpack -C Release
|
cpack -C Release
|
||||||
# Generate a specific install package (ZIP)
|
# Generate a specific archive package (ZIP)
|
||||||
cpack -C Release -G ZIP
|
cpack -C Release -G ZIP
|
||||||
# Generate a specific install package (DEB)
|
# Generate a specific archive package (TGZ)
|
||||||
|
cpack -C Release -G TGZ
|
||||||
|
# Generate debian package (DEB)
|
||||||
cpack -C Release -G DEB
|
cpack -C Release -G DEB
|
||||||
|
# Generate NSIS install package (NSIS)
|
||||||
|
cpack -C Release -G NSIS
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Any of the above options can be appended with `--trace-expand` to debug package generation issues.
|
||||||
|
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` during the cmake configuration step.
|
||||||
|
To generate packages for Qtk desktop application, we should set `-DQTK_INSTALL_GUI=ON`, and optionally `-DQTK_INSTALL_LIB=ON` if we would like to bundle libqtk with the desktop application.
|
||||||
|
|
||||||
|
The NSIS installer will allow component-specific path modification for all of these installation components through a GUI install application.
|
||||||
|
|
||||||
##### Resources
|
##### Resources
|
||||||
|
|
||||||
Some useful links and resources that I have found while working on this project.
|
Some useful links and resources that I have found while working on this project.
|
||||||
|
|
|
@ -9,8 +9,67 @@
|
||||||
add_subdirectory(qtk)
|
add_subdirectory(qtk)
|
||||||
|
|
||||||
# Qtk Application
|
# Qtk Application
|
||||||
if (QTK_BUILD_GUI)
|
if (QTK_INSTALL_GUI OR QTK_INSTALL_PLUGINS)
|
||||||
add_subdirectory(app)
|
add_subdirectory(app)
|
||||||
|
|
||||||
|
# Install custom Qtk plugins for Qt Designer.
|
||||||
|
if(QTK_INSTALL_PLUGINS)
|
||||||
|
install(
|
||||||
|
TARGETS qtk_library qtk_plugin_library
|
||||||
|
COMPONENT qtk_collection
|
||||||
|
LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
||||||
|
ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
||||||
|
RUNTIME DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
||||||
|
)
|
||||||
|
install(
|
||||||
|
TARGETS qtk_collection
|
||||||
|
COMPONENT qtk_collection
|
||||||
|
LIBRARY DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
|
||||||
|
ARCHIVE DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
|
||||||
|
RUNTIME DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(QTK_INSTALL_GUI)
|
||||||
|
install(
|
||||||
|
TARGETS qtk_main qtk_library
|
||||||
|
COMPONENT qtk
|
||||||
|
BUNDLE DESTINATION bin
|
||||||
|
LIBRARY DESTINATION lib
|
||||||
|
ARCHIVE DESTINATION lib/static
|
||||||
|
RUNTIME DESTINATION bin
|
||||||
|
)
|
||||||
|
|
||||||
|
qt_generate_deploy_app_script(
|
||||||
|
TARGET qtk_main
|
||||||
|
OUTPUT_SCRIPT QTK_DEPLOY_SCRIPT
|
||||||
|
NO_UNSUPPORTED_PLATFORM_ERROR
|
||||||
|
)
|
||||||
|
install(SCRIPT ${QTK_DEPLOY_SCRIPT} COMPONENT qtk)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
if(MSVC AND TARGET Qt6::qmake)
|
||||||
|
get_target_property(QT6_QMAKE_LOCATION Qt6::qmake IMPORTED_LOCATION)
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${QT6_QMAKE_LOCATION}" -query QT_INSTALL_PREFIX
|
||||||
|
RESULT_VARIABLE return_code
|
||||||
|
OUTPUT_VARIABLE QT6_INSTALL_PREFIX
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
file(TO_NATIVE_PATH "${QT6_INSTALL_PREFIX}/bin" QT6_INSTALL_PREFIX)
|
||||||
|
|
||||||
|
set(VSUSER_FILE "${CMAKE_CURRENT_BINARY_DIR}/qtk_main.vcxproj.user")
|
||||||
|
file(WRITE ${VSUSER_FILE} "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||||
|
file(APPEND ${VSUSER_FILE} "<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n")
|
||||||
|
file(APPEND ${VSUSER_FILE} " <PropertyGroup>\n")
|
||||||
|
file(APPEND ${VSUSER_FILE} " <LocalDebuggerEnvironment>Path=$(SolutionDir)\\lib\\$(Configuration);${QT6_INSTALL_PREFIX};$(Path)\n")
|
||||||
|
file(APPEND ${VSUSER_FILE} "$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\n")
|
||||||
|
file(APPEND ${VSUSER_FILE} " <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\n")
|
||||||
|
file(APPEND ${VSUSER_FILE} " </PropertyGroup>\n")
|
||||||
|
file(APPEND ${VSUSER_FILE} "</Project>\n")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
write_basic_package_version_file(
|
write_basic_package_version_file(
|
||||||
|
@ -22,6 +81,8 @@ configure_package_config_file(
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
||||||
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME}
|
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (QTK_INSTALL_LIB)
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
|
||||||
|
@ -36,6 +97,19 @@ install(
|
||||||
COMPONENT libqtk
|
COMPONENT libqtk
|
||||||
DESTINATION lib/cmake/${PROJECT_NAME}
|
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}")
|
||||||
|
@ -50,14 +124,41 @@ set(CPACK_PACKAGE_CONTACT "shaunreed.com")
|
||||||
set(CPACK_THREADS 0)
|
set(CPACK_THREADS 0)
|
||||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Qtk")
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Qtk")
|
||||||
|
|
||||||
|
# Remove any assimp components if defined by submodule.
|
||||||
|
if (QTK_UPDATE_SUBMODULES)
|
||||||
|
get_cmake_property(CPACK_COMPONENTS_ALL COMPONENTS)
|
||||||
|
list(FILTER CPACK_COMPONENTS_ALL EXCLUDE REGEX .*assimp.*)
|
||||||
|
list(REMOVE_ITEM CPACK_COMPONENTS_ALL Unspecified)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
set(CPACK_NSIS_MODIFY_PATH ON)
|
||||||
|
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
|
||||||
|
set(
|
||||||
|
CPACK_NSIS_CREATE_ICONS_EXTRA
|
||||||
|
"CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Qtk.lnk' '$INSTDIR\\\\qtk_main.exe'"
|
||||||
|
)
|
||||||
|
set(
|
||||||
|
CPACK_NSIS_DELETE_ICONS_EXTRA
|
||||||
|
"Delete '$SMPROGRAMS\\\\$START_MENU\\\\Qtk.lnk'"
|
||||||
|
)
|
||||||
|
# TODO: Icons for NSIS installer.
|
||||||
|
#set(CPACK_NSIS_MUI_ICON "${CMAKE_SOURCE_DIR}/resources/icon.png")
|
||||||
|
#set(CPACK_NSIS_MUI_UNIICON "${CMAKE_SOURCE_DIR}/resources/icon.png")
|
||||||
|
|
||||||
# Debian
|
# Debian
|
||||||
|
# TODO: Fix output sharedlib path.
|
||||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_PACKAGE_HOMEPAGE_URL})
|
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_PACKAGE_HOMEPAGE_URL})
|
||||||
set(CPACK_INSTALL_SCRIPTS ${QTK_DEPLOY_SCRIPT})
|
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
|
||||||
|
#set(CPACK_PACKAGING_INSTALL_PREFIX /usr/local/)
|
||||||
|
|
||||||
# OSX
|
# OSX
|
||||||
|
# TODO: Fix OSX appbundle error.
|
||||||
set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
|
set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
|
||||||
set(CPACK_BUNDLE_PLIST $<TARGET_BUNDLE_CONTENT_DIR:qtk_main>/Info.plist)
|
set(CPACK_BUNDLE_PLIST $<TARGET_BUNDLE_CONTENT_DIR:qtk_main>/Info.plist)
|
||||||
set(CPACK_BUNDLE_ICON ${QTK_OSX_ICONS})
|
set(CPACK_BUNDLE_ICON ${QTK_OSX_ICONS})
|
||||||
|
|
||||||
|
# Platform defaults for source bundles.
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(CPACK_SOURCE_GENERATOR ZIP)
|
set(CPACK_SOURCE_GENERATOR ZIP)
|
||||||
else()
|
else()
|
||||||
|
|
|
@ -23,7 +23,7 @@ set(
|
||||||
toolbox.h
|
toolbox.h
|
||||||
treeview.h
|
treeview.h
|
||||||
)
|
)
|
||||||
qt_add_library(qtk_plugin_library STATIC)
|
qt_add_library(qtk_plugin_library STATIC EXCLUDE_FROM_ALL)
|
||||||
target_sources(
|
target_sources(
|
||||||
qtk_plugin_library PRIVATE
|
qtk_plugin_library PRIVATE
|
||||||
"${QTK_PLUGIN_LIBRARY_SOURCES}"
|
"${QTK_PLUGIN_LIBRARY_SOURCES}"
|
||||||
|
@ -31,28 +31,11 @@ target_sources(
|
||||||
)
|
)
|
||||||
target_link_libraries(qtk_plugin_library PUBLIC Qt6::UiPlugin qtk_library)
|
target_link_libraries(qtk_plugin_library PUBLIC Qt6::UiPlugin qtk_library)
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS qtk_plugin_library
|
|
||||||
COMPONENT qtk_collection
|
|
||||||
LIBRARY DESTINATION lib
|
|
||||||
ARCHIVE DESTINATION lib/static
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
)
|
|
||||||
|
|
||||||
# Install plugin library to Qt Creator for Designer plugin integration.
|
|
||||||
#install(
|
|
||||||
# TARGETS qtk_plugin_library
|
|
||||||
# EXCLUDE_FROM_ALL
|
|
||||||
# LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
|
||||||
# ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
|
||||||
# RUNTIME DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
|
||||||
#)
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Qtk Widget Collection Plugin
|
# Qtk Widget Collection Plugin
|
||||||
################################################################################
|
################################################################################
|
||||||
# Create a Qt Designer plugin for a collection of widgets from our library.
|
# Create a Qt Designer plugin for a collection of widgets from our library.
|
||||||
qt_add_plugin(qtk_collection STATIC)
|
qt_add_plugin(qtk_collection SHARED EXCLUDE_FROM_ALL)
|
||||||
target_sources(
|
target_sources(
|
||||||
qtk_collection PRIVATE
|
qtk_collection PRIVATE
|
||||||
widgetplugincollection.cpp widgetplugincollection.h
|
widgetplugincollection.cpp widgetplugincollection.h
|
||||||
|
@ -60,22 +43,6 @@ target_sources(
|
||||||
)
|
)
|
||||||
target_link_libraries(qtk_collection PUBLIC qtk_plugin_library)
|
target_link_libraries(qtk_collection PUBLIC qtk_plugin_library)
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS qtk_collection
|
|
||||||
COMPONENT qtk_collection
|
|
||||||
LIBRARY DESTINATION lib
|
|
||||||
ARCHIVE DESTINATION lib/static
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
)
|
|
||||||
|
|
||||||
#install(
|
|
||||||
# TARGETS qtk_collection
|
|
||||||
# EXCLUDE_FROM_ALL
|
|
||||||
# LIBRARY DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
|
|
||||||
# ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
|
||||||
# RUNTIME DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
|
|
||||||
#)
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Final Qtk Application
|
# Final Qtk Application
|
||||||
################################################################################
|
################################################################################
|
||||||
|
@ -109,34 +76,3 @@ set_target_properties(
|
||||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
|
||||||
TARGETS qtk_main
|
|
||||||
COMPONENT qtk
|
|
||||||
BUNDLE DESTINATION bin
|
|
||||||
LIBRARY DESTINATION lib
|
|
||||||
ARCHIVE DESTINATION lib/static
|
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
)
|
|
||||||
|
|
||||||
qt_generate_deploy_app_script(
|
|
||||||
TARGET qtk_main
|
|
||||||
FILENAME_VARIABLE QTK_DEPLOY_SCRIPT
|
|
||||||
NO_UNSUPPORTED_PLATFORM_ERROR
|
|
||||||
)
|
|
||||||
install(SCRIPT ${QTK_DEPLOY_SCRIPT} COMPONENT qtk)
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
if(MSVC AND TARGET Qt6::qmake)
|
|
||||||
set(VSUSER_FILE "${CMAKE_CURRENT_BINARY_DIR}/qtk_main.vcxproj.user")
|
|
||||||
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/extern/assimp/assimp/bin" assimp_bin)
|
|
||||||
file(WRITE ${VSUSER_FILE} "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
|
||||||
file(APPEND ${VSUSER_FILE} "<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n")
|
|
||||||
file(APPEND ${VSUSER_FILE} " <PropertyGroup>\n")
|
|
||||||
file(APPEND ${VSUSER_FILE} " <LocalDebuggerEnvironment>Path=$(SolutionDir)\\lib\\$(Configuration);${qt6_install_prefix};${assimp_bin};$(Path)\n")
|
|
||||||
file(APPEND ${VSUSER_FILE} "$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>\n")
|
|
||||||
file(APPEND ${VSUSER_FILE} " <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>\n")
|
|
||||||
file(APPEND ${VSUSER_FILE} " </PropertyGroup>\n")
|
|
||||||
file(APPEND ${VSUSER_FILE} "</Project>\n")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ set(
|
||||||
)
|
)
|
||||||
|
|
||||||
qt6_add_big_resources(QTK_LIBRARY_SOURCES "${QTK_RESOURCES}/resources.qrc")
|
qt6_add_big_resources(QTK_LIBRARY_SOURCES "${QTK_RESOURCES}/resources.qrc")
|
||||||
qt_add_library(qtk_library STATIC)
|
qt_add_library(qtk_library STATIC EXCLUDE_FROM_ALL)
|
||||||
target_sources(qtk_library PRIVATE ${QTK_LIBRARY_SOURCES})
|
target_sources(qtk_library PRIVATE ${QTK_LIBRARY_SOURCES})
|
||||||
target_sources(
|
target_sources(
|
||||||
qtk_library PUBLIC
|
qtk_library PUBLIC
|
||||||
|
@ -78,24 +78,5 @@ if(WIN32)
|
||||||
target_link_libraries(qtk_library PUBLIC OpenGL::GL)
|
target_link_libraries(qtk_library PUBLIC OpenGL::GL)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# System install for qtk_library
|
#install(SCRIPT ${LIBQTK_DEPLOY_SCRIPT} COMPONENT libqtk)
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
## Install qtk_library to Qt Designer to support widget plugins.
|
## Install qtk_library to Qt Designer to support widget plugins.
|
||||||
#install(
|
|
||||||
# TARGETS qtk_library
|
|
||||||
# EXCLUDE_FROM_ALL
|
|
||||||
# LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
|
||||||
# ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
|
||||||
# RUNTIME DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
|
|
||||||
#)
|
|
||||||
|
|
Loading…
Reference in New Issue