From c2fb1543ea5cd5be0eea2b2708d38c2d97b3bb69 Mon Sep 17 00:00:00 2001 From: Dong Zhao Date: Thu, 27 Feb 2025 14:39:08 -0500 Subject: [PATCH 1/2] Remove unnecessary status messages from CMake build scripts and add installation configuration for macOS. --- cmake/buildMacOS.cmake | 2 -- cmake/buildUbuntu.cmake | 2 -- cmake/buildWindows.cmake | 2 -- cmake/installMacOS.cmake | 9 +++++++++ cmake/packageMacOS.cmake | 3 --- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/cmake/buildMacOS.cmake b/cmake/buildMacOS.cmake index ebd085e..4c79045 100644 --- a/cmake/buildMacOS.cmake +++ b/cmake/buildMacOS.cmake @@ -1,5 +1,3 @@ -message(STATUS "Building on macOS") - # Set macOS specific resources. set(PLIST_MACOS "package/macos/Info.plist") set(ICNS_MACOS "package/macos/app.icns") diff --git a/cmake/buildUbuntu.cmake b/cmake/buildUbuntu.cmake index 37cf310..430fc3c 100644 --- a/cmake/buildUbuntu.cmake +++ b/cmake/buildUbuntu.cmake @@ -1,5 +1,3 @@ -message(STATUS "Building on Unix") - # Add the executable target. add_executable(${CMAKE_PROJECT_NAME} ${Implementation_FILES} diff --git a/cmake/buildWindows.cmake b/cmake/buildWindows.cmake index c57d58b..41c83c0 100644 --- a/cmake/buildWindows.cmake +++ b/cmake/buildWindows.cmake @@ -1,5 +1,3 @@ -message(STATUS "Building on Windows") - # Set windows specific resources. set(RESOURCE_WIN32 "res/resources.rc") diff --git a/cmake/installMacOS.cmake b/cmake/installMacOS.cmake index e69de29..635b788 100644 --- a/cmake/installMacOS.cmake +++ b/cmake/installMacOS.cmake @@ -0,0 +1,9 @@ +# Set the install prefix. +if (NOT USE_CPACK) + set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/deploy/macos" CACHE PATH "Install path prefix, prepended onto install directories." FORCE) +else() + set(CMAKE_INSTALL_PREFIX "" CACHE PATH "Install path prefix, prepended onto install directories." FORCE) +endif() + +# Install the executable to the temporary directory +install(DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIR}/${CMAKE_PROJECT_NAME}.app" DESTINATION /Applications) diff --git a/cmake/packageMacOS.cmake b/cmake/packageMacOS.cmake index f3cd2e2..8fdb8d4 100644 --- a/cmake/packageMacOS.cmake +++ b/cmake/packageMacOS.cmake @@ -14,6 +14,3 @@ set(CPACK_GENERATOR DragNDrop) # Include the CPack module. include(CPack) - -# Install the executable to the temporary directory -install(DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIR}/${CMAKE_PROJECT_NAME}.app" DESTINATION /Applications) From e40b178978b9cd3a0fe81e68b2dcace6263c63b3 Mon Sep 17 00:00:00 2001 From: Dong Zhao Date: Thu, 27 Feb 2025 14:46:19 -0500 Subject: [PATCH 2/2] Enable CPack for packaging and update installation paths for macOS --- CMakeLists.txt | 2 +- cmake/installMacOS.cmake | 2 +- cmake/packageMacOS.cmake | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c9293d7..c35a234 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,7 @@ elseif (UNIX) endif() # Set USE_CPACK option. -set(USE_CPACK OFF) +set(USE_CPACK ON) # Install the application for the target platform. if (WIN32) diff --git a/cmake/installMacOS.cmake b/cmake/installMacOS.cmake index 635b788..50a5fee 100644 --- a/cmake/installMacOS.cmake +++ b/cmake/installMacOS.cmake @@ -6,4 +6,4 @@ else() endif() # Install the executable to the temporary directory -install(DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIR}/${CMAKE_PROJECT_NAME}.app" DESTINATION /Applications) +install(DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIR}/${CMAKE_PROJECT_NAME}.app" DESTINATION "${CMAKE_INSTALL_PREFIX}/Applications") diff --git a/cmake/packageMacOS.cmake b/cmake/packageMacOS.cmake index 8fdb8d4..36082ed 100644 --- a/cmake/packageMacOS.cmake +++ b/cmake/packageMacOS.cmake @@ -7,7 +7,7 @@ set(CPACK_PACKAGE_VERSION ${CMAKE_PROJECT_VERSION}) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${CMAKE_PROJECT_DESCRIPTION}") set(CPACK_PACKAGE_VENDOR ${CMAKE_PROJECT_NAME}) set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}) -set(CPACK_PACKAGE_DIRECTORY "${CMAKE_SOURCE_DIR}/package/macos") +set(CPACK_PACKAGE_DIRECTORY "${CMAKE_SOURCE_DIR}/setup/macos") # Set package generator to Apple Disk Image. set(CPACK_GENERATOR DragNDrop)