Przeglądaj źródła

Move from submodules to cmake external.

Former-commit-id: de5e3215dee059a7dee07d2c56b8d1ca8a2f9384
Jérémie Dumas 6 lat temu
rodzic
commit
1ef33b03a2

+ 0 - 33
.gitmodules

@@ -1,33 +0,0 @@
-[submodule "external/embree"]
-	path = external/embree
-	url = https://github.com/embree/embree.git
-[submodule "external/cgal"]
-	path = external/cgal
-	url = https://github.com/CGAL/cgal.git
-[submodule "external/tetgen"]
-	path = external/tetgen
-	url = https://github.com/libigl/tetgen.git
-[submodule "external/triangle"]
-	path = external/triangle
-	url = https://github.com/libigl/triangle.git
-[submodule "external/tinyxml2"]
-	path = external/tinyxml2
-	url = https://github.com/leethomason/tinyxml2.git
-[submodule "external/CoMISo"]
-	path = external/CoMISo
-	url = https://github.com/libigl/CoMISo.git
-[submodule "external/cork"]
-	path = external/cork
-	url = https://github.com/libigl/cork.git
-[submodule "external/imgui"]
-	path = external/imgui/imgui
-	url = https://github.com/ocornut/imgui.git
-[submodule "external/glfw"]
-	path = external/glfw
-	url = https://github.com/glfw/glfw.git
-[submodule "external/eigen"]
-	path = external/eigen
-	url = https://github.com/eigenteam/eigen-git-mirror.git
-[submodule "external/pybind11"]
-	path = external/pybind11
-	url = https://github.com/pybind/pybind11

+ 0 - 0
shared/cmake/CXXFeatures.cmake → cmake/CXXFeatures.cmake


+ 0 - 0
shared/cmake/DownloadProject.CMakeLists.cmake.in → cmake/DownloadProject.CMakeLists.cmake.in


+ 0 - 0
shared/cmake/DownloadProject.cmake → cmake/DownloadProject.cmake


+ 0 - 0
shared/cmake/FindCORK.cmake → cmake/FindCORK.cmake


+ 0 - 0
shared/cmake/FindMATLAB.cmake → cmake/FindMATLAB.cmake


+ 0 - 0
shared/cmake/FindMOSEK.cmake → cmake/FindMOSEK.cmake


+ 109 - 0
cmake/LibiglDownloadExternal.cmake

@@ -0,0 +1,109 @@
+################################################################################
+include(DownloadProject)
+
+# Shortcut function
+function(igl_download_project name)
+	download_project(
+		PROJ         ${name}
+		SOURCE_DIR   ${LIBIGL_EXTERNAL}/${name}
+		DOWNLOAD_DIR ${LIBIGL_EXTERNAL}/.cache/${name}
+		QUIET
+		${ARGN}
+	)
+endfunction()
+
+################################################################################
+
+## CGAL
+function(igl_download_cgal)
+	igl_download_project(cgal
+		GIT_REPOSITORY https://github.com/libigl/cgal.git
+		GIT_TAG        f7c3c8212b56c0d6dae63787efc99093f4383415
+	)
+endfunction()
+
+## CoMISo
+function(igl_download_comiso)
+	igl_download_project(CoMISo
+		GIT_REPOSITORY https://github.com/libigl/CoMISo.git
+		GIT_TAG        fea3ee0ba7d42ee3eca202d484e4fad855e4d6aa
+	)
+endfunction()
+
+## Cork
+function(igl_download_cork)
+	igl_download_project(cork
+		GIT_REPOSITORY https://github.com/libigl/cork.git
+		GIT_TAG        27ad8a285838f5a480d856429e39d3d56d4338f9
+	)
+endfunction()
+
+## Eigen
+function(igl_download_eigen)
+	igl_download_project(eigen
+		URL           http://bitbucket.org/eigen/eigen/get/3.2.10.tar.gz
+		URL_MD5       8ad10ac703a78143a4062c9bda9d8fd3
+	)
+endfunction()
+
+## Embree
+function(igl_download_embree)
+	igl_download_project(embree
+		URL            https://github.com/embree/embree/archive/v2.17.4.tar.gz
+		URL_MD5        2038f3216b1d626e87453aee72c470e5
+		# GIT_REPOSITORY https://github.com/embree/embree.git
+		# GIT_TAG        cb61322db3bb7082caed21913ad14869b436fe78
+	)
+endfunction()
+
+## GLFW
+function(igl_download_glfw)
+	igl_download_project(glfw
+		GIT_REPOSITORY https://github.com/glfw/glfw.git
+		GIT_TAG        58cc4b2c5c2c9a245e09451437dd6f5af4d60c84
+	)
+endfunction()
+
+## ImGui
+function(igl_download_imgui)
+	download_project(
+		PROJ           imgui
+		SOURCE_DIR     ${LIBIGL_EXTERNAL}/imgui/imgui
+		DOWNLOAD_DIR   ${LIBIGL_EXTERNAL}/.cache/${name}
+		GIT_REPOSITORY https://github.com/ocornut/imgui.git
+		GIT_TAG        bc6ac8b2aee0614debd940e45bc9cd0d9b355c86
+	)
+endfunction()
+
+## pybind11
+function(igl_download_pybind11)
+	igl_download_project(pybind11
+		GIT_REPOSITORY https://github.com/pybind/pybind11.git
+		GIT_TAG        2d0507db43cd5a117f7843e053b17dffca114107
+	)
+endfunction()
+
+## TetGen
+function(igl_download_tetgen)
+	igl_download_project(tetgen
+		GIT_REPOSITORY https://github.com/libigl/tetgen.git
+		GIT_TAG        d2dcc33cb8551f16e302c8130ce12fa52992cd09
+	)
+endfunction()
+
+## TinyXML
+function(igl_download_tinyxml2)
+	igl_download_project(tinyxml2
+		GIT_REPOSITORY https://github.com/leethomason/tinyxml2.git
+		GIT_TAG        d175e9de0be0d4db75d0a8cf065599a435a87eb6
+	)
+endfunction()
+
+## Triangle
+function(igl_download_triangle)
+	igl_download_project(triangle
+		GIT_REPOSITORY https://github.com/libigl/triangle.git
+		GIT_TAG        d6761dd691e2e1318c83bf7773fea88d9437464a
+	)
+endfunction()
+

