Improve UI #13

Merged
shaunrd0 merged 28 commits from ui into master 2023-03-12 02:02:28 +00:00
6 changed files with 54 additions and 34 deletions
Showing only changes of commit 48719412f2 - Show all commits

View File

@ -46,7 +46,7 @@ project(
################################################################################ ################################################################################
option(QTK_DEBUG "Enable debugger" ON) option(QTK_DEBUG "Enable debugger" ON)
option(QTK_BUILD_GUI "Build the Qtk desktop application" ON) option(QTK_BUILD_GUI "Build the Qtk desktop application" ON)
option(QTK_BUILD_EXAMPLE "Build the Qtk example desktop application" OFF) 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)
# 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." OFF)
@ -119,6 +119,7 @@ endif()
set(ASSIMP_BUILD_TESTS OFF) set(ASSIMP_BUILD_TESTS OFF)
if(QTK_UPDATE_SUBMODULES) if(QTK_UPDATE_SUBMODULES)
message(STATUS "[Qtk] Updating submodules...") message(STATUS "[Qtk] Updating submodules...")
set(ASSIMP_INSTALL OFF)
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/")
else() else()
@ -133,3 +134,9 @@ endif()
# Qtk # Qtk
################################################################################ ################################################################################
add_subdirectory(src) add_subdirectory(src)
if(QTK_BUILD_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)
endif()

View File

@ -2,7 +2,7 @@
include("${CMAKE_CURRENT_LIST_DIR}/QtkTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/QtkTargets.cmake")
set_and_check(QTK_EXECUTABLE "${PACKAGE_PREFIX_DIR}/bin/qtk-main") set_and_check(QTK_EXECUTABLE "${PACKAGE_PREFIX_DIR}/bin/qtk_main")
set_and_check(QTK_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include") set_and_check(QTK_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include")
set_and_check(QTK_LIBRARIES "${PACKAGE_PREFIX_DIR}/lib") set_and_check(QTK_LIBRARIES "${PACKAGE_PREFIX_DIR}/lib")

View File

@ -25,11 +25,7 @@ endif()
set(QTK_PATH /usr/local CACHE PATH "Path to installation of Qtk") set(QTK_PATH /usr/local CACHE PATH "Path to installation of Qtk")
# If you did not install Qt6 on a system path, point cmake to installation. # If you did not install Qt6 on a system path, point cmake to installation.
set( set(QT_INSTALL_DIR "$ENV{HOME}/Qt/6.5.0/gcc_64/" CACHE PATH "Path to Qt6")
QT_INSTALL_DIR
"/home/kapper/Code/Clones/Qt/6.3.1/gcc_64/"
CACHE PATH "Path to Qt6 install"
)
################################################################################ ################################################################################
# Project # Project
@ -43,7 +39,12 @@ project(
list(APPEND CMAKE_PREFIX_PATH "${QTK_PATH}") list(APPEND CMAKE_PREFIX_PATH "${QTK_PATH}")
list(APPEND CMAKE_PREFIX_PATH "${QT_INSTALL_DIR}") list(APPEND CMAKE_PREFIX_PATH "${QT_INSTALL_DIR}")
# Allow add_subdirectory on this project to use target ALIAS if available.
# If this example project is opened standalone we will use find_package.
if(NOT TARGET Qtk::qtk_library)
find_package(Qtk 0.2 REQUIRED) find_package(Qtk 0.2 REQUIRED)
endif()
# Print all QTK variables # Print all QTK variables
get_cmake_property(VAR_NAMES VARIABLES) get_cmake_property(VAR_NAMES VARIABLES)
@ -64,4 +65,4 @@ set(
add_executable(example ${EXAMPLE_SOURCES}) add_executable(example ${EXAMPLE_SOURCES})
target_link_libraries(example PUBLIC Qt6::Widgets Qt6::OpenGLWidgets Qt6::Core) target_link_libraries(example PUBLIC Qt6::Widgets Qt6::OpenGLWidgets Qt6::Core)
target_link_libraries(example PUBLIC Qtk::qtk-library) target_link_libraries(example PUBLIC Qtk::qtk_library)

View File

@ -14,25 +14,25 @@ if (QTK_BUILD_GUI)
endif() endif()
write_basic_package_version_file( write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/QtkConfigVersion.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
COMPATIBILITY AnyNewerVersion COMPATIBILITY AnyNewerVersion
) )
configure_package_config_file( configure_package_config_file(
"${CMAKE_SOURCE_DIR}/cmake/templates/Config.cmake.in" "${CMAKE_SOURCE_DIR}/cmake/templates/Config.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/QtkConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION lib/cmake/Qtk INSTALL_DESTINATION lib/cmake/${PROJECT_NAME}
) )
install( install(
FILES FILES
"${CMAKE_CURRENT_BINARY_DIR}/QtkConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/QtkConfigVersion.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION lib/cmake/Qtk DESTINATION lib/cmake/${PROJECT_NAME}
) )
install( install(
EXPORT qtk_export EXPORT qtk_export
FILE QtkTargets.cmake FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE Qtk:: NAMESPACE ${PROJECT_NAME}::
DESTINATION lib/cmake/Qtk DESTINATION lib/cmake/${PROJECT_NAME}
) )
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
@ -41,19 +41,24 @@ set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}")
set(CPACK_PACKAGE_VENDOR "Shaun Reed") set(CPACK_PACKAGE_VENDOR "Shaun Reed")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Qt OpenGL 3D graphics library.") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Qt OpenGL 3D graphics library.")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/shaunrd0/qtk") set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/shaunrd0/qtk")
set(CPACK_SOURCE_IGNORE_FILES build;install;\.git;\.github;\.idea) set(CPACK_SOURCE_IGNORE_FILES build*;install;\.git;\.github;\.idea)
set(CPACK_PACKAGE_DIRECTORY packages/) set(CPACK_PACKAGE_DIRECTORY packages/)
set(CPACK_PACKAGE_CONTACT "shaunreed.com") set(CPACK_PACKAGE_CONTACT "shaunreed.com")
# TODO: This works for debian packages but the script installs to the wrong dir. set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/icon.png")
set(CPACK_THREADS 0)
# Debian
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${CPACK_PACKAGE_HOMEPAGE_URL})
set(CPACK_INSTALL_SCRIPTS ${QTK_DEPLOY_SCRIPT}) set(CPACK_INSTALL_SCRIPTS ${QTK_DEPLOY_SCRIPT})
# OSX # OSX
set(CPACK_BUNDLE_NAME Qtk) set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
set(CPACK_BUNDLE_PLIST ${CMAKE_BINARY_DIR}/bin/qtk_main.app/Contents/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})
if(WIN32) if(WIN32)
set(CPACK_SOURCE_GENERATOR ZIP) set(CPACK_SOURCE_GENERATOR ZIP)
else() else()
set(CPACK_SOURCE_GENERATOR TGZ) set(CPACK_SOURCE_GENERATOR TGZ)
endif() endif()
include(CPack) include(CPack)

