Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ jobs:
uses: ./.github/workflows/build-job.yml
with:
name: OSX
runner_generate: macos-15-intel # Using 13 for x86_64 compatibility or latest as needed
# NB: cross-generating for OSX on Linux
runner_generate: ubuntu-22.04
runner_compile: macos-15-intel
platform: OSX
secrets:
Expand Down
41 changes: 33 additions & 8 deletions .github/workflows/build-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ jobs:
- uses: ./.github/actions/micromamba

- name: SDK install and symlink (Mac)
if: contains(inputs.runner_generate, 'mac')
if: inputs.platform == 'OSX'
run: |
curl -L -O https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX11.3.sdk.tar.xz
sudo mkdir -p /opt
sudo tar -xf MacOSX11.3.sdk.tar.xz -C /opt
sudo ln -s /opt/MacOSX11.3.sdk /opt/MacOSX.sdk
sudo mkdir -p /opt/usr/local/
sudo ln -s /opt/MacOSX11.3.sdk/usr/include /opt/usr/local/include
sudo ln -s /opt/MacOSX11.3.sdk/System/Library/Frameworks/OpenGL.framework/Headers /usr/local/include/OpenGL
Expand All @@ -59,6 +60,7 @@ jobs:
env
micromamba run mamba info
micromamba run mamba-devenv -f environment.devenv.yml
echo "OCCT=$(sed -n 's/^ *- occt=\([0-9.]*\).*/\1/p' environment.devenv.yml)" >> $GITHUB_ENV

- name: Read output dir
id: conf
Expand All @@ -69,7 +71,7 @@ jobs:
- name: Generate (Windows on Linux)
if: inputs.platform == 'Windows'
run: |
micromamba create --yes --platform win-64 --no-deps --prefix ./occt occt=8.0.0
micromamba create --yes --platform win-64 --no-deps --prefix ./occt occt=${OCCT:?}
micromamba run -n bindgen cmake -S . -B . -G Ninja \
-DPython_ROOT_DIR=$CONDA_PREFIX \
-DPython3_ROOT_DIR=$CONDA_PREFIX \
Expand All @@ -80,8 +82,23 @@ jobs:
cmake --build . -- -v
ls -lRht

- name: Generate (OSX on Linux)
if: inputs.platform == 'OSX'
run: |
CONDA_OVERRIDE_OSX=11.0 micromamba create --yes --platform osx-64 --no-deps --prefix ./occt occt=${OCCT:?}
micromamba run -n bindgen cmake -S . -B . -G Ninja \
-DPython_ROOT_DIR=$CONDA_PREFIX \
-DPython3_ROOT_DIR=$CONDA_PREFIX \
-DPython_FIND_VIRTUALENV=ONLY \
-DPython3_FIND_VIRTUALENV=ONLY \
-DOCCT_LIB_DIR=./occt/lib/ \
-DDLL_EXT=dylib \
-DPLATFORM=OSX
cmake --build . -- -v
ls -lRht

- name: Generate (Standard)
if: inputs.platform != 'Windows'
if: inputs.platform != 'Windows' && inputs.platform != 'OSX'
run: |
micromamba run -n bindgen cmake -S . -B . -G Ninja \
-DPython_ROOT_DIR=$CONDA_PREFIX \
Expand Down Expand Up @@ -121,7 +138,10 @@ jobs:

env:
OCP_src: OCP_src_${{ inputs.platform }}
n_cores: 2
CMAKE_CXX_COMPILER_LAUNCHER: sccache
SCCACHE_GHA_ENABLED: "true"
SCCACHE_GHA_VERSION: 1 # bump to start from an empty cache
n_cores: 4
PYTHON_VERSION: 3.${{ matrix.py_min }}
STAGE: "compile"
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
Expand Down Expand Up @@ -155,21 +175,23 @@ jobs:
micromamba create -n bindgen
micromamba run mamba-devenv -f environment.devenv.yml

- uses: mozilla-actions/sccache-action@v0.0.11

- name: Compile (Ubuntu)
if: contains(inputs.runner_compile, 'ubuntu')
run: |
micromamba run -n bindgen cmake -B build -S "../${OCP_src}" -G Ninja \
-DCMAKE_BUILD_TYPE=Release
micromamba run -n bindgen cmake --build build -j 2 -- -k 0
micromamba run -n bindgen cmake --build build -j $n_cores -- -k 0
rm -rf build/CMakeFiles

