aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabien Péan <fabien@pean.pro>2020-11-12 01:48:07 +0100
committerGitHub <noreply@github.com>2020-11-11 16:48:07 -0800
commit4b222f8d2653603b74fa5086cf0b02a1963d3911 (patch)
tree4cd4045ff485841645971227449f1a586f5d831a
parent54d35841b4657604e52636e485926ef535737b49 (diff)
downloadvcpkg-4b222f8d2653603b74fa5086cf0b02a1963d3911.tar.gz
vcpkg-4b222f8d2653603b74fa5086cf0b02a1963d3911.zip
[libigl] Fix dynamic build and enable header-only mode (#14376)
* [libigl] Fix dynamic build and enable header-only mode * Update portfile.cmake Co-authored-by: Lily <47812810+LilyWangL@users.noreply.github.com>
-rw-r--r--ports/libigl/CONTROL2
-rw-r--r--ports/libigl/fix-config.patch28
-rw-r--r--ports/libigl/fix-dependency.patch13
-rw-r--r--ports/libigl/install-extra-headers.patch32
-rw-r--r--ports/libigl/portfile.cmake8
5 files changed, 69 insertions, 14 deletions
diff --git a/ports/libigl/CONTROL b/ports/libigl/CONTROL
index a317fdb1b..0de66e027 100644
--- a/ports/libigl/CONTROL
+++ b/ports/libigl/CONTROL
@@ -1,6 +1,6 @@
Source: libigl
Version: 2.2.0
-Port-Version: 2
+Port-Version: 3
Homepage: https://github.com/libigl/libigl
Description: libigl is a simple C++ geometry processing library. We have a wide functionality including construction of sparse discrete differential geometry operators and finite-elements matrices such as the cotangent Laplacian and diagonalized mass matrix, simple facet and edge-based topology data structures, mesh-viewing utilities for OpenGL and GLSL, and many core functions for matrix manipulation which make Eigen feel a lot more like MATLAB.
Build-Depends: eigen3
diff --git a/ports/libigl/fix-config.patch b/ports/libigl/fix-config.patch
new file mode 100644
index 000000000..523569b05
--- /dev/null
+++ b/ports/libigl/fix-config.patch
@@ -0,0 +1,28 @@
+diff --git a/cmake/libigl-config.cmake.in b/cmake/libigl-config.cmake.in
+index 21aa2468..0aa6d8a0 100644
+--- a/cmake/libigl-config.cmake.in
++++ b/cmake/libigl-config.cmake.in
+@@ -27,5 +27,23 @@ if (TARGET igl::common)
+ endif()
+ endif()
+
++ include(CMakeFindDependencyMacro)
++if (TARGET igl::embree)
++ find_dependency(embree 3 CONFIG REQUIRED)
++endif()
++if (TARGET igl::xml)
++ find_dependency(tinyxml2 CONFIG REQUIRED)
++endif()
++if (TARGET igl::opengl)
++ find_dependency(OpenGL REQUIRED)
++ find_dependency(glad CONFIG REQUIRED)
++ if (TARGET igl::opengl_glfw)
++ find_dependency(glfw3 CONFIG REQUIRED)
++ if (TARGET igl::opengl_glfw_imgui)
++ find_dependency(imgui CONFIG REQUIRED)
++ endif()
++ endif()
++endif()
++
+ check_required_components(libigl)
+
diff --git a/ports/libigl/fix-dependency.patch b/ports/libigl/fix-dependency.patch
index fad85af0a..94ce7aea9 100644
--- a/ports/libigl/fix-dependency.patch
+++ b/ports/libigl/fix-dependency.patch
@@ -34,15 +34,17 @@ index d07bbb3..a33cefa 100644
igl_download_embree()
set(EMBREE_TESTING_INTENSITY 0 CACHE STRING "")
-@@ -315,8 +316,8 @@ if(LIBIGL_WITH_EMBREE)
+@@ -315,8 +315,11 @@ if(LIBIGL_WITH_EMBREE)
endif()
compile_igl_module("embree")
-- target_link_libraries(igl_embree ${IGL_SCOPE} embree)
+ target_link_libraries(igl_embree ${IGL_SCOPE} embree)
- target_include_directories(igl_embree ${IGL_SCOPE} ${EMBREE_DIR}/include)
-+ target_link_libraries(igl_embree ${IGL_SCOPE} ${EMBREE_LIBRARIES})
-+ target_include_directories(igl_embree ${IGL_SCOPE} ${EMBREE_INCLUDE_DIRS})
++ if(LIBIGL_USE_STATIC_LIBRARY)
++ find_package(TBB CONFIG REQUIRED)
++ target_link_libraries(igl_embree ${IGL_SCOPE} TBB::tbb)
target_compile_definitions(igl_embree ${IGL_SCOPE} -DEMBREE_STATIC_LIB)
++ endif()
endif()
@@ -358,11 +359,12 @@ if(LIBIGL_WITH_OPENGL)
@@ -126,7 +128,8 @@ index d07bbb3..a33cefa 100644
compile_igl_module("xml")
- target_link_libraries(igl_xml ${IGL_SCOPE} tinyxml2)
+ target_link_libraries(igl_xml ${IGL_SCOPE} tinyxml2::tinyxml2)
- target_include_directories(igl_xml ${IGL_SCOPE} ${TINYXML2_DIR})
+- target_include_directories(igl_xml ${IGL_SCOPE} ${TINYXML2_DIR})
++
endif()
diff --git a/include/igl/opengl/glfw/imgui/ImGuiHelpers.h b/include/igl/opengl/glfw/imgui/ImGuiHelpers.h
diff --git a/ports/libigl/install-extra-headers.patch b/ports/libigl/install-extra-headers.patch
index 736de152d..77ee2aa2a 100644
--- a/ports/libigl/install-extra-headers.patch
+++ b/ports/libigl/install-extra-headers.patch
@@ -2,13 +2,19 @@ diff --git a/cmake/libigl.cmake b/cmake/libigl.cmake
index a33cefa..0014375 100644
--- a/cmake/libigl.cmake
+++ b/cmake/libigl.cmake
-@@ -560,6 +560,55 @@ export(
+@@ -560,6 +560,85 @@ export(
# Install headers for core library
install_dir_files(core)
install_dir_files(copyleft)
+
+if (LIBIGL_WITH_EMBREE)
+ install_dir_files(embree)
++# if(NOT LIBIGL_USE_STATIC_LIBRARY)
++ install(TARGETS igl_embree EXPORT igl-export)
++ export(TARGETS igl_embree
++ APPEND FILE libigl-export.cmake EXPORT_LINK_INTERFACE_LIBRARIES
++ )
++# endif()
+endif()
+
+if (LIBIGL_WITH_CGAL)
@@ -30,14 +36,32 @@ index a33cefa..0014375 100644
+if (LIBIGL_WITH_OPENGL OR LIBIGL_WITH_OPENGL_GLFW OR LIBIGL_WITH_OPENGL_GLFW_IMGUI)
+ install_dir_files(copyleft/opengl2)
+ install_dir_files(opengl)
++# if(NOT LIBIGL_USE_STATIC_LIBRARY)
++ install(TARGETS igl_opengl EXPORT igl-export)
++ export(TARGETS igl_opengl
++ APPEND FILE libigl-export.cmake EXPORT_LINK_INTERFACE_LIBRARIES
++ )
++# endif()
+endif()
+
+if (LIBIGL_WITH_OPENGL_GLFW OR LIBIGL_WITH_OPENGL_GLFW_IMGUI)
+ install_dir_files(opengl/glfw)
++# if(NOT LIBIGL_USE_STATIC_LIBRARY)
++ install(TARGETS igl_opengl_glfw EXPORT igl-export)
++ export(TARGETS igl_opengl_glfw
++ APPEND FILE libigl-export.cmake EXPORT_LINK_INTERFACE_LIBRARIES
++ )
++# endif()
+endif()
+
+if (LIBIGL_WITH_OPENGL_GLFW_IMGUI)
+ install_dir_files(opengl/glfw/imgui)
++# if(NOT LIBIGL_USE_STATIC_LIBRARY)
++ install(TARGETS igl_opengl_glfw_imgui EXPORT igl-export)
++ export(TARGETS igl_opengl_glfw_imgui
++ APPEND FILE libigl-export.cmake EXPORT_LINK_INTERFACE_LIBRARIES
++ )
++# endif()
+endif()
+
+if (LIBIGL_WITH_PNG)
@@ -54,6 +78,12 @@ index a33cefa..0014375 100644
+
+if (LIBIGL_WITH_XML)
+ install_dir_files(xml)
++# if(NOT LIBIGL_USE_STATIC_LIBRARY)
++ install(TARGETS igl_xml EXPORT igl-export)
++ export(TARGETS igl_xml
++ APPEND FILE libigl-export.cmake EXPORT_LINK_INTERFACE_LIBRARIES
++ )
++# endif()
+endif()
# Write package configuration file
diff --git a/ports/libigl/portfile.cmake b/ports/libigl/portfile.cmake
index aa6d07a1a..46da1c039 100644
--- a/ports/libigl/portfile.cmake
+++ b/ports/libigl/portfile.cmake
@@ -1,7 +1,5 @@
vcpkg_fail_port_install(ON_ARCH "arm" "arm64" ON_TARGET "uwp")
-vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
-
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO libigl/libigl
@@ -12,6 +10,7 @@ vcpkg_from_github(
fix-dependency.patch
fix-imgui-set-cond.patch
install-extra-headers.patch
+ fix-config.patch
)
set(LIBIGL_BUILD_STATIC OFF)
@@ -19,11 +18,6 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(LIBIGL_BUILD_STATIC ON)
endif()
-if ("imgui" IN_LIST FEATURES AND NOT VCPKG_LIBRARY_LINKAGE STREQUAL static)
- # Remove this after add port libigl-imgui
- message(FATAL_ERROR "Feature imgui does not support non-static build currently")
-endif()
-
if ("test" IN_LIST FEATURES AND NOT EXISTS ${SOURCE_PATH}/tests/data)
set(TEST_SOURCE_PATH ${SOURCE_PATH}/tests/data)
file(MAKE_DIRECTORY ${TEST_SOURCE_PATH})