Skip to content

Commit a9baa57

Browse files
committed
Make it switchable between building dependencies and using prebuilt; update usage instruction
1 parent 0c4946e commit a9baa57

File tree

3 files changed

+46
-17
lines changed

3 files changed

+46
-17
lines changed

.github/workflows/main.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ on:
44
push:
55
paths:
66
- 'build_ros2.sh'
7+
- 'build_deps.sh'
78
- '.github/workflows/main.yml'
89
jobs:
910
build-ros2:
1011
runs-on: macos-latest
1112
timeout-minutes: 1200
1213
strategy:
1314
matrix:
14-
platformArch: [macOS, iOS] # , iOS_Simulator, iOS_Simulator_M1, macCatalyst, macCatalyst_M1]
15+
platformArch: [macOS] # iOS , iOS_Simulator, iOS_Simulator_M1, macCatalyst, macCatalyst_M1]
1516
steps:
1617
- uses: actions/checkout@v3
1718
- name: Setup cmake
@@ -26,21 +27,30 @@ jobs:
2627
# - run: pip3 install -r requirements.txt
2728

2829
- name: Build dependencies
30+
id: build_dependencies
2931
run: ./build_deps.sh ${{ matrix.platformArch }}
30-
if: ${{ startsWith(matrix.platformArch, 'macOS') }}
31-
- run: tar cJf ros2deps_${{ matrix.platformArch }}.tar.xz ros2_${{ matrix.platformArch }}/
32-
if: ${{ startsWith(matrix.platformArch, 'macOS') }}
33-
- uses: actions/upload-artifact@v3
32+
if: ${{ false && startsWith(matrix.platformArch, 'macOS') }}
33+
- name: Archive dependencies
34+
run: tar cJf ros2deps_${{ matrix.platformArch }}.tar.xz ros2_${{ matrix.platformArch }}/
35+
if: ${{ steps.build_dependencies.outcome == 'success' }}
36+
- name: Publish dependencies for reuse
37+
uses: actions/upload-artifact@v3
3438
with:
3539
name: ros2deps_${{ matrix.platformArch }}
3640
path: ros2deps_${{ matrix.platformArch }}.tar.xz
37-
if: ${{ startsWith(matrix.platformArch, 'macOS') }}
41+
if: ${{ steps.build_dependencies.outcome == 'success' }}
42+
43+
- name: Download and extract prebuilt dependencies
44+
run: curl -OL https://github.com/light-tech/ROS2-On-iOS/releases/download/humble-macos/ros2deps_${{ matrix.platformArch }}.tar.xz && tar xzf ros2deps_${{ matrix.platformArch }}.tar.xz
45+
if: ${{ true && startsWith(matrix.platformArch, 'macOS') }}
3846

3947
- name: Build ROS2
4048
run: ./build_ros2.sh ${{ matrix.platformArch }}
41-
- run: tar cJf ros2_${{ matrix.platformArch }}.tar.xz ros2_${{ matrix.platformArch }}/
49+
- name: Archive ROS2 and dependencies
50+
run: tar cJf ros2_${{ matrix.platformArch }}.tar.xz ros2_${{ matrix.platformArch }}/
4251
if: ${{ true }} # change this to false to disable temporarily during development
43-
- uses: actions/upload-artifact@v3
52+
- name: Publish ROS2 for release
53+
uses: actions/upload-artifact@v3
4454
with:
4555
name: ros2_${{ matrix.platformArch }}
4656
path: ros2_${{ matrix.platformArch }}.tar.xz