- name: Compile (Mac)
if: contains(inputs.runner_compile, 'mac')
run: |
micromamba run -n bindgen cmake -B build -S "../${OCP_src}" -G Ninja \
micromamba run -n bindgen cmake -B build -S "../${OCP_src}" -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_SYSROOT=/opt/MacOSX10.15.sdk/
micromamba run -n bindgen cmake --build build -j 2 -- -k 0
micromamba run -n bindgen cmake --build build -j $n_cores -- -k 0
rm -rf build/CMakeFiles

- name: Compile (Windows)
Expand All @@ -182,11 +204,14 @@ jobs:
-DPython3_FIND_STRATEGY=LOCATION `
-DPython3_ROOT_DIR=$env:CONDA_PREFIX `
-DCMAKE_LINKER=lld-link.exe
micromamba run -n bindgen cmake --build build -j 1 -- -v -k 0
micromamba run -n bindgen cmake --build build -j $env:n_cores -- -v -k 0
micromamba run -n bindgen cmake -E rm -rf build\CMakeFiles
env:
CXX: "cl.exe"

- name: Cache statistics
run: sccache --show-stats

- name: Upload Compilation Artifacts
uses: actions/upload-artifact@v7
with:
Expand Down
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
cmake_minimum_required(VERSION 3.29)
project(OCP)

cmake_host_system_information(RESULT N_CORES QUERY NUMBER_OF_LOGICAL_CORES)
set(N_PROC
2
${N_CORES}
CACHE STRING "Number of processes used for generating code")
set(DLL_EXT
dll
Expand Down Expand Up @@ -68,7 +69,7 @@ message(STATUS "Include dirs: ${VTK_INCLUDE_DIR}")
message(STATUS "Include dirs: ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")

# OSX
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
if(PLATFORM STREQUAL "OSX" OR ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
list(APPEND CXX_INCLUDES -i /opt/usr/local/include/c++/v1/ -i
/opt/usr/local/include/)

Expand Down Expand Up @@ -118,7 +119,7 @@ set(ENV{PYTHONPATH} ${CMAKE_SOURCE_DIR}/pywrap)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/tmp.pkl
COMMAND
${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_SOURCE_DIR}/pywrap"
${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_SOURCE_DIR}/pywrap" PYTHONHASHSEED=0
${Python_EXECUTABLE} -m bindgen -n ${N_PROC} -l ${LIBCLANG_PATH} -i
${VTK_INCLUDE_DIR}/
# -i ${OPENGL_INCLUDE_DIRS}
Expand All @@ -136,7 +137,7 @@ add_custom_target(pywrap_parse ALL DEPENDS ${CMAKE_BINARY_DIR}/tmp.pkl)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/tmp_filtered.pkl
COMMAND
${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_SOURCE_DIR}/pywrap"
${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_SOURCE_DIR}/pywrap" PYTHONHASHSEED=0
${Python_EXECUTABLE} -m bindgen -n ${N_PROC} -l ${LIBCLANG_PATH} -i
${VTK_INCLUDE_DIR}/
# -i ${OPENGL_INCLUDE_DIRS}
Expand All @@ -155,7 +156,7 @@ add_custom_target(pywrap_transform ALL
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/OCP/CMakeLists.txt
COMMAND
${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_SOURCE_DIR}/pywrap"
${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_SOURCE_DIR}/pywrap" PYTHONHASHSEED=0
${Python_EXECUTABLE} -m bindgen -n ${N_PROC} -l ${LIBCLANG_PATH} -i
${VTK_INCLUDE_DIR}/
# -i ${OPENGL_INCLUDE_DIRS}
Expand Down
1 change: 0 additions & 1 deletion environment.devenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ dependencies:
- click
- jinja2
- logzero
- pandas
- path
- pyparsing
- schema
Expand Down
2 changes: 1 addition & 1 deletion ocp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ class Adaptor3d_Surface;
[OSX]
modules = ["Cocoa"]
symbols = "symbols_mangled_mac.dat"
prefix = "/usr/local/miniconda/envs/cpp-py-bindgen"
prefix = "/opt/MacOSX.sdk"
includes = ['/usr/local/Cellar/gcc@8/8.3.0_2/lib/gcc/8/gcc/x86_64-apple-darwin19/8.3.0/../../../../../../include/c++/8.3.0',
'/usr/local/Cellar/gcc@8/8.3.0_2/lib/gcc/8/gcc/x86_64-apple-darwin19/8.3.0/../../../../../../include/c++/8.3.0/x86_64-apple-darwin19',
'/usr/local/Cellar/gcc@8/8.3.0_2/lib/gcc/8/gcc/x86_64-apple-darwin19/8.3.0/../../../../../../include/c++/8.3.0/backward',
Expand Down
2 changes: 1 addition & 1 deletion pywrap