File tree Expand file tree Collapse file tree 6 files changed +59
-10
lines changed Expand file tree Collapse file tree 6 files changed +59
-10
lines changed Original file line number Diff line number Diff line change @@ -12,3 +12,5 @@ python/src/xstudio/version.py
1212.vs /
1313.DS_Store
1414/build /
15+ xstudio_install /
16+ ** /qml /* _qml_export.h
Original file line number Diff line number Diff line change @@ -101,10 +101,12 @@ macro(default_options_local name)
101101 $<BUILD_INTERFACE:${ROOT_DIR} /extern/include >
102102 )
103103 if (APPLE )
104- set_target_properties (${name}
105- PROPERTIES
106- LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /xSTUDIO.app/Contents/Frameworks"
107- )
104+ set_target_properties (${name}
105+ PROPERTIES
106+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /xSTUDIO.app/Contents/Frameworks"
107+ INSTALL_RPATH "@executable_path/../Frameworks"
108+ INSTALL_RPATH_USE_LINK_PATH TRUE
109+ )
108110 else ()
109111 set_target_properties (${name}
110112 PROPERTIES
@@ -204,7 +206,7 @@ macro(default_plugin_options name)
204206 COMMAND ${CMAKE_COMMAND} -E copy "$<TARGET_FILE:${PROJECT_NAME} >" "${CMAKE_CURRENT_BINARY_DIR} /plugin"
205207 )
206208 endif ()
207-
209+
208210endmacro ()
209211
210212macro (add_plugin_qml name _dir)
@@ -366,7 +368,7 @@ macro(add_python_plugin NAME)
366368 copy_directory ${CMAKE_CURRENT_SOURCE_DIR} /${NAME} ${CMAKE_BINARY_DIR} /bin/plugin-python/${NAME} )
367369
368370 endif ()
369-
371+
370372endmacro ()
371373
372374macro (create_plugin NAME VERSION DEPS)
Original file line number Diff line number Diff line change @@ -57,4 +57,12 @@ if(UNIX AND NOT APPLE)
5757 target_link_libraries (${PROJECT_NAME} PRIVATE asound) # Link against asound on Linux
5858endif ()
5959
60- set_target_properties (${PROJECT_NAME} PROPERTIES LINK_DEPENDS_NO_SHARED true )
60+ if (APPLE )
61+ set_target_properties (${PROJECT_NAME} PROPERTIES
62+ LINK_DEPENDS_NO_SHARED true
63+ INSTALL_RPATH "@executable_path/../Frameworks"
64+ BUILD_WITH_INSTALL_RPATH TRUE
65+ )
66+ else ()
67+ set_target_properties (${PROJECT_NAME} PROPERTIES LINK_DEPENDS_NO_SHARED true )
68+ endif ()
Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ set(SOURCES
1212 xstudio.cpp
1313 xstudio_win_resource.rc
1414 ../../../../ui/qml/xstudio/qml.qrc
15- )
15+ )
1616else ()
1717set (SOURCES
1818 xstudio.cpp
1919 ../../../../ui/qml/xstudio/qml.qrc
20- )
20+ )
2121endif ()
2222if (WIN32 )
2323 # Add the /bigobj option for xstudio.cpp
@@ -134,6 +134,12 @@ elseif(APPLE)
134134 configure_file (macdeploy.cmake.in ${CMAKE_CURRENT_BINARY_DIR} /macdeploy.cmake @ONLY)
135135 install (SCRIPT ${CMAKE_CURRENT_BINARY_DIR} /macdeploy.cmake)
136136
137+ # Add custom command to fix library paths after build
138+ add_custom_command (TARGET ${PROJECT_NAME} POST_BUILD
139+ COMMAND ${CMAKE_COMMAND} -DAPP_BUNDLE_DIR=${CMAKE_BINARY_DIR} /xSTUDIO.app
140+ -P ${CMAKE_CURRENT_SOURCE_DIR} /fixup_macos_bundle.cmake
141+ )
142+
137143else ()
138144
139145 set_target_properties (${PROJECT_NAME}
Original file line number Diff line number Diff line change 1+ # Fix library paths in the app bundle to ensure they're relative
2+ file (GLOB_RECURSE LIBRARIES "${APP_BUNDLE_DIR} /Contents/Frameworks/*.dylib" )
3+ foreach (LIB ${LIBRARIES} )
4+ get_filename_component (LIB_NAME ${LIB} NAME )
5+ execute_process (COMMAND install_name_tool -id "@rpath/${LIB_NAME} " ${LIB} )
6+ endforeach ()
7+
8+ # Fix executable references to libraries
9+ execute_process (
10+ COMMAND
11+ install_name_tool
12+ -add_rpath
13+ "@executable_path/../Frameworks"
14+ ${APP_BUNDLE_DIR} /Contents/MacOS/xstudio.bin
15+ )
Original file line number Diff line number Diff line change 11message ("Running @macdeployqt_exe@ with args: ${CMAKE_BINARY_DIR} /xSTUDIO.app -qmldir=@CMAKE_SOURCE_DIR@/ui" )
22execute_process (COMMAND "@macdeployqt_exe@" ${CMAKE_BINARY_DIR} /xSTUDIO.app -qmldir=@CMAKE_SOURCE_DIR @/ui
3- WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX} " )
3+ WORKING_DIRECTORY "${CMAKE_INSTALL_PREFIX} " )
4+
5+ # Fix library paths to ensure they're relative to the bundle
6+ execute_process (
7+ COMMAND
8+ install_name_tool -id
9+ "@rpath/libglobal.dylib"
10+ ${CMAKE_BINARY_DIR} /xSTUDIO.app/Contents/Frameworks/libglobal.dylib
11+ )
12+ execute_process (
13+ COMMAND
14+ install_name_tool
15+ -change
16+ "@rpath/libglobal.dylib"
17+ "@executable_path/../Frameworks/libglobal.dylib"
18+ ${CMAKE_BINARY_DIR} /xSTUDIO.app/Contents/MacOS/xstudio.bin
19+ )
You can’t perform that action at this time.
0 commit comments