fix compile with openmp
[liba.git] / .github / workflows / macos.yml
blob10607341c4920f3926178bd932cc060ab302e34f
1 name: macos
2 on:
3   workflow_dispatch:
4 jobs:
5   MacOS:
6     strategy:
7       fail-fast: false
8       matrix:
9         include: [
10           { cc: gcc-13, cxx: g++-13, type: Debug },
11           { cc: clang, cxx: clang++, type: Debug },
12           { cc: gcc-13, cxx: g++-13, type: Release },
13           { cc: clang, cxx: clang++, type: Release },
14         ]
15     runs-on: macos-latest
16     steps:
17       - uses: mymindstorm/setup-emsdk@v13
18       - uses: actions/checkout@v4
19         with:
20           lfs: true
21           submodules: true
22       - name: Run setup
23         env:
24           CC: ${{ matrix.cc }}
25           CXX: ${{ matrix.cxx }}
26         run: |
27           python3 -m venv venv
28           source venv/bin/activate
29           python3 -m pip install -r requirements.txt
30           curl https://bellard.org/quickjs/quickjs-2024-01-13.tar.xz | tar -xJf -
31           pushd quickjs-2024-01-13
32           make && sudo make install
33           popd
34           env
35       - name: Run cmake
36         env:
37           CC: ${{ matrix.cc }}
38           CXX: ${{ matrix.cxx }}
39           LIBA_OPENMP: ${{ startsWith(matrix.cc, 'gcc') }}
40         run: |
41           source venv/bin/activate
42           set -x
43           cmake -S . -B build.${{ matrix.cc }} -DCMAKE_BUILD_TYPE=${{ matrix.type }} \
44             -DBUILD_TESTING=1 \
45             -DLIBA_WARNINGS=1 \
46             -DLIBA_SANITIZE=1 \
47             -DLIBA_JAVASCRIPT=1 \
48             -DLIBA_JAVASCRIPT_BIGINT=1 \
49             -DLIBA_JAVASCRIPT_DEBUG=1 \
50             -DLIBA_JAVASCRIPT_TSGEN=1 \
51             -DLIBA_WITH_LUA=1 \
52             -DLIBA_PYTHON=1 \
53             -DLIBA_VCPKG=1 \
54             -DLIBA_JAVA=1 \
55             -DLIBA_QUICKJS=1 \
56             -DLIBA_LIBTOOL=1 \
57             -DLIBA_PKGCONFIG=1
58           cmake --build build.${{ matrix.cc }} --config ${{ matrix.type }} --target package
59       - name: Run vcpkg
60         if: ${{ matrix.type == 'Release' }}
61         env:
62           CC: ${{ matrix.cc }}
63           CXX: ${{ matrix.cxx }}
64         run: |
65           set -x
66           cp -r build.${{ matrix.cc }}/vcpkg/* $VCPKG_INSTALLATION_ROOT
67           vcpkg install liba[ipo,pkgconfig]
68       - name: Run ctest
69         env:
70           CTEST_OUTPUT_ON_FAILURE: 1
71         run: |
72           set -x
73           cmake --build build.${{ matrix.cc }} --target test