@@ -15,51 +15,108 @@ jobs:
1515 strategy :
1616 fail-fast : false
1717 matrix :
18- os : [ubuntu-latest, windows-latest]
18+ os : [ubuntu-latest, windows-latest, macos-latest ]
1919 build_type : [Release]
2020 c_compiler : [gcc, clang, cl]
2121 include :
22+ # Windows
2223 - os : windows-latest
2324 c_compiler : cl
2425 cpp_compiler : cl
26+
27+ # Ubuntu GCC
2528 - os : ubuntu-latest
2629 c_compiler : gcc
2730 cpp_compiler : g++
31+
32+ # Ubuntu Clang
2833 - os : ubuntu-latest
2934 c_compiler : clang
3035 cpp_compiler : clang++
36+
37+ # macOS (use Homebrew LLVM for OpenMP support)
38+ - os : macos-latest
39+ c_compiler : clang
40+ cpp_compiler : clang++
41+
3142 exclude :
3243 - os : windows-latest
3344 c_compiler : gcc
3445 - os : windows-latest
3546 c_compiler : clang
3647 - os : ubuntu-latest
3748 c_compiler : cl
49+ - os : macos-latest
50+ c_compiler : gcc
51+ - os : macos-latest
52+ c_compiler : cl
3853
3954 steps :
4055 - uses : actions/checkout@v4
4156
42- - name : Install OpenMP (Ubuntu only)
57+ # ------------------------
58+ # Linux OpenMP
59+ # ------------------------
60+ - name : Install OpenMP (Ubuntu)
4361 if : matrix.os == 'ubuntu-latest'
44- run : sudo apt-get update && sudo apt-get install -y libomp-dev
62+ run : |
63+ sudo apt-get update
64+ sudo apt-get install -y libomp-dev
4565
66+ # ------------------------
67+ # macOS OpenMP
68+ # ------------------------
69+ - name : Install OpenMP + LLVM (macOS)
70+ if : matrix.os == 'macos-latest'
71+ run : |
72+ brew update
73+ brew install llvm libomp
74+
75+ # ------------------------
76+ # Set reusable strings
77+ # ------------------------
4678 - name : Set reusable strings
4779 id : strings
4880 shell : bash
4981 run : |
5082 echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
5183
52- - name : Configure CMake
84+ # ------------------------
85+ # Configure CMake
86+ # ------------------------
87+ - name : Configure CMake (macOS)
88+ if : matrix.os == 'macos-latest'
5389 run : >
5490 cmake -B ${{ steps.strings.outputs.build-output-dir }}
91+ -S ${{ github.workspace }}
92+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
93+ -DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang
94+ -DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++
95+ -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/llvm
96+ -DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp"
97+ -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp"
98+ -DOpenMP_C_LIB_NAMES="omp"
99+ -DOpenMP_CXX_LIB_NAMES="omp"
100+ -DOpenMP_omp_LIBRARY=/opt/homebrew/opt/libomp/lib/libomp.dylib
101+
102+ - name : Configure CMake (Others)
103+ if : matrix.os != 'macos-latest'
104+ run : >
105+ cmake -B ${{ steps.strings.outputs.build-output-dir }}
106+ -S ${{ github.workspace }}
55107 -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
56108 -DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
57109 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
58- -S ${{ github.workspace }}
59110
111+ # ------------------------
112+ # Build
113+ # ------------------------
60114 - name : Build
61115 run : cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
62116
117+ # ------------------------
118+ # Test
119+ # ------------------------
63120 - name : Test
64121 working-directory : ${{ steps.strings.outputs.build-output-dir }}
65- run : ctest --build-config ${{ matrix.build_type }}
122+ run : ctest --build-config ${{ matrix.build_type }}
0 commit comments