|
@@ -77,11 +77,11 @@ target_include_directories(igl_common SYSTEM INTERFACE
|
|
|
$<BUILD_INTERFACE:${LIBIGL_SOURCE_DIR}>
|
|
|
$<INSTALL_INTERFACE:include>
|
|
|
)
|
|
|
+# Export igl_common as igl::common
|
|
|
+set_property(TARGET igl_common PROPERTY EXPORT_NAME common)
|
|
|
if(LIBIGL_USE_STATIC_LIBRARY)
|
|
|
target_compile_definitions(igl_common INTERFACE -DIGL_STATIC_LIBRARY)
|
|
|
endif()
|
|
|
-list(APPEND LIBIGL_ALL_MODULES igl_common)
|
|
|
-list(APPEND LIBIGL_INSTALL_HEADERS igl)
|
|
|
|
|
|
# Transitive C++11 flags
|
|
|
include(CXXFeatures)
|
|
@@ -110,11 +110,6 @@ else()
|
|
|
$<BUILD_INTERFACE:${LIBIGL_EXTERNAL}/eigen>
|
|
|
$<INSTALL_INTERFACE:include>
|
|
|
)
|
|
|
- # need to install eigen headers
|
|
|
- install(
|
|
|
- DIRECTORY ${LIBIGL_EXTERNAL}/eigen/Eigen
|
|
|
- DESTINATION include
|
|
|
- )
|
|
|
endif()
|
|
|
|
|
|
# C++11 Thread library
|
|
@@ -152,6 +147,8 @@ function(compile_igl_module module_dir)
|
|
|
# Alias target because it looks nicer
|
|
|
message(STATUS "Creating target: igl::${module_name} (${module_libname})")
|
|
|
add_library(igl::${module_name} ALIAS ${module_libname})
|
|
|
+ # Export as igl::${module_name}
|
|
|
+ set_property(TARGET ${module_libname} PROPERTY EXPORT_NAME ${module_name})
|
|
|
endfunction()
|
|
|
|
|
|
|
|
@@ -165,7 +162,6 @@ if(LIBIGL_USE_STATIC_LIBRARY)
|
|
|
"${LIBIGL_SOURCE_DIR}/igl/copyleft/*.cpp")
|
|
|
endif()
|
|
|
compile_igl_module("core" ${SOURCES_IGL})
|
|
|
-list(APPEND LIBIGL_ALL_MODULES igl)
|
|
|
|
|
|
################################################################################
|
|
|
## Compile the AntTweakBar part ###
|
|
@@ -176,8 +172,6 @@ if(LIBIGL_WITH_ANTTWEAKBAR)
|
|
|
endif()
|
|
|
compile_igl_module("anttweakbar")
|
|
|
target_link_libraries(igl_anttweakbar ${IGL_SCOPE} AntTweakBar)
|
|
|
- list(APPEND LIBIGL_ALL_MODULES anttweakbar)
|
|
|
- list(APPEND LIBIGL_INSTALL_HEADERS igl/anttweakbar)
|
|
|
endif()
|
|
|
|
|
|
################################################################################
|
|
@@ -198,8 +192,6 @@ if(LIBIGL_WITH_CGAL)
|
|
|
find_package(Boost 1.48 REQUIRED thread system)
|
|
|
target_include_directories(igl_cgal ${IGL_SCOPE} ${CGAL_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS})
|
|
|
target_link_libraries(igl_cgal ${IGL_SCOPE} CGAL::CGAL CGAL::CGAL_Core ${Boost_LIBRARIES})
|
|
|
- list(APPEND LIBIGL_ALL_MODULES igl_cgal)
|
|
|
- list(APPEND LIBIGL_INSTALL_HEADERS igl/copyleft/cgal)
|
|
|
else()
|
|
|
set(LIBIGL_WITH_CGAL OFF CACHE BOOL "" FORCE)
|
|
|
endif()
|
|
@@ -241,9 +233,6 @@ if(LIBIGL_WITH_COMISO)
|
|
|
add_subdirectory("${LIBIGL_EXTERNAL}/CoMISo" CoMISo)
|
|
|
endif()
|
|
|
target_link_libraries(igl_comiso ${IGL_SCOPE} CoMISo)
|
|
|
- # CoMISo does not get exported, so skip for now
|
|
|
- # list(APPEND LIBIGL_ALL_MODULES igl_comiso)
|
|
|
- # list(APPEND LIBIGL_INSTALL_HEADERS igl/copyleft/comiso)
|
|
|
endif()
|
|
|
|
|
|
################################################################################
|
|
@@ -259,8 +248,6 @@ if(LIBIGL_WITH_CORK)
|
|
|
target_include_directories(igl_cork ${IGL_SCOPE} cork)
|
|
|
target_include_directories(igl_cork ${IGL_SCOPE} "${CORK_DIR}/src")
|
|
|
target_link_libraries(igl_cork ${IGL_SCOPE} cork)
|
|
|
- list(APPEND LIBIGL_ALL_MODULES igl_cork)
|
|
|
- list(APPEND LIBIGL_INSTALL_HEADERS igl/copyleft/cork)
|
|
|
endif()
|
|
|
|
|
|
################################################################################
|
|
@@ -299,8 +286,6 @@ if(LIBIGL_WITH_EMBREE)
|
|
|
if(NOT MSVC)
|
|
|
target_compile_definitions(igl_embree ${IGL_SCOPE} -DENABLE_STATIC_LIB)
|
|
|
endif()
|
|
|
- # list(APPEND LIBIGL_ALL_MODULES igl_embree)
|
|
|
- # list(APPEND LIBIGL_INSTALL_HEADERS igl/embree)
|
|
|
endif()
|
|
|
|
|
|
################################################################################
|
|
@@ -313,9 +298,6 @@ if(LIBIGL_WITH_LIM)
|
|
|
compile_igl_module("lim")
|
|
|
target_link_libraries(igl_lim ${IGL_SCOPE} lim)
|
|
|
target_include_directories(igl_lim ${IGL_SCOPE} ${LIM_DIR})
|
|
|
- # lim does not get exported, so skip for now
|
|
|
- # list(APPEND LIBIGL_ALL_MODULES igl_lim)
|
|
|
- # list(APPEND LIBIGL_INSTALL_HEADERS igl/lim)
|
|
|
endif()
|
|
|
|
|
|
################################################################################
|
|
@@ -325,8 +307,6 @@ if(LIBIGL_WITH_MATLAB)
|
|
|
compile_igl_module("matlab")
|
|
|
target_link_libraries(igl_matlab ${IGL_SCOPE} ${Matlab_LIBRARIES})
|
|
|
target_include_directories(igl_matlab ${IGL_SCOPE} ${Matlab_INCLUDE_DIRS})
|
|
|
- list(APPEND LIBIGL_ALL_MODULES igl_matlab)
|
|
|
- list(APPEND LIBIGL_INSTALL_HEADERS igl/matlab)
|
|
|
endif()
|
|
|
|
|
|
################################################################################
|
|
@@ -337,8 +317,6 @@ if(LIBIGL_WITH_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)
|
|
|
- list(APPEND LIBIGL_ALL_MODULES igl_mosek)
|
|
|
- list(APPEND LIBIGL_INSTALL_HEADERS igl/mosek)
|
|
|
endif()
|
|
|
|
|
|
################################################################################
|
|
@@ -356,10 +334,6 @@ if(LIBIGL_WITH_OPENGL)
|
|
|
add_subdirectory(${LIBIGL_EXTERNAL}/glad glad)
|
|
|
endif()
|
|
|
target_link_libraries(igl_opengl ${IGL_SCOPE} glad)
|
|
|
- # glad does not get exported, so skip for now
|
|
|
- # list(APPEND LIBIGL_ALL_MODULES igl_opengl)
|
|
|
- # list(APPEND LIBIGL_INSTALL_HEADERS igl/opengl)
|
|
|
- # list(APPEND LIBIGL_INSTALL_HEADERS igl/opengl2)
|
|
|
endif()
|
|
|
|
|
|
################################################################################
|
|
@@ -377,9 +351,6 @@ if(LIBIGL_WITH_OPENGL_GLFW)
|
|
|
add_subdirectory(${LIBIGL_EXTERNAL}/glfw glfw)
|
|
|
endif()
|
|
|
target_link_libraries(igl_opengl_glfw ${IGL_SCOPE} igl_opengl glfw)
|
|
|
- # glfw does not get exported, so skip for now
|
|
|
- # list(APPEND LIBIGL_ALL_MODULES igl_opengl_glfw)
|
|
|
- # list(APPEND LIBIGL_INSTALL_HEADERS igl/opengl/glfw)
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
@@ -394,8 +365,6 @@ if(LIBIGL_WITH_OPENGL_GLFW_IMGUI)
|
|
|
add_subdirectory(${LIBIGL_EXTERNAL}/imgui imgui)
|
|
|
endif()
|
|
|
target_link_libraries(igl_opengl_glfw_imgui ${IGL_SCOPE} igl_opengl_glfw imgui)
|
|
|
- # list(APPEND LIBIGL_ALL_MODULES igl_opengl_glfw_imgui)
|
|
|
- # list(APPEND LIBIGL_INSTALL_HEADERS igl/opengl/glfw/imgui)
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
@@ -411,9 +380,6 @@ if(LIBIGL_WITH_PNG)
|
|
|
endif()
|
|
|
compile_igl_module("png" "")
|
|
|
target_link_libraries(igl_png ${IGL_SCOPE} igl_stb_image igl_opengl)
|
|
|
- # igl_std_image does not get exported, so skip for now
|
|
|
- # list(APPEND LIBIGL_ALL_MODULES igl_png)
|
|
|
- # list(APPEND LIBIGL_INSTALL_HEADERS igl/png)
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
@@ -427,9 +393,6 @@ if(LIBIGL_WITH_TETGEN)
|
|
|
compile_igl_module("tetgen")
|
|
|
target_link_libraries(igl_tetgen ${IGL_SCOPE} tetgen)
|
|
|
target_include_directories(igl_tetgen ${IGL_SCOPE} ${TETGEN_DIR})
|
|
|
- # tetget does not get exported, so skip for now
|
|
|
- # list(APPEND LIBIGL_ALL_MODULES igl_tetgen)
|
|
|
- # list(APPEND LIBIGL_INSTALL_HEADERS igl/copyleft/tetgen)
|
|
|
endif()
|
|
|
|
|
|
################################################################################
|
|
@@ -442,9 +405,6 @@ if(LIBIGL_WITH_TRIANGLE)
|
|
|
compile_igl_module("triangle")
|
|
|
target_link_libraries(igl_triangle ${IGL_SCOPE} triangle)
|
|
|
target_include_directories(igl_triangle ${IGL_SCOPE} ${TRIANGLE_DIR})
|
|
|
- # triangle does not get exported, so skip for now
|
|
|
- # list(APPEND LIBIGL_ALL_MODULES igl_triangle)
|
|
|
- # list(APPEND LIBIGL_INSTALL_HEADERS igl/triangle)
|
|
|
endif()
|
|
|
|
|
|
################################################################################
|
|
@@ -461,45 +421,85 @@ if(LIBIGL_WITH_XML)
|
|
|
compile_igl_module("xml")
|
|
|
target_link_libraries(igl_xml ${IGL_SCOPE} tinyxml2)
|
|
|
target_include_directories(igl_xml ${IGL_SCOPE} ${TINYXML2_DIR})
|
|
|
- # tinyxml2 does not get exported, so skip for now
|
|
|
- # list(APPEND LIBIGL_ALL_MODULES igl_xml)
|
|
|
- # list(APPEND LIBIGL_INSTALL_HEADERS igl/xml)
|
|
|
endif()
|
|
|
|
|
|
################################################################################
|
|
|
### Install and export all modules
|
|
|
|
|
|
+function(install_dir_files dir_name)
|
|
|
+ if (dir_name STREQUAL "core")
|
|
|
+ set(subpath "")
|
|
|
+ else()
|
|
|
+ set(subpath "/${dir_name}")
|
|
|
+ endif()
|
|
|
+
|
|
|
+ file(GLOB public_headers
|
|
|
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/igl${subpath}/*.h
|
|
|
+ )
|
|
|
+
|
|
|
+ set(files_to_install ${public_headers})
|
|
|
+
|
|
|
+ if(NOT LIBIGL_USE_STATIC_LIBRARY)
|
|
|
+ file(GLOB public_sources
|
|
|
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/igl${subpath}/*.cpp
|
|
|
+ )
|
|
|
+ endif()
|
|
|
+ list(APPEND files_to_install ${public_sources})
|
|
|
+
|
|
|
+ install(
|
|
|
+ FILES ${files_to_install}
|
|
|
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/igl${subpath}
|
|
|
+ )
|
|
|
+endfunction()
|
|
|
+
|
|
|
+################################################################################
|
|
|
+
|
|
|
include(GNUInstallDirs)
|
|
|
+include(CMakePackageConfigHelpers)
|
|
|
|
|
|
-install(TARGETS ${LIBIGL_ALL_MODULES} EXPORT igl-export
|
|
|
+# Install and export core library
|
|
|
+install(
|
|
|
+ TARGETS
|
|
|
+ igl
|
|
|
+ igl_common
|
|
|
+ EXPORT igl-export
|
|
|
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
)
|
|
|
-
|
|
|
-foreach(HEADERS ${LIBIGL_INSTALL_HEADERS})
|
|
|
- file(GLOB HEADER_FILES "${CMAKE_CURRENT_SOURCE_DIR}/../include/${HEADERS}/*.h")
|
|
|
- install(
|
|
|
- FILES ${HEADER_FILES}
|
|
|
- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${HEADERS}
|
|
|
- )
|
|
|
-endforeach(HEADERS)
|
|
|
-
|
|
|
-install(EXPORT igl-export NAMESPACE igl::
|
|
|
- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/igl/cmake
|
|
|
+export(
|
|
|
+ TARGETS
|
|
|
+ igl
|
|
|
+ igl_common
|
|
|
+ NAMESPACE igl::
|
|
|
+ FILE libigl-export.cmake
|
|
|
)
|
|
|
-export(TARGETS ${LIBIGL_ALL_MODULES} NAMESPACE igl:: FILE igl-export.cmake)
|
|
|
|
|
|
-# Write and install package configuration file
|
|
|
-include(CMakePackageConfigHelpers)
|
|
|
+# Install headers for core library
|
|
|
+install_dir_files(core)
|
|
|
+install_dir_files(copyleft)
|
|
|
+
|
|
|
+# Write package configuration file
|
|
|
configure_package_config_file(
|
|
|
${CMAKE_CURRENT_LIST_DIR}/libigl-config.cmake.in
|
|
|
- ${CMAKE_CURRENT_BINARY_DIR}/libigl-config.cmake
|
|
|
- INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/igl/cmake
|
|
|
+ ${CMAKE_BINARY_DIR}/libigl-config.cmake
|
|
|
+ INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/libigl/cmake
|
|
|
+)
|
|
|
+install(
|
|
|
+ FILES
|
|
|
+ ${CMAKE_BINARY_DIR}/libigl-config.cmake
|
|
|
+ DESTINATION
|
|
|
+ ${CMAKE_INSTALL_DATADIR}/libigl/cmake
|
|
|
)
|
|
|
-install(FILES
|
|
|
- ${CMAKE_CURRENT_BINARY_DIR}/libigl-config.cmake
|
|
|
- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/igl/cmake
|
|
|
+
|
|
|
+# Write export file
|
|
|
+export(EXPORT igl-export
|
|
|
+ FILE "${CMAKE_BINARY_DIR}/libigl-export.cmake"
|
|
|
+ NAMESPACE igl::
|
|
|
)
|
|
|
+install(EXPORT igl-export DESTINATION ${CMAKE_INSTALL_DATADIR}/libigl/cmake FILE libigl-export.cmake)
|
|
|
+
|
|
|
+
|
|
|
+export(PACKAGE libigl)
|
|
|
|