diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ccb1095c..19f163aa4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -750,7 +750,10 @@ install(DIRECTORY "${openstudio_ROOT_DIR}/Python" DESTINATION "." COMPONENT "Pyt # install(DIRECTORY "${openstudio_ROOT_DIR}/lib" DESTINATION "." COMPONENT "OpenStudioApp" USE_SOURCE_PERMISSIONS) if(NOT APPLE) - # On Mac, in openstudio_app/CMakeLists.txt we've already copied the CLI to the OpenStudio.app/Contents/MacOS + # On Mac, we want to have openstudio CLI next to the OpenStudioApp in ./OpenStudio.app/Contents/MacOS + # But we still need it in the ./bin directory so it can be found relative to the files in ./lib, this occurs when a measure tries to use getOpenStudioCLI, see #695 + # In openstudio_app/CMakeLists.txt we've already copied the CLI to the OpenStudio.app/Contents/MacOS, and we install a symlink to ./bin as well + # TODO: the link order is the reverse of the lib ones (where we create a symlink **in the bundle** that points to the ./lib contents) install(IMPORTED_RUNTIME_ARTIFACTS openstudio::openstudio DESTINATION bin COMPONENT "CLI") endif() install(IMPORTED_RUNTIME_ARTIFACTS openstudio::openstudiolib DESTINATION ${LIB_DESTINATION_DIR} COMPONENT "CLI") diff --git a/src/openstudio_app/CMakeLists.txt b/src/openstudio_app/CMakeLists.txt index 6ad1cb425..c576284db 100644 --- a/src/openstudio_app/CMakeLists.txt +++ b/src/openstudio_app/CMakeLists.txt @@ -459,6 +459,11 @@ if( APPLE ) "../../../lib/$" "${CMAKE_INSTALL_PREFIX}/OpenStudioApp.app/Contents/Frameworks/$" + COMMAND "${CMAKE_COMMAND}" -E make_directory "${CMAKE_INSTALL_PREFIX}/bin" + COMMAND "${CMAKE_COMMAND}" -E create_symlink + "../OpenStudioApp.app/Contents/MacOS/$" + "${CMAKE_INSTALL_PREFIX}/bin/$" + COMMAND_ECHO STDOUT COMMAND_ERROR_IS_FATAL ANY )