Skip to content

Commit a6505fb

Browse files
authored
Support for Apple M1 (#479)
Edited pom.xml to build for mac-arm chip and added corresponding build script
1 parent 1b72b83 commit a6505fb

File tree

7 files changed

+47
-4
lines changed

7 files changed

+47
-4
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ jobs:
135135
chmod a+x builder
136136
./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream
137137
138+
osx-arm64:
139+
runs-on: macos-11 # latest
140+
steps:
141+
- name: Checkout Sources
142+
uses: actions/checkout@v2
143+
with:
144+
submodules: true
145+
- name: Build ${{ env.PACKAGE_NAME }} + consumers
146+
run: |
147+
mvn -B compile -P mac-arm64
148+
138149
android:
139150
name: Android
140151
# ubuntu-20.04 comes with Android tooling, see: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#android

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,5 @@ settings.xml
9191

9292
# docs are updated automatically by .github/workflows/docs.yml
9393
docs/
94+
95+
bin/

codebuild/cd/deploy-snapshot.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ phases:
2727
- cp -rv $CODEBUILD_SRC_DIR_linux_x64/dist/* $CODEBUILD_SRC_DIR/aws-crt-java/target/cmake-build/
2828
- cp -rv $CODEBUILD_SRC_DIR_linux_x86/dist/* $CODEBUILD_SRC_DIR/aws-crt-java/target/cmake-build/
2929
- cp -rv $CODEBUILD_SRC_DIR_osx_x64/* $CODEBUILD_SRC_DIR/aws-crt-java/target/cmake-build/
30+
- cp -rv $CODEBUILD_SRC_DIR_osx_arm64/* $CODEBUILD_SRC_DIR/aws-crt-java/target/cmake-build/
3031
- ls -alR $CODEBUILD_SRC_DIR/aws-crt-java/target/cmake-build/lib
3132
# install settings.xml to ~/.m2/settings.xml
3233
- mkdir -p $HOME/.m2

codebuild/cd/osx-arm64-build.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
cd `dirname $0`/../..
6+
7+
git submodule update --init
8+
9+
mvn -B compile -P mac-arm64
10+
11+
# Copy artifacts to dist
12+
mkdir -p ../dist
13+
cp -rv target/cmake-build/lib ../dist/

codebuild/cd/osx-x64-build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cd `dirname $0`/../..
66

77
git submodule update --init
88

9-
mvn -B compile
9+
mvn -B compile -P mac-x64
1010

1111
# Copy artifacts to dist
1212
mkdir -p ../dist

pom.xml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4242
<cmake.warningsareerrors>OFF</cmake.warningsareerrors>
4343
<cmake.s2nNoPqAsm>OFF</cmake.s2nNoPqAsm>
44+
<cmake.osx_arch>-DOSX_ARCH_DUMMY=1</cmake.osx_arch>
4445
</properties>
4546

4647
<profiles>
@@ -89,14 +90,28 @@
8990
</properties>
9091
</profile>
9192
<profile>
92-
<id>mac-make</id>
93+
<id>mac-x64</id>
9394
<activation>
9495
<os>
9596
<family>mac</family>
97+
<arch>x86_64</arch>
9698
</os>
9799
</activation>
98100
<properties>
99101
<cmake.cflags/>
102+
<cmake.osx_arch>-DCMAKE_OSX_ARCHITECTURES=x86_64</cmake.osx_arch>
103+
</properties>
104+
</profile>
105+
<profile>
106+
<id>mac-arm64</id>
107+
<activation>
108+
<os>
109+
<family>mac</family>
110+
<arch>arm64</arch>
111+
</os>
112+
</activation>
113+
<properties>
114+
<cmake.osx_arch>-DCMAKE_OSX_ARCHITECTURES=arm64</cmake.osx_arch>
100115
</properties>
101116
</profile>
102117
<!-- 32-bit Unix -->
@@ -159,9 +174,10 @@
159174
<argument>-DCMAKE_PREFIX_PATH=${cmake.binaries}/install</argument>
160175
<argument>-DCMAKE_INSTALL_PREFIX=${cmake.binaries}/install</argument>
161176
<argument>-DCMAKE_C_FLAGS=${cmake.cflags}</argument>
177+
<argument>${cmake.osx_arch}</argument>
162178
<argument>-DS2N_NO_PQ_ASM=${cmake.s2nNoPqAsm}</argument>
163179
<argument>-DBUILD_TESTING=OFF</argument>
164-
<argument>-Wno-unused-variables</argument>
180+
<argument>--no-warn-unused-cli</argument>
165181
<argument>${cmake.generator}</argument>
166182
<argument>${cmake.toolset}</argument>
167183
</arguments>

0 commit comments

Comments
 (0)