embree.cmake 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. if(TARGET embree::embree)
  2. return()
  3. endif()
  4. message(STATUS "Third-party: creating target 'embree::embree'")
  5. include(FetchContent)
  6. FetchContent_Declare(
  7. embree
  8. GIT_REPOSITORY https://github.com/embree/embree.git
  9. GIT_TAG v3.13.3
  10. GIT_SHALLOW TRUE
  11. )
  12. # Set Embree's default options
  13. option(EMBREE_ISPC_SUPPORT "Build Embree with support for ISPC applications." OFF)
  14. option(EMBREE_TUTORIALS "Enable to build Embree tutorials" OFF)
  15. option(EMBREE_STATIC_LIB "Build Embree as a static library." ON)
  16. set(EMBREE_TESTING_INTENSITY 0 CACHE STRING "Intensity of testing (0 = no testing, 1 = verify and tutorials, 2 = light testing, 3 = intensive testing.")
  17. set(EMBREE_TASKING_SYSTEM "INTERNAL" CACHE STRING "Selects tasking system")
  18. set(EMBREE_MAX_ISA "DEFAULT" CACHE STRING "Selects highest ISA to support.")
  19. # Ready to include embree's atrocious CMake
  20. FetchContent_MakeAvailable(embree)
  21. # Disable warnings
  22. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  23. # Embree's subgrid.h is known for causing array subscript out of bound
  24. # warning. Embree dev claim the code is correct and it is a GCC bug
  25. # for misfiring warnings. See https://github.com/embree/embree/issues/271
  26. #
  27. # The issue should be fixed for gcc 9.2.1 and later.
  28. target_compile_options(embree PRIVATE "-Wno-array-bounds")
  29. endif()
  30. # Now we need to do some juggling to propagate the include directory properties
  31. # along with the `embree` target
  32. include(GNUInstallDirs)
  33. target_include_directories(embree SYSTEM INTERFACE
  34. "$<BUILD_INTERFACE:${embree_SOURCE_DIR}/include>"
  35. "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/>"
  36. )
  37. add_library(embree::embree ALIAS embree)
  38. # Some order for IDEs
  39. set_target_properties(embree PROPERTIES FOLDER "ThirdParty//Embree")
  40. set_target_properties(lexers PROPERTIES FOLDER "ThirdParty//Embree")
  41. set_target_properties(math PROPERTIES FOLDER "ThirdParty//Embree")
  42. set_target_properties(simd PROPERTIES FOLDER "ThirdParty//Embree")
  43. set_target_properties(sys PROPERTIES FOLDER "ThirdParty//Embree")
  44. set_target_properties(tasking PROPERTIES FOLDER "ThirdParty//Embree")
  45. set_target_properties(uninstall PROPERTIES FOLDER "ThirdParty//Embree")