mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-17 14:02:35 +00:00
The deps superbuild passes the Visual Studio generator and platform to every sub-build but not the toolset, so build_win.bat -d -l without -x compiled every dependency with cl even though the superbuild had been configured with -T ClangCL; CMake replaces the forwarded CMAKE_<LANG>_COMPILER with whatever the toolset ran. The recipes that adapt to clang-cl then disagreed with what had been built, and wxInspector told FindwxWidgets to look in lib/clang_x64_lib while the cl-built wxWidgets had installed into lib/vc_x64_lib: Could NOT find wxWidgets (missing: wxWidgets_LIBRARIES wxWidgets_INCLUDE_DIRS core base aui propgrid) Forward CMAKE_GENERATOR_TOOLSET as well, so the dependencies compile with clang-cl under MSBuild the way they already do under Ninja. Four of them need more than that: - OpenSSL always builds with cl, and MSBuild runs its nmake steps in the project's toolset environment, where ClangCL puts clang's include directory first and cl trips over clang's stdint.h. The project gets the default toolset. - Boost.Container's dlmalloc needs -Wno-incompatible-pointer-types under clang. boost_container links as C++, and the Visual Studio generator writes only the link language's flags into the project, so its C file never saw CMAKE_C_FLAGS. Under that generator the option goes through the C++ flags as well, with the defaults kept. - Draco's tools and NLopt's testopt compile sources their own static library also contains. MSBuild lists libraries before objects and lld-link resolves archive members as each input arrives, so the library's copy is pulled in before the executable's own object and the link fails on duplicate symbols; link.exe defers the search and Ninja lists the objects first. Nothing uses those executables, so they get /FORCE:MULTIPLE there. The Ninja path is unchanged: the generated configure commands of all 29 dependencies are identical before and after. OCCT's arm64 override to cl still applies under Ninja but not under the Visual Studio generator, where the toolset wins; that combination never built and is left for a follow-up.
60 lines
2.5 KiB
CMake
60 lines
2.5 KiB
CMake
|
|
set(_context_abi_line "")
|
|
set(_context_arch_line "")
|
|
if (APPLE AND CMAKE_OSX_ARCHITECTURES)
|
|
if (CMAKE_OSX_ARCHITECTURES MATCHES "x86")
|
|
set(_context_abi_line "-DBOOST_CONTEXT_ABI:STRING=sysv")
|
|
elseif (CMAKE_OSX_ARCHITECTURES MATCHES "arm")
|
|
set (_context_abi_line "-DBOOST_CONTEXT_ABI:STRING=aapcs")
|
|
endif ()
|
|
set(_context_arch_line "-DBOOST_CONTEXT_ARCHITECTURE:STRING=${CMAKE_OSX_ARCHITECTURES}")
|
|
endif ()
|
|
|
|
# Windows ARM64: Boost.Context's default fcontext implementation assembles .asm
|
|
# via armasm64, which trips a CMake ASM_ARMASM linker-module bug under the VS
|
|
# generator. The winfib implementation (Windows Fiber API) avoids assembly while
|
|
# keeping the Boost::context target that Boost.Asio's stackful coroutines need.
|
|
set(_context_impl_line "")
|
|
if (MSVC AND "${DEPS_ARCH}" STREQUAL "arm64")
|
|
set(_context_impl_line "-DBOOST_CONTEXT_IMPLEMENTATION:STRING=winfib")
|
|
endif ()
|
|
|
|
set(_options "")
|
|
if (MSVC AND DEP_DEBUG)
|
|
set(_options "FORWARD_CONFIG")
|
|
endif ()
|
|
|
|
# Boost.Container's bundled dlmalloc passes int* where the Win32 Interlocked API
|
|
# takes volatile long*; cl compiles that with a warning, clang errors out.
|
|
set(_boost_c_flags_line "")
|
|
set(_boost_cxx_flags_line "")
|
|
if (MSVC AND CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
|
set(_boost_c_flags_line "-DCMAKE_C_FLAGS:STRING=-Wno-incompatible-pointer-types")
|
|
# The Visual Studio generator applies only the link language's flags to a
|
|
# project, and boost_container links as C++, so its C file never sees
|
|
# CMAKE_C_FLAGS. The C++ flags reach every file; keep CMake's defaults.
|
|
if (CMAKE_GENERATOR MATCHES "Visual Studio")
|
|
set(_boost_cxx_flags_line "-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} -Wno-incompatible-pointer-types")
|
|
endif ()
|
|
endif ()
|
|
|
|
orcaslicer_add_cmake_project(Boost
|
|
${_options}
|
|
URL "https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.gz"
|
|
URL_HASH SHA256=4d27e9efed0f6f152dc28db6430b9d3dfb40c0345da7342eaa5a987dde57bd95
|
|
LIST_SEPARATOR |
|
|
CMAKE_ARGS
|
|
-DBOOST_EXCLUDE_LIBRARIES:STRING=contract|fiber|numpy|stacktrace|wave|test
|
|
-DBOOST_LOCALE_ENABLE_ICU:BOOL=OFF # do not link to libicu, breaks compatibility between distros
|
|
-DBUILD_TESTING:BOOL=OFF
|
|
-DBOOST_IOSTREAMS_ENABLE_BZIP2:BOOL=OFF # avoid libbz2 soname differences in AppImage builds
|
|
-DBOOST_IOSTREAMS_ENABLE_ZSTD:BOOL=OFF
|
|
"${_context_abi_line}"
|
|
"${_context_arch_line}"
|
|
"${_context_impl_line}"
|
|
"${_boost_c_flags_line}"
|
|
"${_boost_cxx_flags_line}"
|
|
)
|
|
|
|
set(DEP_Boost_DEPENDS ZLIB)
|