CMake packaging

This commit is contained in:
Shaun Reed 2023-01-02 22:18:53 -05:00
parent f83f68207d
commit faa9fe28f7
11 changed files with 404 additions and 85 deletions

View File

@ -10,6 +10,7 @@ cmake_minimum_required(VERSION 3.23)
# Includes
################################################################################
include("${CMAKE_SOURCE_DIR}/cmake/include/git_submodule.cmake")
include(CMakePackageConfigHelpers)
################################################################################
# Constants
@ -47,29 +48,19 @@ option(QTK_BUILD_GUI "Build the Qtk desktop application" ON)
# Options for bringing your own assimp installation; Otherwise not needed
# + If assimp is available system-wide we can just set QTK_UPDATE_SUBMODULES OFF
option(ASSIMP_NEW_INTERFACE "Use the assimp::assimp interface (WIN / OSX)" OFF)
message(STATUS
"[Qtk] ASSIMP_NEW_INTERFACE=${ASSIMP_NEW_INTERFACE}"
)
message(STATUS "[Qtk] ASSIMP_NEW_INTERFACE=${ASSIMP_NEW_INTERFACE}")
set(QT_DIR "$ENV{HOME}/Code/Clones/Qt/" CACHE PATH "Path to Qt6")
# 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)
set(QT_PLUGIN_INSTALL_DIR
"${QT_DIR}/Tools/QtCreator/bin/plugins/designer"
)
# This path may be different on windows. I have not tested this.
set(QT_PLUGIN_LIBRARY_DIR
"${QT_DIR}/Tools/QtCreator/lib/Qt/lib"
)
# 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")
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_DIR}/Tools/QtCreator/lib/Qt/plugins/designer")
set(QT_PLUGIN_LIBRARY_DIR "${QT_DIR}/Tools/QtCreator/lib/Qt/lib")
endif()
# This should be set to your Qt6 installation directory.
@ -80,9 +71,7 @@ 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(QTK_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install")
#set(QTK_INSTALL_PREFIX "${QT_INSTALL_DIR}")
#set(QTK_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
message(STATUS "[Qtk] CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
set(QTK_RESOURCES "${CMAKE_SOURCE_DIR}/resources")
# Print all QTK options and their values.
@ -99,12 +88,12 @@ endforeach()
# Find Qt
find_package(Qt6 COMPONENTS Core UiPlugin OpenGLWidgets)
if(NOT Qt6_FOUND)
message(SEND_ERROR
"[Qtk] Error: Unable to find Qt6 at CMAKE_PREFIX_PATH: "
message(
SEND_ERROR "[Qtk] Error: Unable to find Qt6 at CMAKE_PREFIX_PATH: "
"${CMAKE_PREFIX_PATH}"
)
message(FATAL_ERROR
"[Qtk] Error: Specify path to Qt6 with `cmake "
message(
FATAL_ERROR "[Qtk] Error: Specify path to Qt6 with `cmake "
"-DCMAKE_PREFIX_PATH=/path/to/Qt/6.x.x/gcc_64 -S /path/to/qtk -B "
"/path/to/qtk/build && cmake --build /path/to/qtk/build -j $(nprocs)`"
)
@ -130,7 +119,8 @@ add_subdirectory(src)
if(WIN32)
get_target_property(_qt6_qmake_location Qt6::qmake IMPORTED_LOCATION)
execute_process(COMMAND "${_qt6_qmake_location}" -query QT_INSTALL_PREFIX
execute_process(
COMMAND "${_qt6_qmake_location}" -query QT_INSTALL_PREFIX
RESULT_VARIABLE return_code
OUTPUT_VARIABLE qt6_install_prefix
OUTPUT_STRIP_TRAILING_WHITESPACE
@ -138,7 +128,8 @@ if(WIN32)
file(TO_NATIVE_PATH "${qt6_install_prefix}/bin" qt6_install_prefix)
if(TARGET Qt6::windeployqt)
add_custom_command(TARGET qtk-main
add_custom_command(
TARGET qtk-main
POST_BUILD
COMMAND set PATH=%PATH%$<SEMICOLON>${qt6_install_prefix}
COMMAND Qt6::windeployqt --dir "${CMAKE_BINARY_DIR}/windeployqt" "$<TARGET_FILE_DIR:qtk-main>/$<TARGET_FILE_NAME:qtk-main>"
@ -147,7 +138,7 @@ if(WIN32)
endif()
if(MSVC AND TARGET Qt6::qmake)
set(VSUSER_FILE ${CMAKE_CURRENT_BINARY_DIR}/qtk-main.vcxproj.user)
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")

View File

@ -0,0 +1,6 @@
@PACKAGE_INIT@
include("${CMAKE_CURRENT_LIST_DIR}/QtkTargets.cmake")
set_and_check(QTK_EXECUTABLE "${PACKAGE_PREFIX_DIR}/bin/qtk-main")
check_required_components(Qtk)

View File

@ -10,15 +10,34 @@ add_subdirectory(qtk)
# Qtk Application
if (QTK_BUILD_GUI)
#TODO: Use this to test local builds?
# SET(CMAKE_INSTALL_RPATH "${QTK_INSTALL_PREFIX}/lib")
add_subdirectory(app)
endif()
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/QtkConfigVersion.cmake"
COMPATIBILITY AnyNewerVersion
)
configure_package_config_file(
"${CMAKE_SOURCE_DIR}/cmake/templates/Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/QtkConfig.cmake"
INSTALL_DESTINATION lib/cmake/Qtk
)
install(
FILES
"${CMAKE_CURRENT_BINARY_DIR}/QtkConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/QtkConfigVersion.cmake"
DESTINATION lib/cmake/Qtk
)
# Install export
install(EXPORT qtk-export
install(
EXPORT qtk-export
FILE QtkTargets.cmake
NAMESPACE Qtk::
CONFIGURATIONS Debug|Release
DESTINATION ${QTK_INSTALL_PREFIX}/cmake
DESTINATION lib/cmake/Qtk
)
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
include(CPack)

View File

@ -9,36 +9,41 @@
# Qtk Widget Library
################################################################################
# Create a library of widgets used to build Qtk GUI
set(QTK_PLUGIN_LIBRARY_SOURCES
set(
QTK_PLUGIN_LIBRARY_SOURCES
qtkwidget.cpp qtkwidget.h
debugconsole.cpp debugconsole.ui
toolbox.cpp toolbox.ui
treeview.cpp treeview.ui
)
set(QTK_PLUGIN_LIBRARY_HEADERS
set(
QTK_PLUGIN_LIBRARY_HEADERS
debugconsole.h
toolbox.h
treeview.h
)
qt_add_library(qtk-plugin-library SHARED)
target_sources(qtk-plugin-library PRIVATE
${QTK_PLUGIN_LIBRARY_SOURCES}
${QTK_PLUGIN_LIBRARY_HEADERS}
target_sources(
qtk-plugin-library PRIVATE
"${QTK_PLUGIN_LIBRARY_SOURCES}"
"${QTK_PLUGIN_LIBRARY_HEADERS}"
)
target_link_libraries(qtk-plugin-library PUBLIC Qt6::UiPlugin qtk-library)
install(TARGETS qtk-plugin-library
EXPORT qtk-export
BUNDLE DESTINATION ${QTK_INSTALL_PREFIX}/lib
LIBRARY DESTINATION ${QTK_INSTALL_PREFIX}/lib
ARCHIVE DESTINATION ${QTK_INSTALL_PREFIX}/lib/static
RUNTIME DESTINATION ${QTK_INSTALL_PREFIX}/bin
install(
TARGETS qtk-plugin-library
BUNDLE DESTINATION lib
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
RUNTIME DESTINATION bin
)
install(TARGETS qtk-plugin-library
BUNDLE DESTINATION ${QTK_PLUGIN_LIBRARY_DIR}
LIBRARY DESTINATION ${QTK_PLUGIN_LIBRARY_DIR}
RUNTIME DESTINATION ${QTK_PLUGIN_LIBRARY_DIR}
ARCHIVE DESTINATION ${QTK_PLUGIN_LIBRARY_DIR}
install(
TARGETS qtk-plugin-library
BUNDLE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
RUNTIME DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
)
################################################################################
@ -46,51 +51,54 @@ install(TARGETS qtk-plugin-library
################################################################################
# Create a Qt Designer plugin for a collection of widgets from our library.
qt_add_plugin(qtk-collection)
target_sources(qtk-collection PRIVATE
target_sources(
qtk-collection PRIVATE
widgetplugincollection.cpp widgetplugincollection.h
widgetplugin.cpp widgetplugin.h
)
target_link_libraries(qtk-collection PUBLIC qtk-plugin-library)
install(TARGETS qtk-collection
RUNTIME DESTINATION ${QTK_PLUGIN_INSTALL_DIR}
BUNDLE DESTINATION ${QTK_PLUGIN_INSTALL_DIR}
LIBRARY DESTINATION ${QTK_PLUGIN_INSTALL_DIR}
install(
TARGETS qtk-collection
RUNTIME DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
BUNDLE DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
LIBRARY DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
)
################################################################################
# Final Qtk Application
################################################################################
set(QTK_APP_SOURCES
qtkwidget.cpp qtkwidget.h
set(
QTK_APP_SOURCES
examplescene.cpp examplescene.h
qtkmainwindow.cpp qtkmainwindow.ui
qtkmainwindow.h
main.cpp
)
qt6_add_resources(QTK_APP_SOURCES ${CMAKE_SOURCE_DIR}/resources/resources.qrc)
# TODO: Qtk library should not depend on these resources. (qtkapi.h)
# Or should some resources be installed somewhere?
qt6_add_resources(QTK_APP_SOURCES "${QTK_RESOURCES}/resources.qrc")
configure_file(
"resources.h.in"
resources.h.in
"${CMAKE_CURRENT_BINARY_DIR}/resources.h"
@ONLY
)
qt_add_executable(qtk-main ${QTK_APP_SOURCES})
# Link qtk-main executable to main qtk-library library
target_link_libraries(qtk-main PRIVATE qtk-plugin-library)
target_include_directories(qtk-main PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(qtk-main PROPERTIES
set_target_properties(
qtk-main PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
# TODO: Fix install for qtk-main unable to find so files
install(TARGETS qtk-main
BUNDLE DESTINATION ${QTK_INSTALL_PREFIX}/bin
RUNTIME DESTINATION ${QTK_INSTALL_PREFIX}/bin
LIBRARY DESTINATION ${QTK_INSTALL_PREFIX}/bin/lib
install(
TARGETS qtk-main
BUNDLE DESTINATION bin
RUNTIME DESTINATION bin
LIBRARY DESTINATION bin/lib
)

View File

@ -0,0 +1,59 @@
################################################################################
## Example client project using qtk ##
## ##
## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
## All Content (c) 2023 Shaun Reed, all rights reserved ##
################################################################################
cmake_minimum_required(VERSION 3.23)
################################################################################
# Constants
################################################################################
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options(/wd4131 /wd4127)
endif()
################################################################################
# Project
################################################################################
project(
#[[NAME]] QtkClient
VERSION 1.0
DESCRIPTION "An example project using Qtk"
LANGUAGES CXX C
)
# If you did not install Qtk on a system path, point cmake to installation.
#list(APPEND CMAKE_PREFIX_PATH /home/shaun/Code/qtk/install)
find_package(Qtk 1.0 REQUIRED)
# Print all QTK variables
get_cmake_property(VAR_NAMES VARIABLES)
list(FILTER VAR_NAMES INCLUDE REGEX "^QTK_.*$")
list(SORT VAR_NAMES)
foreach(VAR_NAME ${VAR_NAMES})
message(STATUS "[Qtk] ${VAR_NAME}=${${VAR_NAME}}")
endforeach()
set(QT_INSTALL_DIR "/home/kapper/Code/Clones/Qt/6.3.1/gcc_64/" CACHE PATH "Path to Qt6 install")
list(APPEND CMAKE_PREFIX_PATH "${QT_INSTALL_DIR}")
find_package(Qt6 COMPONENTS Core Widgets OpenGLWidgets REQUIRED)
set(EXAMPLE_SOURCES
main.cpp
examplescene.cpp examplescene.h
examplewidget.cpp examplewidget.h
)
qt_add_resources(EXAMPLE_SOURCES ../../resources/resources.qrc)
add_executable(example ${EXAMPLE_SOURCES})
target_link_libraries(example PUBLIC Qt6::Widgets Qt6::OpenGLWidgets Qt6::Core)
target_link_libraries(example PUBLIC Qtk::qtk-library)

View File

@ -0,0 +1,89 @@
/*##############################################################################
## Author: Shaun Reed ##
## Legal: All Content (c) 2023 Shaun Reed, all rights reserved ##
## About: Example Qtk scene ##
## ##
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
##############################################################################*/
#include "examplescene.h"
using namespace Qtk;
ExampleScene::ExampleScene() {
setSceneName("Example Scene");
getCamera().getTransform().setTranslation(-8.0f, 0.0f, 10.0f);
getCamera().getTransform().setRotation(-5.0f, 0.0f, 1.0f, 0.0f);
}
ExampleScene::~ExampleScene() {}
void ExampleScene::init() {
auto skybox = new Qtk::Skybox("Skybox");
setSkybox(skybox);
auto mesh = addObject(
new Qtk::MeshRenderer("rightTriangle", Triangle(QTK_DRAW_ELEMENTS)));
mesh->getTransform().setTranslation(-5.0f, 0.0f, -2.0f);
addObject(new Qtk::MeshRenderer("centerCube", Cube(QTK_DRAW_ELEMENTS)))
->getTransform()
.setTranslation(-7.0f, 0.0f, -2.0f);
mesh = addObject(
new Qtk::MeshRenderer("leftTriangle", Triangle(QTK_DRAW_ELEMENTS)));
mesh->getTransform().setTranslation(-9.0f, 0.0f, -2.0f);
mesh->setDrawType(GL_LINE_LOOP);
mesh = addObject(
new Qtk::MeshRenderer("topTriangle", Triangle(QTK_DRAW_ELEMENTS)));
mesh->getTransform().setTranslation(-7.0f, 2.0f, -2.0f);
mesh->getTransform().scale(0.25f);
mesh = addObject(
new Qtk::MeshRenderer("bottomTriangle", Triangle(QTK_DRAW_ELEMENTS)));
mesh->getTransform().setTranslation(-7.0f, -2.0f, -2.0f);
mesh->getTransform().scale(0.25f);
mesh->setDrawType(GL_LINE_LOOP);
mesh->setColor(GREEN);
}
void ExampleScene::draw() {
Scene::draw();
}
void ExampleScene::update() {
// Pitch forward and roll sideways
MeshRenderer::getInstance("leftTriangle")
->getTransform()
.rotate(0.75f, 1.0f, 0.0f, 0.0f);
MeshRenderer::getInstance("rightTriangle")
->getTransform()
.rotate(0.75f, 0.0f, 0.0f, 1.0f);
static float translateX = 0.025f;
float limit = -9.0f; // Origin position.x - 2.0f
float posX = MeshRenderer::getInstance("topTriangle")
->getTransform()
.getTranslation()
.x();
if(posX < limit || posX > limit + 4.0f) {
translateX = -translateX;
}
MeshRenderer::getInstance("topTriangle")
->getTransform()
.translate(translateX, 0.0f, 0.0f);
MeshRenderer::getInstance("bottomTriangle")
->getTransform()
.translate(-translateX, 0.0f, 0.0f);
MeshRenderer::getInstance("topTriangle")
->getTransform()
.rotate(0.75f, 0.2f, 0.0f, 0.4f);
MeshRenderer::getInstance("bottomTriangle")
->getTransform()
.rotate(0.75f, 0.0f, 0.2f, 0.4f);
MeshRenderer::getInstance("centerCube")
->getTransform()
.rotate(0.75f, 0.2f, 0.4f, 0.6f);
}

View File

@ -0,0 +1,27 @@
/*##############################################################################
## Author: Shaun Reed ##
## Legal: All Content (c) 2023 Shaun Reed, all rights reserved ##
## About: Example Qtk scene ##
## ##
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
##############################################################################*/
#ifndef QTK_EXAMPLE_SCENE_H
#define QTK_EXAMPLE_SCENE_H
#include <qtk/scene.h>
class ExampleScene : public Qtk::Scene {
public:
ExampleScene();
~ExampleScene();
void init() override;
void draw() override;
void update() override;
};
#endif // QTK_EXAMPLE_SCENE_H

View File

@ -0,0 +1,52 @@
/*##############################################################################
## Author: Shaun Reed ##
## Legal: All Content (c) 2023 Shaun Reed, all rights reserved ##
## About: Example Qtk widget ##
## ##
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
##############################################################################*/
#include <qtk/scene.h>
#include "examplewidget.h"
ExampleWidget::ExampleWidget(QWidget * parent) :
QOpenGLWidget(parent), mScene(new ExampleScene) {
QSurfaceFormat format;
format.setRenderableType(QSurfaceFormat::OpenGL);
format.setProfile(QSurfaceFormat::CoreProfile);
format.setVersion(4, 6);
format.setSamples(4);
format.setDepthBufferSize(16);
setFormat(format);
setFocusPolicy(Qt::ClickFocus);
}
void ExampleWidget::initializeGL() {
initializeOpenGLFunctions();
connect(this, SIGNAL(frameSwapped()), this, SLOT(update()));
glEnable(GL_MULTISAMPLE);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glDepthFunc(GL_LEQUAL);
glDepthRange(0.1f, 1.0f);
glClearDepth(1.0f);
glClearColor(0.0f, 0.25f, 0.0f, 0.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
void ExampleWidget::resizeGL(int width, int height) {
Qtk::Scene::getProjectionMatrix().setToIdentity();
Qtk::Scene::getProjectionMatrix().perspective(
45.0f, float(width) / float(height), 0.1f, 1000.0f);
}
void ExampleWidget::paintGL() {
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
mScene->draw();
}
void ExampleWidget::update() {
mScene->update();
QWidget::update();
}

View File

@ -0,0 +1,38 @@
/*##############################################################################
## Author: Shaun Reed ##
## Legal: All Content (c) 2023 Shaun Reed, all rights reserved ##
## About: Example Qtk widget ##
## ##
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
##############################################################################*/
#ifndef QTKCLIENT_EXAMPLEWIDGET_H
#define QTKCLIENT_EXAMPLEWIDGET_H
#include <QOpenGLFunctions>
#include <QOpenGLWidget>
#include "examplescene.h"
class ExampleWidget : public QOpenGLWidget, protected QOpenGLFunctions {
Q_OBJECT;
public:
explicit ExampleWidget(QWidget * parent = nullptr);
~ExampleWidget() = default;
void initializeGL() override;
void resizeGL(int width, int height) override;
void paintGL() override;
protected slots:
void update();
private:
ExampleScene * mScene;
};
#endif // QTKCLIENT_EXAMPLEWIDGET_H

View File

@ -0,0 +1,22 @@
/*##############################################################################
## Author: Shaun Reed ##
## Legal: All Content (c) 2023 Shaun Reed, all rights reserved ##
## About: Example Qt desktop application using Qtk ##
## ##
## Contact: shaunrd0@gmail.com | URL: www.shaunreed.com | GitHub: shaunrd0 ##
##############################################################################*/
#include <QApplication>
#include <QMainWindow>
#include "examplewidget.h"
int main(int argc, char * argv[]) {
QApplication app(argc, argv);
auto window = new QMainWindow;
window->setCentralWidget(new ExampleWidget);
window->show();
app.exec();
}

View File

@ -8,7 +8,8 @@
################################################################################
# Qtk Library
################################################################################
set(PUBLIC_HEADERS
set(
QTK_LIBRARY_PUBLIC_HEADERS
camera3d.h
input.h
shape.h
@ -23,7 +24,8 @@ set(PUBLIC_HEADERS
transform3D.h
)
set(SOURCE_FILES
set(
QTK_LIBRARY_SOURCES
camera3d.cpp
input.cpp
shape.cpp
@ -37,12 +39,14 @@ set(SOURCE_FILES
transform3D.cpp
)
qt_add_library(qtk-library SHARED)
target_sources(qtk-library PRIVATE ${SOURCE_FILES})
target_sources(qtk-library PUBLIC
qt6_add_resources(QTK_LIBRARY_SOURCES "${QTK_RESOURCES}/resources.qrc")
qt_add_library(qtk-library STATIC)
target_sources(qtk-library PRIVATE ${QTK_LIBRARY_SOURCES})
target_sources(
qtk-library PUBLIC
FILE_SET HEADERS
BASE_DIRS ${CMAKE_SOURCE_DIR}/src
FILES ${PUBLIC_HEADERS}
BASE_DIRS "${CMAKE_SOURCE_DIR}/src"
FILES ${QTK_LIBRARY_PUBLIC_HEADERS}
)
if(QTK_DEBUG)
@ -52,13 +56,15 @@ if(QTK_SHARED)
target_compile_definitions(qtk-library PUBLIC QTK_SHARED)
endif()
set_target_properties(qtk-library PROPERTIES
set_target_properties(
qtk-library PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
VERSION ${PROJECT_VERSION}
)
target_link_libraries(qtk-library PUBLIC
target_link_libraries(
qtk-library PUBLIC
Qt6::Core Qt6::OpenGLWidgets Qt6::Widgets
)
@ -73,21 +79,23 @@ if(WIN32)
endif()
# System install for qtk-library
# TODO: Use RUNTIME_DEPENDENCY_SET to install Qt libraries for local builds?
install(TARGETS qtk-library
install(
TARGETS qtk-library
# Associate qtk-library target with qtk-export
EXPORT qtk-export
FILE_SET HEADERS DESTINATION "${QTK_INSTALL_PREFIX}/include"
BUNDLE DESTINATION ${QTK_INSTALL_PREFIX}/lib
LIBRARY DESTINATION ${QTK_INSTALL_PREFIX}/lib
ARCHIVE DESTINATION ${QTK_INSTALL_PREFIX}/lib/static
RUNTIME DESTINATION ${QTK_INSTALL_PREFIX}/bin
FILE_SET HEADERS DESTINATION include
BUNDLE DESTINATION lib
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
RUNTIME DESTINATION bin
INCLUDES DESTINATION include
)
## Install qtk-library to Qt Designer to support widget plugins.
install(TARGETS qtk-library
BUNDLE DESTINATION ${QTK_PLUGIN_LIBRARY_DIR}
LIBRARY DESTINATION ${QTK_PLUGIN_LIBRARY_DIR}
ARCHIVE DESTINATION ${QTK_PLUGIN_LIBRARY_DIR}
RUNTIME DESTINATION ${QTK_PLUGIN_LIBRARY_DIR}
install(
TARGETS qtk-library
BUNDLE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
RUNTIME DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
)