Browse Source

Enable Embree module.

Former-commit-id: b30db1a836fcd187f934e529c6908d36098b9e3a
Jérémie Dumas 7 năm trước cách đây
mục cha
commit
9279accb84
1 tập tin đã thay đổi với 31 bổ sung37 xóa
  1. 31 37
      shared/cmake/libigl.cmake

+ 31 - 37
shared/cmake/libigl.cmake

@@ -163,46 +163,40 @@ endif()
 
 
 ################################################################################
 ################################################################################
 ### Compile the embree part ###
 ### Compile the embree part ###
-# if(LIBIGL_WITH_EMBREE)
-#   set(EMBREE_DIR "${LIBIGL_EXTERNAL}/embree")
-
-#   set(EMBREE_ISPC_SUPPORT OFF CACHE BOOL " " FORCE)
-#   set(EMBREE_TASKING_SYSTEM "INTERNAL" CACHE BOOL " " FORCE)
-#   set(EMBREE_TUTORIALS OFF CACHE BOOL " " FORCE)
-#   set(EMBREE_MAX_ISA NONE CACHE STRINGS " " FORCE)
-
-#   # set(ENABLE_INSTALLER OFF CACHE BOOL " " FORCE)
-#   if(MSVC)
-#     # set(EMBREE_STATIC_RUNTIME OFF CACHE BOOL " " FORCE)
-#     set(EMBREE_STATIC_LIB OFF CACHE BOOL " " FORCE)
-#   else()
-#     set(EMBREE_STATIC_LIB ON CACHE BOOL " " FORCE)
-#   endif()
-
-#   add_subdirectory("${EMBREE_DIR}" "embree")
-#   list(APPEND LIBIGL_INCLUDE_DIRS "${EMBREE_DIR}/include")
-#   list(APPEND LIBIGL_EMBREE_EXTRA_LIBRARIES "embree")
-#   list(APPEND LIBIGL_EXTRA_LIBRARIES ${LIBIGL_EMBREE_EXTRA_LIBRARIES})
+if(LIBIGL_WITH_EMBREE)
+  set(EMBREE_DIR "${LIBIGL_EXTERNAL}/embree")
+
+  set(EMBREE_ISPC_SUPPORT OFF CACHE BOOL " " FORCE)
+  set(EMBREE_TASKING_SYSTEM "INTERNAL" CACHE BOOL " " FORCE)
+  set(EMBREE_TUTORIALS OFF CACHE BOOL " " FORCE)
+  set(EMBREE_MAX_ISA NONE CACHE STRINGS " " FORCE)
+
+  # set(ENABLE_INSTALLER OFF CACHE BOOL " " FORCE)
+  if(MSVC)
+    # set(EMBREE_STATIC_RUNTIME OFF CACHE BOOL " " FORCE)
+    set(EMBREE_STATIC_LIB OFF CACHE BOOL " " FORCE)
+  else()
+    set(EMBREE_STATIC_LIB ON CACHE BOOL " " FORCE)
+  endif()
 
 
-#   if(NOT MSVC)
-#     list(APPEND LIBIGL_DEFINITIONS "-DENABLE_STATIC_LIB")
-#   endif()
+  if(NOT TARGET)
+    add_subdirectory("${EMBREE_DIR}" "embree")
+  endif()
 
 
-#   if(MSVC)
-#     add_custom_target(Copy-Embree-DLL ALL        # Adds a post-build event to MyTest
-#         COMMAND ${CMAKE_COMMAND} -E copy_if_different  # which executes "cmake - E copy_if_different..."
-#             "${CMAKE_BINARY_DIR}/libigl/embree/$<CONFIGURATION>/embree.dll"      # <--this is in-file
-#           "${CMAKE_BINARY_DIR}/embree.dll")                 # <--this is out-file path  endif()
-#   endif()
+  if(MSVC)
+    add_custom_target(Copy-Embree-DLL ALL        # Adds a post-build event to MyTest
+        COMMAND ${CMAKE_COMMAND} -E copy_if_different  # which executes "cmake - E copy_if_different..."
+          "${CMAKE_BINARY_DIR}/libigl/embree/$<CONFIGURATION>/embree.dll"      # <--this is in-file
+          "${CMAKE_BINARY_DIR}/embree.dll")                 # <--this is out-file path  endif()
+  endif()
 
 
-#   if(LIBIGL_USE_STATIC_LIBRARY)
-#     compile_igl_module("embree" "")
-#     target_include_directories(igl_embree PRIVATE ${EMBREE_DIR}/include)
-#   if(NOT MSVC)
-#     target_compile_definitions(igl_embree PRIVATE -DENABLE_STATIC_LIB)
-#   endif()
-#   endif()
-# endif()
+  compile_igl_module("embree" "")
+  target_link_libraries(igl_embree ${IGL_SCOPE} embree)
+  target_include_directories(igl_embree ${IGL_SCOPE} ${EMBREE_DIR}/include)
+  if(NOT MSVC)
+    target_compile_definitions(igl_embree ${IGL_SCOPE} -DENABLE_STATIC_LIB)
+  endif()
+endif()
 
 
 ################################################################################
 ################################################################################
 ### Compile the lim part ###
 ### Compile the lim part ###