Skip to content

Commit

Permalink
Add __bool__ to TDF_Label (#110)
Browse files Browse the repository at this point in the history
* Add __bool__ to TDF_Label

* Use older pandas for now

* Use Ubuntu 20.04 in azure

* Use macOS-latest

* Try specific SDK

* Pin libcxx

* Find all headers

* Additional debugging

* Update pandas spec

* Change include order

* Install c-compiler

* Add cxx-compiler

* SDK install by hand

* Try with sudo

* Revert changes

* More reverts

* Path typo fix

* Another include dir

* More header finding

* find fix

* symlink to opt

* Use opt

* create the dir first

* Another try

* Use 10.15

* Remove libcxx

* libcxx not on win

* Use conda-devenv

* Print the rendered env file

* Rename env.yml to environment.devenv.yml

* Update env file name in the pipeline

* Fix build env creation

* Cleanup and explicit osx sysroot

* typo fix

* Cleanup
  • Loading branch information
adam-urbanczyk authored May 20, 2023
1 parent 67c3bfa commit a705a3a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ message( STATUS "${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES}")
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(PLATFORM Windows)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(CXX_INCLUDES -i ${CLANG_INCLUDE_DIRS}/c++/v1/ -i /usr/local/include/ )
set(CXX_INCLUDES -i ${CLANG_INCLUDE_DIRS}/c++/v1/ -i /opt/usr/local/include/ )
set(PLATFORM OSX)
else()
set(PLATFORM Linux)
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- template: build-bindings-job.yml
parameters:
name: Linux
vmImage: 'ubuntu-18.04'
vmImage: 'ubuntu-20.04'
- template: build-bindings-job.yml
parameters:
name: Windows
Expand All @@ -27,4 +27,4 @@ jobs:
- template: build-bindings-job.yml
parameters:
name: OSX
vmImage: 'macOS-10.15'
vmImage: 'macOS-latest'
49 changes: 21 additions & 28 deletions build-bindings-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ parameters:
- 11
config_file: 'ocp.toml'
conda_bld: '3.16.3'
conda_env_file: 'env.yml'
conda_env_file: 'environment.devenv.yml'
CXX: g++-8

jobs:
Expand All @@ -30,16 +30,22 @@ jobs:

- ${{ if contains(parameters.vmImage, 'mac') }}:
- bash: |
ln -s "$(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/OpenGL.framework/Headers" /usr/local/include/OpenGL
displayName: 'Find GL headers'
curl -L -O https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.15.sdk.tar.xz && \
sudo mkdir -p /opt && \
sudo tar -xf MacOSX10.15.sdk.tar.xz -C /opt && \
sudo mkdir -p /opt/usr/local/ && \
sudo ln -s /opt/MacOSX10.15.sdk/usr/include /opt/usr/local/include && \
sudo ln -s /opt/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework/Headers /usr/local/include/OpenGL
displayName: 'SDK install and symlink'
- template: conda-enable.yml@templates
parameters:
vmImage: ${{ parameters.vmImage }}

- bash: |
conda env create -f ${{ parameters.conda_env_file }} && \
conda install -n cpp-py-bindgen -y python=${{ parameters.py_maj }}.${{ parameters.py_min }}
mamba-devenv -f ${{ parameters.conda_env_file }} --print && \
mamba-devenv -f ${{ parameters.conda_env_file }} && \
mamba install -n cpp-py-bindgen -y python=${{ parameters.py_maj }}.${{ parameters.py_min }}
displayName: 'Prepare conda environment'
- bash: |
Expand All @@ -55,6 +61,9 @@ jobs:
source activate cpp-py-bindgen && \
echo | clang -v -E -x c - && \
cd $CONDA_PREFIX && \
cat /usr/local/miniconda/envs/cpp-py-bindgen/include/c++/v1/cstddef && \
cat /usr/local/miniconda/envs/cpp-py-bindgen/include/c++/v1/stddef.h && \
find . -iname \*.h\* && \
find . -name type_traits\* && \
sudo find /usr/local/ -name type_traits\*
displayName: 'Mac header check'
Expand Down Expand Up @@ -103,9 +112,10 @@ jobs:

- ${{ if contains(parameters.vmImage, 'mac') }}:
- bash: |
sudo find /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/ && \
ln -s "$(xcrun --sdk macosx --show-sdk-path)/System/Library/Frameworks/OpenGL.framework/Headers" /usr/local/include/OpenGL
displayName: 'Search for GL'
curl -L -O https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.15.sdk.tar.xz && \
sudo mkdir -p /opt && \
sudo tar -xf MacOSX10.15.sdk.tar.xz -C /opt
displayName: 'SDK install'
- ${{ if contains(parameters.vmImage, 'win') }}:
- bash: ls "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build"
Expand All @@ -121,27 +131,10 @@ jobs:
vmImage: ${{ parameters.vmImage }}

- bash: |
sed -e s/python=.../python=${{ parameters.py_maj }}.${{ py_min }}/ ${{ parameters.conda_env_file }} > _env.yml && \
conda env create -f _env.yml
sed -e s/python=.../python=${{ parameters.py_maj }}.${{ py_min }}/ ${{ parameters.conda_env_file }} > _env.devenv.yml && \
mamba-devenv -f _env.devenv.yml
displayName: 'Prepare conda environment'
- bash: |
source activate cpp-py-bindgen && \
conda info -a && \
conda list && \
which python && \
env
displayName: 'Conda env sanity checks'
- ${{ if contains(parameters.vmImage, 'mac') }}:
- bash: |
source activate cpp-py-bindgen && \
echo | clang -v -E -x c - && \
cd $CONDA_PREFIX && \
find . -name type_traits\* && \
sudo find /usr/local/ -name type_traits\*
displayName: 'Mac header check'
- ${{ if contains(parameters.vmImage, 'Ubuntu') }}:
- bash: |
source activate cpp-py-bindgen && \
Expand All @@ -157,7 +150,7 @@ jobs:
source activate cpp-py-bindgen && \
cp -rf opencascade $CONDA_PREFIX/include && \
cat $CONDA_PREFIX/include/opencascade/OpenGl_HaltonSampler.hxx &&\
cmake -B build -S "../$(OCP_src)" -G Ninja -DCMAKE_BUILD_TYPE=Release && \
cmake -B build -S "../$(OCP_src)" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_SYSROOT=/opt/MacOSX10.15.sdk/ && \
cmake --build build -j $(n_cores) -- -k 0 && \
rm -rf build/CMakeFiles
displayName: 'Compile'
Expand Down
3 changes: 2 additions & 1 deletion env.yml → environment.devenv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ channels:
- conda-forge
dependencies:
- clangdev=14.*
- libcxx=14.0.6 # [not win]
- python-clang
- boost=1.78.*
- occt=7.7.0
Expand All @@ -16,7 +17,7 @@ dependencies:
- click
- jinja2
- logzero
- pandas
- pandas <2
- path
- pyparsing
- schema
Expand Down
6 changes: 6 additions & 0 deletions ocp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,12 @@ struct NSOpenGLContext {};"""
body = "[]( TDF_Label & self , const Standard_GUID& anID, TDF_Attribute& anAttribute){ Handle(TDF_Attribute) dummy_attr; auto rv = self.FindAttribute(anID, dummy_attr); anAttribute.Restore(dummy_attr); return rv;}"
help = "Finds an attributes according to an ID."
arguments = ["GUID","Attribute"]

[Modules.TDF.Classes.TDF_Label.additional_methods.__bool__]

body = "[]( const TDF_Label & self){ return !self.IsNull();}"
help = "Check if label is not Null"
arguments = []


[Modules.XmlTObjDrivers]
Expand Down

0 comments on commit a705a3a

Please sign in to comment.