Compare commits

..

2 Commits

Author SHA1 Message Date
Shaun Reed baa2ed1e17 OSX packaging 2023-01-15 17:50:50 -05:00
Shaun Reed cfefc49c53 CMake target renaming to avoid C++ errors with `-` 2023-01-15 17:04:06 -05:00
5 changed files with 49 additions and 32 deletions

View File

@ -40,6 +40,12 @@ jobs:
cmake -B build/ ${{ matrix.cmake }} -DQTK_UPDATE_SUBMODULES=ON
cmake --build build/
- name: OSX Stuff
if: matrix.os == 'macos-lates'
shell: bash
run: |
ls build/
- name: Package Qtk
shell: bash
run: |

View File

@ -24,8 +24,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options(/wd4131 /wd4127)
if(MSVC)
add_compile_options(/WX:NO /wd4131 /wd4127)
endif()
################################################################################
@ -84,6 +84,7 @@ if (QTK_PREFIX_QTCREATOR)
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)

View File

@ -29,7 +29,7 @@ install(
DESTINATION lib/cmake/Qtk
)
install(
EXPORT qtk-export
EXPORT qtk_export
FILE QtkTargets.cmake
NAMESPACE Qtk::
DESTINATION lib/cmake/Qtk
@ -43,6 +43,11 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Qt OpenGL 3D graphics library.")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/shaunrd0/qtk")
set(CPACK_SOURCE_IGNORE_FILES build;install;\.git;\.github;\.idea)
set(CPACK_PACKAGE_DIRECTORY packages/)
# OSX
set(CPACK_BUNDLE_NAME Qtk)
set(CPACK_BUNDLE_PLIST ${CMAKE_BINARY_DIR}/Info.plist)
set(CPACK_BUNDLE_ICON ${QTK_OSX_ICONS})
if(WIN32)
set(CPACK_SOURCE_GENERATOR ZIP)
else()

View File

@ -23,16 +23,16 @@ set(
toolbox.h
treeview.h
)
qt_add_library(qtk-plugin-library STATIC)
qt_add_library(qtk_plugin_library STATIC)
target_sources(
qtk-plugin-library PRIVATE
qtk_plugin_library PRIVATE
"${QTK_PLUGIN_LIBRARY_SOURCES}"
"${QTK_PLUGIN_LIBRARY_HEADERS}"
)
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
TARGETS qtk_plugin_library
BUNDLE DESTINATION lib
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/static
@ -40,7 +40,7 @@ install(
)
install(
TARGETS qtk-plugin-library
TARGETS qtk_plugin_library
BUNDLE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
RUNTIME DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
@ -57,7 +57,7 @@ target_sources(
widgetplugincollection.cpp widgetplugincollection.h
widgetplugin.cpp widgetplugin.h
)
target_link_libraries(qtk_collection PUBLIC qtk-plugin-library)
target_link_libraries(qtk_collection PUBLIC qtk_plugin_library)
install(
TARGETS qtk_collection
@ -84,26 +84,31 @@ configure_file(
@ONLY
)
qt_add_executable(qtk-main ${QTK_APP_SOURCES})
target_link_libraries(qtk-main PRIVATE qtk-plugin-library)
qt_add_executable(qtk_main ${QTK_APP_SOURCES})
target_link_libraries(qtk_main PRIVATE qtk_plugin_library)
set_target_properties(
qtk-main PROPERTIES
qtk_main PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_BUNDLE_NAME Qtk
MACOSX_BUNDLE_ICON_FILE ${QTK_OSX_ICONS}
MACOSX_BUNDLE_GUI_IDENTIFIER ${CMAKE_PROJECT_NAME}
MACOSX_BUNDLE_INFO_STRING ${CMAKE_PROJECT_DESCRIPTION}
MACOSX_BUNDLE_COPYRIGHT "All Content (c) 2023 Shaun Reed, all rights reserved"
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
)
install(
TARGETS qtk-main
TARGETS qtk_main
BUNDLE DESTINATION bin
RUNTIME DESTINATION bin
LIBRARY DESTINATION bin/lib
)
qt_generate_deploy_app_script(
TARGET qtk-main
TARGET qtk_main
FILENAME_VARIABLE QTK_DEPLOY_SCRIPT
NO_UNSUPPORTED_PLATFORM_ERROR
)
@ -121,16 +126,16 @@ if(WIN32)
if(TARGET Qt6::windeployqt)
add_custom_command(
TARGET qtk-main
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>"
COMMAND Qt6::windeployqt --dir "${CMAKE_BINARY_DIR}/windeployqt" "$<TARGET_FILE_DIR:qtk_main>/$<TARGET_FILE_NAME:qtk_main>"
)
install(DIRECTORY "${CMAKE_BINARY_DIR}/windeployqt/" DESTINATION bin)
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

@ -44,46 +44,46 @@ set(
)
qt6_add_big_resources(QTK_LIBRARY_SOURCES "${QTK_RESOURCES}/resources.qrc")
qt_add_library(qtk-library STATIC)
target_sources(qtk-library PRIVATE ${QTK_LIBRARY_SOURCES})
qt_add_library(qtk_library STATIC)
target_sources(qtk_library PRIVATE ${QTK_LIBRARY_SOURCES})
target_sources(
qtk-library PUBLIC
qtk_library PUBLIC
FILE_SET HEADERS
BASE_DIRS "${CMAKE_SOURCE_DIR}/src"
FILES ${QTK_LIBRARY_PUBLIC_HEADERS}
)
if(QTK_DEBUG)
target_compile_definitions(qtk-library PUBLIC QTK_DEBUG)
target_compile_definitions(qtk_library PUBLIC QTK_DEBUG)
endif()
set_target_properties(
qtk-library PROPERTIES
qtk_library PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
VERSION ${PROJECT_VERSION}
)
target_link_libraries(
qtk-library PUBLIC
qtk_library PUBLIC
Qt6::Core Qt6::OpenGLWidgets Qt6::Widgets
)
if(QTK_UPDATE_SUBMODULES OR NOT ASSIMP_NEW_INTERFACE)
target_link_libraries(qtk-library PUBLIC assimp)
target_link_libraries(qtk_library PUBLIC assimp)
elseif(ASSIMP_NEW_INTERFACE)
target_link_libraries(qtk-library PUBLIC assimp::assimp)
target_link_libraries(qtk_library PUBLIC assimp::assimp)
endif()
if(WIN32)
target_link_libraries(qtk-library PUBLIC OpenGL::GL)
target_link_libraries(qtk_library PUBLIC OpenGL::GL)
endif()
# System install for qtk-library
# System install for qtk_library
install(
TARGETS qtk-library
# Associate qtk-library target with qtk-export
EXPORT qtk-export
TARGETS qtk_library
# Associate qtk_library target with qtk-export
EXPORT qtk_export
FILE_SET HEADERS DESTINATION include
BUNDLE DESTINATION lib
LIBRARY DESTINATION lib
@ -92,9 +92,9 @@ install(
INCLUDES DESTINATION include
)
## Install qtk-library to Qt Designer to support widget plugins.
## Install qtk_library to Qt Designer to support widget plugins.
install(
TARGETS qtk-library
TARGETS qtk_library
BUNDLE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
LIBRARY DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"
ARCHIVE DESTINATION "${QTK_PLUGIN_LIBRARY_DIR}"