mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
Building igl statically and moving to the dep scripts
Fixing dep build script on Windows and removing some warnings. Use bundled igl by default. Not building with the dependency scripts if not explicitly stated. This way, it will stay in Fix the libigl patch to include C source files in header only mode.
This commit is contained in:
parent
89e39e3895
commit
2ae2672ee9
1095 changed files with 181 additions and 5 deletions
|
@ -89,8 +89,6 @@ enable_testing ()
|
|||
# Enable C++11 language standard.
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
||||
if(NOT WIN32)
|
||||
# Add DEBUG flags to debug builds.
|
||||
|
@ -172,7 +170,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STRE
|
|||
add_compile_options(-Werror=return-type)
|
||||
|
||||
#removes LOTS of extraneous Eigen warnings
|
||||
add_compile_options(-Wno-ignored-attributes)
|
||||
# add_compile_options(-Wno-ignored-attributes) # Tamas: Eigen include dirs are marked as SYSTEM
|
||||
|
||||
if (SLIC3R_ASAN)
|
||||
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
||||
|
@ -314,7 +312,7 @@ if (NOT Eigen3_FOUND)
|
|||
set(Eigen3_FOUND 1)
|
||||
set(EIGEN3_INCLUDE_DIR ${LIBDIR}/eigen/)
|
||||
endif ()
|
||||
include_directories(${EIGEN3_INCLUDE_DIR})
|
||||
include_directories(BEFORE SYSTEM ${EIGEN3_INCLUDE_DIR})
|
||||
|
||||
# Find expat or use bundled version
|
||||
# Always use the system libexpat on Linux.
|
||||
|
|
2
deps/CMakeLists.txt
vendored
2
deps/CMakeLists.txt
vendored
|
@ -35,6 +35,7 @@ set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination direct
|
|||
|
||||
option(DEP_DEBUG "Build debug variants (only applicable on Windows)" ON)
|
||||
option(DEP_WX_STABLE "Build against wxWidgets stable 3.0 as opposed to default 3.1 (Linux only)" OFF)
|
||||
option(DEP_BUILD_IGL_STATIC "Build IGL as a static library. Might cause link errors." OFF)
|
||||
|
||||
message(STATUS "PrusaSlicer deps DESTDIR: ${DESTDIR}")
|
||||
message(STATUS "PrusaSlicer deps debug build: ${DEP_DEBUG}")
|
||||
|
@ -99,6 +100,7 @@ else()
|
|||
dep_gtest
|
||||
dep_nlopt
|
||||
dep_qhull
|
||||
dep_libigl
|
||||
)
|
||||
|
||||
endif()
|
||||
|
|
30
deps/deps-unix-common.cmake
vendored
30
deps/deps-unix-common.cmake
vendored
|
@ -32,7 +32,6 @@ ExternalProject_Add(dep_nlopt
|
|||
-DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
|
||||
${DEP_CMAKE_OPTS}
|
||||
)
|
||||
|
||||
find_package(Git REQUIRED)
|
||||
|
||||
ExternalProject_Add(dep_qhull
|
||||
|
@ -45,3 +44,32 @@ ExternalProject_Add(dep_qhull
|
|||
${DEP_CMAKE_OPTS}
|
||||
PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/qhull-mods.patch
|
||||
)
|
||||
|
||||
ExternalProject_Add(dep_libigl
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/libigl/libigl/archive/v2.0.0.tar.gz"
|
||||
URL_HASH SHA256=42518e6b106c7209c73435fd260ed5d34edeb254852495b4c95dce2d95401328
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
|
||||
-DLIBIGL_BUILD_PYTHON=OFF
|
||||
-DLIBIGL_BUILD_TESTS=OFF
|
||||
-DLIBIGL_BUILD_TUTORIALS=OFF
|
||||
-DLIBIGL_USE_STATIC_LIBRARY=${DEP_BUILD_IGL_STATIC}
|
||||
-DLIBIGL_WITHOUT_COPYLEFT=OFF
|
||||
-DLIBIGL_WITH_CGAL=OFF
|
||||
-DLIBIGL_WITH_COMISO=OFF
|
||||
-DLIBIGL_WITH_CORK=OFF
|
||||
-DLIBIGL_WITH_EMBREE=OFF
|
||||
-DLIBIGL_WITH_MATLAB=OFF
|
||||
-DLIBIGL_WITH_MOSEK=OFF
|
||||
-DLIBIGL_WITH_OPENGL=OFF
|
||||
-DLIBIGL_WITH_OPENGL_GLFW=OFF
|
||||
-DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF
|
||||
-DLIBIGL_WITH_PNG=OFF
|
||||
-DLIBIGL_WITH_PYTHON=OFF
|
||||
-DLIBIGL_WITH_TETGEN=OFF
|
||||
-DLIBIGL_WITH_TRIANGLE=OFF
|
||||
-DLIBIGL_WITH_XML=OFF
|
||||
PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-fixes.patch
|
||||
)
|
||||
|
||||
|
|
45
deps/deps-windows.cmake
vendored
45
deps/deps-windows.cmake
vendored
|
@ -252,6 +252,51 @@ else ()
|
|||
set(DEP_WXWIDGETS_LIBDIR "vc_x64_lib")
|
||||
endif ()
|
||||
|
||||
find_package(Git REQUIRED)
|
||||
|
||||
ExternalProject_Add(dep_libigl
|
||||
EXCLUDE_FROM_ALL 1
|
||||
URL "https://github.com/libigl/libigl/archive/v2.0.0.tar.gz"
|
||||
URL_HASH SHA256=42518e6b106c7209c73435fd260ed5d34edeb254852495b4c95dce2d95401328
|
||||
CMAKE_GENERATOR "${DEP_MSVC_GEN}"
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr/local
|
||||
-DLIBIGL_BUILD_PYTHON=OFF
|
||||
-DLIBIGL_BUILD_TESTS=OFF
|
||||
-DLIBIGL_BUILD_TUTORIALS=OFF
|
||||
-DLIBIGL_USE_STATIC_LIBRARY=${DEP_BUILD_IGL_STATIC}
|
||||
-DLIBIGL_WITHOUT_COPYLEFT=OFF
|
||||
-DLIBIGL_WITH_CGAL=OFF
|
||||
-DLIBIGL_WITH_COMISO=OFF
|
||||
-DLIBIGL_WITH_CORK=OFF
|
||||
-DLIBIGL_WITH_EMBREE=OFF
|
||||
-DLIBIGL_WITH_MATLAB=OFF
|
||||
-DLIBIGL_WITH_MOSEK=OFF
|
||||
-DLIBIGL_WITH_OPENGL=OFF
|
||||
-DLIBIGL_WITH_OPENGL_GLFW=OFF
|
||||
-DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF
|
||||
-DLIBIGL_WITH_PNG=OFF
|
||||
-DLIBIGL_WITH_PYTHON=OFF
|
||||
-DLIBIGL_WITH_TETGEN=OFF
|
||||
-DLIBIGL_WITH_TRIANGLE=OFF
|
||||
-DLIBIGL_WITH_XML=OFF
|
||||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
-DCMAKE_DEBUG_POSTFIX=d
|
||||
PATCH_COMMAND ${GIT_EXECUTABLE} apply --ignore-space-change --ignore-whitespace ${CMAKE_CURRENT_SOURCE_DIR}/igl-fixes.patch
|
||||
BUILD_COMMAND msbuild /m /P:Configuration=Release INSTALL.vcxproj
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
|
||||
if (${DEP_DEBUG})
|
||||
ExternalProject_Get_Property(dep_libigl BINARY_DIR)
|
||||
ExternalProject_Add_Step(dep_libigl build_debug
|
||||
DEPENDEES build
|
||||
DEPENDERS install
|
||||
COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj
|
||||
WORKING_DIRECTORY "${BINARY_DIR}"
|
||||
)
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(dep_wxwidgets
|
||||
EXCLUDE_FROM_ALL 1
|
||||
GIT_REPOSITORY "https://github.com/prusa3d/wxWidgets"
|
||||
|
|
87
deps/igl-fixes.patch
vendored
Normal file
87
deps/igl-fixes.patch
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
diff --git a/cmake/libigl-config.cmake.in b/cmake/libigl-config.cmake.in
|
||||
index 317c745c..f9808e1e 100644
|
||||
--- a/cmake/libigl-config.cmake.in
|
||||
+++ b/cmake/libigl-config.cmake.in
|
||||
@@ -2,28 +2,28 @@
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/libigl-export.cmake)
|
||||
|
||||
-if (TARGET igl::core)
|
||||
- if (NOT TARGET Eigen3::Eigen)
|
||||
- find_package(Eigen3 QUIET)
|
||||
- if (NOT Eigen3_FOUND)
|
||||
- # try with PkgCOnfig
|
||||
- find_package(PkgConfig REQUIRED)
|
||||
- pkg_check_modules(Eigen3 QUIET IMPORTED_TARGET eigen3)
|
||||
- endif()
|
||||
-
|
||||
- if (NOT Eigen3_FOUND)
|
||||
- message(FATAL_ERROR "Could not find required dependency Eigen3")
|
||||
- set(libigl_core_FOUND FALSE)
|
||||
- else()
|
||||
- target_link_libraries(igl::core INTERFACE PkgConfig::Eigen3)
|
||||
- set(libigl_core_FOUND TRUE)
|
||||
- endif()
|
||||
- else()
|
||||
- target_link_libraries(igl::core INTERFACE Eigen3::Eigen)
|
||||
- set(libigl_core_FOUND TRUE)
|
||||
- endif()
|
||||
-
|
||||
-endif()
|
||||
+# if (TARGET igl::core)
|
||||
+# if (NOT TARGET Eigen3::Eigen)
|
||||
+# find_package(Eigen3 QUIET)
|
||||
+# if (NOT Eigen3_FOUND)
|
||||
+# # try with PkgCOnfig
|
||||
+# find_package(PkgConfig REQUIRED)
|
||||
+# pkg_check_modules(Eigen3 QUIET IMPORTED_TARGET eigen3)
|
||||
+# endif()
|
||||
+#
|
||||
+# if (NOT Eigen3_FOUND)
|
||||
+# message(FATAL_ERROR "Could not find required dependency Eigen3")
|
||||
+# set(libigl_core_FOUND FALSE)
|
||||
+# else()
|
||||
+# target_link_libraries(igl::core INTERFACE PkgConfig::Eigen3)
|
||||
+# set(libigl_core_FOUND TRUE)
|
||||
+# endif()
|
||||
+# else()
|
||||
+# target_link_libraries(igl::core INTERFACE Eigen3::Eigen)
|
||||
+# set(libigl_core_FOUND TRUE)
|
||||
+# endif()
|
||||
+#
|
||||
+# endif()
|
||||
|
||||
check_required_components(libigl)
|
||||
|
||||
diff --git a/cmake/libigl.cmake b/cmake/libigl.cmake
|
||||
index 4b11007a..47e6c395 100644
|
||||
--- a/cmake/libigl.cmake
|
||||
+++ b/cmake/libigl.cmake
|
||||
@@ -445,6 +445,7 @@ function(install_dir_files dir_name)
|
||||
if(NOT LIBIGL_USE_STATIC_LIBRARY)
|
||||
file(GLOB public_sources
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/igl${subpath}/*.cpp
|
||||
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/igl${subpath}/*.c
|
||||
)
|
||||
endif()
|
||||
list(APPEND files_to_install ${public_sources})
|
||||
diff --git a/include/igl/AABB.cpp b/include/igl/AABB.cpp
|
||||
index 09537335..31594314 100644
|
||||
--- a/include/igl/AABB.cpp
|
||||
+++ b/include/igl/AABB.cpp
|
||||
@@ -1072,4 +1072,5 @@ template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::init<Eigen
|
||||
template void igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 2>::init<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
|
||||
template double igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::squared_distance<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, double, int&, Eigen::PlainObjectBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> >&) const;
|
||||
template bool igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::intersect_ray<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, igl::Hit&) const;
|
||||
+template bool igl::AABB<Eigen::Matrix<double, -1, -1, 0, -1, -1>, 3>::intersect_ray<Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, Eigen::Matrix<double, 1, 3, 1, 1, 3> const&, std::vector<igl::Hit>&) const;
|
||||
#endif
|
||||
diff --git a/include/igl/ray_mesh_intersect.cpp b/include/igl/ray_mesh_intersect.cpp
|
||||
index 9a70a22b..dda1654b 100644
|
||||
--- a/include/igl/ray_mesh_intersect.cpp
|
||||
+++ b/include/igl/ray_mesh_intersect.cpp
|
||||
@@ -83,4 +83,5 @@ IGL_INLINE bool igl::ray_mesh_intersect(
|
||||
template bool igl::ray_mesh_intersect<Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, std::vector<igl::Hit, std::allocator<igl::Hit> >&);
|
||||
template bool igl::ray_mesh_intersect<Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<float, 3, 1, 0, 3, 1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<float, 3, 1, 0, 3, 1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, igl::Hit&);
|
||||
template bool igl::ray_mesh_intersect<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Block<Eigen::Matrix<int, -1, -1, 0, -1, -1> const, 1, -1, false> >(Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Block<Eigen::Matrix<int, -1, -1, 0, -1, -1> const, 1, -1, false> > const&, igl::Hit&);
|
||||
+template bool igl::ray_mesh_intersect<Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, 1, 3, 1, 1, 3>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Block<Eigen::Matrix<int, -1, -1, 0, -1, -1> const, 1, -1, false> >(Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, 1, 3, 1, 1, 3> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Block<Eigen::Matrix<int, -1, -1, 0, -1, -1> const, 1, -1, false> > const&, std::vector<igl::Hit, std::allocator<igl::Hit> >&);
|
||||
#endif
|
|
@ -12,6 +12,7 @@ add_subdirectory(poly2tri)
|
|||
add_subdirectory(qhull)
|
||||
add_subdirectory(Shiny)
|
||||
add_subdirectory(semver)
|
||||
add_subdirectory(libigl)
|
||||
|
||||
# Adding libnest2d project for bin packing...
|
||||
set(LIBNEST2D_UNITTESTS ON CACHE BOOL "Force generating unittests for libnest2d")
|
||||
|
|
14
src/libigl/CMakeLists.txt
Normal file
14
src/libigl/CMakeLists.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
project(libigl)
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
add_library(libigl INTERFACE)
|
||||
|
||||
find_package(libigl QUIET)
|
||||
|
||||
if(libigl_FOUND)
|
||||
message(STATUS "IGL found, using system version...")
|
||||
target_link_libraries(libigl INTERFACE igl::core)
|
||||
else()
|
||||
message(STATUS "IGL NOT found, using bundled version...")
|
||||
target_include_directories(libigl INTERFACE SYSTEM ${LIBDIR}/libigl)
|
||||
endif()
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue