diff options
Diffstat (limited to 'xT')
-rw-r--r-- | xT/CMakeLists.txt | 97 |
1 files changed, 70 insertions, 27 deletions
diff --git a/xT/CMakeLists.txt b/xT/CMakeLists.txt index 8157805..56ab835 100644 --- a/xT/CMakeLists.txt +++ b/xT/CMakeLists.txt @@ -47,27 +47,33 @@ foreach (icon xT xT-highlighted) list (APPEND icon_rsrc_list "${icon_png}") endforeach () -# The largest size is mainly for an appropriately sized Windows icon -set (icon_base "${PROJECT_BINARY_DIR}/icons") -set (icon_png_list) -foreach (icon_size 16 32 48 256) - icon_to_png (xT "${PROJECT_SOURCE_DIR}/xT.svg" - ${icon_size} "${icon_base}" icon_png) - list (APPEND icon_png_list "${icon_png}") -endforeach () -add_custom_target (icons ALL DEPENDS ${icon_png_list}) -if (WIN32) - list (REMOVE_ITEM icon_png_list "${icon_png}") - set (icon_ico "${PROJECT_BINARY_DIR}/xT.ico") - icon_for_win32 ("${icon_ico}" "${icon_png_list}" "${icon_png}") - - set (resource_file "${PROJECT_BINARY_DIR}/xT.rc") - list (APPEND project_sources "${resource_file}") - add_custom_command (OUTPUT "${resource_file}" - COMMAND ${CMAKE_COMMAND} -E echo "1 ICON \"xT.ico\"" - > ${resource_file} VERBATIM) - set_property (SOURCE "${resource_file}" - APPEND PROPERTY OBJECT_DEPENDS ${icon_ico}) +if (APPLE) + set (MACOSX_BUNDLE_ICON_FILE xT.icns) + icon_to_icns ("${PROJECT_SOURCE_DIR}/xT.svg" + "${MACOSX_BUNDLE_ICON_FILE}" icon_icns) +else () + # The largest size is mainly for an appropriately sized Windows icon + set (icon_base "${PROJECT_BINARY_DIR}/icons") + set (icon_png_list) + foreach (icon_size 16 32 48 256) + icon_to_png (xT "${PROJECT_SOURCE_DIR}/xT.svg" + ${icon_size} "${icon_base}" icon_png) + list (APPEND icon_png_list "${icon_png}") + endforeach () + add_custom_target (icons ALL DEPENDS ${icon_png_list}) + if (WIN32) + list (REMOVE_ITEM icon_png_list "${icon_png}") + set (icon_ico "${PROJECT_BINARY_DIR}/xT.ico") + icon_for_win32 ("${icon_ico}" "${icon_png_list}" "${icon_png}") + + set (resource_file "${PROJECT_BINARY_DIR}/xT.rc") + list (APPEND project_sources "${resource_file}") + add_custom_command (OUTPUT "${resource_file}" + COMMAND ${CMAKE_COMMAND} -E echo "1 ICON \"xT.ico\"" + > ${resource_file} VERBATIM) + set_property (SOURCE "${resource_file}" + APPEND PROPERTY OBJECT_DEPENDS ${icon_ico}) + endif () endif () # Build the main executable and link it @@ -86,14 +92,51 @@ add_custom_command (OUTPUT xC-proto.cpp add_custom_target (xC-proto DEPENDS ${PROJECT_BINARY_DIR}/xC-proto.cpp) list (APPEND project_sources "${root}/liberty/tools/lxdrgen-cpp-qt.cpp") -qt_add_executable (xT xT.cpp ${project_config} ${project_sources}) +qt_add_executable (xT + xT.cpp ${project_config} ${project_sources} "${icon_icns}") add_dependencies (xT xC-proto) qt_add_resources (xT "rsrc" PREFIX / FILES "${beep}" ${icon_rsrc_list}) target_link_libraries (xT PRIVATE Qt6::Widgets Qt6::Network Qt6::Multimedia) -set_target_properties (xT PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON) +set_target_properties (xT PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON + MACOSX_BUNDLE_GUI_IDENTIFIER name.janouch.xT) + +# https://stackoverflow.com/questions/79079161 and resolved in Qt Creator 16. +set (QT_QML_GENERATE_QMLLS_INI ON) + +# The files to be installed +include (GNUInstallDirs) + +if (ANDROID) + install (TARGETS xT DESTINATION .) +elseif (APPLE OR WIN32) + # TODO(p): Consider whether or not to use MSYS2. + install (TARGETS xT DESTINATION .) + # XXX: QTBUG-127075, which can be circumvented by manually running + # macdeployqt on xT.app before the install. + qt_generate_deploy_app_script (TARGET xT OUTPUT_SCRIPT deploy_xT) + install (SCRIPT "${deploy_xT}") +else () + install (TARGETS xT DESTINATION ${CMAKE_INSTALL_BINDIR}) + install (FILES ../LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) + + install (FILES xT.svg + DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/scalable/apps) + install (DIRECTORY ${icon_base} + DESTINATION ${CMAKE_INSTALL_DATADIR}) + install (FILES xT.desktop + DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) +endif () + +# CPack +set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch") +set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>") +set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/../LICENSE") +set (CPACK_GENERATOR "TGZ;ZIP") +set (CPACK_PACKAGE_FILE_NAME + "${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") +set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME} ${PROJECT_VERSION}") +set (CPACK_SOURCE_GENERATOR "TGZ;ZIP") +set (CPACK_SOURCE_IGNORE_FILES "/build;/CMakeLists.txt.user") +set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") -# At least with MinGW, this is a fully independent portable executable -# TODO(p): Figure this out once it builds. -install (TARGETS xT DESTINATION .) -set (CPACK_GENERATOR ZIP) include (CPack) |