View File

@ -33,18 +33,18 @@ target_link_libraries(qtk_plugin_library PUBLIC Qt6::UiPlugin qtk_library)
install( install(
TARGETS qtk_plugin_library TARGETS qtk_plugin_library
BUNDLE DESTINATION lib
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static ARCHIVE DESTINATION lib/static
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
) )
# Install plugin library to Qt Creator for Designer plugin integration.
install( install(
TARGETS qtk_plugin_library TARGETS qtk_plugin_library
BUNDLE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}" EXCLUDE_FROM_ALL
LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}" LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
RUNTIME DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}" ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
RUNTIME DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
) )
################################################################################ ################################################################################
@ -61,9 +61,17 @@ target_link_libraries(qtk_collection PUBLIC qtk_plugin_library)
install( install(
TARGETS qtk_collection TARGETS qtk_collection
RUNTIME DESTINATION "${QTK_PLUGIN_INSTALL_DIR}" LIBRARY DESTINATION lib
BUNDLE DESTINATION "${QTK_PLUGIN_INSTALL_DIR}" ARCHIVE DESTINATION lib/static
RUNTIME DESTINATION bin
)
install(
TARGETS qtk_collection
EXCLUDE_FROM_ALL
LIBRARY DESTINATION "${QTK_PLUGIN_INSTALL_DIR}" LIBRARY DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
RUNTIME DESTINATION "${QTK_PLUGIN_INSTALL_DIR}"
) )
################################################################################ ################################################################################
@ -103,8 +111,9 @@ set_target_properties(
install( install(
TARGETS qtk_main TARGETS qtk_main
BUNDLE DESTINATION bin BUNDLE DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
LIBRARY DESTINATION bin/lib
) )
qt_generate_deploy_app_script( qt_generate_deploy_app_script(

View File

@ -49,7 +49,8 @@ target_sources(qtk_library PRIVATE ${QTK_LIBRARY_SOURCES})
target_sources( target_sources(
qtk_library PUBLIC qtk_library PUBLIC
FILE_SET HEADERS FILE_SET HEADERS
BASE_DIRS "${CMAKE_SOURCE_DIR}/src" BASE_DIRS $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>
BASE_DIRS $<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/include>
FILES ${QTK_LIBRARY_PUBLIC_HEADERS} FILES ${QTK_LIBRARY_PUBLIC_HEADERS}
) )
@ -59,8 +60,6 @@ endif()
set_target_properties( set_target_properties(
qtk_library PROPERTIES qtk_library PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
VERSION ${PROJECT_VERSION} VERSION ${PROJECT_VERSION}
) )
@ -85,17 +84,16 @@ install(
# Associate qtk_library target with qtk-export # Associate qtk_library target with qtk-export
EXPORT qtk_export EXPORT qtk_export
FILE_SET HEADERS DESTINATION include FILE_SET HEADERS DESTINATION include
BUNDLE DESTINATION lib INCLUDES DESTINATION include
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static ARCHIVE DESTINATION lib/static
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
INCLUDES DESTINATION include
) )
## Install qtk_library to Qt Designer to support widget plugins. ## Install qtk_library to Qt Designer to support widget plugins.
install( install(
TARGETS qtk_library TARGETS qtk_library
BUNDLE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}" EXCLUDE_FROM_ALL
LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}" LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}" ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
RUNTIME DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}" RUNTIME DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"