diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ad96a4..c02762c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,19 @@ find_package(Log4cplus REQUIRED) find_package(Python COMPONENTS Interpreter Development) find_package(TBB REQUIRED) +# Houdini's macOS Python framework records its install name as @rpath/Python, +# even when CMake finds it through the libpython compatibility path. Embed the +# framework root so Python extension modules can be loaded by build-time tools. +if(APPLE AND TARGET Python::Python) + get_target_property(_python_library Python::Python IMPORTED_LOCATION_RELEASE) + if(NOT _python_library) + get_target_property(_python_library Python::Python IMPORTED_LOCATION) + endif() + if(_python_library MATCHES "^(.+\\.framework)/") + set(_python_framework_rpath "${CMAKE_MATCH_1}") + endif() +endif() + find_program(LUA_BIN_LUAC NAMES luac HINTS $ENV{LUA_DIR}/bin) @@ -71,8 +84,11 @@ find_program(LUA_BIN_LUA HINTS $ENV{LUA_DIR}/bin) # Set the RPATH for binaries in the install tree -set(CMAKE_BUILD_RPATH ${COMPILER_LIBRARY_DIR}) +set(CMAKE_BUILD_RPATH ${COMPILER_LIBRARY_DIR} ${_python_framework_rpath}) set(CMAKE_INSTALL_RPATH ${GLOBAL_INSTALL_RPATH}) +if(_python_framework_rpath) + list(APPEND CMAKE_INSTALL_RPATH ${_python_framework_rpath}) +endif() set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # if OPT_LEVEL is set use its value to override the CMAKE_BUILD_TYPE because the @@ -158,4 +174,3 @@ install( DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}-${PROJECT_VERSION} ) - diff --git a/cmake/SceneRdl2CompileOptions.cmake b/cmake/SceneRdl2CompileOptions.cmake index 4d98ec6..44ecdae 100644 --- a/cmake/SceneRdl2CompileOptions.cmake +++ b/cmake/SceneRdl2CompileOptions.cmake @@ -57,7 +57,6 @@ function(SceneRdl2_cxx_compile_options target) elseif (CMAKE_CXX_COMPILER_ID STREQUAL AppleClang) target_compile_options(${target} PUBLIC - -Wno-gnu-alignof-expression ) elseif (CMAKE_CXX_COMPILER_ID STREQUAL Intel) target_compile_options(${target} diff --git a/lib/scene/rdl2/CMakeLists.txt b/lib/scene/rdl2/CMakeLists.txt index 31aeaef..9758a80 100644 --- a/lib/scene/rdl2/CMakeLists.txt +++ b/lib/scene/rdl2/CMakeLists.txt @@ -202,7 +202,7 @@ add_executable(rdl2_ispc_util) target_sources(rdl2_ispc_util PRIVATE rdl2_ispc_util/rdl2_ispc_util.cc) target_link_libraries(rdl2_ispc_util PRIVATE scene_rdl2_tmp) if (IsDarwinPlatform) - add_custom_command(TARGET rdl2_ispc_util POST_BUILD COMMAND /usr/bin/codesign -s - -f -o linker-signed */rdl2_ispc_util) + add_custom_command(TARGET rdl2_ispc_util POST_BUILD COMMAND /usr/bin/codesign -s - -f -o linker-signed $) endif() # Set standard compile/link options