ci.yml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. name: CI
  2. on:
  3. push:
  4. branches: [ "master" ]
  5. pull_request:
  6. branches: [ "master" ]
  7. jobs:
  8. build_autotools:
  9. name: Autotools / ${{ matrix.os }} / ${{ matrix.simd }}
  10. runs-on: ${{ matrix.os }}
  11. strategy:
  12. fail-fast: false
  13. matrix:
  14. include:
  15. # x86/x64 builds
  16. - { os: macos-13, simd: none }
  17. - { os: macos-13, simd: sse }
  18. - { os: macos-13, simd: sse2 }
  19. - { os: macos-13, simd: sse3 }
  20. - { os: macos-13, simd: sse4 }
  21. - { os: macos-13, simd: avx }
  22. - { os: macos-13, simd: avx2 }
  23. - { os: macos-14, simd: none }
  24. - { os: macos-14, simd: sse }
  25. - { os: macos-14, simd: sse2 }
  26. - { os: macos-14, simd: sse3 }
  27. - { os: macos-14, simd: sse4 }
  28. - { os: macos-14, simd: avx }
  29. - { os: macos-14, simd: avx2 }
  30. - { os: ubuntu-22.04, simd: none }
  31. - { os: ubuntu-22.04, simd: sse }
  32. - { os: ubuntu-22.04, simd: sse2 }
  33. - { os: ubuntu-22.04, simd: sse3 }
  34. - { os: ubuntu-22.04, simd: sse4 }
  35. - { os: ubuntu-22.04, simd: avx }
  36. - { os: ubuntu-22.04, simd: avx2 }
  37. - { os: ubuntu-24.04, simd: none }
  38. - { os: ubuntu-24.04, simd: sse }
  39. - { os: ubuntu-24.04, simd: sse2 }
  40. - { os: ubuntu-24.04, simd: sse3 }
  41. - { os: ubuntu-24.04, simd: sse4 }
  42. - { os: ubuntu-24.04, simd: avx }
  43. - { os: ubuntu-24.04, simd: avx2 }
  44. # ARM64 builds
  45. - { os: ubuntu-latest-arm64, simd: neon }
  46. steps:
  47. - uses: actions/checkout@v4
  48. - name: Install Autotools on macOS
  49. if: runner.os == 'macOS'
  50. run: brew upgrade && brew install autoconf automake libtool
  51. - name: Install Autotools on Ubuntu
  52. if: matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-24.04'
  53. run: sudo apt-get install -y autoconf automake libtool
  54. - name: Set SIMD flags
  55. run: |
  56. if [ "${{ matrix.simd }}" == "none" ]; then
  57. export CFLAGS=""
  58. elif [ "${{ matrix.simd }}" == "sse" ]; then
  59. export CFLAGS="-msse"
  60. elif [ "${{ matrix.simd }}" == "sse2" ]; then
  61. export CFLAGS="-msse2"
  62. elif [ "${{ matrix.simd }}" == "sse3" ]; then
  63. export CFLAGS="-msse3"
  64. elif [ "${{ matrix.simd }}" == "sse4" ]; then
  65. export CFLAGS="-msse4"
  66. elif [ "${{ matrix.simd }}" == "avx" ]; then
  67. export CFLAGS="-mavx"
  68. elif [ "${{ matrix.simd }}" == "avx2" ]; then
  69. export CFLAGS="-mavx2"
  70. elif [ "${{ matrix.simd }}" == "neon" ]; then
  71. export CFLAGS="-mfpu=neon"
  72. fi
  73. - name: Generate Autotools
  74. run: ./autogen.sh
  75. - name: Configure Autotools
  76. run: ./configure CFLAGS="$CFLAGS"
  77. - name: Build
  78. run: make
  79. - name: Test
  80. run: make check
  81. build_cmake_ios:
  82. name: CMake / iOS
  83. runs-on: macos-14
  84. steps:
  85. - uses: actions/checkout@v4
  86. - name: Configure CMake
  87. run: |
  88. cmake \
  89. -B build \
  90. -GXcode \
  91. -DCMAKE_SYSTEM_NAME=iOS \
  92. -DCMAKE_BUILD_TYPE=Release \
  93. -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED=NO \
  94. -DCGLM_STATIC=ON \
  95. -DCGLM_USE_TEST=ON
  96. - name: Build
  97. run: cmake --build build
  98. build_cmake_ubuntu:
  99. name: CMake / ${{ matrix.target.os }} / ${{ matrix.target.cc }} / ${{ matrix.target.arch }} / ${{ matrix.target.simd }}
  100. runs-on: ${{ matrix.target.arch == 'arm64' && 'ubuntu-latest-arm64' || matrix.target.os }}
  101. strategy:
  102. fail-fast: false
  103. matrix:
  104. target:
  105. # GCC 11 builds
  106. - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: none }
  107. - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: sse }
  108. - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: sse2 }
  109. - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: sse3 }
  110. - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: sse4 }
  111. - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: avx }
  112. - { os: ubuntu-20.04, cc: gcc-11, arch: x64, simd: avx2 }
  113. # GCC 12 builds
  114. - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: none }
  115. - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: sse }
  116. - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: sse2 }
  117. - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: sse3 }
  118. - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: sse4 }
  119. - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: avx }
  120. - { os: ubuntu-22.04, cc: gcc-12, arch: x64, simd: avx2 }
  121. # GCC 13 builds
  122. - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: none }
  123. - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: sse }
  124. - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: sse2 }
  125. - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: sse3 }
  126. - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: sse4 }
  127. - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: avx }
  128. - { os: ubuntu-24.04, cc: gcc-13, arch: x64, simd: avx2 }
  129. # Clang 12 builds
  130. - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: none }
  131. - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: sse }
  132. - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: sse2 }
  133. - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: sse3 }
  134. - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: sse4 }
  135. - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: avx }
  136. - { os: ubuntu-20.04, cc: clang-12, arch: x64, simd: avx2 }
  137. # Clang 15 builds
  138. - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: none }
  139. - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: sse }
  140. - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: sse2 }
  141. - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: sse3 }
  142. - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: sse4 }
  143. - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: avx }
  144. - { os: ubuntu-22.04, cc: clang-15, arch: x64, simd: avx2 }
  145. # ARM64 builds
  146. - { os: ubuntu-latest, cc: gcc-12, arch: arm64, simd: neon }
  147. - { os: ubuntu-latest, cc: gcc-13, arch: arm64, simd: neon }
  148. # ARMv7 builds
  149. - { os: ubuntu-latest-arm64, cc: gcc-12, arch: armv7, simd: neon }
  150. - { os: ubuntu-latest-arm64, cc: gcc-12, arch: armv7, simd: none }
  151. steps:
  152. - uses: actions/checkout@v4
  153. - name: Add Ubuntu Toolchain PPA
  154. if: matrix.target.os == 'ubuntu-20.04'
  155. run: |
  156. sudo apt-get update
  157. sudo apt-get install -y software-properties-common
  158. sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
  159. sudo apt-get update
  160. - name: Install Compiler and Ninja
  161. run: |
  162. sudo apt-get install -y ${{ matrix.target.cc }} ninja-build
  163. - name: Set SIMD flags
  164. run: |
  165. if [ "${{ matrix.simd }}" == "none" ]; then
  166. export CFLAGS=""
  167. elif [ "${{ matrix.simd }}" == "sse" ]; then
  168. export CFLAGS="-msse"
  169. elif [ "${{ matrix.simd }}" == "sse2" ]; then
  170. export CFLAGS="-msse2"
  171. elif [ "${{ matrix.simd }}" == "sse3" ]; then
  172. export CFLAGS="-msse3"
  173. elif [ "${{ matrix.simd }}" == "sse4" ]; then
  174. export CFLAGS="-msse4"
  175. elif [ "${{ matrix.simd }}" == "avx" ]; then
  176. export CFLAGS="-mavx"
  177. elif [ "${{ matrix.simd }}" == "avx2" ]; then
  178. export CFLAGS="-mavx2"
  179. elif [ "${{ matrix.simd }}" == "neon" ]; then
  180. export CFLAGS="-mfpu=neon"
  181. fi
  182. - name: Configure CMake
  183. run: |
  184. if [ "${{ matrix.target.arch }}" == "armv7" ]; then
  185. # Build for ARMv7
  186. neon_flags=""
  187. if [ "${{ matrix.simd }}" == "neon" ]; then
  188. neon_flags="-mfpu=neon -mfloat-abi=hard"
  189. fi
  190. cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release \
  191. -DCMAKE_C_COMPILER=${{ matrix.target.cc }} \
  192. -DCMAKE_C_FLAGS="$CFLAGS -m32 -march=armv7-a ${neon_flags}" \
  193. -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON
  194. elif [ "${{ matrix.target.arch }}" == "arm64" ]; then
  195. # Build for ARM64 (AArch64)
  196. neon_flags=""
  197. if [ "${{ matrix.simd }}" == "neon" ]; then
  198. neon_flags="+simd" # Enable SIMD/NEON features on ARM64
  199. else
  200. neon_flags="+nosimd" # Explicitly disable SIMD/NEON
  201. fi
  202. cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release \
  203. -DCMAKE_C_COMPILER=${{ matrix.target.cc }} \
  204. -DCMAKE_C_FLAGS="$CFLAGS -march=armv8-a${neon_flags}" \
  205. -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON
  206. else
  207. # Normal build (x86/x64)
  208. cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release \
  209. -DCMAKE_C_COMPILER=${{ matrix.target.cc }} \
  210. -DCMAKE_C_FLAGS="$CFLAGS" \
  211. -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON
  212. fi
  213. - name: Build
  214. run: cmake --build build
  215. - name: Test
  216. working-directory: build
  217. run: ./tests
  218. build_cmake_macos:
  219. name: CMake / ${{ matrix.os }}
  220. runs-on: ${{ matrix.os }}
  221. strategy:
  222. fail-fast: false
  223. matrix:
  224. os: [macos-13, macos-14]
  225. steps:
  226. - uses: actions/checkout@v4
  227. - name: Install Ninja
  228. if: runner.os == 'macOS'
  229. run: brew upgrade && brew install ninja
  230. - name: Configure CMake
  231. run: |
  232. cmake \
  233. -B build \
  234. -GNinja \
  235. -DCMAKE_BUILD_TYPE=Release \
  236. -DCGLM_STATIC=ON \
  237. -DCGLM_USE_TEST=ON
  238. - name: Build
  239. run: cmake --build build
  240. - name: Test
  241. working-directory: build
  242. run: ./tests
  243. build_cmake:
  244. name: CMake / ${{ matrix.os }} / ${{ matrix.simd }}
  245. runs-on: ${{ matrix.os }}
  246. strategy:
  247. fail-fast: false
  248. matrix:
  249. include:
  250. # x86/x64 builds
  251. - { os: macos-13, simd: none }
  252. - { os: macos-13, simd: sse }
  253. - { os: macos-13, simd: sse2 }
  254. - { os: macos-13, simd: sse3 }
  255. - { os: macos-13, simd: sse4 }
  256. - { os: macos-13, simd: avx }
  257. - { os: macos-13, simd: avx2 }
  258. - { os: macos-14, simd: none }
  259. - { os: macos-14, simd: sse }
  260. - { os: macos-14, simd: sse2 }
  261. - { os: macos-14, simd: sse3 }
  262. - { os: macos-14, simd: sse4 }
  263. - { os: macos-14, simd: avx }
  264. - { os: macos-14, simd: avx2 }
  265. - { os: windows-2022, simd: none }
  266. - { os: windows-2022, simd: sse }
  267. - { os: windows-2022, simd: sse2 }
  268. - { os: windows-2022, simd: sse3 }
  269. - { os: windows-2022, simd: sse4 }
  270. - { os: windows-2022, simd: avx }
  271. - { os: windows-2022, simd: avx2 }
  272. # ARM64 builds
  273. - { os: macos-14-arm64, simd: neon }
  274. steps:
  275. - uses: actions/checkout@v4
  276. - name: Install Ninja on macOS
  277. if: runner.os == 'macOS'
  278. run: brew upgrade && brew install ninja
  279. - name: Set SIMD flags (Windows)
  280. if: runner.os == 'Windows'
  281. shell: pwsh
  282. run: |
  283. $simd = "${{ matrix.simd }}"
  284. if ($simd -eq "none") {
  285. $env:CFLAGS = ""
  286. } elseif ($simd -eq "sse") {
  287. $env:CFLAGS = "-arch:SSE"
  288. } elseif ($simd -eq "sse2") {
  289. $env:CFLAGS = "-arch:SSE2"
  290. } elseif ($simd -eq "sse3") {
  291. $env:CFLAGS = "-arch:SSE3"
  292. } elseif ($simd -eq "sse4") {
  293. $env:CFLAGS = "-arch:SSE4"
  294. } elseif ($simd -eq "avx") {
  295. $env:CFLAGS = "-arch:AVX"
  296. } elseif ($simd -eq "avx2") {
  297. $env:CFLAGS = "-arch:AVX2"
  298. } elseif ($simd -eq "neon") {
  299. $env:CFLAGS = "-arch:NEON"
  300. }
  301. - name: Set SIMD flags (Unix)
  302. if: runner.os != 'Windows'
  303. shell: bash
  304. run: |
  305. if [ "${{ matrix.simd }}" == "none" ]; then
  306. export CFLAGS=""
  307. elif [ "${{ matrix.simd }}" == "sse" ]; then
  308. export CFLAGS="-msse"
  309. elif [ "${{ matrix.simd }}" == "sse2" ]; then
  310. export CFLAGS="-msse2"
  311. elif [ "${{ matrix.simd }}" == "sse3" ]; then
  312. export CFLAGS="-msse3"
  313. elif [ "${{ matrix.simd }}" == "sse4" ]; then
  314. export CFLAGS="-msse4"
  315. elif [ "${{ matrix.simd }}" == "avx" ]; then
  316. export CFLAGS="-mavx"
  317. elif [ "${{ matrix.simd }}" == "avx2" ]; then
  318. export CFLAGS="-mavx2"
  319. elif [ "${{ matrix.simd }}" == "neon" ]; then
  320. export CFLAGS="-mfpu=neon"
  321. fi
  322. - name: Configure CMake (Windows)
  323. if: runner.os == 'Windows'
  324. shell: pwsh
  325. run: cmake -B build -G "Visual Studio 17 2022" -A x64 -T host=x64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="$env:CFLAGS" -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON
  326. - name: Configure CMake (Unix)
  327. if: runner.os != 'Windows'
  328. shell: bash
  329. run: cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="$CFLAGS" -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON
  330. - name: Build
  331. run: cmake --build build
  332. - name: Test (Windows)
  333. if: runner.os == 'Windows'
  334. shell: pwsh
  335. working-directory: build
  336. run: .\Debug\tests.exe
  337. - name: Test (Unix)
  338. if: runner.os != 'Windows'
  339. shell: bash
  340. working-directory: build
  341. run: ./tests
  342. build_meson:
  343. name: Meson / ${{ matrix.os }} / ${{ matrix.simd }}
  344. runs-on: ${{ contains(matrix.os, 'arm64') && 'ubuntu-latest-arm64' || matrix.os }}
  345. strategy:
  346. fail-fast: false
  347. matrix:
  348. include:
  349. # x86/x64 builds
  350. - { os: macos-14, simd: none }
  351. - { os: macos-14, simd: sse }
  352. - { os: macos-14, simd: sse2 }
  353. - { os: macos-14, simd: sse3 }
  354. - { os: macos-14, simd: sse4 }
  355. - { os: macos-14, simd: avx }
  356. - { os: macos-14, simd: avx2 }
  357. - { os: ubuntu-22.04, simd: none }
  358. - { os: ubuntu-22.04, simd: sse }
  359. - { os: ubuntu-22.04, simd: sse2 }
  360. - { os: ubuntu-22.04, simd: sse3 }
  361. - { os: ubuntu-22.04, simd: sse4 }
  362. - { os: ubuntu-22.04, simd: avx }
  363. - { os: ubuntu-22.04, simd: avx2 }
  364. - { os: ubuntu-24.04, simd: none }
  365. - { os: ubuntu-24.04, simd: sse }
  366. - { os: ubuntu-24.04, simd: sse2 }
  367. - { os: ubuntu-24.04, simd: sse3 }
  368. - { os: ubuntu-24.04, simd: sse4 }
  369. - { os: ubuntu-24.04, simd: avx }
  370. - { os: ubuntu-24.04, simd: avx2 }
  371. - { os: windows-2022, simd: none }
  372. - { os: windows-2022, simd: sse }
  373. - { os: windows-2022, simd: sse2 }
  374. - { os: windows-2022, simd: sse3 }
  375. - { os: windows-2022, simd: sse4 }
  376. - { os: windows-2022, simd: avx }
  377. - { os: windows-2022, simd: avx2 }
  378. # ARM64 builds
  379. - { os: ubuntu-latest-arm64, simd: neon }
  380. steps:
  381. - uses: actions/checkout@v4
  382. - uses: actions/setup-python@v5
  383. with:
  384. python-version: '3.12'
  385. cache: 'pip'
  386. - name: Install meson
  387. run: python3 -m pip install meson ninja
  388. - name: Set SIMD flags (Windows)
  389. if: runner.os == 'Windows'
  390. shell: pwsh
  391. run: |
  392. $simd = "${{ matrix.simd }}"
  393. if ($simd -eq "none") {
  394. $env:CFLAGS = ""
  395. } elseif ($simd -eq "sse") {
  396. $env:CFLAGS = "-arch:SSE"
  397. } elseif ($simd -eq "sse2") {
  398. $env:CFLAGS = "-arch:SSE2"
  399. } elseif ($simd -eq "sse3") {
  400. $env:CFLAGS = "-arch:SSE3"
  401. } elseif ($simd -eq "sse4") {
  402. $env:CFLAGS = "-arch:SSE4"
  403. } elseif ($simd -eq "avx") {
  404. $env:CFLAGS = "-arch:AVX"
  405. } elseif ($simd -eq "avx2") {
  406. $env:CFLAGS = "-arch:AVX2"
  407. } elseif ($simd -eq "neon") {
  408. $env:CFLAGS = "-arch:NEON"
  409. }
  410. - name: Set SIMD flags (Unix)
  411. if: runner.os != 'Windows'
  412. shell: bash
  413. run: |
  414. if [ "${{ matrix.simd }}" == "none" ]; then
  415. export CFLAGS=""
  416. elif [ "${{ matrix.simd }}" == "sse" ]; then
  417. export CFLAGS="-msse"
  418. elif [ "${{ matrix.simd }}" == "sse2" ]; then
  419. export CFLAGS="-msse2"
  420. elif [ "${{ matrix.simd }}" == "sse3" ]; then
  421. export CFLAGS="-msse3"
  422. elif [ "${{ matrix.simd }}" == "sse4" ]; then
  423. export CFLAGS="-msse4"
  424. elif [ "${{ matrix.simd }}" == "avx" ]; then
  425. export CFLAGS="-mavx"
  426. elif [ "${{ matrix.simd }}" == "avx2" ]; then
  427. export CFLAGS="-mavx2"
  428. elif [ "${{ matrix.simd }}" == "neon" ]; then
  429. export CFLAGS="-mfpu=neon"
  430. fi
  431. - name: Build with meson (Windows)
  432. if: runner.os == 'Windows'
  433. shell: pwsh
  434. run: |
  435. meson setup build -Dbuildtype=release --default-library=static -Dbuild_tests=true -Dc_args="$env:CFLAGS"
  436. meson test -C build
  437. - name: Build with meson (Unix)
  438. if: runner.os != 'Windows'
  439. shell: bash
  440. run: |
  441. meson setup build -Dbuildtype=release --default-library=static -Dbuild_tests=true -Dc_args="$CFLAGS"
  442. meson test -C build
  443. build_msbuild:
  444. name: MSBuild / Windows / ${{ matrix.simd }}
  445. runs-on: windows-2022
  446. strategy:
  447. fail-fast: false
  448. matrix:
  449. simd: [none, sse, sse2, sse3, sse4, avx, avx2, neon]
  450. steps:
  451. - uses: actions/checkout@v4
  452. - uses: microsoft/setup-msbuild@v2
  453. - name: Retarget solution
  454. run: |
  455. vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
  456. $vsInstallPath = vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
  457. & "$vsInstallPath\Common7\IDE\devenv.com" cglm.sln /Upgrade
  458. - name: Set SIMD flags
  459. run: |
  460. if ($Env:SIMD -eq 'none') {
  461. $Env:CFLAGS=""
  462. } elseif ($Env:SIMD -eq 'sse') {
  463. $Env:CFLAGS="-arch:SSE"
  464. } elseif ($Env:SIMD -eq 'sse2') {
  465. $Env:CFLAGS="-arch:SSE2"
  466. } elseif ($Env:SIMD -eq 'sse3') {
  467. $Env:CFLAGS="-arch:SSE3"
  468. } elseif ($Env:SIMD -eq 'sse4') {
  469. $Env:CFLAGS="-arch:SSE4"
  470. } elseif ($Env:SIMD -eq 'avx') {
  471. $Env:CFLAGS="-arch:AVX"
  472. } elseif ($Env:SIMD -eq 'avx2') {
  473. $Env:CFLAGS="-arch:AVX2"
  474. } elseif ($Env:SIMD -eq 'neon') {
  475. $Env:CFLAGS="-arch:NEON"
  476. }
  477. - name: Build (x86)
  478. working-directory: win
  479. run: msbuild cglm.vcxproj /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=v143 /p:BuildInParallel=true /p:AdditionalOptions="$Env:CFLAGS"
  480. - name: Build (x64)
  481. working-directory: win
  482. run: msbuild cglm.vcxproj /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v143 /p:BuildInParallel=true /p:AdditionalOptions="$Env:CFLAGS"
  483. build_documentation:
  484. name: Documentation
  485. runs-on: ubuntu-22.04
  486. steps:
  487. - uses: actions/checkout@v4
  488. - uses: actions/setup-python@v5
  489. with:
  490. python-version: '3.12'
  491. - name: Install Dependencies
  492. working-directory: docs
  493. run: python3 -m pip install -r requirements.txt
  494. - name: Build
  495. working-directory: docs
  496. run: sphinx-build -W --keep-going source build
  497. build_swift:
  498. name: Swift ${{ matrix.swift }} / ${{ matrix.os }}
  499. runs-on: ${{ matrix.os }}
  500. strategy:
  501. fail-fast: false
  502. matrix:
  503. os: [macos-13, macos-14, ubuntu-22.04]
  504. # This has no test yet.
  505. steps:
  506. - uses: actions/checkout@v4
  507. - name: Build
  508. run: swift build
  509. build_cmake_arm:
  510. name: CMake / ARM / ${{ matrix.os }} / ${{ matrix.arch }} / ${{ matrix.simd }}
  511. runs-on: ${{ matrix.os }}
  512. strategy:
  513. fail-fast: false
  514. matrix:
  515. include:
  516. # Linux ARM builds
  517. - os: ubuntu-latest-arm64
  518. arch: arm64
  519. simd: neon
  520. - os: ubuntu-latest-arm64
  521. arch: armv7
  522. simd: neon
  523. - os: ubuntu-latest-arm64
  524. arch: armv7
  525. simd: none
  526. # Windows ARM builds
  527. - os: windows-latest-arm64
  528. arch: arm64
  529. simd: neon
  530. - os: windows-latest-arm64
  531. arch: arm
  532. simd: neon
  533. - os: windows-latest-arm64
  534. arch: arm
  535. simd: none
  536. steps:
  537. - uses: actions/checkout@v4
  538. - name: Configure CMake (Windows)
  539. if: runner.os == 'Windows'
  540. shell: pwsh
  541. run: |
  542. $flags = ""
  543. if ("${{ matrix.arch }}" -eq "arm") {
  544. $flags = "-m32 -march=armv7-a"
  545. if ("${{ matrix.simd }}" -eq "neon") {
  546. $flags += " -mfpu=neon"
  547. }
  548. }
  549. elseif ("${{ matrix.simd }}" -eq "neon") {
  550. $flags = "-march=armv8-a+simd"
  551. }
  552. cmake -B build -G "Visual Studio 17 2022" -A ${{ matrix.arch == 'arm64' && 'ARM64' || 'ARM' }} `
  553. -DCMAKE_BUILD_TYPE=Release `
  554. -DCMAKE_C_FLAGS="$flags" `
  555. -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON
  556. - name: Configure CMake (Unix)
  557. if: runner.os != 'Windows'
  558. shell: bash
  559. run: |
  560. flags=""
  561. if [ "${{ matrix.arch }}" = "armv7" ]; then
  562. flags="-m32 -march=armv7-a"
  563. if [ "${{ matrix.simd }}" = "neon" ]; then
  564. flags="$flags -mfpu=neon -mfloat-abi=hard"
  565. fi
  566. elif [ "${{ matrix.simd }}" = "neon" ]; then
  567. flags="-march=armv8-a+simd"
  568. fi
  569. cmake -B build -GNinja -DCMAKE_BUILD_TYPE=Release \
  570. -DCMAKE_C_FLAGS="$flags" \
  571. -DCGLM_STATIC=ON -DCGLM_USE_TEST=ON
  572. - name: Build
  573. run: cmake --build build
  574. - name: Test
  575. working-directory: build
  576. run: ./tests