|
| 1 | +name: Generate Matlab mex files |
| 2 | +on: [push] |
| 3 | +jobs: |
| 4 | + mex-ci: |
| 5 | + name: ${{ matrix.os }} |
| 6 | + strategy: |
| 7 | + matrix: |
| 8 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 9 | + runs-on: ${{ matrix.os }} |
| 10 | + steps: |
| 11 | + - name: Check out repository |
| 12 | + uses: actions/checkout@v4 |
| 13 | + - name: Set up MATLAB |
| 14 | + uses: matlab-actions/setup-matlab@v2 |
| 15 | + with: |
| 16 | + release: R2023b |
| 17 | + cache: true |
| 18 | + - name: Generate Windows mex file |
| 19 | + if: runner.os == 'Windows' |
| 20 | + run: | |
| 21 | + export PATH=/d/hostedtoolcache/windows/MATLAB/2023.2.999/x64/bin/win64:$PATH |
| 22 | + export PATH=/c/msys64/usr/bin:$PATH |
| 23 | + export PATH=/c/msys64/mingw64/bin:$PATH |
| 24 | + export MW_MINGW64_LOC=/c/msys64/mingw64 |
| 25 | + pacman -Sy --noconfirm make mingw-w64-x86_64-toolchain mingw-w64-x86_64-fftw |
| 26 | + mex -setup:.github/workflows/mex_C++_win64.xml C++ |
| 27 | + cp make.inc.windows_msys make.inc |
| 28 | + sed -i '/ LIBSFFT/a \ \ LIBSFFT := `g++ --print-file-name libfftw3.a` `g++ --print-file-name libfftw3f.a` `g++ --print-file-name libfftw3_omp.a` `g++ --print-file-name libfftw3f_omp.a` `g++ --print-file-name libm.a` `g++ --print-file-name libgomp.a`' makefile |
| 29 | + /c/msys64/usr/bin/make matlab |
| 30 | + shell: C:\msys64\usr\bin\bash.exe {0} |
| 31 | + - name: Generate macOS mex file |
| 32 | + if: runner.os == 'macOS' |
| 33 | + run: | |
| 34 | + brew install fftw libomp |
| 35 | + sed 's/\/Applications\/MATLAB_R20\*\*.app/\/Users\/runner\/hostedtoolcache\/MATLAB\/2023.2.999\/arm64\/MATLAB.app/' make.inc.macosx_arm64 > make.inc |
| 36 | + sed -i -e 's/ LIBSFFT.*/\ \ LIBSFFT := \/opt\/homebrew\/opt\/fftw\/lib\/libfftw3\.a \/opt\/homebrew\/opt\/fftw\/lib\/libfftw3f\.a \/opt\/homebrew\/opt\/fftw\/lib\/libfftw3_omp.a \/opt\/homebrew\/opt\/fftw\/lib\/libfftw3f_omp\.a -L\/Users\/runner\/hostedtoolcache\/MATLAB\/2023.2.999\/arm64\/MATLAB.app\/bin\/maca64\/lib -lomp/' makefile |
| 37 | + make matlab |
| 38 | + - name: Generate Linux mex file |
| 39 | + if: runner.os == 'Linux' |
| 40 | + run: | |
| 41 | + sudo apt install libfftw3-dev |
| 42 | + sed -i '/ LIBSFFT/a \ \ LIBSFFT := `g++ --print-file-name libfftw3.a` `g++ --print-file-name libfftw3f.a` `g++ --print-file-name libfftw3_omp.a` `g++ --print-file-name libfftw3f_omp.a` -lm -lgomp' makefile |
| 43 | + make matlab |
| 44 | + - name: Upload mex files |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: ${{matrix.os}}-R2023b-finufft-mex |
| 48 | + path: ${{runner.workspace}}/finufft/matlab/finufft.mex* |
| 49 | + - name: Setup tmate session |
| 50 | + if: ${{ failure() }} |
| 51 | + uses: mxschmitt/action-tmate@v3 |
0 commit comments