Skip to content

Commit 757e13a

Browse files
committed
ci: add gnu32 cross-compiled 32-bit build
1 parent 15bf349 commit 757e13a

File tree

4 files changed

+19
-7
lines changed

4 files changed

+19
-7
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
config: [default, llvm]
14+
config: [default, llvm, gnu32]
1515

1616
name: build • ${{ matrix.config }}
1717

ci/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ To run jobs locally:
1818
```bash
1919
CI_CONFIG=ci/configs/default.sh ci/scripts/run.sh
2020
CI_CONFIG=ci/configs/llvm.sh ci/scripts/run.sh
21+
CI_CONFIG=ci/configs/gnu32.sh ci/scripts/run.sh
2122
```
2223

2324
By default CI jobs will reuse their build directories. `CI_CLEAN=1` can be specified to delete them before running instead.

ci/configs/gnu32.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CI_DESC="CI job cross-compiling to 32-bit"
2+
CI_DIR=build-gnu32
3+
NIX_ARGS=(
4+
--arg minimal true
5+
--arg crossPkgs 'import <nixpkgs> { crossSystem = { config = "i686-unknown-linux-gnu"; }; }'
6+
)
7+
export CXXFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-unused-parameter"
8+
CMAKE_ARGS=(-G Ninja)
9+
BUILD_ARGS=(-k 0)

shell.nix

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
{ pkgs ? import <nixpkgs> {}
2+
, crossPkgs ? import <nixpkgs> {}
23
, enableLibcxx ? false # Whether to use libc++ toolchain and libraries instead of libstdc++
4+
, minimal ? false # Whether to create minimal shell without extra tools (faster when cross compiling)
35
}:
46

57
let
68
lib = pkgs.lib;
7-
llvm = pkgs.llvmPackages_20;
8-
capnproto = pkgs.capnproto.override (lib.optionalAttrs enableLibcxx { clangStdenv = llvm.libcxxStdenv; });
9+
llvm = crossPkgs.llvmPackages_20;
10+
capnproto = crossPkgs.capnproto.override (lib.optionalAttrs enableLibcxx { clangStdenv = llvm.libcxxStdenv; });
911
clang = if enableLibcxx then llvm.libcxxClang else llvm.clang;
1012
clang-tools = llvm.clang-tools.override { inherit enableLibcxx; };
11-
in pkgs.mkShell {
13+
in crossPkgs.mkShell {
1214
buildInputs = [
1315
capnproto
14-
llvm.libcxx
1516
];
1617
nativeBuildInputs = with pkgs; [
17-
clang
18-
clang-tools
1918
cmake
2019
include-what-you-use
2120
ninja
21+
] ++ lib.optionals (!minimal) [
22+
clang
23+
clang-tools
2224
];
2325

2426
# Tell IWYU where its libc++ mapping lives

0 commit comments

Comments
 (0)