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
23 changes: 13 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,10 @@ if(NOT DEFINED PYTHONOCC_INSTALL_DIRECTORY)
message(STATUS "conda-build running, using $ENV{SP_DIR} as install dir")
set(PYTHONOCC_INSTALL_DIRECTORY $ENV{SP_DIR}/OCC CACHE PATH "pythonocc install directory")
else(DEFINED ENV{SP_DIR} AND WIN32)
execute_process(COMMAND ${Python3_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; from os.path import relpath; print(relpath(get_python_lib(1,prefix='${CMAKE_INSTALL_PREFIX}'),'${CMAKE_INSTALL_PREFIX}'))" OUTPUT_VARIABLE python_lib OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(
COMMAND ${Python3_EXECUTABLE} -c "import sysconfig, os, sys; print(os.path.relpath(sysconfig.get_path('platlib'), sys.prefix))"
OUTPUT_VARIABLE python_lib
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(PYTHONOCC_INSTALL_DIRECTORY ${python_lib}/OCC CACHE PATH "pythonocc install directory")
endif(DEFINED ENV{SP_DIR} AND WIN32)
endif(NOT DEFINED PYTHONOCC_INSTALL_DIRECTORY)
Expand Down Expand Up @@ -292,7 +295,7 @@ foreach(OCCT_MODULE ${OCCT_TOOLKIT_MODEL})
set(FILE ${SWIG_FILES_PATH}/${OCCT_MODULE}.i)
set_source_files_properties(${FILE} PROPERTIES CPLUSPLUS ON)
swig_add_library (${OCCT_MODULE} LANGUAGE python SOURCES ${FILE} TYPE MODULE)
swig_link_libraries(${OCCT_MODULE} ${OCCT_MODEL_LIBRARIES} Python3::Module)
target_link_libraries(${OCCT_MODULE} ${OCCT_MODEL_LIBRARIES} Python3::Module)
endforeach(OCCT_MODULE)

###############
Expand All @@ -306,7 +309,7 @@ set(TESSELATOR_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/Tesselator/ShapeTesselator.cpp)

swig_add_library(Tesselator LANGUAGE python SOURCES ${TESSELATOR_SOURCE_FILES} TYPE MODULE)
swig_link_libraries(Tesselator ${OCCT_MODEL_LIBRARIES} Python3::Module)
target_link_libraries(Tesselator ${OCCT_MODEL_LIBRARIES} Python3::Module)

#################
# Visualisation #
Expand All @@ -322,7 +325,7 @@ if(PYTHONOCC_WRAP_VISU)
set(FILE ${SWIG_FILES_PATH}/${OCCT_MODULE}.i)
set_source_files_properties(${FILE} PROPERTIES CPLUSPLUS ON)
swig_add_library (${OCCT_MODULE} LANGUAGE python SOURCES ${FILE} TYPE MODULE)
swig_link_libraries(${OCCT_MODULE} ${OCCT_MODEL_LIBRARIES} ${OCCT_VISUALIZATION_LIBRARIES} Python3::Module)
target_link_libraries(${OCCT_MODULE} ${OCCT_MODEL_LIBRARIES} ${OCCT_VISUALIZATION_LIBRARIES} Python3::Module)
endforeach(OCCT_MODULE)

# Build third part modules
Expand All @@ -335,12 +338,12 @@ if(PYTHONOCC_WRAP_VISU)
${CMAKE_CURRENT_SOURCE_DIR}/src/Visualization/Display3d.cpp)

swig_add_library(Visualization LANGUAGE python SOURCES ${VISUALIZATION_SOURCE_FILES} TYPE MODULE)
swig_link_libraries(Visualization ${OCCT_MODEL_LIBRARIES} ${OCCT_VISUALIZATION_LIBRARIES} Python3::Module)
target_link_libraries(Visualization ${OCCT_MODEL_LIBRARIES} ${OCCT_VISUALIZATION_LIBRARIES} Python3::Module)

if(APPLE)
# on OSX, always add /System/Library/Frameworks/Cocoa.framework, even
# if GLX is enabled
swig_link_libraries(Visualization /System/Library/Frameworks/Cocoa.framework)
target_link_libraries(Visualization /System/Library/Frameworks/Cocoa.framework)
endif(APPLE)

##########################
Expand All @@ -355,7 +358,7 @@ if(PYTHONOCC_WRAP_VISU)
${CMAKE_CURRENT_SOURCE_DIR}/src/MeshDataSource/MeshDataSource.cpp)

