From 95efcf3b35f7821bb4189279ed7dc23e028dbfdd Mon Sep 17 00:00:00 2001 From: elliejs Date: Fri, 17 Jul 2026 05:58:53 +0000 Subject: [PATCH 1/2] Add FreeBSD platform support - ocp.toml: add [FreeBSD] section with Xw module and symbol file - CMakeLists.txt: detect FreeBSD as a build platform, treat its include paths the same as Linux - dump_symbols.py: distinguish FreeBSD from Linux ELF binaries, add lief <0.14 API support. Also fix a latent bug where p.format was accessed before the None check, which would crash if lief.parse failed. Harden parsing with early validation. - templates/CMakeLists.j2: add VTK OPTIONAL_COMPONENTS mpi (required when VTK is built with MPI support) Co-Authored-By: Claude Opus 4.6 --- CMakeLists.txt | 4 +++- dump_symbols.py | 20 ++++++++++++++------ ocp.toml | 4 ++++ templates/CMakeLists.j2 | 2 ++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 12fef27a1..de87227db 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,7 @@ message( STATUS "Include dirs: ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}") if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") list( APPEND CXX_INCLUDES -i /opt/usr/local/include/c++/v1/ -i /opt/usr/local/include/ ) -# Linux-like +# Linux-like (including FreeBSD) elseif(NOT PLATFORM STREQUAL "Windows") foreach( inc IN LISTS CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES) list( APPEND CXX_INCLUDES -i ${inc}/ ) @@ -99,6 +99,8 @@ else() set(PLATFORM Windows) elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") set(PLATFORM OSX) + elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set(PLATFORM FreeBSD) else() set(PLATFORM Linux) endif() diff --git a/dump_symbols.py b/dump_symbols.py index 0c2ce9fc9..eb669fe54 100755 --- a/dump_symbols.py +++ b/dump_symbols.py @@ -1,4 +1,5 @@ import lief +import platform import sys from logzero import logger @@ -7,21 +8,28 @@ exported_symbols = [] +# lief <0.14 uses lief.EXE_FORMATS; 0.14+ uses lief.Binary.FORMATS +FORMATS = getattr(lief, 'EXE_FORMATS', None) or lief.Binary.FORMATS + for lib in libs: + lib = lib.strip() + if not lib: + raise RuntimeError(f'{lib!r} was an empty string') + logger.info(f'Analyzing {lib}') p = lief.parse(lib) - format = p.format - if p is None: - continue + raise RuntimeError(f'lief.parse failed for {lib!r}') + + format = p.format - if format==p.FORMATS.ELF: - name = "linux" + if format == FORMATS.ELF: + name = "freebsd" if platform.system() == "FreeBSD" else "linux" for s in p.exported_symbols: exported_symbols.append(f'{s.name}\n') - elif format==p.FORMATS.MACHO: + elif format == FORMATS.MACHO: name = "mac" for s in p.symbols: if s.raw_type>1: diff --git a/ocp.toml b/ocp.toml index ce5a38533..de707d845 100644 --- a/ocp.toml +++ b/ocp.toml @@ -390,6 +390,10 @@ class Adaptor3d_Surface; exclude_classes = ["Handle_*"] symbols = "symbols_mangled_win.dat" +[FreeBSD] + modules = ["Xw"] + symbols = "symbols_mangled_freebsd.dat" + [OSX] modules = ["Cocoa"] symbols = "symbols_mangled_mac.dat" diff --git a/templates/CMakeLists.j2 b/templates/CMakeLists.j2 index 296ed8365..5b9b464c4 100755 --- a/templates/CMakeLists.j2 +++ b/templates/CMakeLists.j2 @@ -23,6 +23,8 @@ find_package( VTK REQUIRED CommonDataModel CommonExecutionModel freetype + OPTIONAL_COMPONENTS + mpi ) message(STATUS "VTK ${VTK_VERSION} found") find_package( OpenCASCADE REQUIRED ) From ee58bb5b97a0ad27f58798aa11c294d3fa11eb85 Mon Sep 17 00:00:00 2001 From: elliejs Date: Fri, 17 Jul 2026 18:52:29 +0000 Subject: [PATCH 2/2] Point pywrap submodule to upstream OCP79 branch Required for FreeBSD support: tracks CadQuery/pywrap@b7e5acb which includes the -idirafter fix for system include paths, preventing breakage when libclang and system clang versions differ. Co-Authored-By: Claude Opus 4.6 --- pywrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pywrap b/pywrap index f378d84a6..b7e5acbe4 160000 --- a/pywrap +++ b/pywrap @@ -1 +1 @@ -Subproject commit f378d84a6a3a0390f72d8128e2619ba73ef7074a +Subproject commit b7e5acbe4e94fe0a2c9a6e68d4878d9c7ac76046