Skip to content

Commit 7c6b359

Browse files
Problem: not supporting arm64 apple (fix #455) (#456)
add new flow arm64 compile branch ignore restore rename mv to yml branch ignore print use arm64 compile for arm64 indent fix indent fix Makefile tidy up arm64 upload fix clang skip cmake for arm64 fix skip tidy up restore restore changelog fix linux build indent ok fix linux fix linux
1 parent 40842d4 commit 7c6b359

File tree

4 files changed

+106
-14
lines changed

4 files changed

+106
-14
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Mac Arm64 Build CI
2+
3+
on:
4+
push:
5+
branches-ignore:
6+
- main
7+
paths-ignore:
8+
- README.md
9+
tags:
10+
- "v*.*.*"
11+
merge_group:
12+
pull_request:
13+
paths-ignore:
14+
- README.md
15+
16+
jobs:
17+
mac-build:
18+
runs-on: macos-12
19+
env:
20+
MACOSX_DEPLOYMENT_TARGET: 10.15
21+
USE_ARM64: true
22+
steps:
23+
- uses: actions/checkout@v3
24+
with:
25+
submodules: recursive
26+
- name: Build play-cpp-sdk library
27+
run: make
28+
- name: Pack binaries and bindings
29+
run: |
30+
PLATFORM="$(uname -s)_arm64"
31+
BUILD_TYPE="tarball"
32+
mkdir -p install
33+
cp -r demo/sdk install
34+
cp ./LICENSE install/sdk
35+
cp ./CHANGELOG.md install/sdk
36+
cd install
37+
tar zcvf ../play_cpp_sdk_${PLATFORM}.tar.gz *
38+
cd ..
39+
shasum -a 256 *.tar.gz > "checksums-$PLATFORM.txt"
40+
echo "release_file=play_cpp_sdk_$PLATFORM.tar.gz" >> $GITHUB_ENV
41+
echo "checksum_file=checksums-$PLATFORM.txt" >> $GITHUB_ENV
42+
cat $GITHUB_ENV
43+
- name: Upload binaries and bindings to Release
44+
uses: softprops/action-gh-release@v1
45+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
46+
with:
47+
draft: true
48+
files: |
49+
${{ env.release_file }}
50+
${{ env.checksum_file }}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22
## [Unreleased]
3+
4+
## [v0.0.21-alpha] - 2023-6-12
5+
- release arm64 apple
6+
37
## [v0.0.20-alpha] - 2023-5-16
48
- Use defi-wallet-core-rs v0.3.6
59
- Add get_eth_transaction_receipt_blocking

Makefile

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,35 @@ clone:
5353

5454
build_play-cpp-sdk: clone
5555
ifeq ($(shell uname -m), x86_64)
56-
ifeq ($(UNAME), Darwin)
56+
ifeq ($(UNAME), Darwin)
57+
ifeq ($(USE_ARM64),true)
58+
rustup target add aarch64-apple-darwin
59+
MACOSX_DEPLOYMENT_TARGET=10.15 CXX=$(CXX) CXXFLAGS=$(CXXFLAGS) cargo build --package play-cpp-sdk --release --target aarch64-apple-darwin
60+
else
61+
rustup target add x86_64-apple-darwin
5762
MACOSX_DEPLOYMENT_TARGET=10.15 CXX=$(CXX) CXXFLAGS=$(CXXFLAGS) cargo build --package play-cpp-sdk --release
58-
endif
59-
ifeq ($(UNAME), Linux)
63+
endif
64+
endif
65+
ifeq ($(UNAME), Linux)
6066
CXX=$(CXX) CXXFLAGS=$(CXXFLAGS) cargo build --package play-cpp-sdk --release
61-
endif
62-
endif
63-
ifeq ($(shell uname -m), arm64)
67+
endif
68+
else
69+
ifeq ($(shell uname -m), arm64)
70+
ifeq ($(UNAME), Darwin)
71+
ifeq ($(USE_ARM64), true)
72+
rustup target add aarch64-apple-darwin
73+
MACOSX_DEPLOYMENT_TARGET=10.15 CXX=$(CXX) CXXFLAGS=$(CXXFLAGS) cargo build --package play-cpp-sdk --release
74+
else
6475
rustup target add x86_64-apple-darwin
6576
MACOSX_DEPLOYMENT_TARGET=10.15 CXX=$(CXX) CXXFLAGS=$(CXXFLAGS) cargo build --package play-cpp-sdk --release --target x86_64-apple-darwin
77+
endif
78+
endif
79+
else
80+
CXX=$(CXX) CXXFLAGS=$(CXXFLAGS) cargo build --package play-cpp-sdk --release
81+
endif
6682
endif
6783

84+
6885
build_extra-cpp-bindings:
6986
CXX=$(CXX) CXXFLAGS=$(CXXFLAGS) cargo build --package extra-cpp-bindings --release
7087

demo/Makefile

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,31 @@ else
1717
endif
1818

1919
ifeq ($(shell uname -m), x86_64)
20-
TARGET_DIR = ../target/release
21-
endif
22-
23-
ifeq ($(shell uname -m), arm64)
24-
CXX = arch -x86_64 clang++ # for arm64, we only use clang++
25-
TARGET_DIR = ../target/x86_64-apple-darwin/release
20+
ifeq ($(UNAME), Darwin)
21+
ifeq ($(USE_ARM64),true)
22+
CXX = clang++ -target arm64-apple-darwin # for arm64, we only use clang++
23+
TARGET_DIR = ../target/aarch64-apple-darwin/release
24+
else
25+
CXX = arch -x86_64 clang++ # for intel, we only use clang++
26+
TARGET_DIR = ../target/release
27+
endif
28+
else
29+
TARGET_DIR = ../target/release
30+
endif
2631
else
27-
32+
ifeq ($(shell uname -m), arm64)
33+
ifeq ($(UNAME), Darwin)
34+
ifeq ($(USE_ARM64),true)
35+
CXX = clang++ # for arm64, we only use clang++
36+
TARGET_DIR = ../target/release
37+
else
38+
CXX = arch -x86_64 clang++ # for intel, we only use clang++
39+
TARGET_DIR = ../target/x86_64-apple-darwin/release
40+
endif
41+
endif
42+
else
43+
TARGET_DIR = ../target/release
44+
endif
2845
endif
2946

3047
ifeq ($(UNAME), Darwin)
@@ -128,9 +145,13 @@ ifeq ($(UNAME), Darwin)
128145
endif
129146

130147
cmake:
148+
# if mac and arm64 do nothing
149+
ifeq ($(USE_ARM64),true)
150+
echo "skip cmake"
151+
else
131152
mkdir -p build
132153
cd build && CXX="$(CXX)" CXXFLAGS=$(CXXFLAGS) cmake .. && make
133-
154+
endif
134155
run_static:
135156
. ./.env && ./bin/demostatic && ./build/demostatic
136157

0 commit comments

Comments
 (0)