mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-28 11:21:30 +00:00
deps: build libslvs as a dependency instead of vendoring it in src
Review request on PR #15238: "Move the SLVS to deps if the source code remains unmodified. If any changes were made to the source code, move it to deps_src." It is unmodified — all 20 files under src/libslic3r/slvs were byte-identical to JacobStoren/SolveSpaceLib@4d87045, the extraction of solvespace.com's libslvs. So deps/ it is, fetched by hash like every other dependency. Only the CMakeLists is ours: upstream's builds a demo executable and installs nothing, so deps/SLVS/CMakeLists.txt.in replaces it via PATCH_COMMAND — the same shape deps/OpenCSG already uses. The public header keeps its spelling, so SketchSolver.cpp still says `#include <slvs.h>` and needs no edit. The CI deps cache is keyed on hashFiles('deps/**'), so it rebuilds itself. Verified: dep_SLVS builds and installs, libslic3r links against SLVS::slvs, and the CAD suite is unchanged at 2518 assertions in 194 test cases.
This commit is contained in:
Vendored
+2
@@ -350,6 +350,7 @@ include(GLEW/GLEW.cmake)
|
||||
|
||||
include(GLFW/GLFW.cmake)
|
||||
include(OpenCSG/OpenCSG.cmake)
|
||||
include(SLVS/SLVS.cmake)
|
||||
|
||||
include(TBB/TBB.cmake)
|
||||
|
||||
@@ -436,6 +437,7 @@ set(_dep_list
|
||||
dep_NLopt
|
||||
dep_OpenVDB
|
||||
dep_OpenCSG
|
||||
dep_SLVS
|
||||
dep_OpenCV
|
||||
dep_Eigen
|
||||
dep_CGAL
|
||||
|
||||
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
# Replaces the upstream SolveSpaceLib CMakeLists, which builds a demo executable and
|
||||
# has no install rules. The sources themselves are used verbatim.
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
project(SLVS VERSION 3.0)
|
||||
|
||||
add_library(slvs
|
||||
libslvs/constrainteq.cpp
|
||||
libslvs/entity.cpp
|
||||
libslvs/expr.cpp
|
||||
libslvs/system.cpp
|
||||
libslvs/util.cpp
|
||||
libslvs/platform/unixutil.cpp
|
||||
libslvs/lib.cpp
|
||||
libslvs/SolveSpaceSystem.cpp)
|
||||
|
||||
target_compile_features(slvs PUBLIC cxx_std_11)
|
||||
|
||||
# LIBRARY strips the solver core out of the SolveSpace application it was extracted from.
|
||||
target_compile_definitions(slvs PRIVATE -DLIBRARY)
|
||||
if (MSVC)
|
||||
target_compile_definitions(slvs PRIVATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
|
||||
endif ()
|
||||
|
||||
target_include_directories(slvs
|
||||
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/libslvs/include>
|
||||
PRIVATE ${PROJECT_SOURCE_DIR}/libslvs)
|
||||
|
||||
# libslic3r is linked into shared targets, so this has to be position independent.
|
||||
set_target_properties(slvs PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
# 2018 code, predating the project's warning settings; it is not ours to clean up.
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
target_compile_options(slvs PRIVATE -w -fno-strict-aliasing)
|
||||
endif ()
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
VERSION ${PROJECT_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion)
|
||||
|
||||
install(TARGETS slvs
|
||||
EXPORT ${PROJECT_NAME}Targets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
|
||||
|
||||
install(EXPORT ${PROJECT_NAME}Targets
|
||||
FILE "${PROJECT_NAME}Config.cmake"
|
||||
NAMESPACE ${PROJECT_NAME}::
|
||||
DESTINATION ${ConfigPackageLocation})
|
||||
|
||||
install(FILES
|
||||
${PROJECT_SOURCE_DIR}/libslvs/include/slvs.h
|
||||
${PROJECT_SOURCE_DIR}/libslvs/include/SolveSpaceSystem.h
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
|
||||
DESTINATION ${ConfigPackageLocation})
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
# libslvs — the geometric constraint solver behind the Design tab's sketch constraints.
|
||||
# Extraction of solvespace.com's libslvs, taken verbatim from JacobStoren/SolveSpaceLib;
|
||||
# only the CMakeLists is ours, because upstream's builds a demo and installs nothing.
|
||||
# GPLv3, compatible with this fork's licence. Self-contained: no external dependencies.
|
||||
orcaslicer_add_cmake_project(SLVS
|
||||
URL https://github.com/JacobStoren/SolveSpaceLib/archive/4d8704523e4bf212fadf5189f92484244f670fea.zip
|
||||
URL_HASH SHA256=1c4bdde9c3c6ef20ea4b50b73601de56769f2eb131b36927d7c6489f102e6c30
|
||||
PATCH_COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt.in ./CMakeLists.txt
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
add_debug_dep(dep_SLVS)
|
||||
endif ()
|
||||
Reference in New Issue
Block a user