Skip to content

Commit 8c91eea

Browse files
authored
Try #1831:
2 parents 875ac93 + 99737ab commit 8c91eea

File tree

15 files changed

+452
-167
lines changed

15 files changed

+452
-167
lines changed

.github/workflows/main.yaml

+32-5
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ jobs:
5555
artifact_name: 'wasmer-macos-amd64'
5656
cross_compilation_artifact_name: 'cross_compiled_from_mac'
5757
run_integration_tests: true
58+
- build: macos
59+
os: macos-latest
60+
rust: nightly
61+
target: aarch64-apple-darwin
62+
artifact_name: 'wasmer-macos-arm64'
5863
- build: windows
5964
os: windows-latest
6065
rust: 1.46.0
@@ -83,7 +88,12 @@ jobs:
8388
uses: actions-rs/toolchain@v1
8489
with:
8590
toolchain: ${{ matrix.rust }}
91+
target: ${{ matrix.target }}
8692
override: true
93+
- name: Setup Rust target
94+
run:
95+
echo "\n[build]\ntarget = \"aarch64-apple-darwin\"" >> .cargo/config.toml
96+
if: matrix.target != 'aarch64-apple-darwin' # we just build
8797
- name: Configure cargo data directory
8898
# After this point, all cargo registry and crate data is stored in
8999
# $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
@@ -131,7 +141,7 @@ jobs:
131141
# echo "LLVM_SYS_100_PREFIX=C:/llvm-10" >> $GITHUB_ENV
132142
# echo "LIBCLANG_PATH=C:/llvm-10/bin/libclang.dll" >> $GITHUB_ENV
133143
- name: Install LLVM (Unix)
134-
if: matrix.os != 'windows-latest'
144+
if: matrix.os != 'windows-latest' && matrix.target != 'aarch64-apple-darwin'
135145
run: |
136146
curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.llvm_url }} -L -o llvm.tar.xz
137147
mkdir -p ${{ env.LLVM_DIR }}
@@ -141,12 +151,19 @@ jobs:
141151
env:
142152
LLVM_DIR: ${{ github.workspace }}/llvm-10
143153
- name: Set up dependencies for Mac OS
144-
run: brew install automake
154+
run: |
155+
brew install automake
145156
if: matrix.os == 'macos-latest'
146-
- run: make test
147-
- name: Build and Test C API
157+
- name: Test
158+
run: |
159+
make test
160+
if: matrix.target != 'aarch64-apple-darwin'
161+
- name: Test C API
148162
run: |
149163
make test-capi
164+
if: matrix.os != 'windows-latest' && matrix.target != 'aarch64-apple-darwin' # we can't test yet on Apple Silicon or Windows
165+
- name: Build C API
166+
run: |
150167
make build-capi
151168
if: matrix.os != 'windows-latest'
152169
- name: Build C API on Windows
@@ -313,7 +330,7 @@ jobs:
313330
asset_path: artifacts/wasmer-linux-amd64/wasmer-linux-amd64.tar.gz
314331
asset_name: wasmer-linux-amd64.tar.gz
315332
asset_content_type: application/gzip
316-
- name: Upload Release Asset Mac
333+
- name: Upload Release Asset Mac amd64
317334
id: upload-release-asset-mac
318335
uses: actions/upload-release-asset@v1
319336
env:
@@ -323,6 +340,16 @@ jobs:
323340
asset_path: artifacts/wasmer-macos-amd64/wasmer-darwin-amd64.tar.gz
324341
asset_name: wasmer-darwin-amd64.tar.gz
325342
asset_content_type: application/gzip
343+
- name: Upload Release Asset Mac arm64
344+
id: upload-release-asset-mac
345+
uses: actions/upload-release-asset@v1
346+
env:
347+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
348+
with:
349+
upload_url: ${{ steps.create_release.outputs.upload_url }}
350+
asset_path: artifacts/wasmer-macos-amd64/wasmer-darwin-arm64.tar.gz
351+
asset_name: wasmer-darwin-arm64.tar.gz
352+
asset_content_type: application/gzip
326353
- name: Upload Release Asset Linux aarch64
327354
id: upload-release-asset-linux-aarch64
328355
uses: actions/upload-release-asset@v1

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ ifeq ($(ARCH), aarch64)
5151
endif
5252
endif
5353

54+
ifeq ($(ARCH), arm64)
55+
test_compilers_engines += cranelift-jit
56+
endif
57+
5458
compilers := $(filter-out ,$(compilers))
5559
test_compilers_engines := $(filter-out ,$(test_compilers_engines))
5660

examples/engine_cross_compilation.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
9999
}
100100

101101
#[test]
102-
#[cfg(not(windows))]
102+
#[cfg(not(any(
103+
windows,
104+
// We don't support yet crosscompilation in macOS with Apple Silicon
105+
all(target_os = "macos", target_arch = "aarch64")
106+
)))]
103107
fn test_cross_compilation() -> Result<(), Box<dyn std::error::Error>> {
104108
main()
105109
}

lib/cli/src/commands/compile.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl Compile {
8787
if ext != recommended_extension {
8888
warning!("the output file has a wrong extension. We recommend using `{}.{}` for the chosen target", &output_filename, &recommended_extension)
8989
}
90-
},
90+
}
9191
None => {
9292
warning!("the output file has no extension. We recommend using `{}.{}` for the chosen target", &output_filename, &recommended_extension)
9393
}

0 commit comments

Comments
 (0)