build: simplify light build (embree handling)
This commit is contained in:
parent
527c63f55f
commit
bd3452bfdc
|
|
@ -72,48 +72,18 @@ if (embree_FOUND)
|
||||||
message(STATUS "Found embree license: ${EMBREE_LICENSE}")
|
message(STATUS "Found embree license: ${EMBREE_LICENSE}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
add_custom_command(TARGET light POST_BUILD
|
||||||
file(GLOB EMBREE_DLLS "${embree_DIR}/bin/*.dll")
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:embree>" "$<TARGET_FILE_DIR:light>"
|
||||||
foreach(EMBREE_DLL ${EMBREE_DLLS})
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:TBB::tbb>" "$<TARGET_FILE_DIR:light>"
|
||||||
add_custom_command(TARGET light POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${EMBREE_DLL} $<TARGET_FILE_DIR:light>)
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${EMBREE_LICENSE}" "$<TARGET_FILE_DIR:light>/LICENSE-embree.txt")
|
||||||
endforeach(EMBREE_DLL)
|
|
||||||
|
|
||||||
add_custom_command(TARGET light POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${EMBREE_LICENSE} $<TARGET_FILE_DIR:light>/LICENSE-embree.txt)
|
# so the executable will search for dylib's in the same directory as the executable
|
||||||
|
if(APPLE)
|
||||||
install(FILES ${EMBREE_DLLS} DESTINATION bin)
|
add_custom_command(TARGET light POST_BUILD
|
||||||
endif()
|
COMMAND bash ARGS -c \"install_name_tool -add_rpath @loader_path $<TARGET_FILE:light> || true\")
|
||||||
if(UNIX)
|
|
||||||
if (APPLE)
|
|
||||||
set(SHARED_LIB_EXT dylib)
|
|
||||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|
||||||
set(SHARED_LIB_EXT "so.*")
|
|
||||||
else ()
|
|
||||||
message(FATAL_ERROR "only Linux and macOS currently supported")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
file(GLOB EMBREE_DYLIBS_WITH_SYMLINKS "${embree_DIR}/lib/*.${SHARED_LIB_EXT}")
|
|
||||||
|
|
||||||
# Gather all .dylib's that are not symlinks
|
|
||||||
foreach(EMBREE_DYLIB ${EMBREE_DYLIBS_WITH_SYMLINKS})
|
|
||||||
if(NOT IS_SYMLINK ${EMBREE_DYLIB})
|
|
||||||
list(APPEND EMBREE_DYLIBS ${EMBREE_DYLIB})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
foreach(EMBREE_DYLIB ${EMBREE_DYLIBS})
|
|
||||||
message(STATUS "Copying dylib: ${EMBREE_DYLIB}")
|
|
||||||
add_custom_command(TARGET light POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${EMBREE_DYLIB} $<TARGET_FILE_DIR:light>)
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
# so the executable will search for dylib's in the same directory as the executable
|
|
||||||
if(APPLE)
|
|
||||||
add_custom_command(TARGET light POST_BUILD COMMAND bash ARGS -c \"install_name_tool -add_rpath @loader_path $<TARGET_FILE:light> || true\")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
install(FILES ${EMBREE_DYLIBS} DESTINATION bin)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
install(FILES "$<TARGET_FILE:embree>" "$<TARGET_FILE:TBB::tbb>" DESTINATION bin)
|
||||||
install(FILES ${EMBREE_LICENSE} DESTINATION bin RENAME LICENSE-embree.txt)
|
install(FILES ${EMBREE_LICENSE} DESTINATION bin RENAME LICENSE-embree.txt)
|
||||||
endif(embree_FOUND)
|
endif(embree_FOUND)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue