Skip to content

Commit

Permalink
build: macos: Fix configuration phase error for cpack productbuild
Browse files Browse the repository at this point in the history
Signed-off-by: Hiroshi Hatake <hatake@calyptia.com>
  • Loading branch information
cosmo0920 authored and edsiper committed Oct 6, 2022
1 parent 2e514a8 commit c10c966
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,10 @@ if(CTR_TESTS)
add_subdirectory(tests)
endif()

# Output paths
set(CTRACES_ROOT "${CMAKE_CURRENT_SOURCE_DIR}")
set(CTRACES_BUILD_DIR "${CTRACES_ROOT}/build")

# Installer Generation (Cpack)
# ============================

Expand Down Expand Up @@ -316,28 +320,28 @@ if(CTR_SYSTEM_MACOS)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (UNAME_M_RESULT EQUAL 0 AND UNAME_ARCH STREQUAL "arm64")
set(CMETRICS_PKG ${CMAKE_CURRENT_BINARY_DIR}/${CPACK_PACKAGE_NAME}-${CTR_VERSION_STR}-apple)
set(CMETRICS_PKG ${CTRACES_BUILD_DIR}/${CPACK_PACKAGE_NAME}-${CTR_VERSION_STR}-apple)
elseif(UNAME_M_RESULT EQUAL 0 AND UNAME_ARCH STREQUAL "x86_64")
set(CMETRICS_PKG ${CMAKE_CURRENT_BINARY_DIR}/${CPACK_PACKAGE_NAME}-${CTR_VERSION_STR}-intel)
set(CMETRICS_PKG ${CTRACES_BUILD_DIR}/${CPACK_PACKAGE_NAME}-${CTR_VERSION_STR}-intel)
else()
set(CMETRICS_PKG ${CMAKE_CURRENT_BINARY_DIR}/${CPACK_PACKAGE_NAME}-${CTR_VERSION_STR}-${UNAME_ARCH})
set(CMETRICS_PKG ${CTRACES_BUILD_DIR}/${CPACK_PACKAGE_NAME}-${CTR_VERSION_STR}-${UNAME_ARCH})
endif()

if (CPACK_GENERATOR MATCHES "productbuild")
set(CPACK_SET_DESTDIR "ON")
configure_file(cpack/macos/welcome.txt.cmakein ${CMAKE_CURRENT_BINARY_DIR}/welcome.txt)
configure_file(LICENSE ${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt)
configure_file(cpack/macos/welcome.txt.cmakein ${CTRACES_BUILD_DIR}/welcome.txt)
configure_file(LICENSE ${CTRACES_BUILD_DIR}/LICENSE.txt)
find_program(CONVERTER textutil)
if (NOT CONVERTER)
message(FATAL_ERROR "textutil not found.")
endif()
if (CONVERTER)
execute_process(COMMAND ${CONVERTER} -convert html "${CMAKE_SOURCE_DIR}/README.md" -output "${CMAKE_BINARY_DIR}/README.html")
execute_process(COMMAND ${CONVERTER} -convert html "${CMAKE_SOURCE_DIR}/README.md" -output "${CTRACES_BUILD_DIR}/README.html")
endif()
set(CPACK_PACKAGE_FILE_NAME "${CMETRICS_PKG}")
set(CPACK_RESOURCE_FILE_WELCOME ${CMAKE_CURRENT_BINARY_DIR}/welcome.txt)
set(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_CURRENT_BINARY_DIR}/LICENSE.txt)
set(CPACK_RESOURCE_FILE_README ${CMAKE_CURRENT_BINARY_DIR}/README.html)
set(CPACK_RESOURCE_FILE_WELCOME ${CTRACES_BUILD_DIR}/welcome.txt)
set(CPACK_RESOURCE_FILE_LICENSE ${CTRACES_BUILD_DIR}/LICENSE.txt)
set(CPACK_RESOURCE_FILE_README ${CTRACES_BUILD_DIR}/README.html)
set(CPACK_PRODUCTBUILD_IDENTIFIER "com.calyptia.${CPACK_PACKAGE_NAME}")
endif()
endif()
Expand Down

0 comments on commit c10c966

Please sign in to comment.