Skip to content

Commit be78938

Browse files
committed
Fixup Apple-specific dependency problems
1 parent 86714ea commit be78938

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

CMakeLists.txt

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ project(LabRecorder
55
DESCRIPTION "Record and write LabStreamingLayer streams to an XDF file"
66
HOMEPAGE_URL "https://github.com/labstreaminglayer/App-LabRecorder/"
77
LANGUAGES C CXX
8-
VERSION 1.16.1)
8+
VERSION 1.16.2)
99

1010
# Needed for customized MacOSXBundleInfo.plist.in
1111
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake" ${CMAKE_MODULE_PATH})
@@ -117,13 +117,14 @@ if (WIN32)
117117
$<TARGET_FILE:LSL::lsl>
118118
$<TARGET_FILE:xdfwriter>
119119
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
120-
add_custom_command(
121-
TARGET ${PROJECT_NAME} POST_BUILD
122-
COMMAND ${CMAKE_COMMAND} -E copy
123-
${CMAKE_CURRENT_SOURCE_DIR}//${PROJECT_NAME}.cfg
124-
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
125120
endif()
126121

122+
add_custom_command(
123+
TARGET ${PROJECT_NAME} POST_BUILD
124+
COMMAND ${CMAKE_COMMAND} -E copy
125+
${CMAKE_CURRENT_SOURCE_DIR}//${PROJECT_NAME}.cfg
126+
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
127+
127128
if(Qt6_FOUND)
128129
set_target_properties(${PROJECT_NAME} PROPERTIES
129130
QT_ANDROID_EXTRA_LIBS "${CMAKE_CURRENT_BINARY_DIR}/liblsl_bin/liblsl.so")
@@ -133,3 +134,25 @@ endif()
133134
set(CPACK_DEBIAN_LABRECORDER_PACKAGE_SECTION "science" CACHE INTERNAL "")
134135
LSLGenerateCPackConfig()
135136

137+
if(APPLE)
138+
# Qt6 QtNetwork depends on libbrotidec which depends on libbroticommon but whose search path uses @loader_path. Unfortunately, macdeployqt
139+
# does not seem to traverse @loader_path dependencies. So we are forced to call `fixup_bundle`. For now, we only do this if homebrew is present
140+
# because that seems to be where the bad dependency is coming from.
141+
# Note that fixup_bundle also destory the codesigning so we have to redo that.
142+
# TODO: Checkout supercollider apple-specific stuff, e.g.: https://github.com/supercollider/supercollider/blob/develop/CMakeLists.txt#L260-L262
143+
execute_process(
144+
COMMAND brew --prefix
145+
RESULT_VARIABLE BREW_LIB
146+
OUTPUT_VARIABLE BREW_PREFIX
147+
OUTPUT_STRIP_TRAILING_WHITESPACE
148+
)
149+
if (BREW_LIB EQUAL 0 AND EXISTS "${BREW_PREFIX}")
150+
install(CODE
151+
"
152+
include(BundleUtilities)
153+
fixup_bundle(\"${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/${PROJECT_NAME}.app\" \"\" \"${BREW_PREFIX}/lib\")
154+
execute_process(COMMAND codesign --force --deep --sign - ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}/${PROJECT_NAME}.app)
155+
"
156+
)
157+
endif()
158+
endif(APPLE)

0 commit comments

Comments
 (0)