Feature/update deps (#3445)

* update deps

* fix win build errors

* fix mac build

* update linux

(cherry picked from commit 77b6225060fd1b6cbc32865b6397363befd2af1d)
This commit is contained in:
SoftFever 2024-01-04 06:50:11 +08:00
parent 1ea33f0919
commit 9d59cd66c4
16 changed files with 67 additions and 227 deletions

View file

@ -70,7 +70,7 @@ jobs:
if: inputs.os == 'macos-12' if: inputs.os == 'macos-12'
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
run: | run: |
brew install cmake git gettext automake brew install cmake git gettext automake texinfo
brew list brew list
mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }} mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }}
mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }}/OrcaSlicer_dep_${{ inputs.arch }} mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }}/OrcaSlicer_dep_${{ inputs.arch }}
@ -88,7 +88,7 @@ jobs:
libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules pkgconf \ libwayland-dev libxkbcommon-dev wayland-protocols extra-cmake-modules pkgconf \
libglu1-mesa-dev libcairo2-dev libgtk-3-dev libsoup2.4-dev libwebkit2gtk-4.0-dev \ libglu1-mesa-dev libcairo2-dev libgtk-3-dev libsoup2.4-dev libwebkit2gtk-4.0-dev \
libgstreamer1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-base1.0-dev \ libgstreamer1.0-dev libgstreamer-plugins-good1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-bad libosmesa6-dev wget sudo autoconf curl libunwind-dev gstreamer1.0-plugins-bad libosmesa6-dev wget sudo autoconf curl libunwind-dev texinfo
mkdir -p ${{ github.workspace }}/deps/build mkdir -p ${{ github.workspace }}/deps/build
mkdir -p ${{ github.workspace }}/deps/build/destdir mkdir -p ${{ github.workspace }}/deps/build/destdir
sudo ./BuildLinux.sh -ur sudo ./BuildLinux.sh -ur

View file

@ -78,7 +78,7 @@ then
fi fi
# Addtional Dev packages for OrcaSlicer # Addtional Dev packages for OrcaSlicer
export REQUIRED_DEV_PACKAGES="libmspack-dev libgstreamerd-3-dev libsecret-1-dev libwebkit2gtk-4.0-dev libosmesa6-dev libssl-dev libcurl4-openssl-dev eglexternalplatform-dev libudev-dev libdbus-1-dev extra-cmake-modules" export REQUIRED_DEV_PACKAGES="libmspack-dev libgstreamerd-3-dev libsecret-1-dev libwebkit2gtk-4.0-dev libosmesa6-dev libssl-dev libcurl4-openssl-dev eglexternalplatform-dev libudev-dev libdbus-1-dev extra-cmake-modules texinfo"
# libwebkit2gtk-4.1-dev ?? # libwebkit2gtk-4.1-dev ??
export DEV_PACKAGES_COUNT=$(echo ${REQUIRED_DEV_PACKAGES} | wc -w) export DEV_PACKAGES_COUNT=$(echo ${REQUIRED_DEV_PACKAGES} | wc -w)
if [ $(dpkg --get-selections | grep -E "$(echo ${REQUIRED_DEV_PACKAGES} | tr ' ' '|')" | wc -l) -lt ${DEV_PACKAGES_COUNT} ]; then if [ $(dpkg --get-selections | grep -E "$(echo ${REQUIRED_DEV_PACKAGES} | tr ' ' '|')" | wc -l) -lt ${DEV_PACKAGES_COUNT} ]; then

View file

@ -61,7 +61,6 @@ if (APPLE)
if (CMAKE_MACOSX_BUNDLE) if (CMAKE_MACOSX_BUNDLE)
set(CMAKE_INSTALL_RPATH @executable_path/../Frameworks) set(CMAKE_INSTALL_RPATH @executable_path/../Frameworks)
endif() endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE)
SET(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.softfever3d.orca-slicer") SET(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.softfever3d.orca-slicer")
message(STATUS "Orca: IS_CROSS_COMPILE: ${IS_CROSS_COMPILE}") message(STATUS "Orca: IS_CROSS_COMPILE: ${IS_CROSS_COMPILE}")
@ -316,7 +315,7 @@ if(WIN32)
add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
if(MSVC) if(MSVC)
# BOOST_ALL_NO_LIB: Avoid the automatic linking of Boost libraries on Windows. Rather rely on explicit linking. # BOOST_ALL_NO_LIB: Avoid the automatic linking of Boost libraries on Windows. Rather rely on explicit linking.
add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x601 -DBOOST_SYSTEM_USE_UTF8 ) add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x602 -DBOOST_SYSTEM_USE_UTF8 )
# Force the source code encoding to UTF-8. See OrcaSlicer GH pull request #5583 # Force the source code encoding to UTF-8. See OrcaSlicer GH pull request #5583
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>") add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>") add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")

