diff options
Diffstat (limited to 'intern/cycles/hydra')
-rw-r--r-- | intern/cycles/hydra/CMakeLists.txt | 128 | ||||
-rw-r--r-- | intern/cycles/hydra/resources/apple_symbols.map | 1 | ||||
-rw-r--r-- | intern/cycles/hydra/resources/linux_symbols.map | 8 |
3 files changed, 91 insertions, 46 deletions
diff --git a/intern/cycles/hydra/CMakeLists.txt b/intern/cycles/hydra/CMakeLists.txt index 7b7ea43cfe5..17a7f897ac6 100644 --- a/intern/cycles/hydra/CMakeLists.txt +++ b/intern/cycles/hydra/CMakeLists.txt @@ -81,18 +81,18 @@ endif() include_directories(${INC}) include_directories(SYSTEM ${INC_SYS}) -add_library(hdCyclesStatic STATIC +add_library(cycles_hydra STATIC ${SRC_HD_CYCLES} ${INC_HD_CYCLES} ) -target_compile_options(hdCyclesStatic +target_compile_options(cycles_hydra PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/wd4003 /wd4244 /wd4506> $<$<CXX_COMPILER_ID:GNU>:-Wno-float-conversion -Wno-double-promotion -Wno-deprecated> ) -target_compile_definitions(hdCyclesStatic +target_compile_definitions(cycles_hydra PRIVATE GLOG_NO_ABBREVIATED_SEVERITIES=1 OSL_DEBUG=$<CONFIG:DEBUG> @@ -100,57 +100,93 @@ target_compile_definitions(hdCyclesStatic $<$<CXX_COMPILER_ID:MSVC>:NOMINMAX=1> ) -target_link_libraries(hdCyclesStatic +target_link_libraries(cycles_hydra PUBLIC - hd - hgi - hgiGL + ${USD_LIBRARIES} PRIVATE ${LIB} ) -set(HdCyclesPluginName hdCycles) -add_library(${HdCyclesPluginName} SHARED - plugin.h - plugin.cpp -) - -set_target_properties(${HdCyclesPluginName} - PROPERTIES PREFIX "" -) - -target_compile_definitions(${HdCyclesPluginName} - PRIVATE - MFB_PACKAGE_NAME=${HdCyclesPluginName} - MFB_ALT_PACKAGE_NAME=${HdCyclesPluginName} - GLOG_NO_ABBREVIATED_SEVERITIES=1 - OSL_DEBUG=$<CONFIG:DEBUG> - TBB_USE_DEBUG=$<CONFIG:DEBUG> - $<$<CXX_COMPILER_ID:MSVC>:NOMINMAX=1> -) - -target_link_libraries(${HdCyclesPluginName} - hdCyclesStatic -) +if(WITH_CYCLES_HYDRA_RENDER_DELEGATE) + set(HdCyclesPluginName hdCycles) + add_library(${HdCyclesPluginName} SHARED + plugin.h + plugin.cpp + ) -if(WITH_CYCLES_BLENDER) - set(CYCLES_HYDRA_INSTALL_PATH "../") -else() - set(CYCLES_HYDRA_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}) - # Put the root plugInfo.json one level up - delayed_install("${CMAKE_CURRENT_SOURCE_DIR}" "plugInfo.json" ${CMAKE_INSTALL_PREFIX}) -endif() + set_target_properties(${HdCyclesPluginName} + PROPERTIES PREFIX "" + ) -delayed_install("" $<TARGET_FILE:${HdCyclesPluginName}> ${CYCLES_HYDRA_INSTALL_PATH}) + target_compile_definitions(${HdCyclesPluginName} + PRIVATE + MFB_PACKAGE_NAME=${HdCyclesPluginName} + MFB_ALT_PACKAGE_NAME=${HdCyclesPluginName} + GLOG_NO_ABBREVIATED_SEVERITIES=1 + OSL_DEBUG=$<CONFIG:DEBUG> + TBB_USE_DEBUG=$<CONFIG:DEBUG> + $<$<CXX_COMPILER_ID:MSVC>:NOMINMAX=1> + ) -set(PLUG_INFO_ROOT "..") + target_link_libraries(${HdCyclesPluginName} + cycles_hydra + ) -file(RELATIVE_PATH PLUG_INFO_LIBRARY_PATH "${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}" "${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}${CMAKE_SHARED_LIBRARY_SUFFIX}") -file(RELATIVE_PATH PLUG_INFO_RESOURCE_PATH "${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}" "${CYCLES_INSTALL_PATH}") + if(APPLE) + set_property( + TARGET + ${HdCyclesPluginName} + APPEND_STRING PROPERTY LINK_FLAGS + " -Wl,-exported_symbols_list,'${CMAKE_CURRENT_SOURCE_DIR}/resources/apple_symbols.map'" + ) + elseif(UNIX) + set_property( + TARGET + ${HdCyclesPluginName} + APPEND_STRING PROPERTY LINK_FLAGS + " -Wl,--version-script='${CMAKE_CURRENT_SOURCE_DIR}/resources/linux_symbols.map'" + ) + endif() + + + if(WITH_CYCLES_BLENDER) + # Install inside add-on + set(CYCLES_HYDRA_INSTALL_PATH ${CYCLES_INSTALL_PATH}/hydra) + else() + # Install next to cycles executable + set(CYCLES_HYDRA_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/hydra) + endif() -configure_file(resources/plugInfo.json - ${CMAKE_CURRENT_BINARY_DIR}/resources/plugInfo.json - @ONLY -) + # Put the root plugInfo.json one level up + delayed_install("${CMAKE_CURRENT_SOURCE_DIR}" "plugInfo.json" ${CYCLES_HYDRA_INSTALL_PATH}) + delayed_install("" $<TARGET_FILE:${HdCyclesPluginName}> ${CYCLES_HYDRA_INSTALL_PATH}) + + set_target_properties(${HdCyclesPluginName} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + + set(PLUG_INFO_ROOT "..") + + if(WITH_CYCLES_BLENDER) + # Full path not yet know at this point and RELATIVE_PATH requires + # absolute path as input. So just set manually. + set(PLUG_INFO_LIBRARY_PATH "../${HdCyclesPluginName}${CMAKE_SHARED_LIBRARY_SUFFIX}") + set(PLUG_INFO_RESOURCE_PATH "../..") + else() + file(RELATIVE_PATH + PLUG_INFO_LIBRARY_PATH + "${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}" + "${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}${CMAKE_SHARED_LIBRARY_SUFFIX}") + file(RELATIVE_PATH PLUG_INFO_RESOURCE_PATH + "${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}" + "${CYCLES_INSTALL_PATH}") + endif() + + configure_file(resources/plugInfo.json + ${CMAKE_CURRENT_BINARY_DIR}/resources/plugInfo.json + @ONLY + ) -delayed_install("${CMAKE_CURRENT_BINARY_DIR}/resources" "plugInfo.json" "${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}/resources") + delayed_install("${CMAKE_CURRENT_BINARY_DIR}/resources" "plugInfo.json" "${CYCLES_HYDRA_INSTALL_PATH}/${HdCyclesPluginName}/resources") +endif() diff --git a/intern/cycles/hydra/resources/apple_symbols.map b/intern/cycles/hydra/resources/apple_symbols.map new file mode 100644 index 00000000000..85be5ae55fe --- /dev/null +++ b/intern/cycles/hydra/resources/apple_symbols.map @@ -0,0 +1 @@ +*PXR* diff --git a/intern/cycles/hydra/resources/linux_symbols.map b/intern/cycles/hydra/resources/linux_symbols.map new file mode 100644 index 00000000000..397422c9854 --- /dev/null +++ b/intern/cycles/hydra/resources/linux_symbols.map @@ -0,0 +1,8 @@ +/* Hide everything except USD / Hydra symbols, to avoid conflicts with other + * application using different library versions. */ +{ +global: + PXR*; +local: + *; +}; |