4040 target : x86_64-unknown-linux-gnu
4141 - os : ubuntu-latest
4242 target : aarch64-unknown-linux-gnu
43+ cross : true
4344 - os : macos-latest
4445 target : x86_64-apple-darwin
4546 - os : macos-latest
@@ -65,46 +66,23 @@ jobs:
6566 run : |
6667 sudo apt-get update
6768 sudo apt-get install -y \
68- pkg-config \
69- libssl-dev \
7069 gcc-aarch64-linux-gnu \
7170 libc6-dev-arm64-cross \
7271 crossbuild-essential-arm64
7372
74- - name : Setup cross-compilation environment
75- if : matrix.target.os == 'ubuntu-latest' && matrix.target.target == 'aarch64-unknown-linux-gnu'
73+ - name : Install cross
74+ if : matrix.target.cross
7675 run : |
77- # Install cross-compilation tools for ARM64
78- sudo apt-get install -y \
79- gcc-aarch64-linux-gnu \
80- g++-aarch64-linux-gnu \
81- libc6-dev-arm64-cross \
82- gcc-13-aarch64-linux-gnu
83-
84- # Set up cross-compilation environment variables
85- echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
86- echo "CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++" >> $GITHUB_ENV
87- echo "AR_aarch64_unknown_linux_gnu=aarch64-linux-gnu-ar" >> $GITHUB_ENV
88- echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
89-
90- # Set up OpenSSL for cross-compilation (using host libraries)
91- echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
92- echo "OPENSSL_DIR=/usr" >> $GITHUB_ENV
93- echo "OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu" >> $GITHUB_ENV
94- echo "OPENSSL_INCLUDE_DIR=/usr/include" >> $GITHUB_ENV
95-
96- - name : Setup native Linux environment
97- if : matrix.target.os == 'ubuntu-latest' && matrix.target.target == 'x86_64-unknown-linux-gnu'
98- run : |
99- # Ensure native build has proper OpenSSL setup
100- echo "OPENSSL_DIR=/usr" >> $GITHUB_ENV
101- echo "OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu" >> $GITHUB_ENV
102- echo "OPENSSL_INCLUDE_DIR=/usr/include" >> $GITHUB_ENV
76+ cargo install cross --git https://github.com/cross-rs/cross
10377
10478 - name : Install macOS dependencies
10579 if : matrix.target.os == 'macos-latest'
10680 run : |
10781 brew install pkg-config openssl@3
108-
109- - name : Build project
82+ - name : Build project (native)
83+ if : ${{ !matrix.target.cross }} # default to false if not set
11084 run : cargo build --target ${{ matrix.target.target }} --features ${{ matrix.feature }}
85+
86+ - name : Build project (cross-compilation)
87+ if : matrix.target.cross
88+ run : cross build --release --target=${{ matrix.target.target }} --features ${{ matrix.feature }},vendored-openssl
0 commit comments