Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ea80003a7 |
+56
-8
@@ -257,8 +257,18 @@ endif (NOT pcnt)
|
||||
# below. Do not also pass down the top-level generator's jobserver state:
|
||||
# GNU make encodes it in MAKEFLAGS using options that other make variants
|
||||
# (notably FreeBSD make) do not understand.
|
||||
# bext (staged patch): locate a make program rather than hardcoding "make".
|
||||
# On MinGW-w64 the GNU make executable is named mingw32-make (there is no
|
||||
# make.exe on PATH), so a bare "make" fails the autotools ExternalProject
|
||||
# builds (TCL/ICU/flexbison) with "no such file or directory". gmake and
|
||||
# mingw32-make are accepted fallbacks; if none is found we keep "make" so
|
||||
# behavior is unchanged on platforms that ship it (Linux/macOS/MSVC).
|
||||
find_program(BEXT_MAKE_EXECUTABLE NAMES make gmake mingw32-make)
|
||||
if (NOT BEXT_MAKE_EXECUTABLE)
|
||||
set(BEXT_MAKE_EXECUTABLE make)
|
||||
endif (NOT BEXT_MAKE_EXECUTABLE)
|
||||
set(BEXT_MAKE_COMMAND
|
||||
${CMAKE_COMMAND} -E env --unset=MAKEFLAGS --unset=MFLAGS make
|
||||
${CMAKE_COMMAND} -E env --unset=MAKEFLAGS --unset=MFLAGS ${BEXT_MAKE_EXECUTABLE}
|
||||
)
|
||||
|
||||
# We want to pass the build type option to CMake builds if we're not using a
|
||||
@@ -273,7 +283,17 @@ endif (NOT isMultiConfig)
|
||||
|
||||
# With MSVC, some of the non-CMake subbuilds are going to need the vcvars bat
|
||||
# file to set up the environment.
|
||||
if(MSVC)
|
||||
# bext: gate on both MSVC (the boolean CMake sets for the MSVC-compatible ABI)
|
||||
# AND CMAKE_CXX_COMPILER_ID == "MSVC" (the true compiler identity). clang-cl
|
||||
# and Intel-LLVM icx-cl both set MSVC=TRUE for ABI purposes but their driver
|
||||
# executables do not live under a Visual Studio "Auxiliary/Build" tree, so the
|
||||
# vcvars.bat lookup below fatal-errors on those toolchains. When invoked in
|
||||
# our own environments (see env\clang.ps1, env\icc.ps1) the MSVC devcmd is
|
||||
# already sourced into the process, so autotools sub-builds inherit the
|
||||
# needed INCLUDE/LIB/PATH without needing a bat file to source at build time.
|
||||
# Regular MSVC cl.exe builds (Linux/macOS never reach this branch) are
|
||||
# untouched -- they still resolve the vcvars bat exactly as before.
|
||||
if(MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
|
||||
get_filename_component(COMPILER_DIR "${CMAKE_C_COMPILER}" DIRECTORY)
|
||||
get_filename_component(COMPILER_ROOT "${COMPILER_DIR}" NAME)
|
||||
@@ -295,7 +315,7 @@ if(MSVC)
|
||||
endif(NOT EXISTS "${VCVARS_BAT}")
|
||||
endif(NOT EXISTS "${VCVARS_BAT}")
|
||||
|
||||
endif(MSVC)
|
||||
endif()
|
||||
|
||||
# Add a target that will run every time we build and touch a file in
|
||||
# noinstall to allow interested parent CMake builds to be aware of potential
|
||||
@@ -390,11 +410,39 @@ add_project(patch)
|
||||
###############################################################################
|
||||
if (USE_APPLESEED OR USE_OSPRAY)
|
||||
|
||||
if (ENABLE_ALL)
|
||||
if (NOT DEFINED ENABLE_BISON)
|
||||
set(ENABLE_BISON ON)
|
||||
endif (NOT DEFINED ENABLE_BISON)
|
||||
endif (ENABLE_ALL)
|
||||
# bext (staged patch): on Windows non-MSVC toolchains, bext's flexbison
|
||||
# subproject builds winflexbison, whose upstream CMakeLists.txt hard-requires
|
||||
# Visual Studio (line 5-7: 'FATAL_ERROR "Visual Studio Build supported only"')
|
||||
# and fails to configure under MinGW-w64 or clang/mingw. Upstream's
|
||||
# ENABLE_ALL block forces ENABLE_BISON=ON without probing, so an
|
||||
# everything-preset build under a GNU Windows toolchain always broke here.
|
||||
# Fix: for GNU-Windows ONLY, run find_package(BISON/FLEX) BEFORE the
|
||||
# ENABLE_ALL block and skip the force-enable when a suitable system bison/
|
||||
# flex is on PATH. The everything-preset guarantee still holds -- if
|
||||
# find_package does NOT find one, ENABLE_BISON is still turned on and the
|
||||
# subproject still runs (and will still surface the winflexbison error,
|
||||
# correctly, since the user does not have a bison at all).
|
||||
#
|
||||
# On Linux, macOS, and MSVC the upstream ENABLE_ALL path is preserved
|
||||
# BYTE-FOR-BYTE so no working build there changes behavior.
|
||||
if (WIN32 AND NOT MSVC)
|
||||
find_package(FLEX 2.6)
|
||||
find_package(BISON 3.0)
|
||||
if (ENABLE_ALL)
|
||||
if (NOT DEFINED ENABLE_BISON AND NOT BISON_FOUND)
|
||||
set(ENABLE_BISON ON)
|
||||
endif ()
|
||||
if (NOT DEFINED ENABLE_FLEX AND NOT FLEX_FOUND)
|
||||
set(ENABLE_FLEX ON)
|
||||
endif ()
|
||||
endif (ENABLE_ALL)
|
||||
else ()
|
||||
if (ENABLE_ALL)
|
||||
if (NOT DEFINED ENABLE_BISON)
|
||||
set(ENABLE_BISON ON)
|
||||
endif (NOT DEFINED ENABLE_BISON)
|
||||
endif (ENABLE_ALL)
|
||||
endif ()
|
||||
|
||||
if (NOT ENABLE_FLEX)
|
||||
find_package(FLEX 2.6)
|
||||
|
||||
@@ -2,17 +2,41 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 74ed663..ba8c28e 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -224,9 +224,28 @@ if (USE_STATIC_BOOST)
|
||||
@@ -224,9 +224,52 @@ if (USE_STATIC_BOOST)
|
||||
endif ()
|
||||
find_package(Boost 1.70 REQUIRED COMPONENTS atomic chrono date_time filesystem regex system thread wave)
|
||||
add_definitions(-DBOOST_FILESYSTEM_VERSION=3 -DBOOST_FILESYSTEM_NO_DEPRECATED -DBOOST_ALL_DYN_LINK)
|
||||
+if (MSVC)
|
||||
+ # Boost 1.85's auto_link.hpp caps its MSVC toolset tag at vc143 (VS2022), but
|
||||
+ # the bundled Boost is built with the newer (VS2026) toolset and installed as
|
||||
+ # vc145. With BOOST_ALL_DYN_LINK the auto-link #pragma comment(lib, ...)
|
||||
+ # directives would otherwise request boost_*-vc143-mt-x64-1_85.lib, which do
|
||||
+ # not exist (LNK1104). Override the tag to match the bundled libraries.
|
||||
+ add_definitions(-DBOOST_LIB_TOOLSET="vc145")
|
||||
+ # Boost 1.85's auto_link.hpp caps its MSVC toolset tag at vc143 (VS2022), so
|
||||
+ # with BOOST_ALL_DYN_LINK the auto-link #pragma comment(lib, ...) directives
|
||||
+ # request boost_*-vc143-mt-gd-x64-1_85.lib, which does not exist (LNK1104):
|
||||
+ # the bundled Boost is built by b2 with a newer tag (vc144, vc145, ...) that
|
||||
+ # tracks the exact MSVC toolset. find_package(Boost) resolves Boost 1.85 in
|
||||
+ # CONFIG mode, which leaves the legacy Boost_LIBRARY_DIRS empty, so derive the
|
||||
+ # real tag from an imported target's actual import-library filename instead.
|
||||
+ set(_bext_boost_implib "")
|
||||
+ if (TARGET Boost::atomic)
|
||||
+ get_target_property(_bext_boost_cfgs Boost::atomic IMPORTED_CONFIGURATIONS)
|
||||
+ foreach (_bext_cfg IN LISTS _bext_boost_cfgs)
|
||||
+ get_target_property(_bext_boost_implib Boost::atomic IMPORTED_IMPLIB_${_bext_cfg})
|
||||
+ if (_bext_boost_implib)
|
||||
+ break ()
|
||||
+ endif ()
|
||||
+ get_target_property(_bext_boost_implib Boost::atomic IMPORTED_LOCATION_${_bext_cfg})
|
||||
+ if (_bext_boost_implib)
|
||||
+ break ()
|
||||
+ endif ()
|
||||
+ endforeach ()
|
||||
+ endif ()
|
||||
+ if (_bext_boost_implib)
|
||||
+ get_filename_component(_bext_boost_implib "${_bext_boost_implib}" NAME)
|
||||
+ if (_bext_boost_implib MATCHES "-(vc[0-9]+)-")
|
||||
+ add_definitions(-DBOOST_LIB_TOOLSET="${CMAKE_MATCH_1}")
|
||||
+ endif ()
|
||||
+ elseif (MSVC_TOOLSET_VERSION)
|
||||
+ # Fallback: CMake's own toolset number (e.g. 144 -> vc144).
|
||||
+ add_definitions(-DBOOST_LIB_TOOLSET="vc${MSVC_TOOLSET_VERSION}")
|
||||
+ endif ()
|
||||
+endif ()
|
||||
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
|
||||
link_directories(${Boost_LIBRARY_DIRS})
|
||||
|
||||
@@ -16,6 +16,33 @@ if (ENABLE_ASSETIMPORT)
|
||||
set(Z_PREFIX_STR "brl_")
|
||||
endif (TARGET ZLIB_BLD)
|
||||
|
||||
# bext: assimp's inner CMakeLists sets -Werror; many of its headers and
|
||||
# bundled third-party sources (utf8cpp, stb_image, cxxopts, assjson/*.c...)
|
||||
# trigger Clang 20+ warnings that MSVC cl.exe doesn't implement: -Wpadded,
|
||||
# -Wunsafe-buffer-usage(-in-libc-call), -Wswitch-default, -Wlifetime-bound,
|
||||
# etc. Whack-a-mole per warning is fragile; instead we globally disable
|
||||
# -Werror on Clang so assimp's own -Werror flag becomes advisory. MSVC
|
||||
# cl.exe and GCC (both of which don't hit these particular new-Clang
|
||||
# warnings) are untouched. Apply to BOTH CMAKE_C_FLAGS_INIT and
|
||||
# CMAKE_CXX_FLAGS_INIT since assjson/cencode.c is C, not C++. Additive
|
||||
# so CMake's default flags are preserved.
|
||||
set(ASSETIMPORT_BEXT_C_FLAGS_INIT "")
|
||||
set(ASSETIMPORT_BEXT_CXX_FLAGS_INIT "")
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
if (MSVC)
|
||||
set(ASSETIMPORT_BEXT_C_FLAGS_INIT "/clang:-Wno-error")
|
||||
else ()
|
||||
set(ASSETIMPORT_BEXT_C_FLAGS_INIT "-Wno-error")
|
||||
endif ()
|
||||
endif ()
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
if (MSVC)
|
||||
set(ASSETIMPORT_BEXT_CXX_FLAGS_INIT "/clang:-Wno-error")
|
||||
else ()
|
||||
set(ASSETIMPORT_BEXT_CXX_FLAGS_INIT "-Wno-error")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(ASSETIMPORT_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/assimp"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
@@ -25,6 +52,8 @@ if (ENABLE_ASSETIMPORT)
|
||||
COMMAND ${CMAKE_COMMAND};-E;copy;${PROJECT_SOURCE_DIR}/CMake/FindZLIB.cmake;<SOURCE_DIR>/cmake-modules/FindZLIB.cmake
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
-DCMAKE_C_FLAGS_INIT=${ASSETIMPORT_BEXT_C_FLAGS_INIT}
|
||||
-DCMAKE_CXX_FLAGS_INIT=${ASSETIMPORT_BEXT_CXX_FLAGS_INIT}
|
||||
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX=ON>
|
||||
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX_STR=${Z_PREFIX_STR}>
|
||||
-DZLIB_ROOT=$<$<BOOL:${ZLIB_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
|
||||
@@ -11,6 +11,25 @@ if (ENABLE_BOOST)
|
||||
set(Z_PREFIX_STR "brl_")
|
||||
endif (TARGET ZLIB_BLD)
|
||||
|
||||
# bext (staged patch): Boost.Asio (pulled in by Boost.Cobalt, among others) calls
|
||||
# WSAStartup/WSACleanup, which live in the Winsock import libraries. MSVC auto-links
|
||||
# these via `#pragma comment(lib, "ws2_32")`; GCC and Clang targeting MinGW ignore
|
||||
# that pragma, so the shared libs fail to link with undefined references to
|
||||
# `__imp_WSAStartup`/`__imp_WSACleanup`. Append the winsock libs to
|
||||
# CMAKE_<LANG>_STANDARD_LIBRARIES -- emitted at the very end of every link line, the
|
||||
# only position where ld's left-to-right resolution actually pulls the import members
|
||||
# (linker *flags* precede the objects and would be dropped as unreferenced there).
|
||||
# Guarded by MSVC so clang-cl (MSVC ABI, honors the pragma) is left untouched, while
|
||||
# gcc/clang targeting MinGW get the libs. Byte-identical across all three branches.
|
||||
if (NOT MSVC AND WIN32)
|
||||
set(BOOST_STD_LIBS "-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -lws2_32 -lmswsock")
|
||||
set(BOOST_STDLIB_ARGS
|
||||
"-DCMAKE_C_STANDARD_LIBRARIES=${BOOST_STD_LIBS}"
|
||||
"-DCMAKE_CXX_STANDARD_LIBRARIES=${BOOST_STD_LIBS}"
|
||||
)
|
||||
else (NOT MSVC AND WIN32)
|
||||
set(BOOST_STDLIB_ARGS)
|
||||
endif (NOT MSVC AND WIN32)
|
||||
|
||||
ExternalProject_Add(BOOST_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/boost"
|
||||
@@ -32,6 +51,7 @@ if (ENABLE_BOOST)
|
||||
-DBUILD_SHARED_LIBS=ON
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||
${BOOST_STDLIB_ARGS}
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_INSTALL_RPATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}
|
||||
-DCMAKE_INSTALL_LIBDIR:PATH=${LIB_DIR}
|
||||
|
||||
@@ -18,3 +18,27 @@
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
--- embree/common/cmake/gnu.cmake
|
||||
+++ EMBREE_BLD/common/cmake/gnu.cmake
|
||||
@@ -95,10 +95,17 @@ IF (APPLE)
|
||||
ELSE(APPLE)
|
||||
IF (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") # issues link error for undefined symbols in shared library
|
||||
- SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack") # we do not need an executable stack
|
||||
- SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z relro -z now") # re-arranges data sections to increase security
|
||||
- SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z noexecstack") # we do not need an executable stack
|
||||
- SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z relro -z now") # re-arranges data sections to increase security
|
||||
+ # bext: -z noexecstack / -z relro / -z now are ELF-only linker options.
|
||||
+ # GNU ld under MinGW-w64 / clang-mingw targets Windows PE and rejects '-z'
|
||||
+ # with 'unrecognized option'. Skip these hardening flags on WIN32; PE has
|
||||
+ # its own equivalents (/NXCOMPAT is default under GNU ld on mingw). Linux
|
||||
+ # and BSD are untouched. macOS never reaches here (outer IF is NOT APPLE).
|
||||
+ IF (NOT WIN32)
|
||||
+ SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack") # we do not need an executable stack
|
||||
+ SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z relro -z now") # re-arranges data sections to increase security
|
||||
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z noexecstack") # we do not need an executable stack
|
||||
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z relro -z now") # re-arranges data sections to increase security
|
||||
+ ENDIF ()
|
||||
ENDIF ()
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") # enables position independent execution for executable
|
||||
ENDIF(APPLE)
|
||||
@@ -7,9 +7,19 @@ if (ENABLE_FMT)
|
||||
|
||||
RegisterDeps(FMT)
|
||||
|
||||
# bext: apply a single-hunk patch to fmt/include/fmt/ostream.h that skips the
|
||||
# MinGW __gnu_cxx::stdio_*_filebuf dynamic_cast branch when RTTI is disabled
|
||||
# in the including TU (__GXX_RTTI undefined). Consumers such as OSL's
|
||||
# liboslexec compile llvm_util.cpp with -fno-rtti to match LLVM's ABI, and
|
||||
# under GCC/clang -fno-rtti forbids dynamic_cast even at parse time. The
|
||||
# patch is safe on ALL platforms: MSVC takes its own branch (untouched);
|
||||
# Linux/macOS never reach the _WIN32 branches; MinGW RTTI-on TUs get the
|
||||
# same behavior as before (the added && defined(__GXX_RTTI) is true when
|
||||
# -frtti is in effect, which is GCC's default).
|
||||
ExternalProject_Add(FMT_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/fmt"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/fmt.patch
|
||||
CMAKE_ARGS
|
||||
-DFMT_DOC=OFF
|
||||
-DFMT_TEST=OFF
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h
|
||||
--- a/include/fmt/ostream.h
|
||||
+++ b/include/fmt/ostream.h
|
||||
@@ -78,7 +78,15 @@ inline auto write_ostream_unicode(std::ostream& os, fmt::string_view data)
|
||||
f = get_file(*buf);
|
||||
else
|
||||
return false;
|
||||
-#elif defined(_WIN32) && defined(__GLIBCXX__)
|
||||
+// bext: the MinGW-w64 / clang-mingw path below uses dynamic_cast, which
|
||||
+// requires RTTI to parse -- and consumers such as OSL's liboslexec compile
|
||||
+// llvm_util.cpp with -fno-rtti to match LLVM's ABI. Skip the fast path when
|
||||
+// RTTI is disabled in the including TU (__GXX_RTTI is defined only when
|
||||
+// -frtti is in effect for the current TU on GCC/clang). The generic
|
||||
+// fallback below (else branch) returns false, which is the same behavior
|
||||
+// this function had on non-Windows platforms before Windows Unicode
|
||||
+// output was added -- writers fall back to the byte-oriented path.
|
||||
+#elif defined(_WIN32) && defined(__GLIBCXX__) && defined(__GXX_RTTI)
|
||||
auto* rdbuf = os.rdbuf();
|
||||
if (auto* sfbuf = dynamic_cast<__gnu_cxx::stdio_sync_filebuf<char>*>(rdbuf))
|
||||
f = sfbuf->file();
|
||||
|
||||
@@ -14,6 +14,33 @@ if (ENABLE_GDAL)
|
||||
set(Z_PREFIX_STR "brl_")
|
||||
endif (TARGET ZLIB_BLD)
|
||||
|
||||
# bext: gdal's cmake/helpers/CheckCompilerMachineOption.cmake sets
|
||||
# SSSE3/SSE4_1/SSE4_2 feature flags via `-m<feature>` on the "not MSVC and
|
||||
# not ICC" branch, but the MSVC branch only handles AVX/AVX2/AVX512. Under
|
||||
# clang-cl (MSVC=TRUE, driver is clang), the SSSE3/SSE4 arms fall through
|
||||
# empty, so gcore/rasterio_ssse3.cpp is compiled WITHOUT -mssse3 and Clang
|
||||
# fails with "always_inline function '_mm_shuffle_epi8' requires target
|
||||
# feature 'ssse3'". Real MSVC cl.exe accepts SSSE3 intrinsics without a
|
||||
# target flag (its intrinsic headers don't gate on __SSSE3__ macros).
|
||||
#
|
||||
# Fix by pre-setting the GDAL_SSSE3_FLAG / GDAL_SSE41_FLAG / GDAL_SSE42_FLAG
|
||||
# cache variables to `/clang:-m<feature>` (clang-cl passthrough) when the
|
||||
# C++ compiler is Clang. Regular MSVC and Linux/macOS builds see no change.
|
||||
set(GDAL_BEXT_SSSE3_ARG "")
|
||||
set(GDAL_BEXT_SSE41_ARG "")
|
||||
set(GDAL_BEXT_SSE42_ARG "")
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
if (MSVC)
|
||||
set(GDAL_BEXT_SSSE3_ARG "-DGDAL_SSSE3_FLAG=/clang:-mssse3")
|
||||
set(GDAL_BEXT_SSE41_ARG "-DGDAL_SSE41_FLAG=/clang:-msse4.1")
|
||||
set(GDAL_BEXT_SSE42_ARG "-DGDAL_SSE42_FLAG=/clang:-msse4.2")
|
||||
else ()
|
||||
set(GDAL_BEXT_SSSE3_ARG "-DGDAL_SSSE3_FLAG=-mssse3")
|
||||
set(GDAL_BEXT_SSE41_ARG "-DGDAL_SSE41_FLAG=-msse4.1")
|
||||
set(GDAL_BEXT_SSE42_ARG "-DGDAL_SSE42_FLAG=-msse4.2")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(GDAL_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/gdal"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
@@ -23,6 +50,9 @@ if (ENABLE_GDAL)
|
||||
COMMAND ${CMAKE_COMMAND};-E;copy;${PROJECT_SOURCE_DIR}/CMake/FindPNG.cmake;<SOURCE_DIR>/cmake/modules/packages/FindPNG.cmake
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
${GDAL_BEXT_SSSE3_ARG}
|
||||
${GDAL_BEXT_SSE41_ARG}
|
||||
${GDAL_BEXT_SSE42_ARG}
|
||||
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX=ON>
|
||||
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX_STR=${Z_PREFIX_STR}>
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
|
||||
+75
-1
@@ -85,10 +85,76 @@ if (ENABLE_ISPC)
|
||||
# ispc links against the bundled LLVM. Pass the bundled LLVM clang compiler
|
||||
# location when we are switching to it (non-Windows); otherwise ispc is built
|
||||
# with the native compiler above.
|
||||
# bext (staged patch): pick debug-info suppression flags per compiler at configure
|
||||
# time. $<CXX_COMPILER_ID:MSVC> is illegal in ExternalProject steps (custom
|
||||
# commands). MSVC gets the link.exe flags; GNU-style drivers get -g0.
|
||||
if (MSVC)
|
||||
set(ISPC_DBG_CXX_FLAGS "$<$<CONFIG:Debug>:/DEBUG:NONE>")
|
||||
set(ISPC_DBG_LINK_FLAGS "$<$<CONFIG:Debug>:/DEBUG:NONE /INCREMENTAL:NO>")
|
||||
else (MSVC)
|
||||
set(ISPC_DBG_CXX_FLAGS "$<$<CONFIG:Debug>:-g0>")
|
||||
set(ISPC_DBG_LINK_FLAGS "")
|
||||
# bext: on a GNU Windows toolchain (MinGW) ispc-slim.exe is executed during
|
||||
# the build to generate the stdlib bitcode, and the installed ispc is later
|
||||
# invoked by BRL-CAD. A dynamically linked binary aborts on startup with
|
||||
# 0xC0000135 (STATUS_DLL_NOT_FOUND): its libstdc++-6.dll / libgcc_s_seh-1.dll
|
||||
# / libwinpthread-1.dll live in the toolchain bin dir, which is not on PATH
|
||||
# during the sub-build (the compiler is invoked by absolute path, so the
|
||||
# toolchain dir need never be on PATH) nor guaranteed at runtime. Link the
|
||||
# MinGW runtimes statically so the tool is self-contained. (zlib is handled
|
||||
# separately in ispc.patch, which links the static libz_brl.a.) Not applied
|
||||
# on Linux, where fully static linking of the LLVM-based tool is unsupported,
|
||||
# nor on MSVC (its runtime search / hardening path is handled above).
|
||||
if (WIN32)
|
||||
set(ISPC_DBG_LINK_FLAGS "-static")
|
||||
endif ()
|
||||
endif (MSVC)
|
||||
|
||||
# bext: ISPC's runtime library (ispcrt) is built by default, but its Windows
|
||||
# CPU task system (ispcrt/detail/cpu/ispc_tasking.cpp) unconditionally uses the
|
||||
# Microsoft Concurrency Runtime (concrt.h) and other MSVC-isms (e.g. an
|
||||
# implicit FARPROC->void* GetProcAddress conversion), none of which are
|
||||
# available/accepted by MinGW's GNU toolchain. ispcrt is Intel's host-side
|
||||
# runtime for launching ISPC kernels; BRL-CAD only consumes the ispc *compiler*
|
||||
# (no reference to ispcrt anywhere in its build), so on a GNU Windows toolchain
|
||||
# we simply skip ispcrt rather than port ConcRT. MSVC (and Linux/Apple) keep
|
||||
# building it, preserving parity there.
|
||||
set(ISPC_BEXT_INCLUDE_RT ON)
|
||||
if (WIN32 AND NOT MSVC)
|
||||
set(ISPC_BEXT_INCLUDE_RT OFF)
|
||||
endif ()
|
||||
|
||||
# bext: ISPC also builds an embeddable compiler library, libispc (the
|
||||
# libispc_shared target -> libispc.dll), which statically links all of LLVM
|
||||
# and clang. On Windows MSVC only exports __declspec(dllexport)-marked
|
||||
# symbols, so libispc.dll exports a small public API and links fine. MinGW's
|
||||
# ld auto-exports *every* symbol when a DLL has no explicit exports, and the
|
||||
# combined LLVM/clang symbol set (>400k) overflows the PE export table's
|
||||
# 16-bit ordinal space -> "ld.exe: error: export ordinal too large: 411775".
|
||||
# Nothing in bext consumes libispc -- ISPC is pulled in only for OSPRay, which
|
||||
# uses the ispc.exe *compiler* to build its .ispc kernels, not the library --
|
||||
# so on a GNU Windows toolchain we skip the library (ISPC_LIBRARY also forces
|
||||
# ISPC_LIBRARY_JIT off). MSVC (and Linux/Apple) keep building it for parity.
|
||||
set(ISPC_BEXT_LIBRARY ON)
|
||||
if (WIN32 AND NOT MSVC)
|
||||
set(ISPC_BEXT_LIBRARY OFF)
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(ISPC_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/ispc"
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/ispc.patch
|
||||
COMMAND ${CMAKE_COMMAND};-E;copy;${PROJECT_SOURCE_DIR}/CMake/FindZLIB.cmake;<SOURCE_DIR>/cmake/FindZLIB.cmake
|
||||
# bext: install our zlib-name-aware FindZLIB.cmake (it knows the bundled
|
||||
# z_brl library names) into ispc/ispcrt/cmake, which ispc's top-level
|
||||
# CMakeLists.txt unconditionally appends to CMAKE_MODULE_PATH. We formerly
|
||||
# dropped it in ispc/cmake and patched the module-path list to include that
|
||||
# dir, but that one-line patch hunk applied unreliably through
|
||||
# ExternalProject's patch step (the two adjacent module-path lines confuse
|
||||
# patch's -N already-applied heuristic), leaving find_package(ZLIB) to fall
|
||||
# back to CMake's builtin module -- which cannot find z_brl and fails the
|
||||
# generate step with "ZLIB_LIBRARY ... set to NOTFOUND". ispcrt/cmake is
|
||||
# already on the module path with no patch required, so the copy alone is
|
||||
# sufficient and deterministic.
|
||||
COMMAND ${CMAKE_COMMAND};-E;copy;${PROJECT_SOURCE_DIR}/CMake/FindZLIB.cmake;<SOURCE_DIR>/ispcrt/cmake/FindZLIB.cmake
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
@@ -113,6 +179,8 @@ if (ENABLE_ISPC)
|
||||
-DISPC_INCLUDE_EXAMPLES=OFF
|
||||
-DISPC_INCLUDE_DPCPP_EXAMPLES=OFF
|
||||
-DISPC_INCLUDE_TESTS=OFF
|
||||
-DISPC_INCLUDE_RT=${ISPC_BEXT_INCLUDE_RT}
|
||||
-DISPC_LIBRARY=${ISPC_BEXT_LIBRARY}
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
|
||||
@@ -122,6 +190,12 @@ if (ENABLE_ISPC)
|
||||
-DCMAKE_INSTALL_LIBDIR:PATH=${LIB_DIR}
|
||||
-DCMAKE_INSTALL_RPATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}
|
||||
${ISPC_DEBUG_ARGS}
|
||||
# ispc is a build-time codegen tool we never need to debug, and (like LLVM) it
|
||||
# statically links the large bundled LLVM. Suppress debug-info for the Debug
|
||||
# config so it links cleanly (MSVC otherwise hits LNK1201 emitting a huge PDB).
|
||||
# NOTE: quotes must wrap the whole -D argument -- see ISPC_DBG_*_FLAGS above.
|
||||
"-DCMAKE_CXX_FLAGS_DEBUG=${ISPC_DBG_CXX_FLAGS}"
|
||||
"-DCMAKE_EXE_LINKER_FLAGS_DEBUG=${ISPC_DBG_LINK_FLAGS}"
|
||||
LOG_CONFIGURE ${EXT_BUILD_QUIET}
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
|
||||
+69
-27
@@ -2,41 +2,68 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 042e6dd..0d3a2ca 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -312,6 +312,7 @@ endif()
|
||||
|
||||
set(BITCODE2CPP "${CMAKE_CURRENT_SOURCE_DIR}/scripts/bitcode2cpp.py")
|
||||
|
||||
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/ispcrt/cmake)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/FixWindowsPath.cmake)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/Git.cmake)
|
||||
@@ -805,9 +806,18 @@
|
||||
list(APPEND LINK_OPTIONS_PRIVATE /DYNAMICBASE)
|
||||
# Control flow guard
|
||||
list(APPEND LINK_OPTIONS_PRIVATE /GUARD:CF)
|
||||
# When resolving statically linked import dependencies of the module, limit
|
||||
# the module search path to %windows%\system32 directory only.
|
||||
@@ -805,9 +805,27 @@
|
||||
- list(APPEND LINK_OPTIONS_PRIVATE /DYNAMICBASE)
|
||||
- # Control flow guard
|
||||
- list(APPEND LINK_OPTIONS_PRIVATE /GUARD:CF)
|
||||
- # When resolving statically linked import dependencies of the module, limit
|
||||
- # the module search path to %windows%\system32 directory only.
|
||||
- list(APPEND LINK_OPTIONS_PRIVATE /DEPENDENTLOADFLAG:0x800)
|
||||
+ # bext: apply this loader hardening only to non-Debug builds. A Debug ispc
|
||||
+ # depends on the debug CRT DLLs (ucrtbased/msvcp140d/vcruntime140d/
|
||||
+ # vcruntime140_1d), which are never present in system32. Under
|
||||
+ # /DEPENDENTLOADFLAG:0x800 the loader searches only system32 and cannot find
|
||||
+ # them, so ispc-slim.exe fails to start (exit 0xC0000135) when it is run
|
||||
+ # during the build to generate the stdlib bitcode.
|
||||
+ string(TOUPPER "${CMAKE_BUILD_TYPE}" ISPC_BEXT_BUILD_TYPE_UC)
|
||||
+ if (NOT ISPC_BEXT_BUILD_TYPE_UC STREQUAL "DEBUG")
|
||||
+ list(APPEND LINK_OPTIONS_PRIVATE /DEPENDENTLOADFLAG:0x800)
|
||||
+ # bext: /DYNAMICBASE, /GUARD:CF and /DEPENDENTLOADFLAG are all MSVC link.exe
|
||||
+ # options. GNU ld (MinGW) does not understand them and treats each as an
|
||||
+ # input filename -> "ld.exe: cannot find /DYNAMICBASE: No such file or
|
||||
+ # directory" when linking ispc-slim.exe. ld already turns on ASLR
|
||||
+ # (dynamicbase) by default for PE targets and has no Control-Flow-Guard
|
||||
+ # equivalent, so confine this entire hardening block to MSVC. /OPT:REF
|
||||
+ # /OPT:ICF below is already MSVC-gated.
|
||||
+ if (MSVC)
|
||||
+ list(APPEND LINK_OPTIONS_PRIVATE /DYNAMICBASE)
|
||||
+ # Control flow guard
|
||||
+ list(APPEND LINK_OPTIONS_PRIVATE /GUARD:CF)
|
||||
+ # When resolving statically linked import dependencies of the module, limit
|
||||
+ # the module search path to %windows%\system32 directory only.
|
||||
+ # bext: apply this loader hardening only to non-Debug builds. A Debug ispc
|
||||
+ # depends on the debug CRT DLLs (ucrtbased/msvcp140d/vcruntime140d/
|
||||
+ # vcruntime140_1d), which are never present in system32. Under
|
||||
+ # /DEPENDENTLOADFLAG:0x800 the loader searches only system32 and cannot find
|
||||
+ # them, so ispc-slim.exe fails to start (exit 0xC0000135) when it is run
|
||||
+ # during the build to generate the stdlib bitcode.
|
||||
+ string(TOUPPER "${CMAKE_BUILD_TYPE}" ISPC_BEXT_BUILD_TYPE_UC)
|
||||
+ if (NOT ISPC_BEXT_BUILD_TYPE_UC STREQUAL "DEBUG")
|
||||
+ list(APPEND LINK_OPTIONS_PRIVATE /DEPENDENTLOADFLAG:0x800)
|
||||
+ endif()
|
||||
+ endif()
|
||||
if (MSVC AND NOT CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
|
||||
list(APPEND LINK_OPTIONS_PUBLIC /OPT:REF /OPT:ICF)
|
||||
endif()
|
||||
@@ -846,6 +847,10 @@ if (NOT WIN32 AND NOT APPLE)
|
||||
@@ -843,8 +861,29 @@
|
||||
list(APPEND LINK_LIBRARIES)
|
||||
-if (NOT WIN32 AND NOT APPLE)
|
||||
+# bext: ISPC gates the --start-group/--end-group wrapper on "NOT WIN32",
|
||||
+# assuming every Windows build links with MSVC link.exe (which resolves circular
|
||||
+# static-library dependencies via an automatic multi-pass). MinGW is WIN32 but
|
||||
+# links with GNU ld, which is single-pass and needs the group to resolve the
|
||||
+# circular references among the clang/LLVM static libraries (and to let the
|
||||
+# bundled zlib below satisfy libLLVMSupport's brl_* refs regardless of order).
|
||||
+# Key the guard off the linker (MSVC) rather than the platform (WIN32).
|
||||
+if (NOT MSVC AND NOT APPLE)
|
||||
# To resolve circular dependencies between libraries use --start-group/--end-group
|
||||
list(APPEND LINK_LIBRARIES "-Wl,--start-group")
|
||||
endif()
|
||||
|
||||
+# Link against zlib
|
||||
|
||||
+# bext: link the bundled (brl_-prefixed) zlib. libLLVMSupport's Compression.cpp
|
||||
+# and CRC.cpp reference brl_compress2/brl_uncompress/brl_crc32 etc.; upstream
|
||||
+# ISPC never adds zlib to the ispc link line on Windows, so supply it here
|
||||
+# (inside the group above on GNU ld) via our z_brl-aware FindZLIB. Prefer the
|
||||
+# static archive (ZLIB_STATIC_LIBRARIES) so ispc-slim.exe carries no libz_brl.dll
|
||||
+# runtime dependency -- that DLL is not on PATH when ispc runs during the build
|
||||
+# (to generate the stdlib bitcode) and would abort it with 0xC0000135.
|
||||
+find_package(ZLIB)
|
||||
+list(APPEND LINK_LIBRARIES ${ZLIB_LIBRARIES})
|
||||
+if (ZLIB_STATIC_LIBRARIES)
|
||||
+ list(APPEND LINK_LIBRARIES ${ZLIB_STATIC_LIBRARIES})
|
||||
+else ()
|
||||
+ list(APPEND LINK_LIBRARIES ${ZLIB_LIBRARIES})
|
||||
+endif ()
|
||||
+
|
||||
# Link against Clang libraries
|
||||
foreach(clangLib ${CLANG_LIBRARY_LIST})
|
||||
@@ -51,3 +78,18 @@ diff --git a/src/util.cpp b/src/util.cpp
|
||||
+#if defined(__APPLE__) || ISPC_LLVM_VERSION >= ISPC_LLVM_20_0
|
||||
noexcept
|
||||
#endif
|
||||
|
||||
diff --git a/src/util.cpp b/src/util.cpp
|
||||
--- a/src/util.cpp
|
||||
+++ b/src/util.cpp
|
||||
@@ -876,7 +915,9 @@
|
||||
endif()
|
||||
|
||||
-if (NOT WIN32 AND NOT APPLE)
|
||||
+# bext: match the --start-group guard above -- MinGW (WIN32 + GNU ld) needs the
|
||||
+# closing --end-group too; only true MSVC link.exe can omit it.
|
||||
+if (NOT MSVC AND NOT APPLE)
|
||||
list(APPEND LINK_LIBRARIES "-Wl,--end-group")
|
||||
endif()
|
||||
|
||||
# System libraries, our own and transitive dependencies from LLVM libs.
|
||||
|
||||
+45
-9
@@ -30,16 +30,49 @@ if (ENABLE_LLVM)
|
||||
endif (NOT CMAKE_BUILD_TYPE)
|
||||
endif (NOT isMultiConfig)
|
||||
|
||||
# bext (staged patch): pick debug-info suppression flags per compiler at
|
||||
# configure time. $<CXX_COMPILER_ID:MSVC> is illegal in ExternalProject steps
|
||||
# (add_custom_command). /DEBUG:NONE and /INCREMENTAL:NO are MSVC link.exe flags;
|
||||
# passed to g++/clang++ (also WIN32) they poison every compiler probe (LLVM
|
||||
# CheckAtomic fails "linker input file not found" -> "must support std::atomic!").
|
||||
# MSVC keeps the link.exe flags; GNU-style drivers get -g0 (no debug info).
|
||||
if (MSVC)
|
||||
set(LLVM_DBG_CXX_FLAGS "$<$<CONFIG:Debug>:/DEBUG:NONE>")
|
||||
set(LLVM_DBG_LINK_FLAGS "$<$<CONFIG:Debug>:/DEBUG:NONE /INCREMENTAL:NO>")
|
||||
else (MSVC)
|
||||
set(LLVM_DBG_CXX_FLAGS "$<$<CONFIG:Debug>:-g0>")
|
||||
set(LLVM_DBG_LINK_FLAGS "")
|
||||
endif (MSVC)
|
||||
|
||||
# bext (staged patch): GCC 16 / newer libstdc++ stopped providing <cstdint>
|
||||
# transitively. Many LLVM headers (SmallVector.h, X86MCTargetDesc.h, ...)
|
||||
# use uintN_t without #include <cstdint>. Rather than patch each one,
|
||||
# force-include it globally for GNU-style drivers via -include cstdint.
|
||||
# MSVC still gets it transitively and does not accept -include, so it is
|
||||
# excluded (MSVC=TRUE also for clang-cl; FALSE for gcc/clang on MinGW).
|
||||
if (MSVC)
|
||||
set(LLVM_EXTRA_CXX_ARGS)
|
||||
else (MSVC)
|
||||
set(LLVM_EXTRA_CXX_ARGS "-DCMAKE_CXX_FLAGS=-include cstdint")
|
||||
endif (MSVC)
|
||||
|
||||
ExternalProject_Add(LLVM_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/llvm-project"
|
||||
SOURCE_SUBDIR llvm
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE} -E -p1 ${PATCH_OPTIONS} -i "${CMAKE_CURRENT_SOURCE_DIR}/llvm_no_ast_introspection.patch"
|
||||
# bext (staged patch): LLVM's SmallVector.h uses uint32_t/uint64_t in its
|
||||
# extern-template declarations without #include <cstdint>. GCC 16 / newer
|
||||
# libstdc++ no longer provide it transitively, so LLVM fails to build its own
|
||||
# ADT headers ('uint64_t' was not declared -> SmallVectorTemplateCommon is
|
||||
# incomplete). Matches the upstream LLVM fix for GCC 15+; harmless on MSVC.
|
||||
COMMAND ${PATCH_EXECUTABLE} -E -p1 ${PATCH_OPTIONS} -i "${CMAKE_CURRENT_SOURCE_DIR}/llvm_cstdint.patch"
|
||||
COMMAND ${CMAKE_COMMAND};-E;copy;${PROJECT_SOURCE_DIR}/CMake/FindZLIB.cmake;<SOURCE_DIR>/cmake/Modules/FindZLIB.cmake
|
||||
${Z_BRL_PATCH_CMD}
|
||||
CMAKE_ARGS
|
||||
-C ${CMAKE_CURRENT_SOURCE_DIR}/llvm_targets.cmake
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
${LLVM_EXTRA_CXX_ARGS}
|
||||
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX=ON>
|
||||
$<$<BOOL:${ZLIB_TARGET}>:-DZ_PREFIX_STR=${Z_PREFIX_STR}>
|
||||
-DZLIB_ROOT=$<$<BOOL:${ZLIB_TARGET}>:${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
@@ -66,15 +99,12 @@ if (ENABLE_LLVM)
|
||||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BUNDLE_INSTALL_PREFIX}
|
||||
-DCMAKE_INSTALL_LIBDIR:PATH=${LIB_DIR}
|
||||
-DCMAKE_INSTALL_RPATH=${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}
|
||||
# we don't need LLVM itself to be debuggable. Prevents .pdb and .ilk bloat.
|
||||
# NOTE: the quotes must wrap the entire -D argument, not just the value.
|
||||
# Writing -DVAR="..." leaves the double-quotes as literal characters in the
|
||||
# generated configure command; on Windows Debug builds those literal quotes
|
||||
# (plus the embedded space in the linker flags) corrupt child-process argv
|
||||
# parsing and bleed a stray quote onto the following -B path. Wrapping the
|
||||
# whole argument lets CMake consume the quotes as delimiters.
|
||||
"-DCMAKE_CXX_FLAGS_DEBUG=$<$<CONFIG:Debug>:/DEBUG:NONE>"
|
||||
"-DCMAKE_EXE_LINKER_FLAGS_DEBUG=$<$<CONFIG:Debug>:/DEBUG:NONE /INCREMENTAL:NO>"
|
||||
# we don't need LLVM itself to be debuggable. Prevents .pdb/.ilk (MSVC) or
|
||||
# debug-info (GNU) bloat. NOTE: the quotes must wrap the entire -D argument,
|
||||
# not just the value -- literal double-quotes in the value corrupt the
|
||||
# generated configure command's argv on Windows. Flags selected above.
|
||||
"-DCMAKE_CXX_FLAGS_DEBUG=${LLVM_DBG_CXX_FLAGS}"
|
||||
"-DCMAKE_EXE_LINKER_FLAGS_DEBUG=${LLVM_DBG_LINK_FLAGS}"
|
||||
LOG_CONFIGURE ${EXT_BUILD_QUIET}
|
||||
LOG_BUILD ${EXT_BUILD_QUIET}
|
||||
LOG_INSTALL ${EXT_BUILD_QUIET}
|
||||
@@ -92,6 +122,12 @@ if (ENABLE_LLVM)
|
||||
SOURCE_SUBDIR llvm
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE} -E -p1 ${PATCH_OPTIONS} -i "${CMAKE_CURRENT_SOURCE_DIR}/llvm_no_ast_introspection.patch"
|
||||
# bext (staged patch): LLVM's SmallVector.h uses uint32_t/uint64_t in its
|
||||
# extern-template declarations without #include <cstdint>. GCC 16 / newer
|
||||
# libstdc++ no longer provide it transitively, so LLVM fails to build its own
|
||||
# ADT headers ('uint64_t' was not declared -> SmallVectorTemplateCommon is
|
||||
# incomplete). Matches the upstream LLVM fix for GCC 15+; harmless on MSVC.
|
||||
COMMAND ${PATCH_EXECUTABLE} -E -p1 ${PATCH_OPTIONS} -i "${CMAKE_CURRENT_SOURCE_DIR}/llvm_cstdint.patch"
|
||||
COMMAND ${CMAKE_COMMAND};-E;copy;${PROJECT_SOURCE_DIR}/CMake/FindZLIB.cmake;<SOURCE_DIR>/cmake/Modules/FindZLIB.cmake
|
||||
${Z_BRL_PATCH_CMD}
|
||||
CMAKE_ARGS
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
diff -Naur a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
|
||||
--- a/llvm/include/llvm/ADT/SmallVector.h
|
||||
+++ b/llvm/include/llvm/ADT/SmallVector.h
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <algorithm>
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
+#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
@@ -11,11 +11,36 @@ if (ENABLE_NETPBM)
|
||||
|
||||
RegisterDeps(NETPBM)
|
||||
|
||||
# bext: netpbm compat gaps by compiler:
|
||||
# - Clang 20+ / clang-cl: lib/libpm.c calls getpid() without including
|
||||
# <process.h> / <unistd.h>; -Wimplicit-function-declaration is a hard
|
||||
# error per C99. Silence with -Wno-implicit-function-declaration.
|
||||
# - GCC 15+ (mingw): lib/pmfileio.cxx re-declares mkstemp as `static`
|
||||
# after mingw's stdlib.h has already declared it extern; GCC errors
|
||||
# with "was declared 'extern' and later 'static' [-fpermissive]".
|
||||
# Add -fpermissive to demote to warning (same behavior as GCC <15).
|
||||
# MSVC cl.exe accepts both patterns natively and is untouched. Additive
|
||||
# via CMAKE_{C,CXX}_FLAGS_INIT so CMake's default flags are preserved.
|
||||
set(NETPBM_BEXT_C_FLAGS_INIT "")
|
||||
set(NETPBM_BEXT_CXX_FLAGS_INIT "")
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
if (MSVC)
|
||||
set(NETPBM_BEXT_C_FLAGS_INIT "/clang:-Wno-implicit-function-declaration")
|
||||
else ()
|
||||
set(NETPBM_BEXT_C_FLAGS_INIT "-Wno-implicit-function-declaration")
|
||||
endif ()
|
||||
endif ()
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(NETPBM_BEXT_CXX_FLAGS_INIT "-fpermissive")
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(NETPBM_BLD
|
||||
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/netpbm"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
-DCMAKE_C_FLAGS_INIT=${NETPBM_BEXT_C_FLAGS_INIT}
|
||||
-DCMAKE_CXX_FLAGS_INIT=${NETPBM_BEXT_CXX_FLAGS_INIT}
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
|
||||
|
||||
@@ -35,6 +35,20 @@ if (ENABLE_ONETBB)
|
||||
ExternalProject_Add(ONETBB_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/oneTBB"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
# bext (staged patch): oneTBB's profiling.h declares the library-side
|
||||
# r1::itt_set_sync_name() taking "const tchar*", and tchar is unconditionally
|
||||
# wchar_t on all Windows (incl. MinGW). The inline wrapper that converts a
|
||||
# char* name to wchar_t before calling it is gated on
|
||||
# "(_WIN32||_WIN64) && !__MINGW32__", so on MinGW that conversion is skipped
|
||||
# and the char* is passed straight to the wchar_t*-expecting r1 function ->
|
||||
# "cannot convert const char* to const wchar_t*" (fatal, building src/tbb).
|
||||
# The sibling create_itt_sync() already does the same char->wchar_t
|
||||
# conversion under a plain "(_WIN32||_WIN64)" guard and compiles fine on
|
||||
# MinGW, proving the conversion path works there. The patch simply drops the
|
||||
# "&& !__MINGW32__" exclusion so MinGW uses the converting overloads like
|
||||
# MSVC. No-op for MSVC (guard already true) and for non-Windows (guard
|
||||
# false), so it is safe to apply on every toolchain.
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/onetbb.patch
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
-DTBB_TEST=OFF
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
diff -Naur oneTBB/include/oneapi/tbb/profiling.h ONETBB_BLD/include/oneapi/tbb/profiling.h
|
||||
--- oneTBB/include/oneapi/tbb/profiling.h
|
||||
+++ ONETBB_BLD/include/oneapi/tbb/profiling.h
|
||||
@@ -132,7 +132,7 @@
|
||||
r1::call_itt_notify(static_cast<int>(t), ptr);
|
||||
}
|
||||
|
||||
-#if (_WIN32||_WIN64) && !__MINGW32__
|
||||
+#if (_WIN32||_WIN64)
|
||||
inline void itt_set_sync_name(void* obj, const wchar_t* name) {
|
||||
r1::itt_set_sync_name(obj, name);
|
||||
}
|
||||
diff -Naur oneTBB/src/tbb/dynamic_link.cpp ONETBB_BLD/src/tbb/dynamic_link.cpp
|
||||
--- oneTBB/src/tbb/dynamic_link.cpp
|
||||
+++ ONETBB_BLD/src/tbb/dynamic_link.cpp
|
||||
@@ -557,6 +557,11 @@
|
||||
}
|
||||
|
||||
#if _WIN32
|
||||
+#ifndef LOAD_LIBRARY_SAFE_CURRENT_DIRS
|
||||
+// bext: MinGW's libloaderapi.h gates this flag on NTDDI_VERSION >= NTDDI_WIN10_RS1;
|
||||
+// the default target version is lower, so supply its canonical value (0x2000).
|
||||
+#define LOAD_LIBRARY_SAFE_CURRENT_DIRS 0x00002000
|
||||
+#endif
|
||||
DWORD loading_flags(int) {
|
||||
// Do not search in working directory if it is considered unsafe
|
||||
return LOAD_LIBRARY_SAFE_CURRENT_DIRS;
|
||||
@@ -14,6 +14,12 @@ if (ENABLE_OPENCOLORIO)
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/OpenColorIO"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opencolorio.patch
|
||||
# bext (staged patch): OpenColorIO.h uses uint8_t (and an enum : uint8_t) without
|
||||
# including <cstdint>. MSVC and older libstdc++ pulled it in transitively; GCC 16 /
|
||||
# newer libstdc++ tightened transitive includes, so the header fails to compile
|
||||
# ('uint8_t' was not declared). Add the missing include -- a genuine portability
|
||||
# fix, harmless (redundant) on MSVC. Byte-identical across all three branches.
|
||||
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opencolorio-cstdint.patch
|
||||
COMMAND ${CMAKE_COMMAND};-E;copy;${PROJECT_SOURCE_DIR}/CMake/FindZLIB.cmake;<SOURCE_DIR>/share/cmake/modules/FindZLIB.cmake
|
||||
COMMAND ${CMAKE_COMMAND};-E;remove;<SOURCE_DIR>/share/cmake/modules/Findminizip-ng.cmake
|
||||
COMMAND ${CMAKE_COMMAND};-E;remove;<SOURCE_DIR>/share/cmake/modules/Findyaml-cpp.cmake
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
diff -Naur OpenColorIO/include/OpenColorIO/OpenColorIO.h OPENCOLORIO_BLD/include/OpenColorIO/OpenColorIO.h
|
||||
--- OpenColorIO/include/OpenColorIO/OpenColorIO.h
|
||||
+++ OPENCOLORIO_BLD/include/OpenColorIO/OpenColorIO.h
|
||||
@@ -6,6 +6,7 @@
|
||||
#define INCLUDED_OCIO_OPENCOLORIO_H
|
||||
|
||||
#include <cstddef>
|
||||
+#include <cstdint>
|
||||
#include <iosfwd>
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
@@ -7,14 +7,60 @@ if (ENABLE_OPENEXR)
|
||||
|
||||
RegisterDeps(OPENEXR)
|
||||
|
||||
# bext (staged patch): on Windows, GNU ld disables its default "auto-export
|
||||
# every symbol" behaviour as soon as ANY symbol carries __declspec(dllexport)
|
||||
# -- which OpenEXR's IMF_EXPORT macro does. OpenEXR's predefined attribute
|
||||
# types are explicitly instantiated in the library, so their out-of-line member
|
||||
# TypedAttribute<T>::value() is emitted as an ordinary (undecorated) external
|
||||
# symbol; ld then silently drops it from the DLL export table. Downstream
|
||||
# consumers compiled at -O0 (our Debug build, where value() is NOT inlined at
|
||||
# the call site) fail to link with "undefined reference to
|
||||
# Imf::TypedAttribute<...>::value() const" (seen building OpenImageIO's exr
|
||||
# plugin). MSVC's dllexport on the explicit instantiation exports these, so
|
||||
# MSVC is unaffected and is excluded here.
|
||||
#
|
||||
# CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS does NOT help: CMake refuses to synthesise a
|
||||
# .def when the target already carries __declspec markup, so it was silently
|
||||
# ignored (import lib kept only the ~2k dllexport'd symbols, value() absent).
|
||||
# Instead force ld's auto-export directly with --export-all-symbols, which on
|
||||
# PE/COFF exports every defined external symbol IN ADDITION to the dllexport'd
|
||||
# ones -- and does so regardless of GCC -fvisibility=hidden (OpenEXR sets
|
||||
# CXX_VISIBILITY_PRESET hidden), as verified empirically on this toolchain.
|
||||
# The full libOpenEXR external symbol table is ~16k, well under the 65535 PE
|
||||
# export cap. Guarded to WIN32 AND NOT MSVC: --export-all-symbols is a
|
||||
# PE-only ld option (GNU ld rejects it on ELF/Linux) and is meaningless to
|
||||
# MSVC link.exe. The OpenEXR native build does not touch
|
||||
# CMAKE_SHARED_LINKER_FLAGS (its -static Toolchain-mingw.cmake is a
|
||||
# cross-compile file we never pass), so this cache value is not clobbered.
|
||||
if (WIN32 AND NOT MSVC)
|
||||
set(OPENEXR_EXPORT_ARGS "-DCMAKE_SHARED_LINKER_FLAGS=-Wl,--export-all-symbols")
|
||||
else (WIN32 AND NOT MSVC)
|
||||
set(OPENEXR_EXPORT_ARGS)
|
||||
endif (WIN32 AND NOT MSVC)
|
||||
|
||||
ExternalProject_Add(OPENEXR_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/openexr"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/openexr.patch
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
${OPENEXR_EXPORT_ARGS}
|
||||
-DOPENEXR_BUILD_TOOLS=OFF
|
||||
-DOPENEXR_BUILD_EXAMPLES=OFF
|
||||
# bext: we consume only the OpenEXR libraries, not its test suite. On
|
||||
# MinGW/GCC the OpenEXRTest target fails to link with undefined references
|
||||
# to TypedAttribute<T>::value() const (a template-export mismatch in the
|
||||
# test sources), and the tests are never needed by BRL-CAD, so skip them.
|
||||
-DBUILD_TESTING=OFF
|
||||
# bext: force OpenEXR to build AND install its bundled Imath deterministically.
|
||||
# With the default (OFF), OpenEXR's find_package(Imath) can latch onto the
|
||||
# in-tree _deps/imath-build/config (a cached Imath_DIR defeats CMAKE_IGNORE_PATH),
|
||||
# taking the "use but don't install" path -- Imath is then linked but never
|
||||
# staged into the bundle, so a downstream find_package(OpenEXR) ->
|
||||
# find_dependency(Imath) fails (e.g. OpenColorIO). Forcing internal skips
|
||||
# find_package so the install path (gated on OPENEXR_INSTALL=ON) always runs,
|
||||
# staging Imath's config into lib/cmake/Imath. Compiler-agnostic.
|
||||
-DOPENEXR_FORCE_INTERNAL_IMATH=ON
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
|
||||
|
||||
+97
-50
@@ -1,7 +1,8 @@
|
||||
diff -Naur OpenShadingLanguage/CMakeLists.txt OSL_BLD/CMakeLists.txt
|
||||
--- OpenShadingLanguage/CMakeLists.txt 2024-06-26 16:05:10.530665518 -0400
|
||||
+++ OSL_BLD/CMakeLists.txt 2024-06-26 16:00:29.386207307 -0400
|
||||
@@ -15,6 +15,11 @@
|
||||
diff --git OpenShadingLanguage/CMakeLists.txt OSL_BLD/CMakeLists.txt
|
||||
index e7c0382..0729c57 100644
|
||||
--- OpenShadingLanguage/CMakeLists.txt
|
||||
+++ OSL_BLD/CMakeLists.txt
|
||||
@@ -15,6 +15,11 @@ endif ()
|
||||
project (OSL VERSION ${OSL_VERSION}
|
||||
LANGUAGES CXX C
|
||||
HOMEPAGE_URL "https://github.com/AcademySoftwareFoundation/OpenShadingLanguage")
|
||||
@@ -13,10 +14,11 @@ diff -Naur OpenShadingLanguage/CMakeLists.txt OSL_BLD/CMakeLists.txt
|
||||
set (PROJ_NAME ${PROJECT_NAME}) # short name
|
||||
string (TOLOWER ${PROJ_NAME} PROJ_NAME_LOWER) # short name lower case
|
||||
string (TOUPPER ${PROJ_NAME} PROJ_NAME_UPPER) # short name upper case
|
||||
diff -Naur OpenShadingLanguage/src/cmake/Config.cmake.in OSL_BLD/src/cmake/Config.cmake.in
|
||||
--- OpenShadingLanguage/src/cmake/Config.cmake.in 2024-06-26 16:05:10.532665479 -0400
|
||||
+++ OSL_BLD/src/cmake/Config.cmake.in 2024-06-26 16:00:29.386207307 -0400
|
||||
@@ -8,7 +8,7 @@
|
||||
diff --git OpenShadingLanguage/src/cmake/Config.cmake.in OSL_BLD/src/cmake/Config.cmake.in
|
||||
index 6803bc8..21ce05b 100644
|
||||
--- OpenShadingLanguage/src/cmake/Config.cmake.in
|
||||
+++ OSL_BLD/src/cmake/Config.cmake.in
|
||||
@@ -8,7 +8,7 @@ include(CMakeFindDependencyMacro)
|
||||
|
||||
# add here all the find_dependency() whenever switching to config based dependencies
|
||||
if (@OpenEXR_VERSION@ VERSION_GREATER_EQUAL 3.0)
|
||||
@@ -25,10 +27,11 @@ diff -Naur OpenShadingLanguage/src/cmake/Config.cmake.in OSL_BLD/src/cmake/Confi
|
||||
elseif (@OpenEXR_VERSION@ VERSION_GREATER_EQUAL 2.4 AND @FOUND_OPENEXR_WITH_CONFIG@)
|
||||
find_dependency(IlmBase @OpenEXR_VERSION@)
|
||||
find_dependency(OpenEXR @OpenEXR_VERSION@)
|
||||
diff -Naur OpenShadingLanguage/src/cmake/externalpackages.cmake OSL_BLD/src/cmake/externalpackages.cmake
|
||||
--- OpenShadingLanguage/src/cmake/externalpackages.cmake 2024-06-26 16:05:10.532665479 -0400
|
||||
+++ OSL_BLD/src/cmake/externalpackages.cmake 2024-06-26 16:00:29.387207292 -0400
|
||||
@@ -49,13 +49,6 @@
|
||||
diff --git OpenShadingLanguage/src/cmake/externalpackages.cmake OSL_BLD/src/cmake/externalpackages.cmake
|
||||
index 721343a..02906fa 100644
|
||||
--- OpenShadingLanguage/src/cmake/externalpackages.cmake
|
||||
+++ OSL_BLD/src/cmake/externalpackages.cmake
|
||||
@@ -49,13 +49,6 @@ if (BOOST_CUSTOM)
|
||||
# Boost_VERSION, Boost_INCLUDE_DIRS, Boost_LIBRARY_DIRS, Boost_LIBRARIES.
|
||||
else ()
|
||||
set (Boost_COMPONENTS filesystem system thread)
|
||||
@@ -42,10 +45,11 @@ diff -Naur OpenShadingLanguage/src/cmake/externalpackages.cmake OSL_BLD/src/cmak
|
||||
checked_find_package (Boost REQUIRED
|
||||
VERSION_MIN 1.55
|
||||
COMPONENTS ${Boost_COMPONENTS}
|
||||
diff -Naur OpenShadingLanguage/src/cmake/flexbison.cmake OSL_BLD/src/cmake/flexbison.cmake
|
||||
--- OpenShadingLanguage/src/cmake/flexbison.cmake 2024-06-26 16:05:10.532665479 -0400
|
||||
+++ OSL_BLD/src/cmake/flexbison.cmake 2024-06-26 16:00:29.387207292 -0400
|
||||
@@ -27,6 +27,11 @@
|
||||
diff --git OpenShadingLanguage/src/cmake/flexbison.cmake OSL_BLD/src/cmake/flexbison.cmake
|
||||
index 9959cfa..70dcd6b 100644
|
||||
--- OpenShadingLanguage/src/cmake/flexbison.cmake
|
||||
+++ OSL_BLD/src/cmake/flexbison.cmake
|
||||
@@ -27,6 +27,11 @@ if (APPLE AND EXISTS /usr/local/opt
|
||||
DOC "path to the bison executable")
|
||||
endif()
|
||||
|
||||
@@ -57,10 +61,11 @@ diff -Naur OpenShadingLanguage/src/cmake/flexbison.cmake OSL_BLD/src/cmake/flexb
|
||||
checked_find_package (BISON 2.7 REQUIRED
|
||||
PRINT BISON_EXECUTABLE)
|
||||
checked_find_package (FLEX 2.3.35 REQUIRED
|
||||
diff -Naur OpenShadingLanguage/src/cmake/modules/FindLLVM.cmake OSL_BLD/src/cmake/modules/FindLLVM.cmake
|
||||
--- OpenShadingLanguage/src/cmake/modules/FindLLVM.cmake 2024-06-26 16:05:10.532665479 -0400
|
||||
+++ OSL_BLD/src/cmake/modules/FindLLVM.cmake 2024-06-26 16:22:10.337491211 -0400
|
||||
@@ -128,7 +128,7 @@
|
||||
diff --git OpenShadingLanguage/src/cmake/modules/FindLLVM.cmake OSL_BLD/src/cmake/modules/FindLLVM.cmake
|
||||
index 7b6c97f..0926a8f 100644
|
||||
--- OpenShadingLanguage/src/cmake/modules/FindLLVM.cmake
|
||||
+++ OSL_BLD/src/cmake/modules/FindLLVM.cmake
|
||||
@@ -128,7 +128,7 @@ endif ()
|
||||
foreach (COMPONENT clangFrontend clangDriver clangSerialization
|
||||
clangParse clangSema clangAnalysis clangAST
|
||||
clangASTMatchers clangBasic clangEdit clangLex
|
||||
@@ -69,7 +74,7 @@ diff -Naur OpenShadingLanguage/src/cmake/modules/FindLLVM.cmake OSL_BLD/src/cmak
|
||||
find_library ( _CLANG_${COMPONENT}_LIBRARY
|
||||
NAMES ${COMPONENT}
|
||||
PATHS ${LLVM_LIB_DIR})
|
||||
@@ -156,6 +156,7 @@
|
||||
@@ -156,6 +156,7 @@ if ((LLVM_LIBRARY OR LLVM_LIBRARIES OR LLVM_STATIC) AND LLVM_INCLUDES AND LLVM_D
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
@@ -77,10 +82,10 @@ diff -Naur OpenShadingLanguage/src/cmake/modules/FindLLVM.cmake OSL_BLD/src/cmak
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (LLVM
|
||||
diff -Naur OpenShadingLanguage/src/cmake/llvm_macros.cmake OSL_BLD/src/cmake/llvm_macros.cmake
|
||||
--- OpenShadingLanguage/src/cmake/llvm_macros.cmake 2024-06-26 16:05:10.532665479 -0400
|
||||
+++ OSL_BLD/src/cmake/llvm_macros.cmake 2026-05-10 13:35:00.000000000 -0400
|
||||
@@ -40,6 +40,95 @@
|
||||
diff --git OpenShadingLanguage/src/cmake/llvm_macros.cmake OSL_BLD/src/cmake/llvm_macros.cmake
|
||||
--- OpenShadingLanguage/src/cmake/llvm_macros.cmake
|
||||
+++ OSL_BLD/src/cmake/llvm_macros.cmake
|
||||
@@ -40,6 +40,95 @@ function ( EMBED_LLVM_BITCODE_IN_CPP src_list suffix output_name list_to_append_
|
||||
endif ()
|
||||
message (VERBOSE "Using LLVM_BC_GENERATOR ${LLVM_BC_GENERATOR} to generate bitcode.")
|
||||
|
||||
@@ -191,7 +196,7 @@ diff -Naur OpenShadingLanguage/src/include/OSL/dual.h OSL_BLD/src/include/OSL/du
|
||||
diff -Naur OpenShadingLanguage/src/liboslcomp/CMakeLists.txt OSL_BLD/src/liboslcomp/CMakeLists.txt
|
||||
--- OpenShadingLanguage/src/liboslcomp/CMakeLists.txt 2024-06-26 16:05:10.536665401 -0400
|
||||
+++ OSL_BLD/src/liboslcomp/CMakeLists.txt 2024-06-26 16:00:29.387207292 -0400
|
||||
@@ -60,6 +60,7 @@
|
||||
@@ -60,8 +60,20 @@
|
||||
SOVERSION ${SOVERSION}
|
||||
OUTPUT_NAME ${local_lib}${OSL_LIBNAME_SUFFIX}
|
||||
LINK_FLAGS ${link_flags}
|
||||
@@ -199,10 +204,24 @@ diff -Naur OpenShadingLanguage/src/liboslcomp/CMakeLists.txt OSL_BLD/src/liboslc
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
|
||||
diff -Naur OpenShadingLanguage/src/liboslexec/CMakeLists.txt OSL_BLD/src/liboslexec/CMakeLists.txt
|
||||
--- OpenShadingLanguage/src/liboslexec/CMakeLists.txt 2024-06-26 16:05:10.537665382 -0400
|
||||
+++ OSL_BLD/src/liboslexec/CMakeLists.txt 2024-06-26 16:02:50.189463356 -0400
|
||||
@@ -583,6 +583,7 @@
|
||||
install_targets (${local_lib})
|
||||
|
||||
+
|
||||
+# bext: MinGW/clang-mingw need Version.dll's imports too -- clangDriver's
|
||||
+# MSVC.cpp calls GetFileVersionInfoSizeW/GetFileVersionInfoW/VerQueryValueW.
|
||||
+# MSVC's link.exe accepts "Version.lib" as a positional lib name; GNU ld does
|
||||
+# not -- it needs a -l flag. Appended here (rather than in the original
|
||||
+# MSVC-only block above) so that on GNU ld single-pass link, -lversion is
|
||||
+# processed AFTER libclangDriver.a, whose MSVC.cpp.obj emits the undefined
|
||||
+# references. Ordering matters for ld; MSVC link.exe is unaffected by order.
|
||||
+if (WIN32 AND NOT MSVC)
|
||||
+ target_link_libraries (${local_lib} PRIVATE "-lversion")
|
||||
+endif()
|
||||
diff --git OpenShadingLanguage/src/liboslexec/CMakeLists.txt OSL_BLD/src/liboslexec/CMakeLists.txt
|
||||
index d3dc3b4..e667ed1 100644
|
||||
--- OpenShadingLanguage/src/liboslexec/CMakeLists.txt
|
||||
+++ OSL_BLD/src/liboslexec/CMakeLists.txt
|
||||
@@ -583,6 +583,7 @@ target_link_libraries (${local_lib}
|
||||
${Boost_LIBRARIES} ${CMAKE_DL_LIBS}
|
||||
${CLANG_LIBRARIES}
|
||||
${LLVM_LIBRARIES} ${LLVM_LDFLAGS} ${LLVM_SYSTEM_LIBRARIES}
|
||||
@@ -210,7 +229,7 @@ diff -Naur OpenShadingLanguage/src/liboslexec/CMakeLists.txt OSL_BLD/src/libosle
|
||||
)
|
||||
|
||||
target_compile_features (${local_lib}
|
||||
@@ -599,6 +600,7 @@
|
||||
@@ -599,6 +600,7 @@ set_target_properties (${local_lib}
|
||||
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
|
||||
SOVERSION ${SOVERSION}
|
||||
OUTPUT_NAME ${local_lib}${OSL_LIBNAME_SUFFIX}
|
||||
@@ -218,7 +237,7 @@ diff -Naur OpenShadingLanguage/src/liboslexec/CMakeLists.txt OSL_BLD/src/libosle
|
||||
LINK_FLAGS ${link_flags}
|
||||
)
|
||||
|
||||
@@ -613,17 +615,17 @@
|
||||
@@ -613,17 +615,28 @@ install_targets (${local_lib})
|
||||
# Unit tests
|
||||
if (OSL_BUILD_TESTS AND BUILD_TESTING)
|
||||
add_executable (accum_test accum_test.cpp)
|
||||
@@ -239,10 +258,22 @@ diff -Naur OpenShadingLanguage/src/liboslexec/CMakeLists.txt OSL_BLD/src/libosle
|
||||
set_target_properties (llvmutil_test PROPERTIES FOLDER "Unit Tests")
|
||||
add_test (unit_llvmutil ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/llvmutil_test)
|
||||
endif ()
|
||||
diff -Naur OpenShadingLanguage/src/liboslexec/llvm_util.cpp OSL_BLD/src/liboslexec/llvm_util.cpp
|
||||
--- OpenShadingLanguage/src/liboslexec/llvm_util.cpp 2024-06-26 16:05:10.538665362 -0400
|
||||
+++ OSL_BLD/src/liboslexec/llvm_util.cpp 2024-06-26 16:04:03.078993987 -0400
|
||||
@@ -3266,12 +3266,6 @@
|
||||
+
|
||||
+# bext: MinGW/clang-mingw need Version.dll's imports too -- clangDriver's
|
||||
+# MSVC.cpp calls GetFileVersionInfoSizeW/GetFileVersionInfoW/VerQueryValueW.
|
||||
+# MSVC's link.exe accepts "Version.lib" as a positional lib name; GNU ld does
|
||||
+# not -- it needs a -l flag. Appended here (rather than in the original
|
||||
+# MSVC-only block above) so that on GNU ld single-pass link, -lversion is
|
||||
+# processed AFTER libclangDriver.a, whose MSVC.cpp.obj emits the undefined
|
||||
+# references. Ordering matters for ld; MSVC link.exe is unaffected by order.
|
||||
+if (WIN32 AND NOT MSVC)
|
||||
+ target_link_libraries (${local_lib} PRIVATE "-lversion")
|
||||
+endif()
|
||||
diff --git OpenShadingLanguage/src/liboslexec/llvm_util.cpp OSL_BLD/src/liboslexec/llvm_util.cpp
|
||||
index eaa2d05..38a98e6 100644
|
||||
--- OpenShadingLanguage/src/liboslexec/llvm_util.cpp
|
||||
+++ OSL_BLD/src/liboslexec/llvm_util.cpp
|
||||
@@ -3266,12 +3266,6 @@ LLVM_Util::type_wide(llvm::Type* type)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,20 +286,22 @@ diff -Naur OpenShadingLanguage/src/liboslexec/llvm_util.cpp OSL_BLD/src/liboslex
|
||||
llvm::Type*
|
||||
LLVM_Util::type_array(llvm::Type* type, int n)
|
||||
{
|
||||
diff -Naur OpenShadingLanguage/src/oslc/CMakeLists.txt OSL_BLD/src/oslc/CMakeLists.txt
|
||||
--- OpenShadingLanguage/src/oslc/CMakeLists.txt 2024-06-26 16:05:10.542665284 -0400
|
||||
+++ OSL_BLD/src/oslc/CMakeLists.txt 2024-06-26 16:00:29.388207276 -0400
|
||||
@@ -12,5 +12,5 @@
|
||||
diff --git OpenShadingLanguage/src/oslc/CMakeLists.txt OSL_BLD/src/oslc/CMakeLists.txt
|
||||
index 2905324..b7c20e9 100644
|
||||
--- OpenShadingLanguage/src/oslc/CMakeLists.txt
|
||||
+++ OSL_BLD/src/oslc/CMakeLists.txt
|
||||
@@ -12,5 +12,5 @@ if (NOT BUILD_SHARED_LIBS)
|
||||
endif ()
|
||||
|
||||
add_executable ( oslc ${oslc_srcs} )
|
||||
-target_link_libraries ( oslc PRIVATE oslcomp ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||
+target_link_libraries ( oslc PRIVATE oslcomp ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||
install_targets (oslc)
|
||||
diff -Naur OpenShadingLanguage/src/testrender/CMakeLists.txt OSL_BLD/src/testrender/CMakeLists.txt
|
||||
--- OpenShadingLanguage/src/testrender/CMakeLists.txt 2024-06-26 16:05:10.542665284 -0400
|
||||
+++ OSL_BLD/src/testrender/CMakeLists.txt 2024-06-26 16:00:29.388207276 -0400
|
||||
@@ -69,7 +69,10 @@
|
||||
diff --git OpenShadingLanguage/src/testrender/CMakeLists.txt OSL_BLD/src/testrender/CMakeLists.txt
|
||||
index 5f72bfb..4898226 100644
|
||||
--- OpenShadingLanguage/src/testrender/CMakeLists.txt
|
||||
+++ OSL_BLD/src/testrender/CMakeLists.txt
|
||||
@@ -69,7 +69,10 @@ add_executable (testrender ${testrender_srcs})
|
||||
target_link_libraries (testrender
|
||||
PRIVATE
|
||||
oslexec oslquery
|
||||
@@ -280,10 +313,11 @@ diff -Naur OpenShadingLanguage/src/testrender/CMakeLists.txt OSL_BLD/src/testren
|
||||
|
||||
osl_optix_target (testrender)
|
||||
|
||||
diff -Naur OpenShadingLanguage/src/testshade/CMakeLists.txt OSL_BLD/src/testshade/CMakeLists.txt
|
||||
--- OpenShadingLanguage/src/testshade/CMakeLists.txt 2024-06-26 16:05:10.543665265 -0400
|
||||
+++ OSL_BLD/src/testshade/CMakeLists.txt 2024-06-26 16:00:29.388207276 -0400
|
||||
@@ -79,7 +79,7 @@
|
||||
diff --git OpenShadingLanguage/src/testshade/CMakeLists.txt OSL_BLD/src/testshade/CMakeLists.txt
|
||||
index b145341..203dbdc 100644
|
||||
--- OpenShadingLanguage/src/testshade/CMakeLists.txt
|
||||
+++ OSL_BLD/src/testshade/CMakeLists.txt
|
||||
@@ -79,7 +79,7 @@ add_executable ( testshade ${testshade_srcs} testshademain.cpp )
|
||||
|
||||
target_link_libraries (testshade
|
||||
PRIVATE
|
||||
@@ -292,7 +326,7 @@ diff -Naur OpenShadingLanguage/src/testshade/CMakeLists.txt OSL_BLD/src/testshad
|
||||
|
||||
install (TARGETS testshade RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
@@ -106,7 +106,7 @@ if (NOT CODECOV)
|
||||
|
||||
target_link_libraries (libtestshade
|
||||
PRIVATE
|
||||
@@ -301,7 +335,7 @@ diff -Naur OpenShadingLanguage/src/testshade/CMakeLists.txt OSL_BLD/src/testshad
|
||||
set_target_properties (libtestshade PROPERTIES PREFIX "")
|
||||
|
||||
install_targets ( libtestshade )
|
||||
@@ -116,7 +116,7 @@
|
||||
@@ -116,7 +116,7 @@ if (NOT CODECOV)
|
||||
target_link_libraries (testshade_dso
|
||||
PRIVATE
|
||||
OpenImageIO::OpenImageIO
|
||||
@@ -310,3 +344,16 @@ diff -Naur OpenShadingLanguage/src/testshade/CMakeLists.txt OSL_BLD/src/testshad
|
||||
install (TARGETS testshade_dso RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
osl_optix_target(libtestshade)
|
||||
endif ()
|
||||
diff --git OpenShadingLanguage/src/include/OSL/dual.h OSL_BLD/src/include/OSL/dual.h
|
||||
index a7b5e40..60ec05e 100644
|
||||
--- OpenShadingLanguage/src/include/OSL/dual.h
|
||||
+++ OSL_BLD/src/include/OSL/dual.h
|
||||
@@ -204,7 +204,7 @@ public:
|
||||
: m_val(other.m_val)
|
||||
, m_dx(other.m_dx)
|
||||
, m_dy(other.m_dy)
|
||||
- , m_dz(other.dz)
|
||||
+ , m_dz(other.m_dz)
|
||||
{}
|
||||
|
||||
OSL_HOSTDEVICE constexpr const T& elem (ConstIndex<0>) const { return m_val; }
|
||||
|
||||
@@ -0,0 +1,276 @@
|
||||
diff -Naur OpenShadingLanguage/CMakeLists.txt OSL_BLD/CMakeLists.txt
|
||||
--- OpenShadingLanguage/CMakeLists.txt 2024-06-26 16:05:10.530665518 -0400
|
||||
+++ OSL_BLD/CMakeLists.txt 2024-06-26 16:00:29.386207307 -0400
|
||||
@@ -15,6 +15,11 @@
|
||||
project (OSL VERSION ${OSL_VERSION}
|
||||
LANGUAGES CXX C
|
||||
HOMEPAGE_URL "https://github.com/AcademySoftwareFoundation/OpenShadingLanguage")
|
||||
+
|
||||
+set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
+set(CMAKE_CXX_STANDARD 17)
|
||||
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
+
|
||||
set (PROJ_NAME ${PROJECT_NAME}) # short name
|
||||
string (TOLOWER ${PROJ_NAME} PROJ_NAME_LOWER) # short name lower case
|
||||
string (TOUPPER ${PROJ_NAME} PROJ_NAME_UPPER) # short name upper case
|
||||
diff -Naur OpenShadingLanguage/src/cmake/Config.cmake.in OSL_BLD/src/cmake/Config.cmake.in
|
||||
--- OpenShadingLanguage/src/cmake/Config.cmake.in 2024-06-26 16:05:10.532665479 -0400
|
||||
+++ OSL_BLD/src/cmake/Config.cmake.in 2024-06-26 16:00:29.386207307 -0400
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
# add here all the find_dependency() whenever switching to config based dependencies
|
||||
if (@OpenEXR_VERSION@ VERSION_GREATER_EQUAL 3.0)
|
||||
- find_dependency(Imath @Imath_VERSION@)
|
||||
+ find_dependency(OpenEXR @OpenEXR_VERSION@)
|
||||
elseif (@OpenEXR_VERSION@ VERSION_GREATER_EQUAL 2.4 AND @FOUND_OPENEXR_WITH_CONFIG@)
|
||||
find_dependency(IlmBase @OpenEXR_VERSION@)
|
||||
find_dependency(OpenEXR @OpenEXR_VERSION@)
|
||||
diff -Naur OpenShadingLanguage/src/cmake/externalpackages.cmake OSL_BLD/src/cmake/externalpackages.cmake
|
||||
--- OpenShadingLanguage/src/cmake/externalpackages.cmake 2024-06-26 16:05:10.532665479 -0400
|
||||
+++ OSL_BLD/src/cmake/externalpackages.cmake 2024-06-26 16:00:29.387207292 -0400
|
||||
@@ -49,13 +49,6 @@
|
||||
# Boost_VERSION, Boost_INCLUDE_DIRS, Boost_LIBRARY_DIRS, Boost_LIBRARIES.
|
||||
else ()
|
||||
set (Boost_COMPONENTS filesystem system thread)
|
||||
- # The FindBoost.cmake interface is broken if it uses boost's installed
|
||||
- # cmake output (e.g. boost 1.70.0, cmake <= 3.14). Specifically it fails
|
||||
- # to set the expected variables printed below. So until that's fixed
|
||||
- # force FindBoost.cmake to use the original brute force path.
|
||||
- if (NOT DEFINED Boost_NO_BOOST_CMAKE)
|
||||
- set (Boost_NO_BOOST_CMAKE ON)
|
||||
- endif ()
|
||||
checked_find_package (Boost REQUIRED
|
||||
VERSION_MIN 1.55
|
||||
COMPONENTS ${Boost_COMPONENTS}
|
||||
diff -Naur OpenShadingLanguage/src/cmake/flexbison.cmake OSL_BLD/src/cmake/flexbison.cmake
|
||||
--- OpenShadingLanguage/src/cmake/flexbison.cmake 2024-06-26 16:05:10.532665479 -0400
|
||||
+++ OSL_BLD/src/cmake/flexbison.cmake 2024-06-26 16:00:29.387207292 -0400
|
||||
@@ -27,6 +27,11 @@
|
||||
DOC "path to the bison executable")
|
||||
endif()
|
||||
|
||||
+if (MSVC)
|
||||
+ find_program(BISON_EXECUTABLE NAMES win_bison HINTS ${BISON_ROOT} DOC "path to the bison executable")
|
||||
+ find_program(FLEX_EXECUTABLE NAMES win_flex HINTS ${BISON_ROOT} DOC "path to the flex executable")
|
||||
+endif (MSVC)
|
||||
+
|
||||
checked_find_package (BISON 2.7 REQUIRED
|
||||
PRINT BISON_EXECUTABLE)
|
||||
checked_find_package (FLEX 2.3.35 REQUIRED
|
||||
diff -Naur OpenShadingLanguage/src/cmake/modules/FindLLVM.cmake OSL_BLD/src/cmake/modules/FindLLVM.cmake
|
||||
--- OpenShadingLanguage/src/cmake/modules/FindLLVM.cmake 2024-06-26 16:05:10.532665479 -0400
|
||||
+++ OSL_BLD/src/cmake/modules/FindLLVM.cmake 2024-06-26 16:22:10.337491211 -0400
|
||||
@@ -128,7 +128,7 @@
|
||||
foreach (COMPONENT clangFrontend clangDriver clangSerialization
|
||||
clangParse clangSema clangAnalysis clangAST
|
||||
clangASTMatchers clangBasic clangEdit clangLex
|
||||
- clangSupport)
|
||||
+ clangSupport clangAPINotes)
|
||||
find_library ( _CLANG_${COMPONENT}_LIBRARY
|
||||
NAMES ${COMPONENT}
|
||||
PATHS ${LLVM_LIB_DIR})
|
||||
@@ -156,6 +156,7 @@
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
+set(LLVM_LIBRARIES ${LLVM_LIBRARIES} ${CLANG_LIBRARIES})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args (LLVM
|
||||
diff -Naur OpenShadingLanguage/src/cmake/llvm_macros.cmake OSL_BLD/src/cmake/llvm_macros.cmake
|
||||
--- OpenShadingLanguage/src/cmake/llvm_macros.cmake 2024-06-26 16:05:10.532665479 -0400
|
||||
+++ OSL_BLD/src/cmake/llvm_macros.cmake 2026-05-10 13:35:00.000000000 -0400
|
||||
@@ -40,6 +40,21 @@
|
||||
endif ()
|
||||
message (VERBOSE "Using LLVM_BC_GENERATOR ${LLVM_BC_GENERATOR} to generate bitcode.")
|
||||
|
||||
+ if (APPLE)
|
||||
+ execute_process (COMMAND xcrun --show-sdk-path
|
||||
+ OUTPUT_VARIABLE OSL_MACOS_SDK_PATH
|
||||
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
+ if (OSL_MACOS_SDK_PATH)
|
||||
+ list (APPEND LLVM_COMPILE_FLAGS
|
||||
+ "-isysroot" "${OSL_MACOS_SDK_PATH}"
|
||||
+ "-stdlib=libc++")
|
||||
+ if (EXISTS "${OSL_MACOS_SDK_PATH}/usr/include/c++/v1")
|
||||
+ list (APPEND LLVM_COMPILE_FLAGS "-I${OSL_MACOS_SDK_PATH}/usr/include/c++/v1")
|
||||
+ endif ()
|
||||
+ endif ()
|
||||
+ endif ()
|
||||
+
|
||||
+
|
||||
if (NOT LLVM_AS_TOOL)
|
||||
find_program (LLVM_AS_TOOL NAMES "llvm-as"
|
||||
PATHS "${LLVM_DIRECTORY}/bin" "${LLVM_DIRECTORY}/tools/llvm"
|
||||
diff -Naur OpenShadingLanguage/src/liboslcomp/CMakeLists.txt OSL_BLD/src/liboslcomp/CMakeLists.txt
|
||||
--- OpenShadingLanguage/src/liboslcomp/CMakeLists.txt 2024-06-26 16:05:10.536665401 -0400
|
||||
+++ OSL_BLD/src/liboslcomp/CMakeLists.txt 2024-06-26 16:00:29.387207292 -0400
|
||||
@@ -41,7 +41,10 @@
|
||||
${LLVM_SYSTEM_LIBRARIES})
|
||||
|
||||
# link with (system) library to prevent missing symbols inside clangDriver.lib
|
||||
-if (MSVC)
|
||||
- target_link_libraries (${local_lib} PRIVATE "Version.lib")
|
||||
-endif()
|
||||
+# bext: MinGW-w64 and clang/mingw need Version.dll's imports too --
|
||||
+# clangDriver's MSVC.cpp calls GetFileVersionInfoSizeW/GetFileVersionInfoW/
|
||||
+# VerQueryValueW when detecting an installed MSVC toolchain. MSVC's link.exe
|
||||
+# accepts "Version.lib" as a positional lib name; GNU ld does not -- it needs
|
||||
+# either a full path or a -l<name> flag. Use the GCC-style short name on
|
||||
+# non-MSVC and let cmake translate to -lversion; MSVC keeps the .lib form.
|
||||
+if (MSVC)
|
||||
+ target_link_libraries (${local_lib} PRIVATE "Version.lib")
|
||||
+elseif (WIN32)
|
||||
+ target_link_libraries (${local_lib} PRIVATE "-lversion")
|
||||
+endif()
|
||||
|
||||
@@ -60,6 +63,7 @@
|
||||
SOVERSION ${SOVERSION}
|
||||
OUTPUT_NAME ${local_lib}${OSL_LIBNAME_SUFFIX}
|
||||
LINK_FLAGS ${link_flags}
|
||||
+ CXX_STANDARD 17
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
|
||||
diff -Naur OpenShadingLanguage/src/liboslexec/CMakeLists.txt OSL_BLD/src/liboslexec/CMakeLists.txt
|
||||
--- OpenShadingLanguage/src/liboslexec/CMakeLists.txt 2024-06-26 16:05:10.537665382 -0400
|
||||
+++ OSL_BLD/src/liboslexec/CMakeLists.txt 2024-06-26 16:02:50.189463356 -0400
|
||||
@@ -561,7 +561,10 @@
|
||||
endif()
|
||||
|
||||
# link with (system) library to prevent missing symbols inside clangDriver.lib
|
||||
-if (MSVC)
|
||||
- target_link_libraries (${local_lib} PRIVATE "Version.lib")
|
||||
-endif()
|
||||
+# bext: MinGW-w64 and clang/mingw need Version.dll's imports too --
|
||||
+# clangDriver's MSVC.cpp calls GetFileVersionInfoSizeW/GetFileVersionInfoW/
|
||||
+# VerQueryValueW when detecting an installed MSVC toolchain. MSVC's link.exe
|
||||
+# accepts "Version.lib" as a positional lib name; GNU ld does not -- it needs
|
||||
+# either a full path or a -l<name> flag. Use the GCC-style short name on
|
||||
+# non-MSVC and let cmake translate to -lversion; MSVC keeps the .lib form.
|
||||
+if (MSVC)
|
||||
+ target_link_libraries (${local_lib} PRIVATE "Version.lib")
|
||||
+elseif (WIN32)
|
||||
+ target_link_libraries (${local_lib} PRIVATE "-lversion")
|
||||
+endif()
|
||||
|
||||
@@ -583,6 +586,7 @@
|
||||
${Boost_LIBRARIES} ${CMAKE_DL_LIBS}
|
||||
${CLANG_LIBRARIES}
|
||||
${LLVM_LIBRARIES} ${LLVM_LDFLAGS} ${LLVM_SYSTEM_LIBRARIES}
|
||||
+ ${ZLIB_LIBRARIES}
|
||||
)
|
||||
|
||||
target_compile_features (${local_lib}
|
||||
@@ -599,6 +600,7 @@
|
||||
VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}
|
||||
SOVERSION ${SOVERSION}
|
||||
OUTPUT_NAME ${local_lib}${OSL_LIBNAME_SUFFIX}
|
||||
+ CXX_STANDARD 17
|
||||
LINK_FLAGS ${link_flags}
|
||||
)
|
||||
|
||||
@@ -613,17 +615,17 @@
|
||||
# Unit tests
|
||||
if (OSL_BUILD_TESTS AND BUILD_TESTING)
|
||||
add_executable (accum_test accum_test.cpp)
|
||||
- target_link_libraries (accum_test PRIVATE oslexec ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||
+ target_link_libraries (accum_test PRIVATE oslexec ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||
set_target_properties (accum_test PROPERTIES FOLDER "Unit Tests")
|
||||
add_test (unit_accum ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/accum_test)
|
||||
|
||||
add_executable (dual_test dual_test.cpp)
|
||||
- target_link_libraries (dual_test PRIVATE OpenImageIO::OpenImageIO ${ILMBASE_LIBRARIES} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||
+ target_link_libraries (dual_test PRIVATE OpenImageIO::OpenImageIO ${ILMBASE_LIBRARIES} ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||
set_target_properties (dual_test PROPERTIES FOLDER "Unit Tests")
|
||||
add_test (unit_dual ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/dual_test)
|
||||
|
||||
add_executable (llvmutil_test llvmutil_test.cpp)
|
||||
- target_link_libraries (llvmutil_test PRIVATE oslexec ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||
+ target_link_libraries (llvmutil_test PRIVATE oslexec ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||
set_target_properties (llvmutil_test PROPERTIES FOLDER "Unit Tests")
|
||||
add_test (unit_llvmutil ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/llvmutil_test)
|
||||
endif ()
|
||||
diff -Naur OpenShadingLanguage/src/liboslexec/llvm_util.cpp OSL_BLD/src/liboslexec/llvm_util.cpp
|
||||
--- OpenShadingLanguage/src/liboslexec/llvm_util.cpp 2024-06-26 16:05:10.538665362 -0400
|
||||
+++ OSL_BLD/src/liboslexec/llvm_util.cpp 2024-06-26 16:04:03.078993987 -0400
|
||||
@@ -3266,12 +3266,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
-bool
|
||||
-LLVM_Util::is_type_array(llvm::Type* type)
|
||||
-{
|
||||
- return type->isArrayTy();
|
||||
-}
|
||||
-
|
||||
llvm::Type*
|
||||
LLVM_Util::type_array(llvm::Type* type, int n)
|
||||
{
|
||||
diff -Naur OpenShadingLanguage/src/oslc/CMakeLists.txt OSL_BLD/src/oslc/CMakeLists.txt
|
||||
--- OpenShadingLanguage/src/oslc/CMakeLists.txt 2024-06-26 16:05:10.542665284 -0400
|
||||
+++ OSL_BLD/src/oslc/CMakeLists.txt 2024-06-26 16:00:29.388207276 -0400
|
||||
@@ -12,5 +12,5 @@
|
||||
endif ()
|
||||
|
||||
add_executable ( oslc ${oslc_srcs} )
|
||||
-target_link_libraries ( oslc PRIVATE oslcomp ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||
+target_link_libraries ( oslc PRIVATE oslcomp ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${CMAKE_DL_LIBS})
|
||||
install_targets (oslc)
|
||||
diff -Naur OpenShadingLanguage/src/testrender/CMakeLists.txt OSL_BLD/src/testrender/CMakeLists.txt
|
||||
--- OpenShadingLanguage/src/testrender/CMakeLists.txt 2024-06-26 16:05:10.542665284 -0400
|
||||
+++ OSL_BLD/src/testrender/CMakeLists.txt 2024-06-26 16:00:29.388207276 -0400
|
||||
@@ -69,7 +69,10 @@
|
||||
target_link_libraries (testrender
|
||||
PRIVATE
|
||||
oslexec oslquery
|
||||
- pugixml::pugixml)
|
||||
+ pugixml::pugixml
|
||||
+ LLVMSupport
|
||||
+ ${ZLIB_LIBRARIES}
|
||||
+ )
|
||||
|
||||
osl_optix_target (testrender)
|
||||
|
||||
diff -Naur OpenShadingLanguage/src/include/OSL/dual.h OSL_BLD/src/include/OSL/dual.h
|
||||
--- OpenShadingLanguage/src/include/OSL/dual.h
|
||||
+++ OSL_BLD/src/include/OSL/dual.h
|
||||
@@ -204,7 +204,7 @@
|
||||
: m_val(other.m_val)
|
||||
, m_dx(other.m_dx)
|
||||
, m_dy(other.m_dy)
|
||||
- , m_dz(other.dz)
|
||||
+ , m_dz(other.m_dz)
|
||||
{}
|
||||
|
||||
OSL_HOSTDEVICE constexpr const T& elem (ConstIndex<0>) const { return m_val; }
|
||||
diff -Naur OpenShadingLanguage/src/testshade/CMakeLists.txt OSL_BLD/src/testshade/CMakeLists.txt
|
||||
--- OpenShadingLanguage/src/testshade/CMakeLists.txt 2024-06-26 16:05:10.543665265 -0400
|
||||
+++ OSL_BLD/src/testshade/CMakeLists.txt 2024-06-26 16:00:29.388207276 -0400
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
target_link_libraries (testshade
|
||||
PRIVATE
|
||||
- oslexec oslquery)
|
||||
+ oslexec oslquery LLVMSupport ${ZLIB_LIBRARIES})
|
||||
|
||||
install (TARGETS testshade RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
|
||||
target_link_libraries (libtestshade
|
||||
PRIVATE
|
||||
- oslexec oslquery)
|
||||
+ oslexec oslquery LLVMSupport ${ZLIB_LIBRARIES})
|
||||
set_target_properties (libtestshade PROPERTIES PREFIX "")
|
||||
|
||||
install_targets ( libtestshade )
|
||||
@@ -116,7 +116,7 @@
|
||||
target_link_libraries (testshade_dso
|
||||
PRIVATE
|
||||
OpenImageIO::OpenImageIO
|
||||
- ${Boost_LIBRARIES} ${CMAKE_DL_LIBS} )
|
||||
+ ${Boost_LIBRARIES} ${ZLIB_LIBRARIES} ${CMAKE_DL_LIBS} )
|
||||
install (TARGETS testshade_dso RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
|
||||
osl_optix_target(libtestshade)
|
||||
endif ()
|
||||
@@ -25,11 +25,25 @@ if (NOT MSVC AND NOT APPLE)
|
||||
|
||||
RegisterDeps(PLIEF)
|
||||
|
||||
# bext: plief bundles cxxopts.hpp which uses uint8_t without including
|
||||
# <cstdint>. GCC 15+ (mingw's default now) tightens header hygiene and
|
||||
# errors out at "'uint8_t' does not name a type". Pre-inject <cstdint>
|
||||
# via -include so cxxopts.hpp sees the type without editing the vendored
|
||||
# header. MSVC and Apple never reach this branch (outer NOT MSVC AND NOT
|
||||
# APPLE guard); the flag is a no-op on older GCCs / other Clangs so
|
||||
# applying it unconditionally within this branch is safe.
|
||||
if (WIN32)
|
||||
set(PLIEF_BEXT_CXX_FLAGS_INIT "-include cstdint")
|
||||
else ()
|
||||
set(PLIEF_BEXT_CXX_FLAGS_INIT "")
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(PLIEF_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/plief"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
-DCMAKE_CXX_FLAGS_INIT=${PLIEF_BEXT_CXX_FLAGS_INIT}
|
||||
-DLIEF_ROOT=$<$<BOOL:${LEMON_TARGET}>:${CMAKE_NOBUNDLE_INSTALL_PREFIX}>
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
|
||||
+48
-1
@@ -7,11 +7,58 @@ if (ENABLE_RKCOMMON)
|
||||
|
||||
RegisterDeps(RKCOMMON)
|
||||
|
||||
# bext: rkcommon has two Windows non-MSVC portability bugs the parent bext
|
||||
# handles here so we don't touch the submodule. Both are safe on all
|
||||
# toolchains (MSVC's behavior is unchanged), so apply unconditionally so
|
||||
# a stale patched-tree from a prior mixed run stays consistent.
|
||||
# 1. common.h aliases __PRETTY_FUNCTION__ to __FUNCSIG__ on any _WIN32 --
|
||||
# __FUNCSIG__ is MSVC-only, so MinGW/clang-mingw fail with
|
||||
# "'__FUNCSIG__' was not declared in this scope". Tighten the guard
|
||||
# to defined(_WIN32) && defined(_MSC_VER).
|
||||
# 2. rkcommon/rkcommon.rc is UTF-16LE with BOM; MSVC rc.exe accepts that,
|
||||
# GNU windres does not. Re-encode the file in place to UTF-8 on
|
||||
# WIN32 non-MSVC (script is a no-op after the first pass).
|
||||
set(RKCOMMON_BEXT_PATCH_COMMAND
|
||||
${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/rkcommon.patch)
|
||||
if (WIN32 AND NOT MSVC)
|
||||
list(APPEND RKCOMMON_BEXT_PATCH_COMMAND
|
||||
COMMAND ${CMAKE_COMMAND} -DRC=<SOURCE_DIR>/rkcommon/rkcommon.rc -P ${CMAKE_CURRENT_SOURCE_DIR}/rkcommon_reencode_rc.cmake)
|
||||
endif ()
|
||||
|
||||
# bext: on WIN32 non-MSVC, rkcommon's test suite (tests/) includes
|
||||
# math/test_box.cpp which uses M_PI/M_PI_2/M_1_PI without either defining
|
||||
# _USE_MATH_DEFINES or supplying its own constants -- MinGW's <cmath>
|
||||
# does not expose these unless the macro is set. bext never runs the
|
||||
# rkcommon test suite, so disable BUILD_TESTING for this subproject on
|
||||
# GNU-Windows. MSVC/Linux/macOS continue building the tests (unchanged).
|
||||
if (WIN32 AND NOT MSVC)
|
||||
set(RKCOMMON_BEXT_BUILD_TESTING OFF)
|
||||
else ()
|
||||
set(RKCOMMON_BEXT_BUILD_TESTING ON)
|
||||
endif ()
|
||||
|
||||
# bext: rkcommon's cmake/rkcommon_redist_deps.cmake tries to install TBB
|
||||
# runtime DLLs alongside rkcommon on WIN32 (option INSTALL_DEPS, default
|
||||
# ON). It searches for MSVC-style names 'tbb12_debug.dll' / 'tbb_debug.dll'
|
||||
# via find_file, which fails under MinGW/clang-mingw where our bext-built
|
||||
# TBB is named 'libtbb12_debug.dll' -- the install step then errors with
|
||||
# 'file INSTALL cannot find ...TBB_DLL_DEBUG-NOTFOUND'. bext installs TBB
|
||||
# via its own ExternalProject with rpath handling, so rkcommon's DLL-copy
|
||||
# is redundant anyway. Turn INSTALL_DEPS off on WIN32 non-MSVC only;
|
||||
# MSVC (which has the DLL naming rkcommon expects) is unchanged.
|
||||
if (WIN32 AND NOT MSVC)
|
||||
set(RKCOMMON_BEXT_INSTALL_DEPS OFF)
|
||||
else ()
|
||||
set(RKCOMMON_BEXT_INSTALL_DEPS ON)
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(RKCOMMON_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/rkcommon"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
#PATCH_COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/rkcommon.patch
|
||||
PATCH_COMMAND ${RKCOMMON_BEXT_PATCH_COMMAND}
|
||||
CMAKE_ARGS
|
||||
-DBUILD_TESTING=${RKCOMMON_BEXT_BUILD_TESTING}
|
||||
-DINSTALL_DEPS=${RKCOMMON_BEXT_INSTALL_DEPS}
|
||||
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
$<$<BOOL:${ONETBB_TARGET}>:-DRKCOMMON_TBB_ROOT=${CMAKE_BUNDLE_INSTALL_PREFIX}>
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
diff --git a/rkcommon/common.h b/rkcommon/common.h
|
||||
--- a/rkcommon/common.h
|
||||
+++ b/rkcommon/common.h
|
||||
@@ -36,9 +36,13 @@
|
||||
#define RKCOMMON_INTERFACE
|
||||
#endif
|
||||
|
||||
-#ifdef _WIN32
|
||||
+// bext: __FUNCSIG__ is an MSVC-only intrinsic. Upstream keys the alias on
|
||||
+// _WIN32, which is also true under MinGW-w64 and clang/mingw -- those
|
||||
+// compilers already provide __PRETTY_FUNCTION__ natively and reject
|
||||
+// __FUNCSIG__ ("was not declared in this scope"). Restrict the alias to MSVC.
|
||||
+#if defined(_WIN32) && defined(_MSC_VER)
|
||||
#define __PRETTY_FUNCTION__ __FUNCSIG__
|
||||
#endif
|
||||
|
||||
namespace rkcommon {
|
||||
|
||||
diff --git a/rkcommon/os/library.cpp b/rkcommon/os/library.cpp
|
||||
--- a/rkcommon/os/library.cpp
|
||||
+++ b/rkcommon/os/library.cpp
|
||||
@@ -216,7 +216,10 @@
|
||||
void *Library::getSymbol(const std::string &sym) const
|
||||
{
|
||||
#ifdef _WIN32
|
||||
- return GetProcAddress((HMODULE)lib, sym.c_str());
|
||||
+ // bext: MSVC quietly converts FARPROC (a function pointer) to void*.
|
||||
+ // GCC/clang reject the implicit conversion; force it through with an
|
||||
+ // explicit reinterpret_cast so MinGW-w64 and clang/mingw compile too.
|
||||
+ return reinterpret_cast<void *>(GetProcAddress((HMODULE)lib, sym.c_str()));
|
||||
#else
|
||||
return dlsym(lib, sym.c_str());
|
||||
#endif
|
||||
@@ -0,0 +1,51 @@
|
||||
# bext: rkcommon ships rkcommon/rkcommon.rc encoded as UTF-16LE with BOM. MSVC's
|
||||
# rc.exe accepts UTF-16; GNU windres (used by MinGW-w64 and clang/mingw) does
|
||||
# not -- it reads the file as bytes and emits "syntax error" on line 1 because
|
||||
# every character is followed by a NUL. The submodule's inner CMakeLists.txt
|
||||
# adds rkcommon.rc unconditionally as a source, so we cannot skip it from the
|
||||
# parent. Fix: re-encode the file in place to UTF-8 before configure.
|
||||
#
|
||||
# Byte-exact -- do NOT use file(STRINGS ENCODING UTF-16LE). The file contains
|
||||
# a bare LF (0x0A) inside two quoted string literals (VALUE "FileDescription"
|
||||
# and VALUE "LegalCopyright") in addition to CRLF line terminators. Both
|
||||
# rc.exe and windres tolerate a bare LF INSIDE a "..." literal, but if the
|
||||
# splitter treats the bare LF as an end-of-line then the "..." runs off the
|
||||
# end of the line and windres emits "missing terminating "" character".
|
||||
# Rebuilding via file(READ ... HEX) drops the BOM and every other byte
|
||||
# (rkcommon.rc is pure ASCII in the low byte of each UTF-16 code unit),
|
||||
# preserving all embedded NULs-of-line-continuation intact.
|
||||
#
|
||||
# Idempotent: keyed on the BOM (fffe) so BUILD_ALWAYS re-runs skip after the
|
||||
# first pass. Invoked from parent bext/rkcommon/CMakeLists.txt PATCH_COMMAND
|
||||
# as `cmake -DRC=<SOURCE_DIR>/rkcommon/rkcommon.rc -P <this>`.
|
||||
if (NOT DEFINED RC)
|
||||
message(FATAL_ERROR "rkcommon_reencode_rc.cmake: RC variable not set")
|
||||
endif ()
|
||||
if (NOT EXISTS "${RC}")
|
||||
message(FATAL_ERROR "rkcommon_reencode_rc.cmake: ${RC} not found")
|
||||
endif ()
|
||||
file(READ "${RC}" HEAD_HEX LIMIT 2 HEX)
|
||||
if (HEAD_HEX STREQUAL "fffe")
|
||||
file(READ "${RC}" ALL_HEX HEX)
|
||||
# Strip BOM (first 2 bytes = 4 hex chars).
|
||||
string(SUBSTRING "${ALL_HEX}" 4 -1 ALL_HEX)
|
||||
string(LENGTH "${ALL_HEX}" LEN)
|
||||
# Keep the low byte of every UTF-16 code unit (2 chars out of every 4).
|
||||
set(TEXT "")
|
||||
set(i 0)
|
||||
while (i LESS LEN)
|
||||
string(SUBSTRING "${ALL_HEX}" ${i} 2 BH)
|
||||
math(EXPR DEC "0x${BH}")
|
||||
# string(ASCII 0 ...) is illegal; skip stray NULs defensively (should not
|
||||
# happen -- rkcommon.rc's low-byte payload is pure printable + CR/LF).
|
||||
if (NOT DEC EQUAL 0)
|
||||
string(ASCII ${DEC} CH)
|
||||
string(APPEND TEXT "${CH}")
|
||||
endif ()
|
||||
math(EXPR i "${i} + 4")
|
||||
endwhile ()
|
||||
file(WRITE "${RC}" "${TEXT}")
|
||||
message(STATUS "rkcommon.rc re-encoded UTF-16LE -> UTF-8 for GNU windres (byte-exact)")
|
||||
else ()
|
||||
message(STATUS "rkcommon.rc already non-UTF-16 (BOM=${HEAD_HEX}); skipping re-encode")
|
||||
endif ()
|
||||
@@ -14,6 +14,21 @@ if (ENABLE_STEPCODE)
|
||||
# For OSX, we need CMAKE_INSTALL_NAME_DIR
|
||||
set(CMAKE_INSTALL_NAME_DIR "@rpath")
|
||||
|
||||
# bext: stepcode declares many globals with SC_EXPRESS_EXPORT (which resolves
|
||||
# to __declspec(dllexport) under WIN32) but does not extern-declare them in
|
||||
# its own headers. Under GCC 10+ (mingw's default -fno-common), each .c
|
||||
# that includes the header emits its own definition and the DLL export
|
||||
# decoration adds an extra leading underscore, producing exported symbols
|
||||
# like `__ALLOC_new` / `__EXPcreate` etc. -- yet ld looks for the
|
||||
# `__imp_ALLOC_new` etc. that __declspec(dllimport) generates in consumers.
|
||||
# Restore the pre-GCC-10 tentative-definition semantics via -fcommon so the
|
||||
# export decoration matches the import. Gate on WIN32 GCC (MinGW-w64);
|
||||
# MSVC cl.exe / clang-cl / Linux/macOS untouched.
|
||||
set(STEPCODE_BEXT_C_FLAGS_INIT "")
|
||||
if (WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set(STEPCODE_BEXT_C_FLAGS_INIT "-fcommon")
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(STEPCODE_BLD
|
||||
URL "${CMAKE_CURRENT_SOURCE_DIR}/stepcode"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
@@ -21,6 +36,7 @@ if (ENABLE_STEPCODE)
|
||||
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/stepcode_string_pool.patch
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
-DCMAKE_C_FLAGS_INIT=${STEPCODE_BEXT_C_FLAGS_INIT}
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DBUILD_STATIC_LIBS=OFF
|
||||
|
||||
+13
-5
@@ -129,22 +129,30 @@ if (ENABLE_TCL)
|
||||
|
||||
# Scripts expect a non-versioned tclsh program, but the Tcl build doesn't provide one,
|
||||
# we must provide it ourselves
|
||||
if (MSVC)
|
||||
# bext (staged patch): the Windows build (both MSVC nmake and MinGW/clang
|
||||
# autotools via win/) names the interpreter tclsh<major><minor> (e.g.
|
||||
# tclsh86.exe); only the POSIX unix/ build uses tclsh<major>.<minor>. Key the
|
||||
# copy off WIN32, not MSVC, so MinGW/clang-on-Windows finds tclsh86.exe.
|
||||
if (WIN32)
|
||||
add_custom_target(tclsh_cpy ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BUNDLE_INSTALL_PREFIX}/${BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${CMAKE_EXECUTABLE_SUFFIX} ${CMAKE_BUNDLE_INSTALL_PREFIX}/${BIN_DIR}/tclsh${CMAKE_EXECUTABLE_SUFFIX}
|
||||
DEPENDS TCL_BLD-install
|
||||
)
|
||||
else (MSVC)
|
||||
else (WIN32)
|
||||
add_custom_target(tclsh_cpy ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BUNDLE_INSTALL_PREFIX}/${BIN_DIR}/tclsh${TCL_VERSION}${CMAKE_EXECUTABLE_SUFFIX} ${CMAKE_BUNDLE_INSTALL_PREFIX}/${BIN_DIR}/tclsh${CMAKE_EXECUTABLE_SUFFIX}
|
||||
DEPENDS TCL_BLD-install
|
||||
)
|
||||
endif (MSVC)
|
||||
endif (WIN32)
|
||||
|
||||
# The library file permissions end up a bit strange - fix them
|
||||
# bext (staged patch): this is a POSIX shared-object permission fixup (a-x on
|
||||
# the .so). On Windows the produced names differ (tcl86.dll / libtclstub86.a)
|
||||
# and file-mode bits are meaningless, so restrict it to non-Windows to avoid a
|
||||
# chmod on a nonexistent versioned path under MinGW/clang.
|
||||
find_program(CHMOD_EXECUTABLE chmod)
|
||||
mark_as_advanced(CHMOD_EXECUTABLE)
|
||||
if (CHMOD_EXECUTABLE)
|
||||
if (CHMOD_EXECUTABLE AND NOT WIN32)
|
||||
if (MSVC)
|
||||
set(LIB_PREFIX)
|
||||
set(SHARED_DIR ${BIN_DIR})
|
||||
@@ -158,7 +166,7 @@ if (ENABLE_TCL)
|
||||
COMMAND ${CHMOD_EXECUTABLE} a-x,u+w ${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}/${LIB_PREFIX}tclstub${TCL_VERSION}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
DEPENDS TCL_BLD-install
|
||||
)
|
||||
endif (CHMOD_EXECUTABLE)
|
||||
endif (CHMOD_EXECUTABLE AND NOT WIN32)
|
||||
|
||||
# Copy the license into position in CMAKE_BUNDLE_INSTALL_PREFIX
|
||||
configure_file(
|
||||
|
||||
@@ -1,4 +1,37 @@
|
||||
if (NOT WIN32)
|
||||
if (WIN32)
|
||||
|
||||
# bext (staged patch): on native Windows with a GNU toolchain (MinGW-w64 /
|
||||
# clang), Tcl builds from its win/ directory via autotools -- the unix/ tree
|
||||
# targets POSIX and produces no usable Windows Makefile. MSVC uses the nmake
|
||||
# path (makefile.vc) and never runs this script (its CONFIGURE_COMMAND is ""),
|
||||
# so reaching here means a non-MSVC Windows compiler. Run win/configure via a
|
||||
# POSIX shell so a Makefile is generated in the build dir for the subsequent
|
||||
# mingw32-make. --prefix must be a POSIX-style path for the MSYS shell, so
|
||||
# convert it with cygpath.
|
||||
execute_process(
|
||||
COMMAND cygpath -u "@CMAKE_BUNDLE_INSTALL_PREFIX@"
|
||||
OUTPUT_VARIABLE TCL_MSYS_PREFIX
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
set(ENV{CPPFLAGS} "-I@CMAKE_BUNDLE_INSTALL_PREFIX@/@INCLUDE_DIR@")
|
||||
set(ENV{LDFLAGS} "-L@CMAKE_BUNDLE_INSTALL_PREFIX@/@LIB_DIR@")
|
||||
|
||||
execute_process(
|
||||
COMMAND sh @TCL_SRC_DIR@/win/configure --prefix=${TCL_MSYS_PREFIX}
|
||||
RESULT_VARIABLE TCL_RET
|
||||
WORKING_DIRECTORY "@TCL_BIN_DIR@"
|
||||
OUTPUT_VARIABLE MSG
|
||||
ERROR_VARIABLE MSG
|
||||
)
|
||||
|
||||
if (TCL_RET)
|
||||
message(FATAL_ERROR "Tcl configure failed:\n${MSG}\n")
|
||||
endif (TCL_RET)
|
||||
|
||||
message("${MSG}\nTcl configure succeeded.\n")
|
||||
|
||||
elseif (NOT WIN32)
|
||||
|
||||
if (APPLE)
|
||||
|
||||
@@ -36,7 +69,7 @@ if (NOT WIN32)
|
||||
|
||||
message("${MSG}\nTcl configure succeeded.\n")
|
||||
|
||||
endif (NOT WIN32)
|
||||
endif (WIN32)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
|
||||
+12
-2
@@ -55,6 +55,13 @@ if (TK_DO_BUILD)
|
||||
endif (TARGET TCL_BLD)
|
||||
|
||||
set(TK_SRC_DIR "${CMAKE_CURRENT_BINARY_DIR}/TK_BLD-prefix/src/TK_BLD")
|
||||
# bext (staged patch): the Tk configure template references @TK_BIN_DIR@ as its
|
||||
# autotools (VPATH) build directory, but upstream never defines it -- on
|
||||
# non-Windows execute_process inherits the ExternalProject step CWD, so it
|
||||
# works by accident. The Windows win/configure branch below runs configure
|
||||
# explicitly, so define it to the default out-of-source ExternalProject build
|
||||
# directory (mirrors tcl's TCL_BIN_DIR).
|
||||
set(TK_BIN_DIR "${CMAKE_CURRENT_BINARY_DIR}/TK_BLD-prefix/src/TK_BLD-build")
|
||||
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tk_configure.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/tk_configure.cmake @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tk_build.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/tk_build.cmake @ONLY)
|
||||
@@ -114,9 +121,12 @@ if (TK_DO_BUILD)
|
||||
endif (NOT MSVC)
|
||||
|
||||
# The library file permissions end up a bit strange - fix them
|
||||
# bext (staged patch): POSIX shared-object permission fixup (a-x on the .so).
|
||||
# On Windows the produced names differ (tk86.dll / libtkstub86.a) and file-mode
|
||||
# bits are meaningless, so restrict it to non-Windows (mirrors tcl).
|
||||
find_program(CHMOD_EXECUTABLE chmod)
|
||||
mark_as_advanced(CHMOD_EXECUTABLE)
|
||||
if (CHMOD_EXECUTABLE)
|
||||
if (CHMOD_EXECUTABLE AND NOT WIN32)
|
||||
if (MSVC)
|
||||
set(LIB_PREFIX)
|
||||
set(SHARED_DIR ${BIN_DIR})
|
||||
@@ -130,7 +140,7 @@ if (TK_DO_BUILD)
|
||||
COMMAND ${CHMOD_EXECUTABLE} a-x,u+w ${CMAKE_BUNDLE_INSTALL_PREFIX}/${LIB_DIR}/${LIB_PREFIX}tkstub${TCL_VERSION}${CMAKE_STATIC_LIBRARY_SUFFIX}
|
||||
DEPENDS TK_BLD-install
|
||||
)
|
||||
endif (CHMOD_EXECUTABLE)
|
||||
endif (CHMOD_EXECUTABLE AND NOT WIN32)
|
||||
|
||||
TargetInstallDeps(TK TK_DEPENDS)
|
||||
|
||||
|
||||
@@ -1,4 +1,43 @@
|
||||
if (NOT WIN32)
|
||||
if (WIN32)
|
||||
|
||||
# bext (staged patch): mirror the Tcl fix -- on native Windows with a GNU
|
||||
# toolchain (MinGW-w64 / clang) Tk builds from its win/ directory via autotools;
|
||||
# the unix/ tree targets POSIX and produces no usable Windows Makefile. MSVC
|
||||
# uses the nmake path (makefile.vc) and never runs this script (its
|
||||
# CONFIGURE_COMMAND is ""), so reaching here means a non-MSVC Windows compiler.
|
||||
# Run win/configure via a POSIX shell so a Makefile is generated in the build
|
||||
# dir for the subsequent mingw32-make. Paths handed to the MSYS shell (the
|
||||
# --prefix and the --with-tcl directory holding tclConfig.sh) must be
|
||||
# POSIX-style, so convert them with cygpath.
|
||||
execute_process(
|
||||
COMMAND cygpath -u "@CMAKE_BUNDLE_INSTALL_PREFIX@"
|
||||
OUTPUT_VARIABLE TK_MSYS_PREFIX
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
execute_process(
|
||||
COMMAND cygpath -u "@WITH_TCL_DIR@"
|
||||
OUTPUT_VARIABLE TK_MSYS_TCLDIR
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
set(ENV{CPPFLAGS} "-I@CMAKE_BUNDLE_INSTALL_PREFIX@/@INCLUDE_DIR@")
|
||||
set(ENV{LDFLAGS} "-L@CMAKE_BUNDLE_INSTALL_PREFIX@/@LIB_DIR@")
|
||||
|
||||
execute_process(
|
||||
COMMAND sh @TK_SRC_DIR@/win/configure --prefix=${TK_MSYS_PREFIX} --with-tcl=${TK_MSYS_TCLDIR}
|
||||
RESULT_VARIABLE TK_RET
|
||||
WORKING_DIRECTORY "@TK_BIN_DIR@"
|
||||
OUTPUT_VARIABLE MSG
|
||||
ERROR_VARIABLE MSG
|
||||
)
|
||||
|
||||
if (TK_RET)
|
||||
message(FATAL_ERROR "Tk configure failed:\n${MSG}\n")
|
||||
endif (TK_RET)
|
||||
|
||||
message("${MSG}\nTk configure succeeded.\n")
|
||||
|
||||
elseif (NOT WIN32)
|
||||
|
||||
if (APPLE)
|
||||
|
||||
@@ -38,7 +77,7 @@ if (NOT WIN32)
|
||||
|
||||
message("${MSG}\nTk configure succeeded.\n")
|
||||
|
||||
endif (NOT WIN32)
|
||||
endif (WIN32)
|
||||
|
||||
# Local Variables:
|
||||
# tab-width: 8
|
||||
|
||||
@@ -1,6 +1,28 @@
|
||||
# xmltools provides the xsltproc and xmllint tools for Docbook processing
|
||||
bext_enable_all_default(XMLTOOLS xmltools)
|
||||
|
||||
# bext: xmltools bundles libxml2 + libxslt, which have deep Windows portability
|
||||
# gaps that manifest differently on each compiler:
|
||||
# - mingw-gcc: libxml2's globals.h uses TLS-accessor macros (xmlGenericError
|
||||
# becomes a function call via __xmlGenericError()) when LIBXML_THREAD_ENABLED
|
||||
# is set for the libxml build, but libxslt sees the plain variable name --
|
||||
# link fails with "undefined reference to __imp_xmlGenericError".
|
||||
# - clang-cl (clang / icc branches): libxslt tentative-definition duplicate
|
||||
# symbols under lld-link (fixed via -fcommon), plus -Wimplicit-function-
|
||||
# declaration on libxml2's xmlIO.c (fixed via -Wno-...).
|
||||
# xmltools produces xsltproc/xmllint for Docbook -> HTML/PDF documentation
|
||||
# generation, which is not required for building brlcad or IBRT. Skip the
|
||||
# submodule build on WIN32 non-MSVC entirely; brlcad will only miss the
|
||||
# Docbook doc-generation targets, which we don't invoke in our workflow.
|
||||
# MSVC/Linux/macOS continue building xmltools as before (ENABLE_XMLTOOLS
|
||||
# retains its upstream auto-detect logic; this override fires only when the
|
||||
# user hasn't explicitly asked for the build).
|
||||
if (WIN32 AND NOT MSVC AND NOT DEFINED ENABLE_XMLTOOLS)
|
||||
set(ENABLE_XMLTOOLS OFF CACHE BOOL "Enable xmltools build" FORCE)
|
||||
message(STATUS "bext: xmltools disabled on WIN32 non-MSVC (libxml2/libxslt "
|
||||
"Windows portability; xsltproc/xmllint used only for Docbook)")
|
||||
endif ()
|
||||
|
||||
if (NOT ENABLE_XMLTOOLS)
|
||||
|
||||
find_program(XSLTPROC_EXECUTABLE xsltproc)
|
||||
@@ -24,11 +46,40 @@ if (ENABLE_XMLTOOLS)
|
||||
|
||||
RegisterDeps(XMLTOOLS)
|
||||
|
||||
# bext: xmltools bundles libxml2 + libxslt. Compatibility gaps vs MSVC cl.exe:
|
||||
# (1) libxml2 src/xmlIO.c and libxslt call read/write/close/getcwd/isatty
|
||||
# without including <unistd.h> / <io.h>. MSVC's cl.exe accepts these
|
||||
# implicit function declarations; Clang 20+ / clang-cl / GCC 15+ promote
|
||||
# -Wimplicit-function-declaration to an error per C99. Silence via
|
||||
# -Wno-implicit-function-declaration.
|
||||
# (2) libxml2 headers declare globals like xmlGenericError via XMLPUBVAR
|
||||
# without `extern`, relying on tentative definition COMDAT behavior.
|
||||
# GCC 10+ defaults to -fno-common; libxslt then fails to link with
|
||||
# "undefined reference to __imp_xmlGenericError" because the dllimport
|
||||
# side and the definition side disagree on symbol decoration. Clang's
|
||||
# lld-link ALSO errors "duplicate symbol: xsltMaxVars". MSVC cl.exe /
|
||||
# link.exe deduplicate silently. Restore legacy behavior via -fcommon.
|
||||
# Gate on any GNU-style driver (Clang or GNU); leave MSVC cl.exe untouched.
|
||||
# Compose an ADDITIVE flag string via CMAKE_C_FLAGS_INIT rather than
|
||||
# -DCMAKE_C_FLAGS=... so the sub-configure keeps CMake's default C flags
|
||||
# instead of clobbering them to empty.
|
||||
set(XMLTOOLS_BEXT_C_FLAGS_INIT "")
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
if (MSVC)
|
||||
set(XMLTOOLS_BEXT_C_FLAGS_INIT "/clang:-Wno-implicit-function-declaration /clang:-fcommon")
|
||||
else ()
|
||||
set(XMLTOOLS_BEXT_C_FLAGS_INIT "-Wno-implicit-function-declaration -fcommon")
|
||||
endif ()
|
||||
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
set(XMLTOOLS_BEXT_C_FLAGS_INIT "-Wno-implicit-function-declaration -fcommon")
|
||||
endif ()
|
||||
|
||||
ExternalProject_Add(XMLTOOLS_BLD
|
||||
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/xmltools"
|
||||
BUILD_ALWAYS ${EXT_BUILD_ALWAYS} ${LOG_OPTS}
|
||||
CMAKE_ARGS
|
||||
${BUILD_TYPE_SPECIFIER}
|
||||
-DCMAKE_C_FLAGS_INIT=${XMLTOOLS_BEXT_C_FLAGS_INIT}
|
||||
-DBIN_DIR=${BIN_DIR}
|
||||
-DLIB_DIR=${LIB_DIR}
|
||||
-DBUILD_STATIC_LIBS=${BUILD_STATIC_LIBS}
|
||||
|
||||
Reference in New Issue
Block a user