Skip to content

Commit 2ae02ab

Browse files
committed
add Darwin build
1 parent a1b3b95 commit 2ae02ab

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

README.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
### Build dependencies
66

77
- GNU Bash
8-
- GNU g++ version 9+
8+
- GNU g++ version 7+
99
- GNU make
1010

1111
### Code formatter (optional)
@@ -25,10 +25,16 @@ $ sudo make install
2525

2626
### Native build
2727

28+
Linux, Windows:
2829
```
2930
$ make
3031
```
3132

33+
MacOS X and BSD-likes:
34+
```
35+
$ CXX=scripts/darwin.sh make
36+
```
37+
3238
### Cross-compiling
3339

3440
Simply override CXX to use your target toolchain.

check

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ set -euo pipefail
33

44
export BIN=${BIN-bin}
55

6+
if [ $(uname -s) == "Darwin" ]; then
7+
CORES=$(sysctl -n hw.logicalcpu)
8+
else
9+
CORES=$(nproc)
10+
fi
11+
612
./scripts/reformat.sh
7-
make -j`nproc`
13+
CXX=$CXX make -j$CORES
814
./tests/run $BIN
915

1016
lines=$(find $BIN -name "*.lines" | xargs cat | awk '{s+=$1} END {printf "%d\n", (s/1000)}')

scripts/darwin.sh

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
params=()
5+
for p in "$@" ; do
6+
case $p in
7+
-Wl,-gc-sections)
8+
;;
9+
*)
10+
params+=("$p")
11+
;;
12+
esac
13+
done
14+
15+
"/usr/bin/g++" "${params[@]}"
16+

0 commit comments

Comments
 (0)