Improve UI #13

Merged
shaunrd0 merged 28 commits from ui into master 2023-03-12 02:02:28 +00:00
6 changed files with 240 additions and 151 deletions
Showing only changes of commit 5e886672da - Show all commits

View File

@ -92,7 +92,7 @@ jobs:
name: qtk-packages-${{ matrix.os }}
path: |
build/packages/
!build/packages/_cpack_packages/*
!build/packages/_CPack_Packages/*
Build-Qtk-Assimp-Targets:
strategy:

View File

@ -6,12 +6,6 @@
################################################################################
cmake_minimum_required(VERSION 3.23)
################################################################################
# Includes
################################################################################
include("${CMAKE_SOURCE_DIR}/cmake/include/git_submodule.cmake")
include(CMakePackageConfigHelpers)
################################################################################
# Constants
################################################################################
@ -40,15 +34,31 @@ project(
LANGUAGES CXX C
)
################################################################################
# Includes
################################################################################
include("${CMAKE_SOURCE_DIR}/cmake/include/git_submodule.cmake")
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
################################################################################
# Options
################################################################################
option(QTK_DEBUG "Enable debugger" ON)
option(QTK_BUILD_GUI "Build the Qtk desktop application" ON)
option(QTK_BUILD_EXAMPLE "Build the Qtk example desktop application" ON)
option(QTK_DEBUG "Enable debugger" 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.
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
# + If assimp is available system-wide we can just set QTK_UPDATE_SUBMODULES OFF
option(
@ -63,40 +73,44 @@ else()
set(CMAKE_BUILD_TYPE Debug)
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.
# These paths are for using Qt Designer integrated within Qt Creator.
# Standalone Qt Designer may use different paths.
if (WIN32)
# 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_LIBRARY_DIR "${QT_DIR}/Tools/QtCreator/lib/Qt/lib")
set(QT_PLUGIN_INSTALL_DIR "${QT_CREATOR_DIR}/bin/plugins/designer")
set(QT_PLUGIN_LIBRARY_DIR "${QT_CREATOR_DIR}/lib/Qt/lib")
else()
set(QT_PLUGIN_INSTALL_DIR "${QT_DIR}/Tools/QtCreator/lib/Qt/plugins/designer")
set(QT_PLUGIN_LIBRARY_DIR "${QT_DIR}/Tools/QtCreator/lib/Qt/lib")
set(QT_PLUGIN_INSTALL_DIR "${QT_CREATOR_DIR}/lib/Qt/plugins/designer")
set(QT_PLUGIN_LIBRARY_DIR "${QT_CREATOR_DIR}/lib/Qt/lib")
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_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}")
set(QTK_RESOURCES "${CMAKE_SOURCE_DIR}/resources")
set(QTK_OSX_ICONS ${CMAKE_SOURCE_DIR}/resources/icons/osx/kilroy.icns)
# Print all QTK options and their values.
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)
foreach(VAR_NAME ${VAR_NAMES})
message(STATUS "[Qtk] ${VAR_NAME}=${${VAR_NAME}}")
@ -120,15 +134,26 @@ if(NOT Qt6_FOUND)
)
endif()
# 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)
# Find Assimp.
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...")
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()
find_package(assimp REQUIRED)
endif()

View File

@ -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.
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 -
```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
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
./qtk/build/qtk-main
cmake -S qtk/ -B qtk/build/ -DCMAKE_PREFIX_PATH=$HOME/Qt/6.5.0/gcc_64
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.
@ -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.
```bash
sudo apt update -y && sudo apt install freeglut3-dev libassimp-dev cmake build-essential git
git clone https://gitlab.com/shaunrd0/qtk
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/qtk-main
cmake -S qtk/ -B qtk/build/ -DQTK_UPDATE_SUBMODULES=ON -DCMAKE_PREFIX_PATH=$HOME/Qt/6.5.0/gcc_64
cmake --build qtk/build/ -j $(nproc --ignore=2)
./qtk/build/bin/qtk-main
```
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
```
#### 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
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.
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 -
```bash
cmake -S /path/to/qtk -B /path/to/qtk/build -DCMAKE_PREFIX_PATH=$HOME/Qt/6.3.1/gcc_64
cmake --build /path/to/qtk/build --target qtk-collection
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
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
You can fly around the scene if you hold the right mouse button and use WASD.
@ -148,7 +182,7 @@ If you're using CLion, the `.clang-format` configuration will be picked up by CL
# Move to the root of the repo
cd qtk
# Build
cmake -B build && cmake --build build
cmake -B build && cmake --build build
clang-tidy -p build/ --fix --config-file=.clang-tidy src/*.cpp src/*.h app/*.cpp app/*.h
```
@ -198,12 +232,24 @@ Alternatively, we can use `cpack` directly -
cd /path/to/qtk && cmake -B build
# Generate all install packages
cpack -C Release
# Generate a specific install package (ZIP)
# Generate a specific archive package (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
# 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
Some useful links and resources that I have found while working on this project.

View File

@ -9,8 +9,67 @@
add_subdirectory(qtk)
# Qtk Application
if (QTK_BUILD_GUI)
if (QTK_INSTALL_GUI OR QTK_INSTALL_PLUGINS)
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()
write_basic_package_version_file(
@ -22,20 +81,35 @@ configure_package_config_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION lib/cmake/${PROJECT_NAME}
)
install(
FILES
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
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}
)
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_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
@ -50,14 +124,41 @@ set(CPACK_PACKAGE_CONTACT "shaunreed.com")
set(CPACK_THREADS 0)
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
# TODO: Fix output sharedlib path.
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
# TODO: Fix OSX appbundle error.
set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
set(CPACK_BUNDLE_PLIST $<TARGET_BUNDLE_CONTENT_DIR:qtk_main>/Info.plist)
set(CPACK_BUNDLE_ICON ${QTK_OSX_ICONS})
# Platform defaults for source bundles.
if(WIN32)
set(CPACK_SOURCE_GENERATOR ZIP)
else()

View File

@ -23,7 +23,7 @@ set(
toolbox.h
treeview.h
)
qt_add_library(qtk_plugin_library STATIC)
qt_add_library(qtk_plugin_library STATIC EXCLUDE_FROM_ALL)
target_sources(
qtk_plugin_library PRIVATE
"${QTK_PLUGIN_LIBRARY_SOURCES}"
@ -31,28 +31,11 @@ target_sources(
)
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
################################################################################
# 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(
qtk_collection PRIVATE
widgetplugincollection.cpp widgetplugincollection.h
@ -60,22 +43,6 @@ target_sources(
)
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
################################################################################
@ -109,34 +76,3 @@ set_target_properties(
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
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()

View File

@ -44,7 +44,7 @@ set(
)
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 PUBLIC
@ -78,24 +78,5 @@ if(WIN32)
target_link_libraries(qtk_library PUBLIC OpenGL::GL)
endif()
# 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
)
#install(SCRIPT ${LIBQTK_DEPLOY_SCRIPT} COMPONENT libqtk)
## 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}"
#)