Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Apple M1 #479

Merged
merged 15 commits into from
May 23, 2022
Merged
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ jobs:
chmod a+x builder
./builder build -p ${{ env.PACKAGE_NAME }} --spec=downstream

osx-arm64:
runs-on: macos-11 # latest
steps:
- name: Checkout Sources
uses: actions/checkout@v2
with:
submodules: true
- name: Build ${{ env.PACKAGE_NAME }} + consumers
run: |
mvn -B compile -P mac-arm64

android:
name: Android
# ubuntu-20.04 comes with Android tooling, see: https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#android
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,5 @@ settings.xml

# docs are updated automatically by .github/workflows/docs.yml
docs/

bin/
1 change: 1 addition & 0 deletions codebuild/cd/deploy-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ phases:
- cp -rv $CODEBUILD_SRC_DIR_linux_x64/dist/* $CODEBUILD_SRC_DIR/aws-crt-java/target/cmake-build/
- cp -rv $CODEBUILD_SRC_DIR_linux_x86/dist/* $CODEBUILD_SRC_DIR/aws-crt-java/target/cmake-build/
- cp -rv $CODEBUILD_SRC_DIR_osx_x64/* $CODEBUILD_SRC_DIR/aws-crt-java/target/cmake-build/
- cp -rv $CODEBUILD_SRC_DIR_osx_arm64/* $CODEBUILD_SRC_DIR/aws-crt-java/target/cmake-build/
graebm marked this conversation as resolved.
Show resolved Hide resolved
- ls -alR $CODEBUILD_SRC_DIR/aws-crt-java/target/cmake-build/lib
# install settings.xml to ~/.m2/settings.xml
- mkdir -p $HOME/.m2
Expand Down
13 changes: 13 additions & 0 deletions codebuild/cd/osx-arm64-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

set -ex

cd `dirname $0`/../..

git submodule update --init

mvn -B compile -P mac-arm64

# Copy artifacts to dist
mkdir -p ../dist
cp -rv target/cmake-build/lib ../dist/
2 changes: 1 addition & 1 deletion codebuild/cd/osx-x64-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cd `dirname $0`/../..

git submodule update --init

mvn -B compile
mvn -B compile -P mac-x64

# Copy artifacts to dist
mkdir -p ../dist
Expand Down
20 changes: 18 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cmake.warningsareerrors>OFF</cmake.warningsareerrors>
<cmake.s2nNoPqAsm>OFF</cmake.s2nNoPqAsm>
<cmake.osx_arch>-DOSX_ARCH_DUMMY=1</cmake.osx_arch>
</properties>

<profiles>
Expand Down Expand Up @@ -89,14 +90,28 @@
</properties>
</profile>
<profile>
<id>mac-make</id>
<id>mac-x64</id>
<activation>
<os>
<family>mac</family>
<arch>x86_64</arch>
</os>
</activation>
<properties>
<cmake.cflags/>
<cmake.osx_arch>-DCMAKE_OSX_ARCHITECTURES=x86_64</cmake.osx_arch>
</properties>
</profile>
<profile>
<id>mac-arm64</id>
<activation>
<os>
<family>mac</family>
<arch>arm64</arch>
</os>
</activation>
graebm marked this conversation as resolved.
Show resolved Hide resolved
<properties>
<cmake.osx_arch>-DCMAKE_OSX_ARCHITECTURES=arm64</cmake.osx_arch>
</properties>
</profile>
<!-- 32-bit Unix -->
Expand Down Expand Up @@ -159,9 +174,10 @@
<argument>-DCMAKE_PREFIX_PATH=${cmake.binaries}/install</argument>
<argument>-DCMAKE_INSTALL_PREFIX=${cmake.binaries}/install</argument>
<argument>-DCMAKE_C_FLAGS=${cmake.cflags}</argument>
<argument>${cmake.osx_arch}</argument>
<argument>-DS2N_NO_PQ_ASM=${cmake.s2nNoPqAsm}</argument>
<argument>-DBUILD_TESTING=OFF</argument>
<argument>-Wno-unused-variables</argument>
<argument>--no-warn-unused-cli</argument>
<argument>${cmake.generator}</argument>
<argument>${cmake.toolset}</argument>
</arguments>
Expand Down