swig_add_library(MeshDS LANGUAGE python SOURCES ${MESHDATASOURCE_SOURCE_FILES} TYPE MODULE)
swig_link_libraries(MeshDS ${OCCT_MODEL_LIBRARIES} ${OCCT_VISUALIZATION_LIBRARIES} Python3::Module)
target_link_libraries(MeshDS ${OCCT_MODEL_LIBRARIES} ${OCCT_VISUALIZATION_LIBRARIES} Python3::Module)

endif(PYTHONOCC_WRAP_VISU)

Expand All @@ -367,7 +370,7 @@ if(PYTHONOCC_WRAP_DATAEXCHANGE)
set(FILE ${SWIG_FILES_PATH}/${OCCT_MODULE}.i)
set_source_files_properties(${FILE} PROPERTIES CPLUSPLUS ON)
swig_add_library(${OCCT_MODULE} LANGUAGE python SOURCES ${FILE} TYPE MODULE)
swig_link_libraries(${OCCT_MODULE} ${OCCT_MODEL_LIBRARIES} ${OCCT_DATAEXCHANGE_LIBRARIES} Python3::Module)
target_link_libraries(${OCCT_MODULE} ${OCCT_MODEL_LIBRARIES} ${OCCT_DATAEXCHANGE_LIBRARIES} Python3::Module)
endforeach(OCCT_MODULE)
endif(PYTHONOCC_WRAP_DATAEXCHANGE)

Expand All @@ -379,7 +382,7 @@ if(PYTHONOCC_WRAP_OCAF)
set(FILE ${SWIG_FILES_PATH}/${OCCT_MODULE}.i)
set_source_files_properties(${FILE} PROPERTIES CPLUSPLUS ON)
swig_add_library(${OCCT_MODULE} LANGUAGE python SOURCES ${FILE} TYPE MODULE)
swig_link_libraries(${OCCT_MODULE} ${OCCT_MODEL_LIBRARIES} ${OCCT_OCAF_LIBRARIES} Python3::Module)
target_link_libraries(${OCCT_MODULE} ${OCCT_MODEL_LIBRARIES} ${OCCT_OCAF_LIBRARIES} Python3::Module)
endforeach(OCCT_MODULE)
endif(PYTHONOCC_WRAP_OCAF)

Expand All @@ -398,7 +401,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/src/Addons/Font3d.cpp
)

swig_add_library(Addons LANGUAGE python SOURCES ${ADDONS_SOURCE_FILES} TYPE MODULE)
swig_link_libraries(Addons ${OCCT_MODEL_LIBRARIES} ${OCCT_VISUALIZATION_LIBRARIES} Python3::Module)
target_link_libraries(Addons ${OCCT_MODEL_LIBRARIES} ${OCCT_VISUALIZATION_LIBRARIES} Python3::Module)

################
# Installation #
Expand Down
42 changes: 42 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,45 @@ jobs:
vmImage: 'windows-2022'
py_maj: 3
py_min: 12

- template: conda-build.yml
parameters:
name: Ubuntu_24_04_python313
vmImage: 'ubuntu-24.04'
py_maj: 3
py_min: 13

- template: conda-build.yml
parameters:
name: macOS_12_python313
vmImage: 'macOS-latest'
py_maj: 3
py_min: 13