+ 0 - 0
shared/cmake/libigl-config.cmake.in → cmake/libigl-config.cmake.in


+ 20 - 44
shared/cmake/libigl.cmake → cmake/libigl.cmake

@@ -27,17 +27,15 @@ find_package(OpenGL) # --> OPENGL_FOUND
 
 ### Available options ###
 option(LIBIGL_USE_STATIC_LIBRARY     "Use libigl as static library" ON)
-option(LIBIGL_WITH_ANTTWEAKBAR       "Use AntTweakBar"    OFF)
 option(LIBIGL_WITH_CGAL              "Use CGAL"           ON)
 option(LIBIGL_WITH_COMISO            "Use CoMiso"         ON)
 option(LIBIGL_WITH_CORK              "Use Cork"           OFF)
 option(LIBIGL_WITH_EMBREE            "Use Embree"         OFF)
-option(LIBIGL_WITH_LIM               "Use LIM"            ON)
 option(LIBIGL_WITH_MATLAB            "Use Matlab"         "${Matlab_FOUND}")
 option(LIBIGL_WITH_MOSEK             "Use MOSEK"          "${MOSEK_FOUND}")
 option(LIBIGL_WITH_OPENGL            "Use OpenGL"         "${OPENGL_FOUND}")
 option(LIBIGL_WITH_OPENGL_GLFW       "Use GLFW"           "${OPENGL_FOUND}")
-option(LIBIGL_WITH_OPENGL_GLFW_IMGUI "Use ImGui"          ON)
+option(LIBIGL_WITH_OPENGL_GLFW_IMGUI "Use ImGui"          "${OPENGL_FOUND}")
 option(LIBIGL_WITH_PNG               "Use PNG"            ON)
 option(LIBIGL_WITH_TETGEN            "Use Tetgen"         ON)
 option(LIBIGL_WITH_TRIANGLE          "Use Triangle"       ON)
@@ -52,7 +50,7 @@ endif()
 ################################################################################
 
 ### Configuration
-set(LIBIGL_ROOT "${CMAKE_CURRENT_LIST_DIR}/../..")
+set(LIBIGL_ROOT "${CMAKE_CURRENT_LIST_DIR}/..")
 set(LIBIGL_SOURCE_DIR "${LIBIGL_ROOT}/include")
 set(LIBIGL_EXTERNAL "${LIBIGL_ROOT}/external")
 
