Skip to content

Commit 0f8b83a

Browse files
authored
Add Mac OS wheel build action (#69)
* Update to tesseract 0.21.4 * Fix LD_LIBRARY_PATH during docs build for wheels workflow * Bump version to 0.3.0 * Add python 3.12 build * Update generated api docs * Update docs requirements * Update docs requirements * Add macos action * run ci * Add macos action * Add macos action * Add macos action * Add macos action * Add macos action * Add macos action * Use setup-python output python-path on mac * Fix delocate-wheel command arguments * Wheels workflow branch trigger * Only build Python 3.12 on macos * DYLD_LIBRARY_PATH during macos build
1 parent 59a3529 commit 0f8b83a

File tree

3 files changed

+110
-4
lines changed

3 files changed

+110
-4
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
set(VCPKG_TARGET_ARCHITECTURE x64)
2+
set(VCPKG_CRT_LINKAGE dynamic)
3+
set(VCPKG_LIBRARY_LINKAGE dynamic)
4+
5+
set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
6+
set(VCPKG_OSX_ARCHITECTURES x86_64)
7+
8+
set(VCPKG_BUILD_TYPE release)
9+
set(VCPKG_OSX_DEPLOYMENT_TARGET 12.0)

.github/workflows/wheels.yml

Lines changed: 89 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- master
7-
- dev
7+
- 'dev**'
88
pull_request:
99
release:
1010
types:
@@ -17,11 +17,11 @@ env:
1717
tinyxml2 console-bridge assimp
1818
urdfdom octomap orocos-kdl pcl
1919
gtest benchmark flann jsoncpp
20-
yaml-cpp
21-
blas lapack
20+
yaml-cpp eigen3
21+
openblas
2222
fcl ompl taskflow
2323
bullet3[multithreading,double-precision,rtti]
24-
ccd[double-precision]
24+
ccd[double-precision] gperftools
2525
jobs:
2626
build-ubuntu:
2727
runs-on: ${{ matrix.config.runs_on }}
@@ -274,10 +274,95 @@ jobs:
274274
name: 'build-logs-win-${{ matrix.config.arch }}-python-${{ matrix.config.python_version }}'
275275
path: "**/*.log"
276276
retention-days: 2
277+
build-macos:
278+
runs-on: macos-latest
279+
strategy:
280+
fail-fast: false
281+
matrix:
282+
config:
283+
- py_platform: macosx-10.9-x86_64
284+
python_version: "3.12"
285+
steps:
286+
- uses: actions/checkout@v2
287+
with:
288+
path: ws/src/tesseract_python
289+
- uses: actions/setup-python@v4
290+
id: setup-python
291+
with:
292+
python-version: '${{ matrix.config.python_version }}'
293+
- name: brew
294+
run: |
295+
brew install libomp cmake automake autoconf libtool gcc ninja
296+
- name: vcpkg build
297+
uses: johnwason/vcpkg-action@v5
298+
with:
299+
pkgs: >-
300+
${{ env.VCPKG_PKGS }}
301+
triplet: x64-osx-dynamic-release
302+
extra-args: --clean-after-build --overlay-triplets=${{ github.workspace }}/ws/src/tesseract_python/.github/workflows/vcpkg_triplets
303+
token: ${{ github.token }}
304+
cache-key: osx-x64-vcpkg
305+
revision: master
306+
- name: pip3
307+
run: |
308+
python3 -m pip install numpy setuptools wheel pytest delvewheel colcon-common-extensions vcstool delocate
309+
- name: vcs import
310+
working-directory: ws/src
311+
run: vcs import --input tesseract_python/dependencies.rosinstall
312+
- name: colcon build
313+
working-directory: ws
314+
run: |
315+
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GITHUB_WORKSPACE/vcpkg/installed/x64-osx-dynamic-release/lib:$GITHUB_WORKSPACE/ws/install/lib
316+
export CMAKE_PREFIX_PATH=$GITHUB_WORKSPACE/vcpkg/installed/x64-osx-dynamic-release
317+
318+
colcon build --merge-install \
319+
--packages-ignore tesseract_examples trajopt_ifopt trajopt_sqp ifopt vhacd \
320+
--event-handlers console_cohesion+ \
321+
--cmake-force-configure \
322+
--cmake-args -GNinja -DCMAKE_BUILD_TYPE=Release \
323+
-DINSTALL_OMPL=OFF -DINSTALL_OMPL_TAG=master -DBUILD_IPOPT=OFF -DBUILD_SNOPT=OFF \
324+
-DBUILD_SHARED_LIBS=ON -DTESSERACT_ENABLE_EXAMPLES=OFF -DTESSERACT_BUILD_TRAJOPT_IFOPT=OFF \
325+
-DVCPKG_APPLOCAL_DEPS=OFF -DTESSERACT_ENABLE_TESTING=ON \
326+
-DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 \
327+
-DOpenMP_CXX_INCLUDE_DIR=/usr/local/opt/libomp/include \
328+
-DOpenMP_C_INCLUDE_DIR=/usr/local/opt/libomp/include \
329+
-DOpenMP_CXX_LIB_NAMES=libomp -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp" \
330+
-DOpenMP_C_LIB_NAMES=libomp -DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp" \
331+
-DOpenMP_libomp_LIBRARY=/usr/local/opt/libomp/lib/libomp.dylib \
332+
-Dtcmalloc_minimal_LIBRARY=${{ github.workspace }}/vcpkg/installed/x64-osx-dynamic-release/lib/libtcmalloc_minimal.dylib \
333+
-DPYTHON_EXECUTABLE="${{ steps.setup-python.outputs.python-path }}" \
334+
-DTESSERACT_PYTHON_WHEEL_PLATFORM=${{ matrix.config.py_platform }} \
335+
-DTESSERACT_PYTHON_BUILD_WHEEL=ON
336+
- name: test
337+
shell: bash
338+
run: |
339+
${{ steps.setup-python.outputs.python-path }} -m venv venv
340+
source venv/bin/activate
341+
python -m pip install --upgrade pip
342+
python -m pip install ws/build/tesseract_python/python/wheelhouse/*
343+
python -m pip install pytest
344+
export TESSERACT_SUPPORT_DIR=$GITHUB_WORKSPACE/ws/src/tesseract/tesseract_support
345+
export TESSERACT_TASK_COMPOSER_DIR=$GITHUB_WORKSPACE/ws/src/tesseract_planning/tesseract_task_composer
346+
cd ws/src/tesseract_python/tesseract_python
347+
pytest -s
348+
- name: archive wheels
349+
if: always()
350+
uses: actions/upload-artifact@v2
351+
with:
352+
name: 'python-macos-win-${{matrix.config.python_version}}'
353+
path: ws/build/tesseract_python/python
354+
- name: archive logs
355+
if: failure()
356+
uses: actions/upload-artifact@v2
357+
with:
358+
name: 'build-logs-macos-${{ matrix.config.arch }}-python-${{ matrix.config.python_version }}'
359+
path: "**/*.log"
360+
retention-days: 2
277361
collect-wheels:
278362
needs:
279363
- build-win
280364
- build-ubuntu
365+
- build-macos
281366
runs-on: ubuntu-20.04
282367
steps:
283368
- uses: actions/checkout@v2

tesseract_python/cmake/install_build_wheel.cmake.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ if(STATUS AND NOT STATUS EQUAL 0)
1414
endif()
1515
endforeach()
1616

17+
elseif(APPLE)
18+
execute_process(COMMAND @PYTHON_EXECUTABLE@ setup.py bdist_wheel WORKING_DIRECTORY python RESULT_VARIABLE STATUS)
19+
if(STATUS AND NOT STATUS EQUAL 0)
20+
message(FATAL_ERROR "Python Build Wheel Failed: ${STATUS}")
21+
endif()
22+
file(GLOB wheel_files "${CMAKE_CURRENT_LIST_DIR}/python/dist/*.whl")
23+
foreach(wheel_file ${wheel_files})
24+
execute_process(COMMAND delocate-wheel --sanitize-rpaths -d -w ${CMAKE_CURRENT_LIST_DIR}/python/wheelhouse ${wheel_file} WORKING_DIRECTORY python RESULT_VARIABLE STATUS)
25+
if(STATUS AND NOT STATUS EQUAL 0)
26+
message(FATAL_ERROR "Python Build Wheel Failed: ${STATUS}")
27+
endif()
28+
endforeach()
1729
else()
1830
execute_process(COMMAND @PYTHON_EXECUTABLE@ setup.py bdist_wheel --plat-name=@TESSERACT_PYTHON_WHEEL_PLATFORM@ WORKING_DIRECTORY python RESULT_VARIABLE STATUS)
1931
if(STATUS AND NOT STATUS EQUAL 0)

0 commit comments

Comments
 (0)