Fix Xcode 16.3 build (#9422)

* Fix build with Xcode 16.3

* Simplify OpenVDB patch, from 930c3acb8e (diff-bc3061cc2fe6c64a3d67c8350330bb3a530d01037faace6da27ad9a12aa03e29)

* Fix CGAL header under clang 19
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281880

* Fix compile error due to removal of base template for `std::char_traits` in clang 19
https://releases.llvm.org/19.1.0/projects/libcxx/docs/ReleaseNotes.html#deprecations-and-removals
This commit is contained in:
Noisyfox 2025-05-01 17:09:45 +08:00 committed by GitHub
parent 66830d2344
commit a9d426a3dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 189 additions and 8 deletions

59
deps/CGAL/0001-clang19.patch vendored Normal file
View file

@ -0,0 +1,59 @@
--- a/BGL/include/CGAL/boost/graph/iterator.h 2022-10-07 19:04:41 UTC
+++ b/BGL/include/CGAL/boost/graph/iterator.h
@@ -213,18 +213,7 @@ class Halfedge_around_source_iterator { (public)
{}
#ifndef DOXYGEN_RUNNING
- // design patter: "safe bool"
- // will be replaced by explicit operator bool with C++11
- typedef void (Halfedge_around_source_iterator::*bool_type)() const;
- void this_type_does_not_support_comparisons() const {}
-
- operator bool_type() const
- {
- return (! (this->base() == nullptr)) ?
- &Halfedge_around_source_iterator::this_type_does_not_support_comparisons : 0;
- }
-
bool operator==( const Self& i) const {
CGAL_assertion( anchor == anchor);
return ( g == i.g) && ( pos == i.pos) && ( winding == i.winding);
@@ -313,18 +302,7 @@ class Halfedge_around_target_iterator { (public)
{}
#ifndef DOXYGEN_RUNNING
- // design patter: "safe bool"
- // will be replaced by explicit operator bool with C++11
- typedef void (Halfedge_around_target_iterator::*bool_type)() const;
- void this_type_does_not_support_comparisons() const {}
-
- operator bool_type() const
- {
- return (! (this->base() == nullptr)) ?
- &Halfedge_around_target_iterator::this_type_does_not_support_comparisons : 0;
- }
-
bool operator==( const Self& i) const {
CGAL_assertion( anchor == anchor);
return ( g == i.g) && ( pos == i.pos) && ( winding == i.winding);
@@ -411,18 +389,6 @@ class Halfedge_around_face_iterator { (public)
const value_type& operator * ( ) const { return pos; }
pointer operator -> ( ) { return &pos; }
const value_type* operator -> ( ) const { return &pos; }
-
- // design patter: "safe bool"
- // will be replaced by explicit operator bool with C++11
- typedef void (Halfedge_around_face_iterator::*bool_type)() const;
-
- void this_type_does_not_support_comparisons() const {}
-
- operator bool_type() const
- {
- return (! (this->base() == nullptr)) ?
- &Halfedge_around_face_iterator::this_type_does_not_support_comparisons : 0;
- }
bool operator==( const Self& i) const {
CGAL_assertion( anchor == anchor);

View file

@ -1,3 +1,7 @@
if (IN_GIT_REPO)
set(CGAL_DIRECTORY_FLAG --directory ${BINARY_DIR_REL}/dep_CGAL-prefix/src/dep_CGAL)
endif ()
orcaslicer_add_cmake_project(
CGAL
# GIT_REPOSITORY https://github.com/CGAL/cgal.git
@ -5,6 +9,7 @@ orcaslicer_add_cmake_project(
# For whatever reason, this keeps downloading forever (repeats downloads if finished)
URL https://github.com/CGAL/cgal/archive/refs/tags/v5.4.zip
URL_HASH SHA256=d7605e0a5a5ca17da7547592f6f6e4a59430a0bc861948974254d0de43eab4c0
PATCH_COMMAND git apply ${CGAL_DIRECTORY_FLAG} --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-clang19.patch
DEPENDS dep_Boost dep_GMP dep_MPFR
)

54
deps/OpenCV/0002-clang19-macos.patch vendored Normal file
View file

@ -0,0 +1,54 @@
From 893b8113f04d408cc6177c6de19c9889a48faa24 Mon Sep 17 00:00:00 2001
From: Zixu Wang <zixu_wang@apple.com>
Date: Thu, 18 Jan 2024 11:12:00 -0800
Subject: [PATCH] Fix unused platform check and configuration for macOS
In a similar manner as zlib (https://github.com/madler/zlib/pull/895),
libpng contains a header configuration that's no longer valid and
hasn't been exercised for the macOS target.
- The target OS conditional macros are misused. Specifically
`TARGET_OS_MAC` covers all Apple targets, including iOS, and it
should not be checked with `#if defined` as they would always be
defined (to either 1 or 0) on Apple platforms.
- `#include <fp.h>` no longer works for the macOS target and results
in a compilation failure. macOS ships all required functions in
`math.h`, and clients should use `math.h` instead.
This problem has not been noticed until a recent extension in clang
(https://github.com/llvm/llvm-project/pull/74676) exposed the issue
and broke libpng builds on Apple platforms. The failure can be
reproduced now by adding `#include <TargetConditionals.h>` before the
block.
Signed-off-by: Cosmin Truta <ctruta@gmail.com>
---
AUTHORS | 2 ++
pngpriv.h | 14 ++------------
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/3rdparty/libpng/pngpriv.h b/3rdparty/libpng/pngpriv.h
index 6c7280cf53..190eb85cbf 100644
--- a/3rdparty/libpng/pngpriv.h
+++ b/3rdparty/libpng/pngpriv.h
@@ -556,18 +556,8 @@
*/
# include <float.h>
-# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
- defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
- /* We need to check that <math.h> hasn't already been included earlier
- * as it seems it doesn't agree with <fp.h>, yet we should really use
- * <fp.h> if possible.
- */
-# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
-# include <fp.h>
-# endif
-# else
-# include <math.h>
-# endif
+# include <math.h>
+
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
* MATH=68881

View file

@ -11,7 +11,7 @@ endif ()
orcaslicer_add_cmake_project(OpenCV
URL https://github.com/opencv/opencv/archive/refs/tags/4.6.0.tar.gz
URL_HASH SHA256=1ec1cba65f9f20fe5a41fda1586e01c70ea0c9a6d7b67c9e13edf0cfe2239277
PATCH_COMMAND git apply ${OpenCV_DIRECTORY_FLAG} --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-vs2022.patch
PATCH_COMMAND git apply ${OpenCV_DIRECTORY_FLAG} --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-vs2022.patch ${CMAKE_CURRENT_LIST_DIR}/0002-clang19-macos.patch
CMAKE_ARGS
-DBUILD_SHARED_LIBS=0
-DBUILD_PERE_TESTS=OFF

29
deps/OpenVDB/0001-clang19.patch vendored Normal file
View file

@ -0,0 +1,29 @@
--- a/openvdb/openvdb/tree/NodeManager.h 2023-11-01 20:31:11 UTC
+++ b/openvdb/openvdb/tree/NodeManager.h
@@ -327,7 +327,7 @@ class NodeList (private)
void operator()(const NodeRange& range) const
{
for (typename NodeRange::Iterator it = range.begin(); it; ++it) {
- OpT::template eval(mNodeOp, it);
+ OpT::eval(mNodeOp, it);
}
}
const NodeOp mNodeOp;
@@ -347,7 +347,7 @@ class NodeList (private)
void operator()(const NodeRange& range) const
{
for (typename NodeRange::Iterator it = range.begin(); it; ++it) {
- OpT::template eval(mNodeOp, it);
+ OpT::eval(mNodeOp, it);
}
}
const NodeOp& mNodeOp;
@@ -372,7 +372,7 @@ class NodeList (private)
void operator()(const NodeRange& range)
{
for (typename NodeRange::Iterator it = range.begin(); it; ++it) {
- OpT::template eval(*mNodeOp, it);
+ OpT::eval(*mNodeOp, it);
}
}
void join(const NodeReducer& other)

View file

@ -6,10 +6,15 @@ else()
set(_build_static ON)
endif()
if (IN_GIT_REPO)
set(OPENVDB_DIRECTORY_FLAG --directory ${BINARY_DIR_REL}/dep_OpenVDB-prefix/src/dep_OpenVDB)
endif ()
orcaslicer_add_cmake_project(OpenVDB
# support vs2022, update to 8.2
URL https://github.com/tamasmeszaros/openvdb/archive/a68fd58d0e2b85f01adeb8b13d7555183ab10aa5.zip
URL_HASH SHA256=f353e7b99bd0cbfc27ac9082de51acf32a8bc0b3e21ff9661ecca6f205ec1d81
PATCH_COMMAND git apply ${OPENVDB_DIRECTORY_FLAG} --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-clang19.patch
DEPENDS dep_TBB dep_Blosc dep_OpenEXR dep_Boost
CMAKE_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE=ON

29
deps/PNG/0002-clang19-macos.patch vendored Normal file
View file

@ -0,0 +1,29 @@
--- a/pngpriv.h 2025-04-20 19:36:04.000000000
+++ b/pngpriv.h 2025-04-20 19:35:55.000000000
@@ -511,24 +511,14 @@
* DBL_DIG Maximum number of decimal digits (can be set to any constant)
* DBL_MIN Smallest normalized fp number (can be set to an arbitrary value)
* DBL_MAX Maximum floating point number (can be set to an arbitrary value)
*/
# include <float.h>
-# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
- defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
- /* We need to check that <math.h> hasn't already been included earlier
- * as it seems it doesn't agree with <fp.h>, yet we should really use
- * <fp.h> if possible.
- */
-# if !defined(__MATH_H__) && !defined(__MATH_H) && !defined(__cmath__)
-# include <fp.h>
-# endif
-# else
-# include <math.h>
-# endif
+# include <math.h>
+
# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
/* Amiga SAS/C: We must include builtin FPU functions when compiling using
* MATH=68881
*/
# include <m68881.h>
# endif

4
deps/PNG/PNG.cmake vendored
View file

@ -12,7 +12,7 @@ if(APPLE AND IS_CROSS_COMPILE)
GIT_TAG v1.6.35
DEPENDS ${ZLIB_PKG}
PATCH_COMMAND ${GIT_EXECUTABLE} checkout -f -- . && git clean -df &&
${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/macos-arm64.patch
${GIT_EXECUTABLE} apply --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/macos-arm64.patch ${CMAKE_CURRENT_LIST_DIR}/0002-clang19-macos.patch
CMAKE_ARGS
-DPNG_SHARED=OFF
-DPNG_STATIC=ON
@ -24,7 +24,7 @@ if(APPLE AND IS_CROSS_COMPILE)
else ()
set(_patch_step "")
if (APPLE)
set(_patch_step PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/PNG.patch)
set(_patch_step PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/PNG.patch ${CMAKE_CURRENT_LIST_DIR}/0002-clang19-macos.patch)
endif ()
orcaslicer_add_cmake_project(PNG
# GIT_REPOSITORY https://github.com/glennrp/libpng.git

View file

@ -4053,7 +4053,7 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
try {
auto evt_str = evt.GetString();
if (!evt_str.empty()) {
json j = json::parse(evt_str);
json j = json::parse(evt_str.utf8_string());
if (j.contains("code")) {
if (!j["code"].is_null())
code = j["code"].get<int>();

View file

@ -124,7 +124,7 @@ namespace GUI {
{
try {
wxString strInput = evt.GetString();
json j = json::parse(strInput);
json j = json::parse(strInput.utf8_string());
wxString strCmd = j["command"];

View file

@ -237,7 +237,7 @@ void ProjectPanel::OnScriptMessage(wxWebViewEvent& evt)
{
try {
wxString strInput = evt.GetString();
json j = json::parse(strInput);
json j = json::parse(strInput.utf8_string());
wxString strCmd = j["command"];

View file

@ -199,7 +199,7 @@ void DownPluginFrame::OnScriptMessage(wxWebViewEvent &evt)
{
try {
wxString strInput = evt.GetString();
json j = json::parse(strInput);
json j = json::parse(strInput.utf8_string());
wxString strCmd = j["command"];

View file

@ -373,7 +373,7 @@ void GuideFrame::OnScriptMessage(wxWebViewEvent &evt)
try {
wxString strInput = evt.GetString();
BOOST_LOG_TRIVIAL(trace) << "GuideFrame::OnScriptMessage;OnRecv:" << strInput.c_str();
json j = json::parse(strInput);
json j = json::parse(strInput.utf8_string());
wxString strCmd = j["command"];
BOOST_LOG_TRIVIAL(trace) << "GuideFrame::OnScriptMessage;Command:" << strCmd;