View file

@ -65,11 +65,12 @@ Orca Slicer's logo is designed by community member Justin Levine(@freejstnalxndr
- Run `build_release.bat` in `x64 Native Tools Command Prompt for VS 2019` - Run `build_release.bat` in `x64 Native Tools Command Prompt for VS 2019`
- Mac 64-bit - Mac 64-bit
- Tools needed: Xcode, Cmake, git, gettext, libtool, automake, autoconf - Tools needed: Xcode, Cmake, git, gettext, libtool, automake, autoconf, texinfo
- You can install most of them by running `brew install cmake gettext libtool automake autoconf texinfo`
- run `build_release_macos.sh` - run `build_release_macos.sh`
- Ubuntu - Ubuntu
- Dependencies **Will be auto installed with the shell script**: `libmspack-dev libgstreamerd-3-dev libsecret-1-dev libwebkit2gtk-4.0-dev libosmesa6-dev libssl-dev libcurl4-openssl-dev eglexternalplatform-dev libudev-dev libdbus-1-dev extra-cmake-modules libgtk2.0-dev libglew-dev libudev-dev libdbus-1-dev cmake git` - Dependencies **Will be auto installed with the shell script**: `libmspack-dev libgstreamerd-3-dev libsecret-1-dev libwebkit2gtk-4.0-dev libosmesa6-dev libssl-dev libcurl4-openssl-dev eglexternalplatform-dev libudev-dev libdbus-1-dev extra-cmake-modules libgtk2.0-dev libglew-dev libudev-dev libdbus-1-dev cmake git texinfo`
- run 'sudo ./BuildLinux.sh -u' - run 'sudo ./BuildLinux.sh -u'
- run './BuildLinux.sh -dsir' - run './BuildLinux.sh -dsir'

216
deps/Boost/Boost.cmake vendored
View file