- template: conda-build.yml
parameters:
name: Windows_VS2022_python313
vmImage: 'windows-2022'
py_maj: 3
py_min: 13

- template: conda-build.yml
parameters:
name: Ubuntu_24_04_python314
vmImage: 'ubuntu-24.04'
py_maj: 3
py_min: 14

- template: conda-build.yml
parameters:
name: macOS_12_python314
vmImage: 'macOS-latest'
py_maj: 3
py_min: 14

- template: conda-build.yml
parameters:
name: Windows_VS2022_python314
vmImage: 'windows-2022'
py_maj: 3
py_min: 14
16 changes: 7 additions & 9 deletions ci/conda/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/bin/bash
# make an in source build do to some problems with install

# Configure step
EXTRA_CMAKE_ARGS=""
if [ "$(uname)" == "Darwin" ]; then
EXTRA_CMAKE_ARGS="-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13"
fi

cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=$PREFIX \
Expand All @@ -12,17 +16,11 @@ cmake -G Ninja \
-DPython3_FIND_STRATEGY=LOCATION \
-DPython3_FIND_FRAMEWORK=NEVER \
-DSWIG_HIDE_WARNINGS=ON \
-DPYTHONOCC_MESHDS_NUMPY=ON
-DPYTHONOCC_MESHDS_NUMPY=ON \
$EXTRA_CMAKE_ARGS

# Build step
ninja

# Install step
ninja install

# fix rpaths
#if [ $(uname) == Darwin ]; then
# for lib in $(ls $SP_DIR/OCC/_*.so); do
# install_name_tool -rpath $PREFIX/lib @loader_path/../../../ $lib
# done
#fi
12 changes: 8 additions & 4 deletions ci/conda/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,29 @@ requirements:

host:
- python {{ python }}
- python_abi * *_cp313 [py==313]
- python_abi * *_cp314 [py==314]
- occt ==7.9.3
- numpy >=1.17

run:
- occt ==7.9.3
- numpy >=1.17
- python_abi * *_cp313 [py==313]
- python_abi * *_cp314 [py==314]

test:
imports:
- OCC
- OCC.Core.BRepPrimAPI
- OCC.Core.Tesselator
requires:
- pyqt >=5
- pyqt5-sip # [win]
- pyside6 >=6.10 # [win]
- wxpython >=4.2 # [win]
- svgwrite >=1.4
- mypy
- pytest
- svgwrite
- wxpython >=4
- pyside6

about:
home: https://github.com/tpaviot/pythonocc-core
Expand Down
6 changes: 3 additions & 3 deletions conda-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
conda info -a && \
conda config --add channels https://conda.anaconda.org/conda-forge
displayName: 'Conda config and info'
- bash: conda create --yes --quiet --name build_env conda-build conda-verify libarchive python=${{ parameters.py_maj }}.${{ parameters.py_min }} anaconda-client
- bash: conda create --yes --quiet --name build_env conda-build conda-verify libarchive python=3.12 anaconda-client
displayName: 'Create Anaconda environment'
- ${{ if eq(parameters.vmImage, 'windows-2022') }}:
- script: |
Expand All @@ -54,7 +54,7 @@ jobs:
set CC=cl.exe
set CXX=cl.exe
call activate build_env
conda-build --no-remove-work-dir --dirty ci/conda
conda-build --python ${{ parameters.py_maj }}.${{ parameters.py_min }} --no-remove-work-dir --dirty ci/conda
displayName: 'Set Windows environment and build'
env:
CXX: "cl.exe"
Expand All @@ -66,7 +66,7 @@ jobs:
- ${{ if not(contains(parameters.vmImage, 'win')) }}:
- bash: |
source activate build_env && \
conda-build --no-remove-work-dir --dirty ci/conda
conda-build --python ${{ parameters.py_maj }}.${{ parameters.py_min }} --no-remove-work-dir --dirty ci/conda
displayName: 'Run conda build'
failOnStderr: false
env:
Expand Down