Skip to content

Add new commands and update documentation #12

Add new commands and update documentation

Add new commands and update documentation #12

name: Build for Windows-x64
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up MATLAB
uses: matlab-actions/setup-matlab@v2
- name: Run MATLAB script to give the header and library paths
# We run a MATLAB script, which writes the header and library paths the GITHUB_ENV file,
# which is a special file that can be used to set environment variables for subsequent steps.
uses: matlab-actions/run-command@v2
with:
command: |
headerPath = fullfile(matlabroot, 'extern', 'include');libPath = fullfile(matlabroot, 'extern', 'lib', computer('arch'));envFile = getenv('GITHUB_ENV');fid = fopen(envFile, 'a');fprintf(fid, 'MATLAB_HEADER_PATH=%s\n', headerPath);fprintf(fid, 'MATLAB_LIB_PATH=%s\n', libPath);fclose(fid);
- name: Use environment variables from MATLAB
run: |
echo "Header path is $MATLAB_HEADER_PATH"
echo "Library path is $MATLAB_LIB_PATH"
shell: bash
- name: run build
shell: bash
run: |
mkdir build
cd build
# actually, we don't need to pass the MATLAB header and library paths to CMake, we can rely on CMake to find them
#cmake .. -A x64 -DCMAKE_BUILD_TYPE=Release -DMEXLIBCZI_HEADERS=%MATLAB_HEADER_PATH% -DMEXLIBCZI_LIBS=%MATLAB_LIB_PATH%\microsoft
cmake .. -A x64 -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
- name: Prepare artifact
shell: bash
run: |
mkdir -p artifacts
name="MEXlibCZI-windows-x64-$(git describe --always)"
mkdir -p artifacts/${name}
cp build/MEXlibCZI/Release/MEXlibCZI.mexw64 artifacts/${name}/
echo "artifactName=${name}" >> "$GITHUB_ENV"
echo "artifactPath=artifacts/${name}" >> "$GITHUB_ENV"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: ${{ env.artifactPath }}/
name: ${{ env.artifactName }}