From 75bb11678e0ee4ecd6f1b21f4b436abbb04955b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jack=C2=B7Boos=C2=B7Yu?= <47264268+JackBoosY@users.noreply.github.com> Date: Sat, 1 Aug 2020 16:12:24 -0700 Subject: [PATCH] [libigl] Fix configure error and dependencies (#10252) * [libigl] Fix configure error and dependencies * convert patch EOL * [libigl] Update to 2.2.0 * Update ports/libigl/CONTROL Co-authored-by: nicole mazzuca Co-authored-by: nicole mazzuca --- ports/libigl/CONTROL | 15 +--- ports/libigl/fix-dependency.patch | 128 ++++++++++++++---------------- ports/libigl/portfile.cmake | 23 +++--- 3 files changed, 75 insertions(+), 91 deletions(-) diff --git a/ports/libigl/CONTROL b/ports/libigl/CONTROL index 90c5313fbd..496f735700 100644 --- a/ports/libigl/CONTROL +++ b/ports/libigl/CONTROL @@ -1,8 +1,9 @@ Source: libigl -Version: 2.1.0-2 +Version: 2.2.0 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 +Supports: !(arm|uwp) Feature: embree Description: Build with embree @@ -20,18 +21,6 @@ Feature: imgui Description: Build with imgui Build-Depends: imgui[bindings] -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 \ No newline at end of file diff --git a/ports/libigl/fix-dependency.patch b/ports/libigl/fix-dependency.patch index 06e3d0f7d0..e891e341ef 100644 --- a/ports/libigl/fix-dependency.patch +++ b/ports/libigl/fix-dependency.patch @@ -1,47 +1,51 @@ +diff --git a/cmake/LibiglWindows.cmake b/cmake/LibiglWindows.cmake +index b98aa55..46c68a7 100644 +--- a/cmake/LibiglWindows.cmake ++++ b/cmake/LibiglWindows.cmake +@@ -1,4 +1,4 @@ +-if(MSVC) ++if(0) + option(IGL_STATIC_RUNTIME "Use libigl with the static MSVC runtime." OFF) + if(IGL_STATIC_RUNTIME) + message(STATUS "MSVC -> forcing use of statically-linked runtime.") diff --git a/cmake/libigl.cmake b/cmake/libigl.cmake -index 7016cbf..3a6b4dd 100644 +index d07bbb3..a33cefa 100644 --- a/cmake/libigl.cmake +++ b/cmake/libigl.cmake -@@ -96,8 +96,9 @@ if(UNIX) +@@ -107,7 +107,8 @@ if(HUNTER_ENABLED) 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() +-if(NOT TARGET Eigen3::Eigen) ++find_package(Eigen3 CONFIG REQUIRED) ++if(0) igl_download_eigen() -@@ -182,7 +183,7 @@ compile_igl_module("core" ${SOURCES_IGL}) + add_library(igl_eigen INTERFACE) + target_include_directories(igl_eigen SYSTEM INTERFACE +@@ -296,9 +297,9 @@ endif() ################################################################################ - ### 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() + ### Compile the embree part ### + if(LIBIGL_WITH_EMBREE) +- set(EMBREE_DIR "${LIBIGL_EXTERNAL}/embree") ++ find_package(embree 3 CONFIG REQUIRED) - 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) + + set(EMBREE_TESTING_INTENSITY 0 CACHE STRING "") +@@ -315,8 +316,8 @@ 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_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}) target_compile_definitions(igl_embree ${IGL_SCOPE} -DEMBREE_STATIC_LIB) endif() -@@ -332,11 +334,12 @@ if(LIBIGL_WITH_OPENGL) + +@@ -358,11 +359,12 @@ if(LIBIGL_WITH_OPENGL) endif() # glad module @@ -56,17 +60,17 @@ index 7016cbf..3a6b4dd 100644 endif() ################################################################################ -@@ -345,7 +348,8 @@ if(LIBIGL_WITH_OPENGL_GLFW) +@@ -371,7 +373,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) + igl_download_glfw() + option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF) + option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF) +@@ -394,11 +397,12 @@ if(LIBIGL_WITH_OPENGL_GLFW_IMGUI) if(TARGET igl::opengl_glfw) # ImGui module compile_igl_module("opengl/glfw/imgui") @@ -74,12 +78,14 @@ index 7016cbf..3a6b4dd 100644 + 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) + add_subdirectory(${LIBIGL_EXTERNAL}/libigl-imgui imgui) endif() - target_link_libraries(igl_opengl_glfw_imgui ${IGL_SCOPE} igl_opengl_glfw imgui) +- target_link_libraries(igl_opengl_glfw_imgui ${IGL_SCOPE} igl_opengl_glfw imgui) ++ target_link_libraries(igl_opengl_glfw_imgui ${IGL_SCOPE} igl_opengl_glfw imgui::imgui) endif() -@@ -377,12 +382,21 @@ if(LIBIGL_WITH_PNG) + endif() + +@@ -408,12 +412,22 @@ 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) @@ -87,6 +93,7 @@ index 7016cbf..3a6b4dd 100644 + find_path(stb_include_dir stb.h) + find_package(opengl REQUIRED) + find_package(libpng CONFIG REQUIRED) ++ find_package(glad CONFIG REQUIRED) + if (BUILD_SHARED_LIBS) + set(libpng_LIBRARIES png) + else() @@ -98,12 +105,12 @@ index 7016cbf..3a6b4dd 100644 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}) ++ target_include_directories(igl_png INTERFACE ${stb_include_dir}) ++ target_link_libraries(igl_png ${IGL_SCOPE} OpenGL::GL ${libpng_LIBRARIES} glad::glad) endif() endif() -@@ -430,7 +444,8 @@ endif() +@@ -461,7 +475,8 @@ endif() ### Compile the xml part ### if(LIBIGL_WITH_XML) set(TINYXML2_DIR "${LIBIGL_EXTERNAL}/tinyxml2") @@ -113,7 +120,7 @@ index 7016cbf..3a6b4dd 100644 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) +@@ -471,7 +486,7 @@ if(LIBIGL_WITH_XML) SOVERSION "3") endif() compile_igl_module("xml") @@ -136,20 +143,26 @@ index 1d3e3bc..682b6d7 100644 #include #include diff --git a/include/igl/opengl/glfw/imgui/ImGuiMenu.cpp b/include/igl/opengl/glfw/imgui/ImGuiMenu.cpp -index 3939b03..835b208 100644 +index 47de487..6c607de 100644 --- a/include/igl/opengl/glfw/imgui/ImGuiMenu.cpp +++ b/include/igl/opengl/glfw/imgui/ImGuiMenu.cpp -@@ -9,7 +9,7 @@ +@@ -9,10 +9,10 @@ #include "ImGuiMenu.h" #include "ImGuiHelpers.h" #include -#include +-#include +-#include +-#include +#include - #include - #include - #include ++#include ++#include ++#include + #include + #include + //////////////////////////////////////////////////////////////////////////////// diff --git a/include/igl/opengl/glfw/imgui/ImGuiTraits.h b/include/igl/opengl/glfw/imgui/ImGuiTraits.h -index fbc892f..e8828b1 100644 +index 7dae22a..e6911c5 100644 --- a/include/igl/opengl/glfw/imgui/ImGuiTraits.h +++ b/include/igl/opengl/glfw/imgui/ImGuiTraits.h @@ -8,7 +8,7 @@ @@ -161,30 +174,11 @@ index fbc892f..e8828b1 100644 // 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 +index 273324d..cefbd52 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt -@@ -11,16 +11,14 @@ else() - endif() - - ### Download data --igl_download_test_data() +@@ -15,12 +15,11 @@ igl_download_test_data() set(IGL_TEST_DATA ${LIBIGL_EXTERNAL}/../tests/data) ### Download Catch2 unit test framework @@ -199,7 +193,7 @@ index 8a0af13..5c6a350 100644 # Create test executable diff --git a/tutorial/106_ViewerMenu/main.cpp b/tutorial/106_ViewerMenu/main.cpp -index 09f3272..9e1a19d 100644 +index cc514e5..f1be538 100644 --- a/tutorial/106_ViewerMenu/main.cpp +++ b/tutorial/106_ViewerMenu/main.cpp @@ -2,7 +2,7 @@ diff --git a/ports/libigl/portfile.cmake b/ports/libigl/portfile.cmake index 6407ca8126..d3e342b5b6 100644 --- a/ports/libigl/portfile.cmake +++ b/ports/libigl/portfile.cmake @@ -1,10 +1,12 @@ 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 - REF f6b406427400ed7ddb56cfc2577b6af571827c8c #2.1.0 - SHA512 262f0b16e6c018d86d11a7cc90f8f4f8088fa7190634a7cd5cc392ebdefe47e2218b4f9276e411498ae0001d66d0207f4108c87c5090e3a39df4a2760930e945 + REF 3cb4894eaf8ea4610467189ca292be349425d44b #2.2.0 + SHA512 339f96e36b6a99ae8301ec2e234e18cecba7b7c42289ed68a26c20b279dce3135405f9b49e292c321fba962d56c083ae61831057bec9a19ad1495e2afa379b8b HEAD_REF master PATCHES fix-dependency.patch ) @@ -14,10 +16,9 @@ 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}") +if ("imgui" IN_LIST FEATURES AND VCPKG_LIBRARY_LINKAGE STREQUAL static) + # Remove this after add port libigl-imgui + message(FATAL_ERROR "Feature imgui does not support static build currentlly") endif() if ("test" IN_LIST FEATURES AND NOT EXISTS ${SOURCE_PATH}/tests/data) @@ -37,10 +38,9 @@ vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS opengl LIBIGL_WITH_OPENGL glfw LIBIGL_WITH_OPENGL_GLFW imgui LIBIGL_WITH_OPENGL_GLFW_IMGUI - png LIBIGL_WITH_PNG + #png LIBIGL_WITH_PNG # Disable this feature due to issue https://github.com/libigl/libigl/issues/1199 xml LIBIGL_WITH_XML - python LIBIGL_WITH_PYTHON - test LIBIGL_BUILD_TESTS + #python LIBIGL_WITH_PYTHON # Python binding are in the process of being redone. ) vcpkg_configure_cmake( @@ -55,7 +55,9 @@ vcpkg_configure_cmake( -DLIBIGL_WITH_TRIANGLE=OFF -DLIBIGL_WITH_PREDICATES=OFF -DLIBIGL_BUILD_TUTORIALS=OFF - -DPYTHON_EXECUTABLE=${PYTHON2} + -DLIBIGL_WITH_PNG=OFF + -DLIBIGL_BUILD_TESTS=OFF + -DPYTHON_EXECUTABLE=${PYTHON2} ) vcpkg_install_cmake() @@ -70,4 +72,3 @@ 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) -