MACOS.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,30 @@ While there is an option, namely [RoboStack](https://robostack.github.io/Getting
44

55
So let us build ROS2 from source to use on macOS (Intel only) as well.
66

7-
**Note**: ~~At the moment, you cannot simply download and run the software built on GitHub Action because it was not `codesign`ed unless you are willing to [disable Gatekeeper](https://www.makeuseof.com/how-to-disable-gatekeeper-mac/).~~ You can use our release built on GitHub Action server but you must not download it from the browser as doing so put them in quarantine. Open the terminal and do
7+
8+
## For the impatient
9+
10+
If you want to save yourself one full working day, you can use [our release](https://github.com/light-tech/ROS2-On-iOS/releases) built on GitHub Action server.
11+
12+
* If you download the file from a browser, it will be put in quarantine so you need to `xattr -d com.apple.quarantine FILE` before extraction.
13+
* To avoid that thank to [this discussion thread](https://developer.apple.com/forums/thread/703523), you could open the terminal and do
14+
```shell
15+
curl -OL https://github.com/light-tech/ROS2-On-iOS/releases/download/humble-macos/ros2_macOS.tar.xz
16+
```
17+
18+
After extracting the archive with `tar xzf` and move it to where you want (I usually rename the folder to `ros2` and move it inside `~/usr` in my home folder along with the other Linux-based software), you first need to
819
```shell
9-
curl -OL https://github.com/light-tech/ROS2-On-iOS/releases/download/humble-macos/ros2_deps_macOS.tar.xz \
10-
https://github.com/light-tech/ROS2-On-iOS/releases/download/humble-macos/ros2_macOS.tar.xz
20+
# Tip: Add these commands to your `.zshrc` to have them ready.
21+
22+
export DYLD_LIBRARY_PATH=PATH_TO_EXTRACTED_ROS2/deps/lib:$DYLD_LIBRARY_PATH
23+
24+
source PATH_TO_PYTHON_ENV/bin/activate
25+
source PATH_TO_EXTRACTED_ROS2/setup.zsh
1126
```
12-
thank to [this discussion thread](https://developer.apple.com/forums/thread/703523).
27+
and then you can use ROS2 as usual.
28+
29+
30+
## Build rviz2
1331

1432
First we build the required libs to the local location, say `$ros2SystemDependenciesPath`, such as `$REPO_ROOT/deps`, `~/ros2deps` or the commonly used `~/usr`.
1533

@@ -35,6 +53,8 @@ First we build the required libs to the local location, say `$ros2SystemDependen
3553
3654
Likewise for `orocos_kdl_vendor` which relies on `Eigen3Config.cmake` located in `$ros2SystemDependenciesPath`.
3755
56+
The package `libcurl_vendor` by default have a lot of dependencies so either disable most of them or build those you want.
57+
3858
Also, disable `python_orocos_kdl_vendor` and `rviz_visual_testing_framework`.
3959
4060
5. Build ROS2 for macOS using the similar command but set `CMAKE_PREFIX_PATH` to the location where we install the above dependencies

build_ros2.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@ targetPlatform=$1
1010
ros2PythonEnvPath=$REPO_ROOT/ros2PythonEnv
1111
ros2InstallPath=$REPO_ROOT/ros2_$targetPlatform
1212
ros2SystemDependenciesPath=$ros2InstallPath/deps
13-
verboseColcon=0
14-
15-
# --packages-up-to libcurl_vendor \
16-
# --executor sequential --event-handlers console_direct+ \
1713

14+
# --packages-up-to libcurl_vendor
15+
# --executor sequential --event-handlers console_direct+
1816
colconArgs=(--install-base $ros2InstallPath \
1917
--merge-install --cmake-force-configure \
2018
--cmake-args -DBUILD_TESTING=NO \
@@ -23,6 +21,7 @@ colconArgs=(--install-base $ros2InstallPath \
2321
-DFORCE_BUILD_VENDOR_PKG=ON \
2422
-DBUILD_MEMORY_TOOLS=OFF \
2523
-DRCL_LOGGING_IMPLEMENTATION=rcl_logging_noop)
24+
colconVerbose=0
2625

2726
prepareVirtualEnv() {
2827
python3 -m venv $ros2PythonEnvPath
@@ -83,7 +82,7 @@ buildRos2Base() {
8382
sed -i.bak 's/if_arp.h/ethernet.h/g' src/eProsima/Fast-DDS/src/cpp/utils/IPFinder.cpp
8483
fi
8584

86-
VERBOSE=$verboseColcon colcon build "${colconArgs[@]}"
85+
VERBOSE=$colconVerbose colcon build "${colconArgs[@]}"
8786
}
8887

8988
setupROS2base() {

0 commit comments

Comments
 (0)