Skip to content

Commit

Permalink
Reorganize cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed Jun 16, 2024
1 parent 86a2d68 commit e923a89
Show file tree
Hide file tree
Showing 55 changed files with 76 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .ci/ci_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ elif [[ "$CI_NAME" == 'linux' ]]; then

if [[ "$DOCKER_TAG" == "ArchLinux" ]]; then
echo "Arch Linux detected"
cp cmake/arch/* .
cp cmake/linux/arch/* .
executeCommand="makepkg"
chmod -R a+rw ${CI_BUILD_DIR}/deploy
versionFile=`cat version`
Expand Down
15 changes: 8 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ message( STATUS "CMake Version: ${CMAKE_VERSION}" )

PROJECT(HyperHdr)

# Parse semantic version of version file
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.cmake)

set(OUR_CMAKE_MODULES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_modules)
set(CMAKE_MODULE_PATH ${OUR_CMAKE_MODULES} ${CMAKE_MODULE_PATH})

# print version
include (version)
file (STRINGS "version" HYPERHDR_VERSION)
SetVersionNumber(HYPERHDR ${HYPERHDR_VERSION})

Expand Down Expand Up @@ -224,9 +228,6 @@ STRING( TOUPPER "-DPLATFORM_${PLATFORM}" PLATFORM_DEFINE)
STRING( REPLACE "-DEV" "" PLATFORM_DEFINE "${PLATFORM_DEFINE}" )
ADD_DEFINITIONS( ${PLATFORM_DEFINE} )

# Add project specific cmake modules (find, etc)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

if (DEFAULT_X11)
if (NOT CMAKE_CROSSCOMPILING)
find_package(XLibs QUIET )
Expand Down Expand Up @@ -526,7 +527,7 @@ endif()

# Use GNU gold linker if available
if (NOT WIN32)
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/LDGold.cmake)
include (LDGold)
endif()

# Don't create new dynamic tags (RUNPATH)
Expand Down Expand Up @@ -639,7 +640,7 @@ LIST( APPEND GENERATED_QRC
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${GENERATED_QRC}" )

# uninstall target
configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
configure_file( "${OUR_CMAKE_MODULES}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

# enable make package - no code after this line !
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions cmake/win/win_rc.cmake → cmake/cmake_modules/win_rc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ function(generate_win_rc_file BINARY_NAME)
# target path to store generated files
set(TARGET_PATH ${CMAKE_BINARY_DIR}/win_rc_file/${BINARY_NAME})
# assets
string(REPLACE "/" "\\\\" WIN_RC_ICON_PATH ${CMAKE_SOURCE_DIR}/cmake/nsis/installer.ico)
string(REPLACE "/" "\\\\" WIN_RC_ICON_PATH ${CMAKE_SOURCE_DIR}/cmake/windows/installer.ico)
# configure the rc file
configure_file(
${CMAKE_SOURCE_DIR}/cmake/win/win.rc.in
${CMAKE_SOURCE_DIR}/cmake/windows/win.rc.in
${TARGET_PATH}/win.rc
)
# provide var for parent scope
Expand Down
51 changes: 43 additions & 8 deletions cmake/Dependencies.cmake → cmake/installers.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
macro(DeployApple TARGET)
if(EXISTS ${TARGET_FILE})
install ( TARGETS hyperhdr DESTINATION "share/.." COMPONENT "HyperHDR" )

execute_process(
COMMAND bash -c "cd ${CMAKE_CURRENT_BINARY_DIR} && tar -xzf ${PROJECT_SOURCE_DIR}/resources/lut/lut_lin_tables.tar.xz"
RESULT_VARIABLE STATUS
Expand All @@ -12,18 +14,18 @@ macro(DeployApple TARGET)
endif()

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/lut_lin_tables.3d" DESTINATION "hyperhdr.app/Contents/lut" COMPONENT "HyperHDR")
install(FILES "${PROJECT_SOURCE_DIR}/cmake/osxbundle/Hyperhdr.icns" DESTINATION "hyperhdr.app/Contents/Resources" COMPONENT "HyperHDR")
install(FILES "${PROJECT_SOURCE_DIR}/cmake/osx/Hyperhdr.icns" DESTINATION "hyperhdr.app/Contents/Resources" COMPONENT "HyperHDR")
install(FILES "${PROJECT_SOURCE_DIR}/LICENSE" DESTINATION "hyperhdr.app/Contents/Resources" COMPONENT "HyperHDR")
install(FILES "${PROJECT_SOURCE_DIR}/3RD_PARTY_LICENSES" DESTINATION "hyperhdr.app/Contents/Resources" COMPONENT "HyperHDR")

# Copy QMQTT
if (USE_SHARED_LIBS)
if (USE_SHARED_LIBS AND TARGET qmqtt)
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:qmqtt> DESTINATION "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/lib" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
install(CODE [[ file(INSTALL FILES $<TARGET_SONAME_FILE:qmqtt> DESTINATION "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/lib" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
endif()

# Copy SQLITE3
if (USE_SHARED_LIBS)
if (USE_SHARED_LIBS AND TARGET sqlite3)
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:sqlite3> DESTINATION "${CMAKE_INSTALL_PREFIX}/hyperhdr.app/Contents/lib" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
endif()

Expand Down Expand Up @@ -207,6 +209,14 @@ macro(DeployUnix TARGET)
install(FILES "${PROJECT_SOURCE_DIR}/LICENSE" DESTINATION "share/hyperhdr" COMPONENT "HyperHDR")
install(FILES "${PROJECT_SOURCE_DIR}/3RD_PARTY_LICENSES" DESTINATION "share/hyperhdr" COMPONENT "HyperHDR")

# HyperHDR bin & res
install ( TARGETS hyperhdr DESTINATION "share/hyperhdr/bin" COMPONENT "HyperHDR" )
install ( DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/linux/service DESTINATION "share/hyperhdr/" COMPONENT "HyperHDR" )
install ( FILES ${CMAKE_SOURCE_DIR}/cmake/resources/hyperhdr-icon-32px.png DESTINATION "share/hyperhdr/icons" COMPONENT "HyperHDR" )
install ( FILES ${CMAKE_SOURCE_DIR}/cmake/resources/hyperhdr_128.png DESTINATION "share/hyperhdr/desktop" COMPONENT "HyperHDR" )
install ( FILES ${CMAKE_SOURCE_DIR}/cmake/resources/hyperhdr.desktop DESTINATION "share/hyperhdr/desktop" COMPONENT "HyperHDR" )


# Our and custom libs
set(PREREQUISITE_LIBS "")

Expand Down Expand Up @@ -303,6 +313,11 @@ macro(DeployUnix TARGET)
COMPONENT "HyperHDR"
)

# symlink
install( CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperhdr/bin/hyperhdr\" \"${CMAKE_BINARY_DIR}/symlink_hyperhdr\" )" COMPONENT "HyperHDR" )
install( FILES ${CMAKE_BINARY_DIR}/symlink_hyperhdr DESTINATION "bin" RENAME hyperhdr COMPONENT "HyperHDR" )
install( CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_hyperhdr )" COMPONENT "HyperHDR" )

# install CODE
install(CODE "set(TARGET_FILE \"${TARGET_FILE}\")" COMPONENT "HyperHDR")
install(CODE "set(PREREQUISITE_LIBS \"${PREREQUISITE_LIBS}\")" COMPONENT "HyperHDR")
Expand Down Expand Up @@ -459,7 +474,28 @@ endmacro()

macro(DeployWindows TARGET)
if(EXISTS ${TARGET_FILE})
message(STATUS "Collecting Dependencies for target file: ${TARGET_FILE}")

install ( TARGETS hyperhdr DESTINATION "bin" COMPONENT "HyperHDR" )
include( InstallRequiredSystemLibraries )

message("Collecting Dependencies for target file: ${TARGET_FILE}")

if (Qt_VERSION EQUAL 5)
get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
get_filename_component(QT_BIN_DIR "${QT_QMAKE_EXECUTABLE}" DIRECTORY)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}")
else()
get_filename_component(My_Qt6Core_EXECUTABLE_DIR ${QT6_INSTALL_PREFIX}/${QT6_INSTALL_BINS} ABSOLUTE)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt PATHS "${My_Qt6Core_EXECUTABLE_DIR}" NO_DEFAULT_PATH)
if (NOT WINDEPLOYQT_EXECUTABLE)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt)
endif()
endif()

if (WINDEPLOYQT_EXECUTABLE AND NOT CMAKE_GITHUB_ACTION)
set(WINDEPLOYQT_PARAMS_RUNTIME --verbose 0 --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler)
message("Found windeployqt: ${WINDEPLOYQT_EXECUTABLE} PATH_HINT:${My_Qt6Core_EXECUTABLE_DIR}${QT_BIN_DIR}")
endif()

# Collect the runtime libraries
get_filename_component(COMPILER_PATH "${CMAKE_CXX_COMPILER}" DIRECTORY)
Expand Down Expand Up @@ -511,12 +547,12 @@ macro(DeployWindows TARGET)
install(FILES ${TurboJPEG_INSTALL_LIB} DESTINATION "bin" COMPONENT "HyperHDR" )

# Copy QMQTT
if (USE_SHARED_LIBS)
if (USE_SHARED_LIBS AND TARGET qmqtt)
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:qmqtt> DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
endif()

# Copy SQLITE3
if (USE_SHARED_LIBS)
if (USE_SHARED_LIBS AND TARGET sqlite3)
install(CODE [[ file(INSTALL FILES $<TARGET_FILE:sqlite3> DESTINATION "${CMAKE_INSTALL_PREFIX}/bin" TYPE SHARED_LIBRARY) ]] COMPONENT "HyperHDR")
endif()

Expand Down Expand Up @@ -586,8 +622,7 @@ macro(DeployWindows TARGET)
message( WARNING "OpenSSL NOT found. HyperHDR's https instance and Philips Hue devices will not work.")
endif()

else()
# Run CMake after target was built
else()
add_custom_command(
TARGET ${TARGET} POST_BUILD
COMMAND "${CMAKE_COMMAND}" "-DTARGET_FILE=$<TARGET_FILE:${TARGET}>"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
41 changes: 19 additions & 22 deletions cmake/packages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ SET ( CPACK_PACKAGE_CONTACT "see_me_at@hyperhdr.eu")
SET ( CPACK_PACKAGE_VENDOR "HyperHDR")
SET ( CPACK_PACKAGE_EXECUTABLES "hyperhdr;HyperHDR" )
SET ( CPACK_PACKAGE_INSTALL_DIRECTORY "HyperHDR" )
SET ( CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/icons/hyperhdr-icon-32px.png")
SET ( CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/cmake/resources/hyperhdr-icon-32px.png")

SET ( CPACK_PACKAGE_VERSION_MAJOR "${HYPERHDR_VERSION_MAJOR}")
SET ( CPACK_PACKAGE_VERSION_MINOR "${HYPERHDR_VERSION_MINOR}")
Expand All @@ -85,9 +85,9 @@ if(USE_STANDARD_INSTALLER_NAME AND UNIX AND NOT APPLE)
endif()

if ( APPLE )
SET ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/osxbundle/LICENSE" )
SET ( CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/osxbundle/background.png" )
SET ( CPACK_DMG_DS_STORE_SETUP_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/cmake/osxbundle/autorun.scpt" )
SET ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/osx/LICENSE" )
SET ( CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/osx/background.png" )
SET ( CPACK_DMG_DS_STORE_SETUP_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/cmake/osx/autorun.scpt" )
ELSE()
SET ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" )
ENDIF()
Expand All @@ -104,7 +104,7 @@ ENDIF()
# Specific CPack Package Generators
# https://cmake.org/Wiki/CMake:CPackPackageGenerators
# .deb files for apt
SET ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/preinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/prerm" )
SET ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/linux/debian/preinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/linux/debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/linux/debian/prerm" )
SET ( CPACK_DEBIAN_PACKAGE_DEPENDS "xz-utils, libglib2.0-0" )
SET ( CPACK_DEBIAN_PACKAGE_RECOMMENDS "shared-mime-info" )
if ( UNIX AND NOT APPLE )
Expand All @@ -131,9 +131,9 @@ SET ( CPACK_RPM_PACKAGE_RELEASE 1)
SET ( CPACK_RPM_PACKAGE_LICENSE "MIT")
SET ( CPACK_RPM_PACKAGE_GROUP "Applications")
SET ( CPACK_RPM_PACKAGE_REQUIRES "xz" )
SET ( CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/rpm/preinst" )
SET ( CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/rpm/postinst" )
SET ( CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/rpm/prerm" )
SET ( CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/linux/rpm/preinst" )
SET ( CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/linux/rpm/postinst" )
SET ( CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/linux/rpm/prerm" )
if ( ENABLE_SYSTRAY )
SET( CPACK_RPM_PACKAGE_SUGGESTS "gtk3")
endif()
Expand All @@ -149,11 +149,11 @@ if ( APPLE )
SET ( CPACK_DMG_FORMAT "UDBZ" )

unset(CPACK_PACKAGE_ICON)
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/cmake/osxbundle/Hyperhdr.icns")
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/cmake/osx/Hyperhdr.icns")

set_target_properties(hyperhdr PROPERTIES
MACOSX_BUNDLE TRUE
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/cmake/osxbundle/Info.plist
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/cmake/osx/Info.plist
XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "YES"
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "-"
MACOSX_BUNDLE_COPYRIGHT "awawa-dev"
Expand All @@ -164,15 +164,15 @@ endif()

# Windows NSIS
# Use custom script based on cpack nsis template
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/nsis/template ${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/windows/template ${CMAKE_MODULE_PATH})
# Some path transformations
if(WIN32)
file(TO_NATIVE_PATH ${CPACK_PACKAGE_ICON} CPACK_PACKAGE_ICON)
STRING(REGEX REPLACE "\\\\" "\\\\\\\\" CPACK_PACKAGE_ICON ${CPACK_PACKAGE_ICON})
endif()
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/nsis/installer.ico" NSIS_HYP_ICO)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/nsis/hyperhdr-logo.bmp" NSIS_HYP_LOGO_HORI)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/nsis/hyperhdr-logo-vert.bmp" NSIS_HYP_LOGO_VERT)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/windows/installer.ico" NSIS_HYP_ICO)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/windows/hyperhdr-logo.bmp" NSIS_HYP_LOGO_HORI)
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/windows/hyperhdr-logo-vert.bmp" NSIS_HYP_LOGO_VERT)
STRING(REGEX REPLACE "\\\\" "\\\\\\\\" NSIS_HYP_ICO "${NSIS_HYP_ICO}")
STRING(REGEX REPLACE "\\\\" "\\\\\\\\" NSIS_HYP_LOGO_VERT "${NSIS_HYP_LOGO_VERT}")
STRING(REGEX REPLACE "\\\\" "\\\\\\\\" NSIS_HYP_LOGO_HORI "${NSIS_HYP_LOGO_HORI}")
Expand All @@ -190,7 +190,7 @@ SET ( CPACK_NSIS_URL_INFO_ABOUT "https://github.com/awawa-dev/HyperHDR")
SET ( CPACK_NSIS_MUI_FINISHPAGE_RUN "hyperhdr.exe")
SET ( CPACK_NSIS_BRANDING_TEXT "HyperHDR-${HYPERHDR_VERSION}")
# custom nsis plugin directory
SET ( CPACK_NSIS_EXTRA_DEFS "!addplugindir ${CMAKE_SOURCE_DIR}/cmake/nsis/plugins")
SET ( CPACK_NSIS_EXTRA_DEFS "!addplugindir ${CMAKE_SOURCE_DIR}/cmake/windows/plugins")
# additional hyperhdr startmenu link, won't be created if the user disables startmenu links
SET ( CPACK_NSIS_CREATE_ICONS_EXTRA "CreateShortCut '$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\HyperHDR (Console).lnk' '$INSTDIR\\\\bin\\\\hyperhdr.exe' '-d -c'")
SET ( CPACK_NSIS_DELETE_ICONS_EXTRA "Delete '$SMPROGRAMS\\\\$MUI_TEMP\\\\HyperHDR (Console).lnk'")
Expand All @@ -203,11 +203,7 @@ SET ( CPACK_NSIS_DELETE_ICONS_EXTRA "Delete '$SMPROGRAMS\\\\$MUI_TEMP\\\\HyperHD
# and https://cmake.org/cmake/help/latest/module/CPackComponent.html
SET ( CPACK_COMPONENTS_GROUPING "ALL_COMPONENTS_IN_ONE")
# Components base
if (NOT APPLE)
SET ( CPACK_COMPONENTS_ALL "HyperHDR" "HyperHDR_remote" )
else()
SET ( CPACK_COMPONENTS_ALL "HyperHDR" )
endif()
SET ( CPACK_COMPONENTS_ALL "HyperHDR" )

SET ( CPACK_ARCHIVE_COMPONENT_INSTALL ON )
SET ( CPACK_DEB_COMPONENT_INSTALL ON )
Expand All @@ -220,8 +216,8 @@ INCLUDE ( CPack )

cpack_add_install_type(Full DISPLAY_NAME "Full")
cpack_add_install_type(Min DISPLAY_NAME "Minimal")
cpack_add_component_group(Runtime EXPANDED DESCRIPTION "HyperHdr runtime and HyperHdr_remote commandline tool")
cpack_add_component_group(Screencapture EXPANDED DESCRIPTION "Standalone Screencapture commandline programs")
cpack_add_component_group(Runtime EXPANDED DESCRIPTION "HyperHdr runtime")

# Components base
cpack_add_component(HyperHDR
DISPLAY_NAME "HyperHDR"
Expand All @@ -230,3 +226,4 @@ cpack_add_component(HyperHDR
GROUP Runtime
REQUIRED
)

Binary file added cmake/resources/hyperhdr-icon-32px.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
51 changes: 3 additions & 48 deletions sources/hyperhdr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# generate windows .rc file for this binary
if (WIN32)
include(${CMAKE_SOURCE_DIR}/cmake/win/win_rc.cmake)
include(win_rc)
generate_win_rc_file(hyperhdr)
endif()

Expand Down Expand Up @@ -125,53 +125,8 @@ if (ENABLE_SOUNDCAPMACOS)
target_link_libraries(hyperhdr sound-capture-macos)
endif ()


if(APPLE)
install ( TARGETS hyperhdr DESTINATION "share/.." COMPONENT "HyperHDR" )
elseif(NOT WIN32)
install ( TARGETS hyperhdr DESTINATION "share/hyperhdr/bin" COMPONENT "HyperHDR" )
install ( DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/debian/service DESTINATION "share/hyperhdr/" COMPONENT "HyperHDR" )
install ( FILES ${CMAKE_SOURCE_DIR}/resources/icons/hyperhdr-icon-32px.png DESTINATION "share/hyperhdr/icons" COMPONENT "HyperHDR" )

# Desktop file for hyperhdr
install ( FILES ${CMAKE_SOURCE_DIR}/cmake/desktop/hyperhdr_128.png DESTINATION "share/hyperhdr/desktop" COMPONENT "HyperHDR" )
install ( FILES ${CMAKE_SOURCE_DIR}/cmake/desktop/hyperhdr.desktop DESTINATION "share/hyperhdr/desktop" COMPONENT "HyperHDR" )
else()
install ( TARGETS hyperhdr DESTINATION "bin" COMPONENT "HyperHDR" )

#set( CMAKE_INSTALL_UCRT_LIBRARIES TRUE )
#set( CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE )
include( InstallRequiredSystemLibraries )
endif()

if(CMAKE_HOST_UNIX AND NOT APPLE)
install( CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperhdr/bin/hyperhdr\" \"${CMAKE_BINARY_DIR}/symlink_hyperhdr\" )" COMPONENT "HyperHDR" )
install( FILES ${CMAKE_BINARY_DIR}/symlink_hyperhdr DESTINATION "bin" RENAME hyperhdr COMPONENT "HyperHDR" )
install( CODE "FILE (REMOVE ${CMAKE_BINARY_DIR}/symlink_hyperhdr )" COMPONENT "HyperHDR" )
endif()

# Copy dependencies (not for OSX)
include(${CMAKE_SOURCE_DIR}/cmake/Dependencies.cmake)

if(WIN32)
if (Qt_VERSION EQUAL 5)
get_target_property(QT_QMAKE_EXECUTABLE ${Qt5Core_QMAKE_EXECUTABLE} IMPORTED_LOCATION)
get_filename_component(QT_BIN_DIR "${QT_QMAKE_EXECUTABLE}" DIRECTORY)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt HINTS "${QT_BIN_DIR}")
else()
get_filename_component(My_Qt6Core_EXECUTABLE_DIR ${QT6_INSTALL_PREFIX}/${QT6_INSTALL_BINS} ABSOLUTE)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt PATHS "${My_Qt6Core_EXECUTABLE_DIR}" NO_DEFAULT_PATH)
if (NOT WINDEPLOYQT_EXECUTABLE)
find_program(WINDEPLOYQT_EXECUTABLE windeployqt)
endif()
endif()

if (WINDEPLOYQT_EXECUTABLE AND NOT CMAKE_GITHUB_ACTION)
set(WINDEPLOYQT_PARAMS_RUNTIME --verbose 0 --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler)
message(STATUS "Found windeployqt: ${WINDEPLOYQT_EXECUTABLE} PATH_HINT:${My_Qt6Core_EXECUTABLE_DIR}${QT_BIN_DIR}")
add_custom_command(TARGET hyperhdr POST_BUILD COMMAND ${WINDEPLOYQT_EXECUTABLE} ${WINDEPLOYQT_PARAMS_RUNTIME} "$<TARGET_FILE:hyperhdr>")
endif()
endif()
# rules for installers
include(${OUR_CMAKE_MODULES}/../installers.cmake)

if (APPLE)
DeployApple("hyperhdr")
Expand Down

0 comments on commit e923a89

Please sign in to comment.