mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-27 17:21:10 +00:00
Build without precompiled headers when the compiler is clang-cl, in both the slicer and the wxWidgets dependency, and add a CI check that fails if broken exception throw info comes back. With a precompiled header, clang-cl can leave the copy constructor out of the throw info it emits for an exception type (llvm/llvm-project#53486, open since 2022 and still present in clang 22.1.3). The linker keeps one throw info per type for the whole binary. When it keeps one from a precompiled header file, a copy of that exception is bitwise, and the copy and the original free the same data. Mesh Boolean hits this on every operation. mcut destroys a std::promise that was never set, which stores a broken_promise future_error in an exception_ptr. Freeing it corrupts the heap, and Windows ends the process with 0xC0000374. The 2.5.0-alpha release has broken throw info for 64 exception classes, including std::runtime_error, std::bad_alloc and boost exceptions. scripts/check_exception_throw_info.ps1 runs after the Windows clang build and its uploads, before any deploy. It fails when an exception class has throw info both with and without a copy constructor, when OrcaSlicer.pdb is missing, or when it finds no exception classes at all. scripts/test_check_exception_throw_info.ps1 tests it on canned dumps. build_win.bat now treats -l as --no-pch. The Windows ccache key drops the cl.exe version, which only mattered for precompiled headers. The bug came in with #15428, which moved Windows CI to clang-cl. 2.4.2 was built with MSVC. Fixes #16581
104 lines
3.1 KiB
CMake
104 lines
3.1 KiB
CMake
set(_wx_toolkit "")
|
|
set(_wx_debug_postfix "")
|
|
set(_wx_shared -DwxBUILD_SHARED=OFF)
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
set(_gtk_ver 2)
|
|
|
|
if (DEP_WX_GTK3)
|
|
set(_gtk_ver 3)
|
|
endif ()
|
|
|
|
set(_wx_toolkit "-DwxBUILD_TOOLKIT=gtk${_gtk_ver}")
|
|
if (FLATPAK)
|
|
set(_wx_debug_postfix "d")
|
|
set(_wx_shared -DwxBUILD_SHARED=ON -DBUILD_SHARED_LIBS:BOOL=ON)
|
|
endif ()
|
|
endif()
|
|
|
|
if (MSVC)
|
|
set(_wx_edge "-DwxUSE_WEBVIEW_EDGE=ON")
|
|
else ()
|
|
set(_wx_edge "-DwxUSE_WEBVIEW_EDGE=OFF")
|
|
endif ()
|
|
|
|
# With a precompiled header, clang-cl can omit an exception type's copy constructor from its throw info,
|
|
# so copies of the exception share and double-free their data: https://github.com/llvm/llvm-project/issues/53486
|
|
if (MSVC AND CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
set(_wx_precomp OFF)
|
|
else ()
|
|
set(_wx_precomp ON)
|
|
endif ()
|
|
|
|
set(_wx_patch_command "")
|
|
if (APPLE)
|
|
set(_wx_patch_command
|
|
${GIT_EXECUTABLE} checkout -f -- src/osx/cocoa/colour.mm
|
|
COMMAND ${GIT_EXECUTABLE} apply --verbose
|
|
${CMAKE_CURRENT_LIST_DIR}/0001-macos-use-srgb-colour-components.patch
|
|
)
|
|
endif ()
|
|
|
|
orcaslicer_add_cmake_project(
|
|
wxWidgets
|
|
GIT_REPOSITORY "https://github.com/SoftFever/Orca-deps-wxWidgets"
|
|
GIT_TAG v3.3.2
|
|
GIT_SHALLOW ON
|
|
GIT_SUBMODULES 3rdparty/catch 3rdparty/pcre 3rdparty/libwebp
|
|
PATCH_COMMAND ${_wx_patch_command}
|
|
DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} ${JPEG_PKG}
|
|
CMAKE_ARGS
|
|
-DwxBUILD_PRECOMP=${_wx_precomp}
|
|
${_wx_toolkit}
|
|
"-DCMAKE_DEBUG_POSTFIX:STRING=${_wx_debug_postfix}"
|
|
-DwxBUILD_DEBUG_LEVEL=0
|
|
-DwxBUILD_SAMPLES=OFF
|
|
${_wx_shared}
|
|
-DwxUSE_MEDIACTRL=ON
|
|
-DwxUSE_DETECT_SM=OFF
|
|
-DwxUSE_PRIVATE_FONTS=ON
|
|
-DwxUSE_OPENGL=ON
|
|
-DwxUSE_GLCANVAS_EGL=ON
|
|
-DwxUSE_WEBREQUEST=ON
|
|
-DwxUSE_WEBVIEW=ON
|
|
${_wx_edge}
|
|
-DwxUSE_WEBVIEW_IE=OFF
|
|
-DwxUSE_REGEX=builtin
|
|
-DwxUSE_LIBSDL=OFF
|
|
-DwxUSE_XTEST=OFF
|
|
-DwxUSE_STC=OFF
|
|
-DwxUSE_AUI=ON
|
|
-DwxUSE_LIBPNG=sys
|
|
-DwxUSE_ZLIB=sys
|
|
-DwxUSE_LIBJPEG=sys
|
|
-DwxUSE_LIBTIFF=OFF
|
|
-DwxUSE_LIBWEBP=builtin
|
|
-DwxUSE_EXPAT=sys
|
|
-DwxUSE_NANOSVG=OFF
|
|
)
|
|
|
|
# wxWidgets 3.3 cmake install doesn't include private headers.
|
|
# OrcaSlicer uses some of the private headers (for accessibility support).
|
|
# Copy the private headers directory after install.
|
|
if(MSVC)
|
|
set(_wx_inc_dest ${DESTDIR}/include/wx)
|
|
else()
|
|
set(_wx_inc_dest ${DESTDIR}/include/wx-3.3/wx)
|
|
endif()
|
|
ExternalProject_Add_Step(dep_wxWidgets copy_private_headers
|
|
DEPENDEES install
|
|
COMMENT "Copying wxWidgets private headers"
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
<SOURCE_DIR>/include/wx/private
|
|
${_wx_inc_dest}/private
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
<SOURCE_DIR>/include/wx/generic/private
|
|
${_wx_inc_dest}/generic/private
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
<SOURCE_DIR>/include/wx/gtk/private
|
|
${_wx_inc_dest}/gtk/private
|
|
)
|
|
|
|
if (MSVC)
|
|
add_debug_dep(dep_wxWidgets)
|
|
endif ()
|