@@ -63,6 +61,10 @@ else()
   set(IGL_SCOPE INTERFACE)
 endif()
 
+# Download and update 3rdparty libraries
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+include(LibiglDownloadExternal)
+
 ################################################################################
 ### IGL Common
 ################################################################################
@@ -86,6 +88,9 @@ target_compile_features(igl_common INTERFACE ${CXX11_FEATURES})
 if(MSVC)
   # Enable parallel compilation for Visual Studio
   target_compile_options(igl_common INTERFACE /MP /bigobj)
+  if(LIBIGL_WITH_CGAL)
+    target_compile_options(igl_common INTERFACE "/MD$<$<CONFIG:Debug>:d>")
+  endif()
 endif()
 
 if(BUILD_SHARED_LIBS)
@@ -98,7 +103,8 @@ if(TARGET Eigen3::Eigen)
   # If an imported target already exists, use it
   target_link_libraries(igl_common INTERFACE Eigen3::Eigen)
 else()
-  target_include_directories(igl_common SYSTEM INTERFACE 
+  igl_download_eigen()
+  target_include_directories(igl_common SYSTEM INTERFACE
     $<BUILD_INTERFACE:${LIBIGL_EXTERNAL}/eigen>
     $<INSTALL_INTERFACE:include>
   )
@@ -110,20 +116,6 @@ target_link_libraries(igl_common INTERFACE ${CMAKE_THREAD_LIBS_INIT})
 
 ################################################################################
 
-include(DownloadProject)
-
-# Shortcut function
-function(igl_download_project name)
-  download_project(
-    PROJ         ${name}
-    SOURCE_DIR   ${LIBIGL_EXTERNAL}/${name}
-    DOWNLOAD_DIR ${LIBIGL_EXTERNAL}/.cache/${name}
-    ${ARGN}
-  )
-endfunction()
-
-################################################################################
-
 ## CGAL dependencies on Windows: GMP & MPFR
 function(igl_download_cgal_deps)
   if(WIN32)
@@ -175,7 +167,6 @@ function(compile_igl_module module_dir)
   set_property(TARGET ${module_libname} PROPERTY EXPORT_NAME igl::${module_name})
 endfunction()
 
-
 ################################################################################
 ### IGL Core
 ################################################################################
@@ -187,18 +178,6 @@ if(LIBIGL_USE_STATIC_LIBRARY)
 endif()
 compile_igl_module("core" ${SOURCES_IGL})
 
-################################################################################
-## Compile the AntTweakBar part ###
-if(LIBIGL_WITH_ANTTWEAKBAR)
-  set(ANTTWEAKBAR_DIR "${LIBIGL_EXTERNAL}/AntTweakBar")
-  if(NOT TARGET AntTweakBar)
-    add_subdirectory("${ANTTWEAKBAR_DIR}" AntTweakBar)
-  endif()
-  compile_igl_module("anttweakbar")
-  target_link_libraries(igl_anttweakbar ${IGL_SCOPE} AntTweakBar)
-  target_include_directories(igl_anttweakbar ${IGL_SCOPE} "${ANTTWEAKBAR_DIR}/include")
-endif()
-
 ################################################################################
 ### Compile the CGAL part ###
 if(LIBIGL_WITH_CGAL)
@@ -253,6 +232,7 @@ endfunction()
 if(LIBIGL_WITH_COMISO)
   compile_igl_module("comiso")
   if(NOT TARGET CoMISo)
+    igl_download_comiso()
     add_subdirectory("${LIBIGL_EXTERNAL}/CoMISo" CoMISo)
   endif()
   target_link_libraries(igl_comiso ${IGL_SCOPE} CoMISo)
@@ -265,6 +245,7 @@ if(LIBIGL_WITH_CORK)
   if(NOT TARGET cork)
     # call this "lib-cork" instead of "cork", otherwise cmake gets confused about
     # "cork" executable
+    igl_download_cork()
     add_subdirectory("${CORK_DIR}" "lib-cork")
   endif()
   compile_igl_module("cork")
@@ -293,6 +274,7 @@ if(LIBIGL_WITH_EMBREE)
   endif()
 
   if(NOT TARGET embree)
+    igl_download_embree()
     add_subdirectory("${EMBREE_DIR}" "embree")
   endif()
 
@@ -312,18 +294,6 @@ if(LIBIGL_WITH_EMBREE)
   endif()
 endif()
 
-################################################################################
-### Compile the lim part ###
-if(LIBIGL_WITH_LIM)
-  set(LIM_DIR "${LIBIGL_EXTERNAL}/lim")
-  if(NOT TARGET lim)
-    add_subdirectory("${LIM_DIR}" "lim")
-  endif()
-  compile_igl_module("lim")
-  target_link_libraries(igl_lim ${IGL_SCOPE} lim)
-  target_include_directories(igl_lim ${IGL_SCOPE} ${LIM_DIR})
-endif()
-
 ################################################################################
 ### Compile the matlab part ###
 if(LIBIGL_WITH_MATLAB)
@@ -370,6 +340,7 @@ if(LIBIGL_WITH_OPENGL_GLFW)
       set(GLFW_BUILD_TESTS OFF CACHE BOOL " " FORCE)
       set(GLFW_BUILD_DOCS OFF CACHE BOOL " " FORCE)
       set(GLFW_INSTALL OFF CACHE BOOL " " FORCE)
+      igl_download_glfw()
       add_subdirectory(${LIBIGL_EXTERNAL}/glfw glfw)
     endif()
     target_link_libraries(igl_opengl_glfw ${IGL_SCOPE} igl_opengl glfw)
@@ -383,6 +354,7 @@ if(LIBIGL_WITH_OPENGL_GLFW_IMGUI)
     # ImGui module
     compile_igl_module("opengl/glfw/imgui")
     if(NOT TARGET imgui)
+      igl_download_imgui()
       add_subdirectory(${LIBIGL_EXTERNAL}/imgui imgui)
     endif()
     target_link_libraries(igl_opengl_glfw_imgui ${IGL_SCOPE} igl_opengl_glfw imgui)
@@ -409,6 +381,7 @@ endif()
 if(LIBIGL_WITH_TETGEN)
   set(TETGEN_DIR "${LIBIGL_EXTERNAL}/tetgen")
   if(NOT TARGET tetgen)
+    igl_download_tetgen()
     add_subdirectory("${TETGEN_DIR}" "tetgen")
   endif()
   compile_igl_module("tetgen")
@@ -421,6 +394,7 @@ endif()
 if(LIBIGL_WITH_TRIANGLE)
   set(TRIANGLE_DIR "${LIBIGL_EXTERNAL}/triangle")
   if(NOT TARGET triangle)
+    igl_download_triangle()
     add_subdirectory("${TRIANGLE_DIR}" "triangle")
   endif()
   compile_igl_module("triangle")
@@ -433,7 +407,9 @@ endif()
 if(LIBIGL_WITH_XML)
   set(TINYXML2_DIR "${LIBIGL_EXTERNAL}/tinyxml2")
   if(NOT TARGET tinyxml2)
+    igl_download_tinyxml2()
     add_library(tinyxml2 STATIC ${TINYXML2_DIR}/tinyxml2.cpp ${TINYXML2_DIR}/tinyxml2.h)
+    target_include_directories(tinyxml2 PUBLIC ${TINYXML2_DIR})
     set_target_properties(tinyxml2 PROPERTIES
             COMPILE_DEFINITIONS "TINYXML2_EXPORT"
             VERSION "3.0.0"

+ 1 - 1
python/CMakeLists.txt

@@ -48,7 +48,7 @@ option(LIBIGL_WITH_COPYLEFT          "Use Copyleft"       ON)
 
 ## libigl
 if(NOT TARGET igl::core)
-  list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../shared/cmake")
+  list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/../cmake")
   include(libigl)
 endif()
 

+ 1 - 4
tutorial/CMakeLists.txt

@@ -4,7 +4,7 @@ message(STATUS "CMAKE_C_COMPILER: ${CMAKE_C_COMPILER}")
 message(STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}")
 
 ### conditionally compile certain modules depending on libraries found on the system
-list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../shared/cmake)
+list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake)
 #find_package(CGAL QUIET COMPONENTS Core)
 find_package(MATLAB QUIET)
 find_package(MOSEK)
@@ -123,9 +123,6 @@ if(TUTORIALS_CHAPTER6)
   if(LIBIGL_WITH_PNG)
     add_subdirectory("607_ScreenCapture")
   endif()
-  if(LIBIGL_WITH_LIM)
-    add_subdirectory("608_LIM")
-  endif()
   if(LIBIGL_WITH_CGAL)
     add_subdirectory("609_Boolean")
     add_subdirectory("610_CSGTree")