mirror of
https://github.com/QIDITECH/QIDIStudio.git
synced 2026-01-31 00:48:41 +03:00
update
This commit is contained in:
125
deps/Boost/0001-Boost-fix.patch
vendored
Normal file
125
deps/Boost/0001-Boost-fix.patch
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
From 1d6cd7c2f8640db3cda194c1b9b82f1e4b321395 Mon Sep 17 00:00:00 2001
|
||||
From: "chunmao.guo" <chunmao.guo@qidilab.com>
|
||||
Date: Thu, 5 Jan 2023 15:55:57 +0800
|
||||
Subject: [PATCH] FIX: limit_handles
|
||||
|
||||
---
|
||||
boost/process/detail/posix/executor.hpp | 4 +++-
|
||||
boost/process/detail/posix/pipe_out.hpp | 13 +++++++++++--
|
||||
boost/process/detail/used_handles.hpp | 3 +++
|
||||
boost/process/detail/windows/handles.hpp | 10 +++++++---
|
||||
4 files changed, 24 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/boost/process/detail/posix/executor.hpp b/boost/process/detail/posix/executor.hpp
|
||||
index ca7713c..5521720 100644
|
||||
--- a/boost/process/detail/posix/executor.hpp
|
||||
+++ b/boost/process/detail/posix/executor.hpp
|
||||
@@ -325,6 +325,7 @@ public:
|
||||
}
|
||||
void set_error(const std::error_code &ec, const std::string &msg) {set_error(ec, msg.c_str());};
|
||||
|
||||
+ int error_sink() const { return _pipe_sink; }
|
||||
};
|
||||
|
||||
template<typename Sequence>
|
||||
@@ -388,6 +389,8 @@ child executor<Sequence>::invoke(boost::mpl::false_, boost::mpl::false_)
|
||||
set_error(err, "fcntl(2) failed");//this might throw, so we need to be sure our pipe is safe.
|
||||
return child();
|
||||
}
|
||||
+ _pipe_sink = p.p[1];
|
||||
+
|
||||
_ec.clear();
|
||||
boost::fusion::for_each(seq, call_on_setup(*this));
|
||||
|
||||
@@ -411,7 +414,6 @@ child executor<Sequence>::invoke(boost::mpl::false_, boost::mpl::false_)
|
||||
}
|
||||
else if (pid == 0)
|
||||
{
|
||||
- _pipe_sink = p.p[1];
|
||||
::close(p.p[0]);
|
||||
|
||||
boost::fusion::for_each(seq, call_on_exec_setup(*this));
|
||||
diff --git a/boost/process/detail/posix/pipe_out.hpp b/boost/process/detail/posix/pipe_out.hpp
|
||||
index d54cca4..a081d78 100644
|
||||
--- a/boost/process/detail/posix/pipe_out.hpp
|
||||
+++ b/boost/process/detail/posix/pipe_out.hpp
|
||||
@@ -18,7 +18,7 @@
|
||||
namespace boost { namespace process { namespace detail { namespace posix {
|
||||
|
||||
template<int p1, int p2>
|
||||
-struct pipe_out : handler_base_ext
|
||||
+struct pipe_out : handler_base_ext, ::boost::process::detail::uses_handles
|
||||
{
|
||||
int sink;
|
||||
int source; //opposite end
|
||||
@@ -30,6 +30,14 @@ struct pipe_out : handler_base_ext
|
||||
{
|
||||
p.assign_sink(-1);
|
||||
}
|
||||
+
|
||||
+ std::array<int, 4> get_used_handles()
|
||||
+ {
|
||||
+ const auto pp1 = p1 != -1 ? p1 : p2;
|
||||
+ const auto pp2 = p2 != -1 ? p2 : p1;
|
||||
+
|
||||
+ return {sink, source, pp1, pp2};
|
||||
+ }
|
||||
|
||||
template<typename Executor>
|
||||
void on_error(Executor &, const std::error_code &) const
|
||||
@@ -66,7 +74,7 @@ void pipe_out<2,-1>::on_exec_setup(Executor &e) const
|
||||
if (::dup2(sink, STDERR_FILENO) == -1)
|
||||
e.set_error(::boost::process::detail::get_last_error(), "dup2() failed");
|
||||
|
||||
- if (sink != STDOUT_FILENO)
|
||||
+ if (sink != STDERR_FILENO)
|
||||
::close(sink);
|
||||
::close(source);
|
||||
}
|
||||
@@ -81,6 +89,7 @@ void pipe_out<1,2>::on_exec_setup(Executor &e) const
|
||||
e.set_error(::boost::process::detail::get_last_error(), "dup2() failed");
|
||||
if ((sink != STDOUT_FILENO) && (sink != STDERR_FILENO))
|
||||
::close(sink);
|
||||
+ ::close(source);
|
||||
}
|
||||
|
||||
class async_pipe;
|
||||
diff --git a/boost/process/detail/used_handles.hpp b/boost/process/detail/used_handles.hpp
|
||||
index 4d56af3..5d71dc3 100644
|
||||
--- a/boost/process/detail/used_handles.hpp
|
||||
+++ b/boost/process/detail/used_handles.hpp
|
||||
@@ -61,6 +61,9 @@ struct foreach_handle_invocator
|
||||
template<typename Executor, typename Function>
|
||||
void foreach_used_handle(Executor &exec, Function &&func)
|
||||
{
|
||||
+#if defined(BOOST_POSIX_API)
|
||||
+ func(exec.error_sink());
|
||||
+#endif
|
||||
boost::fusion::for_each(boost::fusion::filter_if<does_use_handle<boost::mpl::_>>(exec.seq),
|
||||
foreach_handle_invocator<Function>(func));
|
||||
}
|
||||
diff --git a/boost/process/detail/windows/handles.hpp b/boost/process/detail/windows/handles.hpp
|
||||
index 7a93ac2..f120ef7 100644
|
||||
--- a/boost/process/detail/windows/handles.hpp
|
||||
+++ b/boost/process/detail/windows/handles.hpp
|
||||
@@ -139,10 +139,14 @@ struct limit_handles_ : handler_base_ext
|
||||
::boost::winapi::DWORD_ flags = 0u;
|
||||
if (itr != all_handles.end())
|
||||
*itr = ::boost::winapi::INVALID_HANDLE_VALUE_;
|
||||
- else if ((::boost::winapi::GetHandleInformation(*itr, &flags) != 0)
|
||||
- &&((flags & ::boost::winapi::HANDLE_FLAG_INHERIT_) == 0)) //it is NOT inherited anyhow, so ignore too
|
||||
- *itr = ::boost::winapi::INVALID_HANDLE_VALUE_;
|
||||
});
|
||||
+ for (auto& h : all_handles) {
|
||||
+ ::boost::winapi::DWORD_ flags = 0u;
|
||||
+ if ((h != ::boost::winapi::INVALID_HANDLE_VALUE_)
|
||||
+ && (::boost::winapi::GetHandleInformation(h, &flags) != 0)
|
||||
+ && ((flags & ::boost::winapi::HANDLE_FLAG_INHERIT_) == 0)) //it is NOT inherited anyhow, so ignore too
|
||||
+ h = ::boost::winapi::INVALID_HANDLE_VALUE_;
|
||||
+ }
|
||||
|
||||
auto part_itr = std::partition(all_handles.begin(), all_handles.end(),
|
||||
[](::boost::winapi::HANDLE_ handle) {return handle != ::boost::winapi::INVALID_HANDLE_VALUE_;});
|
||||
--
|
||||
2.36.1.windows.1
|
||||
|
||||
160
deps/Boost/Boost.cmake
vendored
Normal file
160
deps/Boost/Boost.cmake
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
include(ExternalProject)
|
||||
|
||||
if (WIN32)
|
||||
set(_bootstrap_cmd bootstrap.bat)
|
||||
set(_build_cmd b2.exe)
|
||||
else()
|
||||
set(_bootstrap_cmd ./bootstrap.sh)
|
||||
set(_build_cmd ./b2)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(_boost_toolset gcc)
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/user-config.jam boost-user-config.jam)
|
||||
set(_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 1950)
|
||||
# 1930-1949 = VS 17.0 (v143 toolset)
|
||||
set(_boost_toolset "msvc-14.3")
|
||||
else ()
|
||||
message(FATAL_ERROR "Unsupported MSVC version")
|
||||
endif ()
|
||||
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
if (WIN32)
|
||||
set(_boost_toolset "clang-win")
|
||||
elseif (APPLE)
|
||||
set(_boost_toolset "clang")
|
||||
else()
|
||||
set(_boost_toolset clang)
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/user-config.jam boost-user-config.jam)
|
||||
set(_patch_command ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/boost-user-config.jam ./tools/build/src/tools/user-config.jam)
|
||||
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 ()
|
||||
|
||||
include(ProcessorCount)
|
||||
ProcessorCount(NPROC)
|
||||
file(TO_NATIVE_PATH ${DESTDIR}/usr/local/ _prefix)
|
||||
|
||||
set(_boost_flags "")
|
||||
if (UNIX)
|
||||
set(_boost_flags "cflags=-fPIC;cxxflags=-fPIC")
|
||||
endif ()
|
||||
|
||||
if(APPLE)
|
||||
set(_boost_flags
|
||||
"cflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET};"
|
||||
"cxxflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET};"
|
||||
"mflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET};"
|
||||
"mmflags=-fPIC -mmacosx-version-min=${DEP_OSX_TARGET}")
|
||||
endif()
|
||||
|
||||
set(_boost_variants "")
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
list(APPEND CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE})
|
||||
list(REMOVE_DUPLICATES CMAKE_CONFIGURATION_TYPES)
|
||||
endif()
|
||||
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 ( (NOT MSVC AND _cfg_deb GREATER -1) OR (MSVC AND ${DEP_DEBUG}) )
|
||||
list(APPEND _boost_variants debug)
|
||||
endif()
|
||||
|
||||
if (NOT _boost_variants)
|
||||
set(_boost_variants release)
|
||||
endif()
|
||||
|
||||
set(_build_cmd ${_build_cmd}
|
||||
${_boost_flags}
|
||||
-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)
|
||||
|
||||
list(APPEND _patch_command COMMAND git init && ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-Boost-fix.patch)
|
||||
|
||||
ExternalProject_Add(
|
||||
dep_Boost
|
||||
#URL "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.zip"
|
||||
URL "https://github.com/qidilab/boost/releases/download/1.78.0/boost_1_78_0.zip"
|
||||
URL_HASH SHA256=f22143b5528e081123c3c5ed437e92f648fe69748e95fa6e2bd41484e2986cc3
|
||||
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}"
|
||||
)
|
||||
|
||||
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
|
||||
# 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 ""
|
||||
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/Boost/user-config.jam
vendored
Normal file
1
deps/Boost/user-config.jam
vendored
Normal file
@@ -0,0 +1 @@
|
||||
using @_boost_toolset@ : : @CMAKE_CXX_COMPILER@ ;
|
||||
Reference in New Issue
Block a user