@ -1,203 +1,25 @@
include(ExternalProject)
# Use boost 1.78 for Windows, to support VS2022 set(_context_abi_line "")
if (WIN32) set(_context_arch_line "")
set(_boost_url "https://github.com/SoftFever/OrcaSlicer_deps/releases/download/boost/boost_1_78_0.tar.gz") if (APPLE AND CMAKE_OSX_ARCHITECTURES)
set(_boost_hash 94CED8B72956591C4775AE2207A9763D3600B30D9D7446562C552F0A14A63BE7) if (CMAKE_OSX_ARCHITECTURES MATCHES "x86")
set(_bootstrap_cmd bootstrap.bat) set(_context_abi_line "-DBOOST_CONTEXT_ABI:STRING=sysv")
set(_build_cmd b2.exe) elseif (CMAKE_OSX_ARCHITECTURES MATCHES "arm")
else() set (_context_abi_line "-DBOOST_CONTEXT_ABI:STRING=aapcs")
set(_boost_url "https://github.com/SoftFever/OrcaSlicer_deps/releases/download/boost/boost_1_75_0.tar.gz")
set(_boost_hash AEB26F80E80945E82EE93E5939BAEBDCA47B9DEE80A07D3144BE1E1A6A66DD6A)
set(_bootstrap_cmd ./bootstrap.sh)
set(_build_cmd ./b2)
endif()
set(_patch_command ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/common.jam ./tools/build/src/tools/common.jam)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
configure_file(${CMAKE_CURRENT_LIST_DIR}/user-config.jam boost-user-config.jam)
set(_boost_toolset gcc)
set(_patch_command ${_patch_command} && ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/boost-user-config.jam ./tools/build/src/tools/user-config.jam)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
if (MSVC_VERSION EQUAL 1800)
# 1800 = VS 12.0 (v120 toolset)
set(_boost_toolset "msvc-12.0")
elseif (MSVC_VERSION EQUAL 1900)
# 1900 = VS 14.0 (v140 toolset)
set(_boost_toolset "msvc-14.0")
elseif (MSVC_VERSION LESS 1920)
# 1910-1919 = VS 15.0 (v141 toolset)
set(_boost_toolset "msvc-14.1")
elseif (MSVC_VERSION LESS 1930)
# 1920-1929 = VS 16.0 (v142 toolset)
set(_boost_toolset "msvc-14.2")
elseif (MSVC_VERSION LESS 1940)
# 1930-1939 = VS 17.0 (v143 toolset)
set(_boost_toolset "msvc-14.3")
else ()
message(FATAL_ERROR "Unsupported MSVC version")
endif () endif ()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") set(_context_arch_line "-DBOOST_CONTEXT_ARCHITECTURE:STRING=${CMAKE_OSX_ARCHITECTURES}")
if (WIN32)
set(_boost_toolset "clang-win")
else()
set(_boost_toolset "clang")
endif()
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(_boost_toolset "intel")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(_boost_toolset "clang")
endif()
message(STATUS "Deduced boost toolset: ${_boost_toolset} based on ${CMAKE_CXX_COMPILER_ID} compiler")
set(_libs "")
foreach(_comp ${DEP_Boost_COMPONENTS})
list(APPEND _libs "--with-${_comp}")
endforeach()
if (BUILD_SHARED_LIBS)
set(_link shared)
else()
set(_link static)
endif()
set(_bits "")
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(_bits 64)
elseif ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
set(_bits 32)
endif () endif ()
include(ProcessorCount) orcaslicer_add_cmake_project(Boost
ProcessorCount(NPROC) URL "https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.gz"
file(TO_NATIVE_PATH ${DESTDIR}/usr/local/ _prefix) URL_HASH SHA256=4d27e9efed0f6f152dc28db6430b9d3dfb40c0345da7342eaa5a987dde57bd95
LIST_SEPARATOR |
CMAKE_ARGS
set(_boost_variants "") -DBOOST_EXCLUDE_LIBRARIES:STRING=contract|fiber|numpy|stacktrace|wave|test
if(CMAKE_BUILD_TYPE) -DBOOST_LOCALE_ENABLE_ICU:BOOL=OFF # do not link to libicu, breaks compatibility between distros
list(APPEND CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE}) -DBUILD_TESTING:BOOL=OFF
list(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES) "${_context_abi_line}"
endif() "${_context_arch_line}"
list(FIND CMAKE_CONFIGURATION_TYPES "Release" _cfg_rel)
list(FIND CMAKE_CONFIGURATION_TYPES "RelWithDebInfo" _cfg_relwdeb)
list(FIND CMAKE_CONFIGURATION_TYPES "MinSizeRel" _cfg_minsizerel)
list(FIND CMAKE_CONFIGURATION_TYPES "Debug" _cfg_deb)
if (_cfg_rel GREATER -1 OR _cfg_relwdeb GREATER -1 OR _cfg_minsizerel GREATER -1)
list(APPEND _boost_variants release)
endif()
if (MSVC AND ${DEP_DEBUG} )
list(APPEND _boost_variants debug)
endif()
if (NOT _boost_variants)
set(_boost_variants release)
endif()
if (IS_CROSS_COMPILE AND APPLE)
if (${CMAKE_OSX_ARCHITECTURES} MATCHES "arm")
message(STATUS "Compiling Boost for arm64.")
message(STATUS "Compiling Boost with toolset ${_boost_toolset}.")
message(STATUS "Compiling Boost with libs ${_libs}.")
message(STATUS "Compiling Boost with variant ${_boost_variants}.")
message(STATUS "Compiling Boost with _bootstrap_cmd ${_bootstrap_cmd}.")
message(STATUS "_boost_linkflags = ${_boost_linkflags}")
set(_arch_flags "-arch arm64")
set(_boost_linkflags "linkflags=${_arch_flags}")
message(STATUS "_cmake_args_osx_arch = '${_cmake_args_osx_arch}'")
elseif (${CMAKE_OSX_ARCHITECTURES} MATCHES "x86_64")
message(STATUS "Compiling Boost for x86_64.")
set(_arch_flags "-arch x86_64")
endif()
set(_boost_linkflags "linkflags=${_arch_flags}")
endif ()
set(_boost_flags "")
if(APPLE)
set(_boost_flags
"cflags=-fPIC ${_arch_flags} -mmacosx-version-min=${DEP_OSX_TARGET};"
"cxxflags=-fPIC ${_arch_flags} -mmacosx-version-min=${DEP_OSX_TARGET};"
"mflags=-fPIC ${_arch_flags} -mmacosx-version-min=${DEP_OSX_TARGET};"
"mmflags=-fPIC ${_arch_flags} -mmacosx-version-min=${DEP_OSX_TARGET}")
elseif (UNIX)
set(_boost_flags "cflags=-fPIC;cxxflags=-fPIC")
endif()
set(_build_cmd ${_build_cmd}
${_boost_flags}
${_boost_linkflags}
-j${NPROC}
${_libs}
--layout=versioned
--debug-configuration
toolset=${_boost_toolset}
address-model=${_bits}
link=${_link}
threading=multi
boost.locale.icu=off
--disable-icu
${_boost_variants}
stage)
set(_install_cmd ${_build_cmd} --prefix=${_prefix} install)
if (NOT IS_CROSS_COMPILE OR NOT APPLE OR BUILD_SHARED_LIBS)
message(STATUS "Standard boost build with bootstrap command '${_bootstrap_cmd}'")
message(STATUS "Standard boost build with patch command '${_patch_command}'")
message(STATUS "Standard boost build with build command '${_build_cmd}'")
message(STATUS "Standard boost build with install command '${_install_cmd}'")
ExternalProject_Add(
dep_Boost
URL ${_boost_url}
URL_HASH SHA256=${_boost_hash}
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/Boost
CONFIGURE_COMMAND "${_bootstrap_cmd}"
PATCH_COMMAND ${_patch_command}
BUILD_COMMAND "${_build_cmd}"
BUILD_IN_SOURCE ON
INSTALL_COMMAND "${_install_cmd}"
) )
else() set(DEP_Boost_DEPENDS ZLIB)
ExternalProject_Add(
dep_Boost
URL ${_boost_url}
URL_HASH SHA256=${_boost_hash}
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/Boost
CONFIGURE_COMMAND ./bootstrap.sh
--with-toolset=clang
--with-libraries=date_time,filesystem,iostreams,locale,log,regex,system,thread
"--prefix=${DESTDIR}/usr/local"
# PATCH_COMMAND ${_patch_command}
BUILD_COMMAND "${_build_cmd}"
BUILD_IN_SOURCE ON
INSTALL_COMMAND "${_install_cmd}"
)
endif()
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
message(STATUS "Patch the boost::polygon library with a custom one.")
# Patch the boost::polygon library with a custom one.
ExternalProject_Add(dep_boost_polygon
EXCLUDE_FROM_ALL ON
# GIT_REPOSITORY "https://github.com/prusa3d/polygon"
# GIT_TAG prusaslicer_gmp
URL https://github.com/prusa3d/polygon/archive/refs/heads/prusaslicer_gmp.zip
URL_HASH SHA256=abeb9710f0a7069fb9b22181ae5c56f6066002f125db210e7ffb27032aed6824
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/boost_polygon
DEPENDS dep_Boost
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
${_cmake_args_osx_arch}
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_CURRENT_BINARY_DIR}/dep_boost_polygon-prefix/src/dep_boost_polygon/include/boost/polygon"
"${DESTDIR}/usr/local/include/boost/polygon"
)
# Only override boost::Polygon Voronoi implementation with Vojtech's GMP hacks on 64bit platforms.
list(APPEND _dep_list "dep_boost_polygon")
endif ()

