Skip to content

Commit e0aa5b8

Browse files
committed
aarch64 build
1 parent e16f8ef commit e0aa5b8

File tree

6 files changed

+203
-16
lines changed

6 files changed

+203
-16
lines changed

.github/workflows/build.yml

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,34 @@ jobs:
3636
name: linux-wheels-all
3737
path: ./wheelhouse/*.whl
3838

39+
build-linux-aarch64-all:
40+
runs-on: ubuntu-22.04-arm
41+
permissions:
42+
contents: write
43+
container:
44+
image: fxiangucsd/sapien-build-env-aarch64:3.6
45+
env:
46+
CMAKE_BUILD_PARALLEL_LEVEL: 2
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v4
50+
with:
51+
submodules: "true"
52+
fetch-depth: 0
53+
fetch-tags: true
54+
- name: Set up cmake cache
55+
uses: actions/cache@v3
56+
with:
57+
path: docker_sapien_build/_sapien_deps
58+
key: ${{ runner.os }}.${{ hashFiles('**/*.cmake', '**/CMakeLists.txt') }}
59+
- name: Build wheels
60+
run: "git config --global --add safe.directory '*' && ./scripts/build_aarch64.sh"
61+
- name: Upload wheels
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: linux-aarch64-wheels-all
65+
path: ./wheelhouse/*.whl
66+
3967
build-windows-sapien:
4068
runs-on: windows-2022
4169
permissions:
@@ -77,7 +105,7 @@ jobs:
77105
needs: build-windows-sapien
78106
strategy:
79107
matrix:
80-
python-version: ["3.9", "3.10", "3.11", "3.12"]
108+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
81109
steps:
82110
- name: Checkout
83111
uses: actions/checkout@v4
@@ -139,7 +167,13 @@ jobs:
139167

140168
release:
141169
runs-on: ubuntu-latest
142-
needs: [build-linux-all, build-windows-pybind, build-mac]
170+
needs:
171+
[
172+
build-linux-all,
173+
build-linux-aarch64-all,
174+
build-windows-pybind,
175+
build-mac,
176+
]
143177
permissions:
144178
contents: write
145179
steps:
@@ -163,11 +197,21 @@ jobs:
163197
with:
164198
name: windows-wheel-3.12
165199
path: wheelhouse
200+
- name: Download wheels
201+
uses: actions/download-artifact@v4
202+
with:
203+
name: windows-wheel-3.13
204+
path: wheelhouse
166205
- name: Download wheels
167206
uses: actions/download-artifact@v4
168207
with:
169208
name: linux-wheels-all
170209
path: wheelhouse
210+
- name: Download wheels
211+
uses: actions/download-artifact@v4
212+
with:
213+
name: linux-aarch64-wheels-all
214+
path: wheelhouse
171215
- name: Download wheels
172216
uses: actions/download-artifact@v4
173217
with:
@@ -181,8 +225,8 @@ jobs:
181225
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
182226
with:
183227
tag_name: nightly
184-
name: 'Nightly Release'
228+
name: "Nightly Release"
185229
prerelease: true
186-
body: 'SAPIEN development nightly release. This release is mainly for internal testing. Stable releases are published to pypi https://pypi.org/project/sapien/'
230+
body: "SAPIEN development nightly release. This release is mainly for internal testing. Stable releases are published to pypi https://pypi.org/project/sapien/"
187231
files: |
188232
./wheelhouse/*.whl

3rd_party/sapien-vulkan-2

cmake/physx5.cmake

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,30 @@ else()
1717
URL_HASH MD5=3156af2509410dffaffa84c84cbae188
1818
)
1919
elseif (UNIX)
20-
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
20+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64")
21+
2122
FetchContent_Declare(
2223
physx5
23-
URL https://github.com/sapien-sim/physx-precompiled/releases/download/${PHYSX_VERSION}/linux-checked.zip
24-
URL_HASH MD5=8379bf7ba4d6a0866404fd8a11cc10c2
24+
URL https://github.com/sapien-sim/physx-precompiled/releases/download/${PHYSX_VERSION}/linux-aarch64-release.zip
25+
URL_HASH MD5=21cbdce291de6bfed4eb14832b64087a
2526
)
27+
2628
else ()
27-
FetchContent_Declare(
28-
physx5
29-
URL https://github.com/sapien-sim/physx-precompiled/releases/download/${PHYSX_VERSION}/linux-release.zip
30-
URL_HASH MD5=020222e5441b9ae2779dc05b1f04539c
31-
)
29+
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
30+
FetchContent_Declare(
31+
physx5
32+
URL https://github.com/sapien-sim/physx-precompiled/releases/download/${PHYSX_VERSION}/linux-checked.zip
33+
URL_HASH MD5=8379bf7ba4d6a0866404fd8a11cc10c2
34+
)
35+
else ()
36+
FetchContent_Declare(
37+
physx5
38+
URL https://github.com/sapien-sim/physx-precompiled/releases/download/${PHYSX_VERSION}/linux-release.zip
39+
URL_HASH MD5=020222e5441b9ae2779dc05b1f04539c
40+
)
41+
endif ()
3242
endif ()
43+
3344
elseif (WIN32)
3445
FetchContent_Declare(
3546
physx5
@@ -55,11 +66,17 @@ if (APPLE)
5566
)
5667
target_include_directories(physx5 SYSTEM INTERFACE $<BUILD_INTERFACE:${physx5_SOURCE_DIR}/include>)
5768
elseif(UNIX)
58-
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
59-
target_link_directories(physx5 INTERFACE $<BUILD_INTERFACE:${physx5_SOURCE_DIR}/bin/linux.clang/checked>)
69+
70+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64")
71+
target_link_directories(physx5 INTERFACE $<BUILD_INTERFACE:${physx5_SOURCE_DIR}/bin/linux.aarch64/release>)
6072
else()
61-
target_link_directories(physx5 INTERFACE $<BUILD_INTERFACE:${physx5_SOURCE_DIR}/bin/linux.clang/release>)
73+
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
74+
target_link_directories(physx5 INTERFACE $<BUILD_INTERFACE:${physx5_SOURCE_DIR}/bin/linux.clang/checked>)
75+
else()
76+
target_link_directories(physx5 INTERFACE $<BUILD_INTERFACE:${physx5_SOURCE_DIR}/bin/linux.clang/release>)
77+
endif()
6278
endif()
79+
6380
target_link_libraries(physx5 INTERFACE
6481
-Wl,--start-group
6582
libPhysXCharacterKinematic_static_64.a libPhysXCommon_static_64.a

docker/arm.Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM quay.io/pypa/manylinux_2_28_aarch64:latest
2+
3+
RUN yum install -y libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel zip wget openssh-clients git-lfs gcc-toolset-11
4+
5+
RUN mkdir -p /workspace && cd /workspace && wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux_sbsa.run && \
6+
sh cuda_11.8.0_520.61.05_linux_sbsa.run --silent --toolkit --toolkitpath=/workspace/cuda --override && rm -f cuda_11.8.0_520.61.05_linux_sbsa.run
7+
ENV CUDA_PATH=/workspace/cuda PATH="/workspace/cuda/bin:$PATH" LD_LIBRARY_PATH="/workspace/cuda/lib64:$LD_LIBRARY_PATH"
8+
9+
RUN pipx install cmake==3.26.3 --force
10+
11+
RUN /opt/python/cp313-cp313/bin/python -m pip install setuptools wheel
12+
13+
# custom auditwheel
14+
RUN /opt/python/cp313-cp313/bin/pip install git+https://github.com/fbxiang/auditwheel.git@fe61bcdfb78f3955d9a3b6fbb05e3852c32239b0
15+
RUN echo "#!/opt/python/cp313-cp313/bin/python" > /usr/local/bin/auditwheel && \
16+
echo "import re, sys" >> /usr/local/bin/auditwheel && \
17+
echo "from auditwheel.main import main" >> /usr/local/bin/auditwheel && \
18+
echo "if __name__ == '__main__':" >> /usr/local/bin/auditwheel && \
19+
echo " sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])" >> /usr/local/bin/auditwheel && \
20+
echo " sys.exit(main())" >> /usr/local/bin/auditwheel
21+
22+
23+
ENV CC=/opt/rh/gcc-toolset-11/root/usr/bin/cc CXX=/opt/rh/gcc-toolset-11/root/usr/bin/c++
24+
ENV LD_LIBRARY_PATH=/opt/rh/gcc-toolset-11/root/usr/lib64:/opt/rh/gcc-toolset-11/root/usr/lib:/opt/rh/gcc-toolset-11/root/usr/lib64/dyninst:/opt/rh/gcc-toolset-11/root/usr/lib/dyninst PCP_DIR=/opt/rh/gcc-toolset-11/root/ DEVTOOLSET_ROOTPATH=/opt/rh/gcc-toolset-11/root MANPATH=/opt/rh/gcc-toolset-11/root/usr/share/man PATH=/opt/rh/gcc-toolset-11/root/usr/bin:/usr/share/Modules/bin:/opt/rh/gcc-toolset-11/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
25+
26+
ENV PATH=/opt/python/cp313-cp313/bin:$PATH

scripts/build_aarch64.sh

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/usr/bin/env bash
2+
3+
VERSION=
4+
DEBUG=
5+
PROFILE=
6+
while [[ "$#" -gt 0 ]]; do
7+
case $1 in
8+
--debug) DEBUG=1;;
9+
--profile) PROFILE=1;;
10+
35) VERSION="35";;
11+
36) VERSION="36";;
12+
37) VERSION="37";;
13+
38) VERSION="38";;
14+
39) VERSION="39";;
15+
310) VERSION="310";;
16+
311) VERSION="311";;
17+
312) VERSION="312";;
18+
313) VERSION="313";;
19+
esac
20+
shift
21+
done
22+
23+
[ -z $VERSION ] && echo "Version not specified, building for all versions" || echo "Compile for Python ${VERSION}"
24+
( [ $DEBUG ] && echo "Debug Mode" ) || ( [ $PROFILE ] && echo "Profile Mode" ) || echo "Release Mode"
25+
26+
function build_sapien() {
27+
echo "Building SAPIEN"
28+
BIN=/opt/python/cp310-cp310/bin/python
29+
COMMAND="${BIN} setup.py bdist_wheel"
30+
[ $PROFILE ] && COMMAND="${BIN} setup.py bdist_wheel --profile"
31+
[ $DEBUG ] && COMMAND="${BIN} setup.py bdist_wheel --debug"
32+
eval "${COMMAND} --sapien-only --build-dir=docker_sapien_build"
33+
}
34+
35+
function build_pybind() {
36+
echo "Building Pybind"
37+
38+
PY_VERSION=$1
39+
if [ "$PY_VERSION" -eq 35 ]; then
40+
PY_DOT=3.5
41+
EXT="m"
42+
elif [ "$PY_VERSION" -eq 36 ]; then
43+
PY_DOT=3.6
44+
EXT="m"
45+
elif [ "$PY_VERSION" -eq 37 ]; then
46+
PY_DOT=3.7
47+
EXT="m"
48+
elif [ "$PY_VERSION" -eq 38 ]; then
49+
PY_DOT=3.8
50+
EXT=""
51+
elif [ "$PY_VERSION" -eq 39 ]; then
52+
PY_DOT=3.9
53+
EXT=""
54+
elif [ "$PY_VERSION" -eq 310 ]; then
55+
PY_DOT=3.10
56+
EXT=""
57+
elif [ "$PY_VERSION" -eq 311 ]; then
58+
PY_DOT=3.11
59+
EXT=""
60+
elif [ "$PY_VERSION" -eq 312 ]; then
61+
PY_DOT=3.12
62+
EXT=""
63+
elif [ "$PY_VERSION" -eq 313 ]; then
64+
PY_DOT=3.13
65+
EXT=""
66+
else
67+
echo "Error, python version not found!"
68+
fi
69+
70+
INCLUDE_PATH=/opt/python/cp${PY_VERSION}-cp${PY_VERSION}${EXT}/include/python${PY_DOT}${EXT}
71+
BIN=/opt/python/cp${PY_VERSION}-cp${PY_VERSION}${EXT}/bin/python
72+
export CPLUS_INCLUDE_PATH=${INCLUDE_PATH}
73+
COMMAND="${BIN} setup.py bdist_wheel"
74+
eval "${COMMAND} --pybind-only --build-dir=docker_sapien_build"
75+
76+
PACKAGE_VERSION=`${BIN} setup.py --get-version`
77+
WHEEL_NAME="./dist/sapien-${PACKAGE_VERSION}-cp${PY_VERSION}-cp${PY_VERSION}${EXT}-linux_aarch64.whl"
78+
if test -f "$WHEEL_NAME"; then
79+
echo "$FILE exist, begin audit and repair"
80+
fi
81+
auditwheel repair ${WHEEL_NAME} --plat linux_aarch64 --exclude 'libm.so*' --exclude 'libc.so*' --exclude 'libdl.so*' --exclude 'libpthread.so*' --exclude 'libvulkan*' --exclude 'libOpenImageDenoise*' --internal libsapien --internal libsvulkan2
82+
}
83+
84+
build_sapien
85+
if [ -z "${VERSION}" ]
86+
then
87+
build_pybind 39
88+
build_pybind 310
89+
build_pybind 311
90+
build_pybind 312
91+
build_pybind 313
92+
else
93+
build_pybind $VERSION
94+
fi
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
docker run --platform linux/arm64 -v `pwd`:/workspace/SAPIEN -it --rm \
4+
-u $(id -u ${USER}):$(id -g ${USER}) \
5+
fxiangucsd/sapien-build-env-aarch64:3.6 bash -c \
6+
"export CMAKE_BUILD_PARALLEL_LEVEL=${CMAKE_BUILD_PARALLEL_LEVEL} && cd /workspace/SAPIEN && ./scripts/build_aarch64.sh $1 --profile"

0 commit comments

Comments
 (0)