|
@@ -76,11 +76,12 @@ endif()
|
|
|
|
|
|
################################################################################
|
|
|
|
|
|
-function(compile_igl_module module_dir prefix)
|
|
|
+function(compile_igl_module module_dir)
|
|
|
string(REPLACE "/" "_" module_name "${module_dir}")
|
|
|
if(LIBIGL_USE_STATIC_LIBRARY)
|
|
|
file(GLOB SOURCES_IGL_${module_name}
|
|
|
- "${LIBIGL_SOURCE_DIR}/igl/${prefix}/${module_dir}/*.cpp")
|
|
|
+ "${LIBIGL_SOURCE_DIR}/igl/${module_dir}/*.cpp"
|
|
|
+ "${LIBIGL_SOURCE_DIR}/igl/copyleft/${module_dir}/*.cpp")
|
|
|
add_library(igl_${module_name} STATIC ${SOURCES_IGL_${module_name}} ${ARGN})
|
|
|
if(MSVC)
|
|
|
target_compile_options(igl_${module_name} PRIVATE /w) # disable all warnings (not ideal but...)
|
|
@@ -110,7 +111,7 @@ if(LIBIGL_USE_STATIC_LIBRARY)
|
|
|
"${LIBIGL_SOURCE_DIR}/igl/*.cpp"
|
|
|
"${LIBIGL_SOURCE_DIR}/igl/copyleft/*.cpp")
|
|
|
endif()
|
|
|
-compile_igl_module("core" "" ${SOURCES_IGL})
|
|
|
+compile_igl_module("core" ${SOURCES_IGL})
|
|
|
|
|
|
################################################################################
|
|
|
## Compile the AntTweakBar part ###
|
|
@@ -119,7 +120,7 @@ if(LIBIGL_WITH_ANTTWEAKBAR)
|
|
|
if(NOT TARGET AntTweakBar)
|
|
|
add_subdirectory("${ANTTWEAKBAR_DIR}" AntTweakBar)
|
|
|
endif()
|
|
|
- compile_igl_module("anttweakbar" "")
|
|
|
+ compile_igl_module("anttweakbar")
|
|
|
target_link_libraries(igl_anttweakbar ${IGL_SCOPE} AntTweakBar)
|
|
|
endif()
|
|
|
|
|
@@ -130,7 +131,7 @@ if(LIBIGL_WITH_CGAL)
|
|
|
# `Exact_predicates_exact_constructions_kernel_with_sqrt`
|
|
|
find_package(CGAL COMPONENTS Core)
|
|
|
if(CGAL_FOUND)
|
|
|
- compile_igl_module("cgal" "copyleft/")
|
|
|
+ compile_igl_module("cgal")
|
|
|
find_package(Boost 1.48 REQUIRED thread system)
|
|
|
target_include_directories(igl_cgal ${IGL_SCOPE} ${CGAL_INCLUDE_DIRS})
|
|
|
target_link_libraries(igl_cgal ${IGL_SCOPE} CGAL::CGAL CGAL::CGAL_Core ${Boost_LIBRARIES})
|
|
@@ -144,7 +145,7 @@ endif()
|
|
|
# NOTE: this cmakefile works only with the
|
|
|
# comiso available here: https://github.com/libigl/CoMISo
|
|
|
if(LIBIGL_WITH_COMISO)
|
|
|
- compile_igl_module("comiso" "copyleft/")
|
|
|
+ compile_igl_module("comiso")
|
|
|
if(NOT TARGET CoMISo)
|
|
|
add_subdirectory("${LIBIGL_EXTERNAL}/CoMISo" CoMISo)
|
|
|
endif()
|
|
@@ -160,7 +161,7 @@ if(LIBIGL_WITH_CORK)
|
|
|
# "cork" executable
|
|
|
add_subdirectory("${CORK_DIR}" "lib-cork")
|
|
|
endif()
|
|
|
- compile_igl_module("cork" "copyleft/")
|
|
|
+ compile_igl_module("cork")
|
|
|
target_include_directories(igl_cork ${IGL_SCOPE} cork)
|
|
|
target_include_directories(igl_cork ${IGL_SCOPE} "${CORK_DIR}/src")
|
|
|
endif()
|
|
@@ -195,7 +196,7 @@ if(LIBIGL_WITH_EMBREE)
|
|
|
DEPENDS embree) # Execute after embree target has been built
|
|
|
endif()
|
|
|
|
|
|
- compile_igl_module("embree" "")
|
|
|
+ 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)
|
|
@@ -210,7 +211,7 @@ if(LIBIGL_WITH_LIM)
|
|
|
if(NOT TARGET lim)
|
|
|
add_subdirectory("${LIM_DIR}" "lim")
|
|
|
endif()
|
|
|
- compile_igl_module("lim" "")
|
|
|
+ compile_igl_module("lim")
|
|
|
target_link_libraries(igl_lim ${IGL_SCOPE} lim)
|
|
|
target_include_directories(igl_lim ${IGL_SCOPE} ${LIM_DIR})
|
|
|
endif()
|
|
@@ -220,7 +221,7 @@ endif()
|
|
|
if(LIBIGL_WITH_MATLAB)
|
|
|
find_package(MATLAB)
|
|
|
if(MATLAB_FOUND)
|
|
|
- compile_igl_module("matlab" "")
|
|
|
+ compile_igl_module("matlab")
|
|
|
target_link_libraries(igl_matlab ${IGL_SCOPE} ${MATLAB_LIBRARIES})
|
|
|
target_include_directories(igl_matlab ${IGL_SCOPE} ${MATLAB_INCLUDE_DIR})
|
|
|
else()
|
|
@@ -233,7 +234,7 @@ endif()
|
|
|
if(LIBIGL_WITH_MOSEK)
|
|
|
find_package(MOSEK)
|
|
|
if(MOSEK_FOUND)
|
|
|
- compile_igl_module("mosek" "")
|
|
|
+ compile_igl_module("mosek")
|
|
|
target_link_libraries(igl_mosek ${IGL_SCOPE} ${MOSEK_LIBRARIES})
|
|
|
target_include_directories(igl_mosek ${IGL_SCOPE} ${MOSEK_INCLUDE_DIRS})
|
|
|
target_compile_definitions(igl_mosek ${IGL_SCOPE} -DLIBIGL_WITH_MOSEK)
|
|
@@ -248,8 +249,8 @@ endif()
|
|
|
if(LIBIGL_WITH_OPENGL)
|
|
|
# OpenGL modules
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
- compile_igl_module("opengl" "")
|
|
|
- compile_igl_module("opengl2" "")
|
|
|
+ compile_igl_module("opengl")
|
|
|
+ compile_igl_module("opengl2")
|
|
|
target_link_libraries(igl_opengl ${IGL_SCOPE} ${OPENGL_gl_LIBRARY})
|
|
|
target_link_libraries(igl_opengl2 ${IGL_SCOPE} ${OPENGL_gl_LIBRARY})
|
|
|
target_include_directories(igl_opengl SYSTEM ${IGL_SCOPE} ${OPENGL_INCLUDE_DIR})
|
|
@@ -281,7 +282,7 @@ if(LIBIGL_WITH_OPENGL)
|
|
|
|
|
|
# GLFW module
|
|
|
if(LIBIGL_WITH_OPENGL_GLFW)
|
|
|
- compile_igl_module("opengl/glfw" "")
|
|
|
+ compile_igl_module("opengl/glfw")
|
|
|
if(NOT TARGET glfw)
|
|
|
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL " " FORCE)
|
|
|
set(GLFW_BUILD_TESTS OFF CACHE BOOL " " FORCE)
|
|
@@ -295,7 +296,7 @@ if(LIBIGL_WITH_OPENGL)
|
|
|
|
|
|
# Viewer module
|
|
|
if(LIBIGL_WITH_VIEWER)
|
|
|
- compile_igl_module("viewer" "")
|
|
|
+ compile_igl_module("viewer")
|
|
|
target_link_libraries(igl_viewer ${IGL_SCOPE} igl_core glfw glew ${OPENGL_gl_LIBRARY})
|
|
|
target_include_directories(igl_viewer SYSTEM ${IGL_SCOPE} ${OPENGL_INCLUDE_DIR})
|
|
|
if(TARGET nanogui)
|
|
@@ -309,16 +310,13 @@ endif()
|
|
|
################################################################################
|
|
|
### Compile the png parts ###
|
|
|
if(LIBIGL_WITH_PNG)
|
|
|
- if(TARGET igl_opengl)
|
|
|
- set(STB_IMAGE_DIR "${LIBIGL_EXTERNAL}/stb_image")
|
|
|
- if(NOT TARGET stb_image)
|
|
|
- add_subdirectory("${STB_IMAGE_DIR}" "stb_image")
|
|
|
- endif()
|
|
|
- compile_igl_module("png" "")
|
|
|
- target_link_libraries(igl_png ${IGL_SCOPE} igl_stb_image igl_opengl)
|
|
|
- else()
|
|
|
- set(LIBIGL_WITH_PNG OFF CACHE BOOL "" FORCE)
|
|
|
+ set(STB_IMAGE_DIR "${LIBIGL_EXTERNAL}/stb_image")
|
|
|
+ if(NOT TARGET stb_image)
|
|
|
+ add_subdirectory("${STB_IMAGE_DIR}" "stb_image")
|
|
|
endif()
|
|
|
+ compile_igl_module("png")
|
|
|
+ target_link_libraries(igl_png ${IGL_SCOPE} igl_stb_image igl_opengl)
|
|
|
+ target_include_directories(igl_png SYSTEM ${IGL_SCOPE} ${STB_IMAGE_DIR})
|
|
|
endif()
|
|
|
|
|
|
################################################################################
|
|
@@ -328,7 +326,7 @@ if(LIBIGL_WITH_TETGEN)
|
|
|
if(NOT TARGET tetgen)
|
|
|
add_subdirectory("${TETGEN_DIR}" "tetgen")
|
|
|
endif()
|
|
|
- compile_igl_module("tetgen" "copyleft/")
|
|
|
+ compile_igl_module("tetgen")
|
|
|
target_link_libraries(igl_tetgen ${IGL_SCOPE} tetgen)
|
|
|
target_include_directories(igl_tetgen ${IGL_SCOPE} ${TETGEN_DIR})
|
|
|
endif()
|
|
@@ -340,7 +338,7 @@ if(LIBIGL_WITH_TRIANGLE)
|
|
|
if(NOT TARGET triangle)
|
|
|
add_subdirectory("${TRIANGLE_DIR}" "triangle")
|
|
|
endif()
|
|
|
- compile_igl_module("triangle" "")
|
|
|
+ compile_igl_module("triangle")
|
|
|
target_link_libraries(igl_triangle ${IGL_SCOPE} triangle)
|
|
|
target_include_directories(igl_triangle ${IGL_SCOPE} ${TRIANGLE_DIR})
|
|
|
endif()
|
|
@@ -357,6 +355,6 @@ if(LIBIGL_WITH_XML)
|
|
|
VERSION "3.0.0"
|
|
|
SOVERSION "3")
|
|
|
endif()
|
|
|
- compile_igl_module("xml" "")
|
|
|
+ compile_igl_module("xml")
|
|
|
target_link_libraries(igl_xml ${IGL_SCOPE} tinyxml2)
|
|
|
endif()
|