1
deps/CMakeLists.txt vendored
View file

@ -172,7 +172,6 @@ if (MSVC)
endif () endif ()
elseif (APPLE) elseif (APPLE)
message("OS X SDK Path: ${CMAKE_OSX_SYSROOT}") message("OS X SDK Path: ${CMAKE_OSX_SYSROOT}")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE)
if (CMAKE_OSX_DEPLOYMENT_TARGET) if (CMAKE_OSX_DEPLOYMENT_TARGET)
set(DEP_OSX_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}") set(DEP_OSX_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}")
message("OS X Deployment Target: ${DEP_OSX_TARGET}") message("OS X Deployment Target: ${DEP_OSX_TARGET}")

View file

@ -26,8 +26,8 @@ else ()
endif () endif ()
ExternalProject_Add(dep_MPFR ExternalProject_Add(dep_MPFR
URL http://ftp.vim.org/ftp/gnu/mpfr/mpfr-3.1.6.tar.bz2 https://www.mpfr.org/mpfr-3.1.6/mpfr-3.1.6.tar.bz2 # mirrors are allowed URL https://www.mpfr.org/mpfr-current/mpfr-4.2.1.tar.bz2
URL_HASH SHA256=cf4f4b2d80abb79e820e78c8077b6725bbbb4e8f41896783c899087be0e94068 URL_HASH SHA256=b9df93635b20e4089c29623b19420c4ac848a1b29df1cfd59f26cab0d2666aa0
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/MPFR DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/MPFR
BUILD_IN_SOURCE ON BUILD_IN_SOURCE ON
CONFIGURE_COMMAND autoreconf -f -i && CONFIGURE_COMMAND autoreconf -f -i &&

View file

@ -28,7 +28,7 @@
using namespace Slic3r; using namespace Slic3r;
#include "ExPolygonsIndex.hpp" #include "ExPolygonsIndex.hpp"
#include <boost/next_prior.hpp>
#include <CGAL/Polygon_mesh_processing/corefinement.h> #include <CGAL/Polygon_mesh_processing/corefinement.h>
#include <CGAL/Exact_integer.h> #include <CGAL/Exact_integer.h>
#include <CGAL/Surface_mesh.h> #include <CGAL/Surface_mesh.h>

View file

@ -31,7 +31,6 @@
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>
#include <boost/filesystem/string_file.hpp>
#include <boost/nowide/fstream.hpp> #include <boost/nowide/fstream.hpp>
#include <boost/nowide/cstdio.hpp> #include <boost/nowide/cstdio.hpp>
#include <boost/spirit/include/karma.hpp> #include <boost/spirit/include/karma.hpp>
@ -1290,9 +1289,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
model.set_backup_path(m_backup_path); model.set_backup_path(m_backup_path);
try { try {
if (boost::filesystem::exists(model.get_backup_path() + "/origin.txt")) if (boost::filesystem::exists(model.get_backup_path() + "/origin.txt"))
boost::filesystem::load_string_file(model.get_backup_path() + "/origin.txt", m_origin_file); load_string_file(model.get_backup_path() + "/origin.txt", m_origin_file);
} catch (...) {} } catch (...) {}
boost::filesystem::save_string_file( save_string_file(
model.get_backup_path() + "/lock.txt", model.get_backup_path() + "/lock.txt",
boost::lexical_cast<std::string>(get_current_pid())); boost::lexical_cast<std::string>(get_current_pid()));
} }
@ -1305,7 +1304,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
file_version = *m_bambuslicer_generator_version; file_version = *m_bambuslicer_generator_version;
// save for restore // save for restore
if (result && m_load_aux && !m_load_restore) { if (result && m_load_aux && !m_load_restore) {
boost::filesystem::save_string_file(model.get_backup_path() + "/origin.txt", filename); save_string_file(model.get_backup_path() + "/origin.txt", filename);
} }
if (m_load_restore && !result) // not clear failed backup data for later analyze if (m_load_restore && !result) // not clear failed backup data for later analyze
model.set_backup_path("detach"); model.set_backup_path("detach");
@ -5544,7 +5543,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
return false; return false;
} }
if (!(store_params.strategy & SaveStrategy::Silence)) if (!(store_params.strategy & SaveStrategy::Silence))
boost::filesystem::save_string_file(store_params.model->get_backup_path() + "/origin.txt", filename); save_string_file(store_params.model->get_backup_path() + "/origin.txt", filename);
} }
return result; return result;
} }
@ -8287,7 +8286,7 @@ bool has_restore_data(std::string & path, std::string& origin)
} }
if (boost::filesystem::exists(path + "/lock.txt")) { if (boost::filesystem::exists(path + "/lock.txt")) {
std::string pid; std::string pid;
boost::filesystem::load_string_file(path + "/lock.txt", pid); load_string_file(path + "/lock.txt", pid);
try { try {
if (get_process_name(boost::lexical_cast<int>(pid)) == if (get_process_name(boost::lexical_cast<int>(pid)) ==
get_process_name(0)) { get_process_name(0)) {
@ -8304,7 +8303,7 @@ bool has_restore_data(std::string & path, std::string& origin)
return false; return false;
try { try {
if (boost::filesystem::exists(path + "/origin.txt")) if (boost::filesystem::exists(path + "/origin.txt"))
boost::filesystem::load_string_file(path + "/origin.txt", origin); load_string_file(path + "/origin.txt", origin);
} }
catch (...) { catch (...) {
} }

View file

@ -5,6 +5,7 @@
#include "libslic3r/format.hpp" #include "libslic3r/format.hpp"
#undef PI #undef PI
#include <boost/next_prior.hpp>
// Include igl first. It defines "L" macro which then clashes with our localization // Include igl first. It defines "L" macro which then clashes with our localization
#include <igl/copyleft/cgal/mesh_boolean.h> #include <igl/copyleft/cgal/mesh_boolean.h>
#undef L #undef L

View file

@ -38,7 +38,6 @@
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/replace.hpp> #include <boost/algorithm/string/replace.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/filesystem/string_file.hpp>
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
#include <boost/nowide/iostream.hpp> #include <boost/nowide/iostream.hpp>
@ -873,7 +872,7 @@ std::string Model::get_backup_path()
BOOST_LOG_TRIVIAL(info) << "create /Metadata in " << temp_path; BOOST_LOG_TRIVIAL(info) << "create /Metadata in " << temp_path;
boost::filesystem::create_directories(backup_path + "/Metadata"); boost::filesystem::create_directories(backup_path + "/Metadata");
BOOST_LOG_TRIVIAL(info) << "create /lock.txt in " << temp_path; BOOST_LOG_TRIVIAL(info) << "create /lock.txt in " << temp_path;
boost::filesystem::save_string_file(backup_path + "/lock.txt", save_string_file(backup_path + "/lock.txt",
boost::lexical_cast<std::string>(get_current_pid())); boost::lexical_cast<std::string>(get_current_pid()));
} }
} catch (std::exception &ex) { } catch (std::exception &ex) {

View file

@ -4,6 +4,7 @@
///|/ ///|/
#include "Triangulation.hpp" #include "Triangulation.hpp"
#include "IntersectionPoints.hpp" #include "IntersectionPoints.hpp"
#include <boost/next_prior.hpp>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h> #include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h> #include <CGAL/Triangulation_vertex_base_with_info_2.h>

View file

@ -650,6 +650,9 @@ inline std::string filter_characters(const std::string& str, const std::string&
void copy_directory_recursively(const boost::filesystem::path &source, const boost::filesystem::path &target); void copy_directory_recursively(const boost::filesystem::path &source, const boost::filesystem::path &target);
// Orca: Since 1.7.9 Boost deprecated save_string_file and load_string_file, copy and modified from boost 1.7.8
void save_string_file(const boost::filesystem::path& p, const std::string& str);
void load_string_file(const boost::filesystem::path& p, std::string& str);
} // namespace Slic3r } // namespace Slic3r

View file

@ -1527,4 +1527,22 @@ void copy_directory_recursively(const boost::filesystem::path &source, const boo
return; return;
} }
void save_string_file(const boost::filesystem::path& p, const std::string& str)
{
boost::nowide::ofstream file;
file.exceptions(std::ios_base::failbit | std::ios_base::badbit);
file.open(p.generic_string(), std::ios_base::binary);
file.write(str.c_str(), str.size());
}
void load_string_file(const boost::filesystem::path& p, std::string& str)
{
boost::nowide::ifstream file;
file.exceptions(std::ios_base::failbit | std::ios_base::badbit);
file.open(p.generic_string(), std::ios_base::binary);
std::size_t sz = static_cast<std::size_t>(boost::filesystem::file_size(p));
str.resize(sz, '\0');
file.read(&str[0], sz);
}
}; // namespace Slic3r }; // namespace Slic3r

View file

@ -8,7 +8,6 @@
#include "MsgDialog.hpp" #include "MsgDialog.hpp"
#include "DownloadProgressDialog.hpp" #include "DownloadProgressDialog.hpp"
#include <boost/filesystem/string_file.hpp>
#include <boost/nowide/utf8_codecvt.hpp> #include <boost/nowide/utf8_codecvt.hpp>
#undef pid_t #undef pid_t
#include <boost/process.hpp> #include <boost/process.hpp>
@ -596,7 +595,7 @@ bool MediaPlayCtrl::start_stream_service(bool *need_install)
file_url2 = wxURI(file_url2).BuildURI(); file_url2 = wxURI(file_url2).BuildURI();
try { try {
std::string configs; std::string configs;
boost::filesystem::load_string_file(file_ff_cfg, configs); load_string_file(file_ff_cfg, configs);
std::vector<std::string> configss; std::vector<std::string> configss;
boost::algorithm::split(configss, configs, boost::algorithm::is_any_of("\r\n")); boost::algorithm::split(configss, configs, boost::algorithm::is_any_of("\r\n"));
configss.erase(std::remove(configss.begin(), configss.end(), std::string()), configss.end()); configss.erase(std::remove(configss.begin(), configss.end(), std::string()), configss.end());

View file

@ -9,7 +9,6 @@
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/filesystem/string_file.hpp>
#include <boost/filesystem/fstream.hpp> #include <boost/filesystem/fstream.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
@ -819,9 +818,9 @@ void PresetUpdater::priv::sync_tooltip(std::string http_url, std::string languag
fs::path cache_root = fs::path(data_dir()) / "resources/tooltip"; fs::path cache_root = fs::path(data_dir()) / "resources/tooltip";
try { try {
auto vf = cache_root / "common" / "version"; auto vf = cache_root / "common" / "version";
if (fs::exists(vf)) fs::load_string_file(vf, common_version); if (fs::exists(vf)) load_string_file(vf, common_version);
vf = cache_root / language / "version"; vf = cache_root / language / "version";
if (fs::exists(vf)) fs::load_string_file(vf, language_version); if (fs::exists(vf)) load_string_file(vf, language_version);
} catch (...) {} } catch (...) {}
std::map<std::string, Resource> resources std::map<std::string, Resource> resources
{ {
@ -997,11 +996,11 @@ void PresetUpdater::priv::sync_printer_config(std::string http_url)
auto cache_folder = data_dir_path / "ota" / "printers"; auto cache_folder = data_dir_path / "ota" / "printers";
try { try {
boost::filesystem::load_string_file(config_folder / "version.txt", curr_version); load_string_file(config_folder / "version.txt", curr_version);
boost::algorithm::trim(curr_version); boost::algorithm::trim(curr_version);
} catch (...) {} } catch (...) {}
try { try {
boost::filesystem::load_string_file(cache_folder / "version.txt", cached_version); load_string_file(cache_folder / "version.txt", cached_version);
boost::algorithm::trim(cached_version); boost::algorithm::trim(cached_version);
} catch (...) {} } catch (...) {}
if (!cached_version.empty()) { if (!cached_version.empty()) {
@ -1035,7 +1034,7 @@ void PresetUpdater::priv::sync_printer_config(std::string http_url)
bool result = false; bool result = false;
try { try {
boost::filesystem::load_string_file(cache_folder / "version.txt", cached_version); load_string_file(cache_folder / "version.txt", cached_version);
boost::algorithm::trim(cached_version); boost::algorithm::trim(cached_version);
result = true; result = true;
} catch (...) {} } catch (...) {}
@ -1154,11 +1153,11 @@ Updates PresetUpdater::priv::get_printer_config_updates(bool update) const
std::string curr_version; std::string curr_version;
std::string resc_version; std::string resc_version;
try { try {
boost::filesystem::load_string_file(resc_folder / "version.txt", resc_version); load_string_file(resc_folder / "version.txt", resc_version);
boost::algorithm::trim(resc_version); boost::algorithm::trim(resc_version);
} catch (...) {} } catch (...) {}
try { try {
boost::filesystem::load_string_file(config_folder / "version.txt", curr_version); load_string_file(config_folder / "version.txt", curr_version);
boost::algorithm::trim(curr_version); boost::algorithm::trim(curr_version);
} catch (...) {} } catch (...) {}