From 134b4dd28635ec74ea8ae168aca22571cc2427e3 Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Sun, 23 Apr 2023 22:43:30 -0400 Subject: [PATCH] macOS specific cmake changes experiment. --- CMakeLists.txt | 13 +++++++++++-- cmake/deploy-qt-mac.cmake.in | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eeb78b11..bad925bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,6 +98,7 @@ qt_add_qml_module(chat ) set_target_properties(chat PROPERTIES + OUTPUT_NAME GPT4All MACOSX_BUNDLE_GUI_IDENTIFIER gpt4all.chat MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} @@ -121,7 +122,15 @@ if(NOT (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_HOST_SYSTEM_PROCESSOR endif() install(TARGETS chat DESTINATION bin COMPONENT ${COMPONENT_NAME_MAIN}) -install(TARGETS llama DESTINATION lib COMPONENT ${COMPONENT_NAME_MAIN}) +if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + set_target_properties(llama PROPERTIES + BUILD_WITH_INSTALL_RPATH TRUE + INSTALL_RPATH "@loader_path/../Frameworks" + ) + install(TARGETS llama DESTINATION Frameworks COMPONENT ${COMPONENT_NAME_MAIN}) +else() + install(TARGETS llama DESTINATION lib COMPONENT ${COMPONENT_NAME_MAIN}) +endif() set(CPACK_GENERATOR "IFW") set(CPACK_VERBATIM_VARIABLES YES) @@ -152,7 +161,7 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES Darwin) set(CPACK_IFW_ROOT "~/Qt/Tools/QtInstallerFramework/4.5") set(CPACK_IFW_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/favicon.icns") set(CPACK_PACKAGE_FILE_NAME "${COMPONENT_NAME_MAIN}-installer-darwin") - set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/Applications/${COMPONENT_NAME_MAIN}") + set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/Applications/") set(CPACK_BUNDLE_NAME ${COMPONENT_NAME_MAIN}) set(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/icons/favicon.icns") endif() diff --git a/cmake/deploy-qt-mac.cmake.in b/cmake/deploy-qt-mac.cmake.in index 3f4242d2..7e176db2 100644 --- a/cmake/deploy-qt-mac.cmake.in +++ b/cmake/deploy-qt-mac.cmake.in @@ -1,7 +1,7 @@ set(MACDEPLOYQT "@MACDEPLOYQT@") set(COMPONENT_NAME_MAIN "@COMPONENT_NAME_MAIN@") set(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") -execute_process(COMMAND ${MACDEPLOYQT} ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data/bin/chat.app -qmldir=${CMAKE_CURRENT_SOURCE_DIR} -verbose=2) +execute_process(COMMAND ${MACDEPLOYQT} ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data/bin/chat.app -executable="${CMAKE_INSTALL_PREFIX}/bin/chat.app/Contents/Frameworks/llama.dylib" -qmldir=${CMAKE_CURRENT_SOURCE_DIR} -verbose=2) file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-16.png" DESTINATION ${CPACK_TEMPORARY_INSTALL_DIRECTORY}/packages/${COMPONENT_NAME_MAIN}/data) file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/icons/logo-32.png"