mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-28 05:39:40 +08:00
[libigl]Add port libigl, add features. (#8607)
* [libigl]Add port libigl, add features. * [libigl]Re-generate patch. * Trigger CI. * [libigl]Correct homepage.
This commit is contained in:
parent
cd2c2c8081
commit
4f30616769
37
ports/libigl/CONTROL
Normal file
37
ports/libigl/CONTROL
Normal file
@ -0,0 +1,37 @@
|
||||
Source: libigl
|
||||
Version: 2.1.0-1
|
||||
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
|
||||
|
||||
Feature: embree
|
||||
Description: Build with embree
|
||||
Build-Depends: embree3
|
||||
|
||||
Feature: opengl
|
||||
Description: Build with opengl
|
||||
Build-Depends: opengl, glad
|
||||
|
||||
Feature: glfw
|
||||
Description: Build with glfw
|
||||
Build-Depends: glfw3
|
||||
|
||||
Feature: imgui
|
||||
Description: Build with imgui
|
||||
Build-Depends: imgui[example]
|
||||
|
||||
Feature: png
|
||||
Description: Build with libpng
|
||||
Build-Depends: libpng, stb
|
||||
|
||||
Feature: xml
|
||||
Description: Build with libxml
|
||||
Build-Depends: tinyxml2
|
||||
|
||||
Feature: python
|
||||
Description: Build with python bind
|
||||
Build-Depends: pybind11
|
||||
|
||||
Feature: test
|
||||
Description: Build test
|
||||
Build-Depends: catch2
|
213
ports/libigl/fix-dependency.patch
Normal file
213
ports/libigl/fix-dependency.patch
Normal file
@ -0,0 +1,213 @@
|
||||
diff --git a/cmake/libigl.cmake b/cmake/libigl.cmake
|
||||
index 7016cbf..3a6b4dd 100644
|
||||
--- a/cmake/libigl.cmake
|
||||
+++ b/cmake/libigl.cmake
|
||||
@@ -96,8 +96,9 @@ if(UNIX)
|
||||
endif()
|
||||
|
||||
# Eigen
|
||||
-if(TARGET Eigen3::Eigen)
|
||||
+if(1)
|
||||
# If an imported target already exists, use it
|
||||
+ find_package(Eigen3 CONFIG REQUIRED)
|
||||
target_link_libraries(igl_common INTERFACE Eigen3::Eigen)
|
||||
else()
|
||||
igl_download_eigen()
|
||||
@@ -182,7 +183,7 @@ compile_igl_module("core" ${SOURCES_IGL})
|
||||
################################################################################
|
||||
### Download the python part ###
|
||||
if(LIBIGL_WITH_PYTHON)
|
||||
- igl_download_pybind11()
|
||||
+ #igl_download_pybind11()
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
@@ -281,7 +282,8 @@ if(LIBIGL_WITH_EMBREE)
|
||||
set(EMBREE_STATIC_RUNTIME ON CACHE BOOL " " FORCE)
|
||||
endif()
|
||||
|
||||
- if(NOT TARGET embree)
|
||||
+ find_package(embree 3 CONFIG REQUIRED)
|
||||
+ if(0)
|
||||
# TODO: Should probably save/restore the CMAKE_CXX_FLAGS_*, since embree seems to be
|
||||
# overriding them on Windows. But well... it works for now.
|
||||
igl_download_embree()
|
||||
@@ -289,7 +291,7 @@ if(LIBIGL_WITH_EMBREE)
|
||||
endif()
|
||||
|
||||
compile_igl_module("embree")
|
||||
- target_link_libraries(igl_embree ${IGL_SCOPE} embree)
|
||||
+ target_link_libraries(igl_embree ${IGL_SCOPE} sys math simd embree)
|
||||
target_include_directories(igl_embree ${IGL_SCOPE} ${EMBREE_DIR}/include)
|
||||
target_compile_definitions(igl_embree ${IGL_SCOPE} -DEMBREE_STATIC_LIB)
|
||||
endif()
|
||||
@@ -332,11 +334,12 @@ if(LIBIGL_WITH_OPENGL)
|
||||
endif()
|
||||
|
||||
# glad module
|
||||
- if(NOT TARGET glad)
|
||||
+ find_package(glad CONFIG REQUIRED)
|
||||
+ if(0)
|
||||
igl_download_glad()
|
||||
add_subdirectory(${LIBIGL_EXTERNAL}/glad glad)
|
||||
endif()
|
||||
- target_link_libraries(igl_opengl ${IGL_SCOPE} glad)
|
||||
+ target_link_libraries(igl_opengl ${IGL_SCOPE} glad::glad)
|
||||
endif()
|
||||
|
||||
################################################################################
|
||||
@@ -345,7 +348,8 @@ if(LIBIGL_WITH_OPENGL_GLFW)
|
||||
if(TARGET igl::opengl)
|
||||
# GLFW module
|
||||
compile_igl_module("opengl/glfw")
|
||||
- if(NOT TARGET glfw)
|
||||
+ find_package(glfw3 CONFIG REQUIRED)
|
||||
+ if(0)
|
||||
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL " " FORCE)
|
||||
set(GLFW_BUILD_TESTS OFF CACHE BOOL " " FORCE)
|
||||
set(GLFW_BUILD_DOCS OFF CACHE BOOL " " FORCE)
|
||||
@@ -363,9 +367,10 @@ if(LIBIGL_WITH_OPENGL_GLFW_IMGUI)
|
||||
if(TARGET igl::opengl_glfw)
|
||||
# ImGui module
|
||||
compile_igl_module("opengl/glfw/imgui")
|
||||
- if(NOT TARGET imgui)
|
||||
+ find_package(imgui CONFIG REQUIRED)
|
||||
+ if(0)
|
||||
igl_download_imgui()
|
||||
- add_subdirectory(${LIBIGL_EXTERNAL}/libigl-imgui imgui)
|
||||
+ add_subdirectory(${LIBIGL_EXTERNAL}/libigl-imgui imgui::imgui)
|
||||
endif()
|
||||
target_link_libraries(igl_opengl_glfw_imgui ${IGL_SCOPE} igl_opengl_glfw imgui)
|
||||
endif()
|
||||
@@ -377,12 +382,21 @@ if(LIBIGL_WITH_PNG)
|
||||
# png/ module is anomalous because it also depends on opengl it really should
|
||||
# be moved into the opengl/ directory and namespace ...
|
||||
if(TARGET igl_opengl)
|
||||
- if(NOT TARGET stb_image)
|
||||
+ find_path(stb_include_dir stb.h)
|
||||
+ find_package(opengl REQUIRED)
|
||||
+ find_package(libpng CONFIG REQUIRED)
|
||||
+ if (BUILD_SHARED_LIBS)
|
||||
+ set(libpng_LIBRARIES png)
|
||||
+ else()
|
||||
+ set(libpng_LIBRARIES png_static)
|
||||
+ endif()
|
||||
+ if(0)
|
||||
igl_download_stb()
|
||||
add_subdirectory(${LIBIGL_EXTERNAL}/stb stb_image)
|
||||
endif()
|
||||
compile_igl_module("png" "")
|
||||
- target_link_libraries(igl_png ${IGL_SCOPE} igl_stb_image igl_opengl)
|
||||
+ target_include_directories(igl_png PUBLIC ${stb_include_dir})
|
||||
+ target_link_libraries(igl_png ${IGL_SCOPE} OpenGL::GL ${libpng_LIBRARIES})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -430,7 +444,8 @@ endif()
|
||||
### Compile the xml part ###
|
||||
if(LIBIGL_WITH_XML)
|
||||
set(TINYXML2_DIR "${LIBIGL_EXTERNAL}/tinyxml2")
|
||||
- if(NOT TARGET tinyxml2)
|
||||
+ find_package(tinyxml2 CONFIG REQUIRED)
|
||||
+ if(0)
|
||||
igl_download_tinyxml2()
|
||||
add_library(tinyxml2 STATIC ${TINYXML2_DIR}/tinyxml2.cpp ${TINYXML2_DIR}/tinyxml2.h)
|
||||
target_include_directories(tinyxml2 PUBLIC ${TINYXML2_DIR})
|
||||
@@ -440,7 +455,7 @@ if(LIBIGL_WITH_XML)
|
||||
SOVERSION "3")
|
||||
endif()
|
||||
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})
|
||||
endif()
|
||||
|
||||
diff --git a/include/igl/opengl/glfw/imgui/ImGuiHelpers.h b/include/igl/opengl/glfw/imgui/ImGuiHelpers.h
|
||||
index 1d3e3bc..682b6d7 100644
|
||||
--- a/include/igl/opengl/glfw/imgui/ImGuiHelpers.h
|
||||
+++ b/include/igl/opengl/glfw/imgui/ImGuiHelpers.h
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include "ImGuiTraits.h"
|
||||
-#include <imgui/imgui.h>
|
||||
+#include <imgui.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
diff --git a/include/igl/opengl/glfw/imgui/ImGuiMenu.cpp b/include/igl/opengl/glfw/imgui/ImGuiMenu.cpp
|
||||
index 3939b03..835b208 100644
|
||||
--- a/include/igl/opengl/glfw/imgui/ImGuiMenu.cpp
|
||||
+++ b/include/igl/opengl/glfw/imgui/ImGuiMenu.cpp
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "ImGuiMenu.h"
|
||||
#include "ImGuiHelpers.h"
|
||||
#include <igl/project.h>
|
||||
-#include <imgui/imgui.h>
|
||||
+#include <imgui.h>
|
||||
#include <imgui_impl_glfw.h>
|
||||
#include <imgui_impl_opengl3.h>
|
||||
#include <imgui_fonts_droid_sans.h>
|
||||
diff --git a/include/igl/opengl/glfw/imgui/ImGuiTraits.h b/include/igl/opengl/glfw/imgui/ImGuiTraits.h
|
||||
index fbc892f..e8828b1 100644
|
||||
--- a/include/igl/opengl/glfw/imgui/ImGuiTraits.h
|
||||
+++ b/include/igl/opengl/glfw/imgui/ImGuiTraits.h
|
||||
@@ -8,7 +8,7 @@
|
||||
#ifndef IGL_OPENGL_GLFW_IMGUI_IMGUITRAITS_H
|
||||
#define IGL_OPENGL_GLFW_IMGUI_IMGUITRAITS_H
|
||||
|
||||
-#include <imgui/imgui.h>
|
||||
+#include <imgui.h>
|
||||
|
||||
// Extend ImGui by populating its namespace directly
|
||||
namespace ImGui
|
||||
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
|
||||
index 7a14775..f5c84a8 100644
|
||||
--- a/python/CMakeLists.txt
|
||||
+++ b/python/CMakeLists.txt
|
||||
@@ -23,8 +23,8 @@ endif()
|
||||
# set(PYTHON_INCLUDE_DIR "/usr/local/Cellar/python3/3.5.0/Frameworks/Python.framework/Versions/3.5/include/python3.5m")
|
||||
|
||||
set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6 3.7)
|
||||
-find_package(PythonInterp 3.4 REQUIRED)
|
||||
-find_package(PythonLibs 3.4 REQUIRED)
|
||||
+find_package(PythonInterp REQUIRED)
|
||||
+find_package(PythonLibs REQUIRED)
|
||||
|
||||
## libigl
|
||||
if(NOT TARGET igl::core)
|
||||
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
|
||||
index 8a0af13..5c6a350 100644
|
||||
--- a/tests/CMakeLists.txt
|
||||
+++ b/tests/CMakeLists.txt
|
||||
@@ -11,16 +11,14 @@ else()
|
||||
endif()
|
||||
|
||||
### Download data
|
||||
-igl_download_test_data()
|
||||
set(IGL_TEST_DATA ${LIBIGL_EXTERNAL}/../tests/data)
|
||||
|
||||
### Download Catch2 unit test framework
|
||||
-igl_download_catch2()
|
||||
+find_package(Catch2 CONFIG REQUIRED)
|
||||
list(APPEND CMAKE_MODULE_PATH ${LIBIGL_EXTERNAL}/catch2/contrib)
|
||||
|
||||
|
||||
# Add catch2
|
||||
-add_subdirectory(${LIBIGL_EXTERNAL}/catch2 catch2)
|
||||
|
||||
|
||||
# Create test executable
|
||||
diff --git a/tutorial/106_ViewerMenu/main.cpp b/tutorial/106_ViewerMenu/main.cpp
|
||||
index 09f3272..9e1a19d 100644
|
||||
--- a/tutorial/106_ViewerMenu/main.cpp
|
||||
+++ b/tutorial/106_ViewerMenu/main.cpp
|
||||
@@ -2,7 +2,7 @@
|
||||
#include <igl/opengl/glfw/Viewer.h>
|
||||
#include <igl/opengl/glfw/imgui/ImGuiMenu.h>
|
||||
#include <igl/opengl/glfw/imgui/ImGuiHelpers.h>
|
||||
-#include <imgui/imgui.h>
|
||||
+#include <imgui.h>
|
||||
#include <iostream>
|
||||
#include "tutorial_shared_path.h"
|
||||
|
73
ports/libigl/portfile.cmake
Normal file
73
ports/libigl/portfile.cmake
Normal file
@ -0,0 +1,73 @@
|
||||
vcpkg_fail_port_install(ON_ARCH "arm" "arm64" ON_TARGET "uwp")
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO libigl/libigl
|
||||
REF f6b406427400ed7ddb56cfc2577b6af571827c8c #2.1.0
|
||||
SHA512 262f0b16e6c018d86d11a7cc90f8f4f8088fa7190634a7cd5cc392ebdefe47e2218b4f9276e411498ae0001d66d0207f4108c87c5090e3a39df4a2760930e945
|
||||
HEAD_REF master
|
||||
PATCHES fix-dependency.patch
|
||||
)
|
||||
|
||||
set(LIBIGL_BUILD_STATIC OFF)
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
set(LIBIGL_BUILD_STATIC ON)
|
||||
endif()
|
||||
|
||||
if ("python" IN_LIST FEATURES)
|
||||
vcpkg_find_acquire_program(PYTHON2)
|
||||
get_filename_component(PYTHON2_DIR ${PYTHON2} DIRECTORY)
|
||||
set(ENV{PATH} "$ENV{PATH};${PYTHON2_DIR}")
|
||||
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})
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH ${TEST_SOURCE_PATH}
|
||||
REPO libigl/libigl-tests-data
|
||||
REF 0689abc55bc12825e6c01ac77446f742839ff277
|
||||
SHA512 2b6aec21ed39a9fd534da86fff75eee0f94a3ea2db2fb9dd28974636cc34936341cc28dfcf3bb07cf79409124342717e001c529dc887da72c85fe314b0eb6ea6
|
||||
HEAD_REF master
|
||||
)
|
||||
endif()
|
||||
|
||||
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
|
||||
embree LIBIGL_WITH_EMBREE
|
||||
opengl LIBIGL_WITH_OPENGL
|
||||
glfw LIBIGL_WITH_OPENGL_GLFW
|
||||
imgui LIBIGL_WITH_OPENGL_GLFW_IMGUI
|
||||
png LIBIGL_WITH_PNG
|
||||
xml LIBIGL_WITH_XML
|
||||
python LIBIGL_WITH_PYTHON
|
||||
test LIBIGL_BUILD_TESTS
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS ${FEATURE_OPTIONS}
|
||||
-DLIBIGL_BUILD_PYTHON=OFF
|
||||
-DLIBIGL_EXPORT_TARGETS=ON
|
||||
-DLIBIGL_USE_STATIC_LIBRARY=${LIBIGL_BUILD_STATIC}
|
||||
-DLIBIGL_WITH_COMISO=OFF
|
||||
-DLIBIGL_WITH_TETGEN=OFF
|
||||
-DLIBIGL_WITH_TRIANGLE=OFF
|
||||
-DLIBIGL_WITH_PREDICATES=OFF
|
||||
-DLIBIGL_BUILD_TUTORIALS=OFF
|
||||
-DPYTHON_EXECUTABLE=${PYTHON2}
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH share/libigl/cmake)
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
if (NOT LIBIGL_BUILD_STATIC)
|
||||
# For dynamic build, libigl is a header-only library.
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug)
|
||||
endif()
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/LICENSE.GPL DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
|
||||
|
Loading…
Reference in New Issue
Block a user