| 1 |
file(GLOB copyq_SOURCES ${copyq_SOURCES} |
| 2 |
platform/mac/*.mm |
| 3 |
platform/dummy/dummyclipboard.cpp |
| 4 |
platform/platformcommon.cpp |
| 5 |
../qxt/qxtglobalshortcut_mac.cpp |
| 6 |
) |
| 7 |
|
| 8 |
set(USE_QXT TRUE) |
| 9 |
|
| 10 |
# Install QCA ossl plugin into the bundle |
| 11 |
if (WITH_QCA_ENCRYPTION) |
| 12 |
# Find QCA plugin directory |
| 13 |
get_target_property(QCA_LOCATION qca-qt${QT_DEFAULT_MAJOR_VERSION} IMPORTED_LOCATION) |
| 14 |
if(NOT QCA_LOCATION) |
| 15 |
get_target_property(QCA_LOCATION qca-qt${QT_DEFAULT_MAJOR_VERSION} IMPORTED_LOCATION_RELEASE) |
| 16 |
endif() |
| 17 |
if(NOT QCA_LOCATION) |
| 18 |
get_target_property(QCA_LOCATION qca-qt${QT_DEFAULT_MAJOR_VERSION} IMPORTED_LOCATION_NOCONFIG) |
| 19 |
endif() |
| 20 |
get_filename_component(QCA_LIB_DIR "${QCA_LOCATION}" DIRECTORY) |
| 21 |
|
| 22 |
# Derive the install prefix from the QCA cmake config location. |
| 23 |
# Qca-qt6_DIR is set by find_package and points to <prefix>/lib/cmake/Qca-qt6. |
| 24 |
get_filename_component(QCA_INSTALL_PREFIX "${Qca-qt6_DIR}/../../.." ABSOLUTE) |
| 25 |
|
| 26 |
# QCA plugins are in one of these locations: |
| 27 |
# - <prefix>/lib/qca-qt6/crypto (source builds) |
| 28 |
# - <lib_dir>/qt/plugins/crypto (Homebrew framework) |
| 29 |
set(QCA_PLUGIN_SEARCH_PATHS |
| 30 |
"${QCA_INSTALL_PREFIX}/lib/qca-qt6/crypto" |
| 31 |
"${QCA_LIB_DIR}/qt/plugins/crypto" |
| 32 |
"${QCA_LIB_DIR}/../qt/plugins/crypto" |
| 33 |
"/usr/local/lib/qt/plugins/crypto" |
| 34 |
"/opt/homebrew/lib/qt/plugins/crypto" |
| 35 |
) |
| 36 |
|
| 37 |
set(QCA_OSSL_PLUGIN_FOUND FALSE) |
| 38 |
foreach(QCA_PLUGIN_PATH ${QCA_PLUGIN_SEARCH_PATHS}) |
| 39 |
if(EXISTS "${QCA_PLUGIN_PATH}/libqca-ossl.dylib") |
| 40 |
install(FILES "${QCA_PLUGIN_PATH}/libqca-ossl.dylib" |
| 41 |
DESTINATION "${COPYQ_EXECUTABLE_NAME}.app/Contents/PlugIns/crypto" |
| 42 |
COMPONENT Runtime) |
| 43 |
message(STATUS "QCA ossl plugin found at: ${QCA_PLUGIN_PATH}/libqca-ossl.dylib") |
| 44 |
set(QCA_OSSL_PLUGIN_FOUND TRUE) |
| 45 |
break() |
| 46 |
endif() |
| 47 |
endforeach() |
| 48 |
|
| 49 |
set(QCA_OSSL_RELATIVE_PATH "/../PlugIns/crypto/libqca-ossl.dylib") |
| 50 |
|
| 51 |
if(NOT QCA_OSSL_PLUGIN_FOUND) |
| 52 |
message(FATAL_ERROR "QCA ossl plugin (libqca-ossl.dylib) not found. Searched paths: ${QCA_PLUGIN_SEARCH_PATHS}") |
| 53 |
endif() |
| 54 |
endif() |
| 55 |
|
| 56 |
# Bundle non-Qt third-party libraries into the app. |
| 57 |
# macdeployqt only handles Qt libraries; we must handle the rest. |
| 58 |
set(_bundle_fwk_dir "${COPYQ_EXECUTABLE_NAME}.app/Contents/Frameworks") |
| 59 |
|
| 60 |
# Helper: bundle a target's library into the Frameworks directory. |
| 61 |
function(copyq_bundle_library target) |
| 62 |
if(NOT TARGET ${target}) |
| 63 |
return() |
| 64 |
endif() |
| 65 |
get_target_property(_loc ${target} IMPORTED_LOCATION) |
| 66 |
if(NOT _loc) |
| 67 |
get_target_property(_loc ${target} IMPORTED_LOCATION_RELEASE) |
| 68 |
endif() |
| 69 |
if(NOT _loc) |
| 70 |
get_target_property(_loc ${target} IMPORTED_LOCATION_NOCONFIG) |
| 71 |
endif() |
| 72 |
if(NOT _loc) |
| 73 |
return() |
| 74 |
endif() |
| 75 |
if(_loc MATCHES "\\.framework/") |
| 76 |
string(REGEX REPLACE "(.*\\.framework)/.*" "\\1" _fwk_dir "${_loc}") |
| 77 |
install(DIRECTORY "${_fwk_dir}" |
| 78 |
DESTINATION "${_bundle_fwk_dir}" |
| 79 |
COMPONENT Runtime) |
| 80 |
else() |
| 81 |
# Install the actual library and all versioned symlinks. |
| 82 |
get_filename_component(_dir "${_loc}" DIRECTORY) |
| 83 |
get_filename_component(_name "${_loc}" NAME) |
| 84 |
# Get the base name (e.g. libqt6keychain from libqt6keychain.1.0.0.dylib) |
| 85 |
string(REGEX REPLACE "\\.[0-9].*" "" _base "${_name}") |
| 86 |
file(GLOB _all_files "${_dir}/${_base}*") |
| 87 |
install(FILES ${_all_files} |
| 88 |
DESTINATION "${_bundle_fwk_dir}" |
| 89 |
COMPONENT Runtime) |
| 90 |
endif() |
| 91 |
endfunction() |
| 92 |
|
| 93 |
copyq_bundle_library(qca-qt6) |
| 94 |
copyq_bundle_library(qt6keychain) |
| 95 |
copyq_bundle_library(KF6::ConfigCore) |
| 96 |
copyq_bundle_library(KF6::WindowSystem) |
| 97 |
copyq_bundle_library(KF6::Notifications) |
| 98 |
copyq_bundle_library(KF6::StatusNotifierItem) |