From 866fc767bb129b042669bc5a50deb98cd0cc5218 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Fri, 28 Jul 2023 19:30:49 +0200 Subject: [PATCH] Integrating LibBGCode into deps with an optional var for source dir One can then co-develop the two projects with relative convenience --- deps/CMakeLists.txt | 9 +++++++-- deps/LibBGCode/LibBGCode.cmake | 24 ++++++++++++++++++++++++ src/libslic3r/CMakeLists.txt | 3 +++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 deps/LibBGCode/LibBGCode.cmake diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index b00f85ba70..1008707d78 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -20,8 +20,8 @@ # therefore, unfortunatelly, the installation cannot be copied/moved elsewhere without re-installing wxWidgets. # +cmake_minimum_required(VERSION 3.10) project(PrusaSlicer-deps) -cmake_minimum_required(VERSION 3.2) include(ExternalProject) include(ProcessorCount) @@ -62,6 +62,8 @@ if (NOT _is_multi AND NOT CMAKE_BUILD_TYPE) message(STATUS "Forcing CMAKE_BUILD_TYPE to Release as it was not specified.") endif () +cmake_policy(SET CMP0135 NEW) + function(prusaslicer_add_cmake_project projectname) cmake_parse_arguments(P_ARGS "" "INSTALL_DIR;BUILD_COMMAND;INSTALL_COMMAND" "CMAKE_ARGS" ${ARGN}) @@ -195,6 +197,8 @@ include(NanoSVG/NanoSVG.cmake) include(wxWidgets/wxWidgets.cmake) include(OCCT/OCCT.cmake) +include(LibBGCode/LibBGCode.cmake) + set(_dep_list dep_Boost dep_TBB @@ -206,10 +210,11 @@ set(_dep_list dep_OpenCSG dep_CGAL dep_Qhull - dep_OCCT + # dep_OCCT ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} + dep_LibBGCode ) # if (NOT MSVC) diff --git a/deps/LibBGCode/LibBGCode.cmake b/deps/LibBGCode/LibBGCode.cmake new file mode 100644 index 0000000000..6ecd5ee725 --- /dev/null +++ b/deps/LibBGCode/LibBGCode.cmake @@ -0,0 +1,24 @@ +set(LibBGCode_SOURCE_DIR "" CACHE PATH "Optionally specify local LibBGCode source directory") + +set(_source_dir_line "URL;https://github.com/prusa3d/libbgcode/archive/refs/heads/main.zip") + +if (LibBGCode_SOURCE_DIR) + set(_source_dir_line "SOURCE_DIR;${LibBGCode_SOURCE_DIR};BUILD_ALWAYS;ON") +endif () + +prusaslicer_add_cmake_project(LibBGCode_deps + ${_source_dir_line} + SOURCE_SUBDIR deps + CMAKE_ARGS + -DDEP_DOWNLOAD_DIR:PATH=${DEP_DOWNLOAD_DIR} + -DLibBGCode_Deps_SELECT_ALL:BOOL=OFF + -DLibBGCode_Deps_SELECT_heatshrink:BOOL=ON + -DDESTDIR=${DESTDIR} +) + +prusaslicer_add_cmake_project(LibBGCode + ${_source_dir_line} + DEPENDS dep_LibBGCode_deps + CMAKE_ARGS + -DLibBGCode_BUILD_TESTS:BOOL=OFF +) \ No newline at end of file diff --git a/src/libslic3r/CMakeLists.txt b/src/libslic3r/CMakeLists.txt index 0de0b4e517..f11986d314 100644 --- a/src/libslic3r/CMakeLists.txt +++ b/src/libslic3r/CMakeLists.txt @@ -14,6 +14,8 @@ if (TARGET OpenVDB::openvdb) set(OpenVDBUtils_SOURCES OpenVDBUtils.cpp OpenVDBUtils.hpp OpenVDBUtilsLegacy.hpp) endif() +find_package(LibBGCode REQUIRED COMPONENTS Convert) + set(SLIC3R_SOURCES pchheader.cpp pchheader.hpp @@ -508,6 +510,7 @@ target_link_libraries(libslic3r ZLIB::ZLIB JPEG::JPEG qoi + LibBGCode::bgcode_convert ) if (APPLE)