Skip to content

Commit

Permalink
Add build for ubuntu22 (#9)
Browse files Browse the repository at this point in the history
* adding build for Ubuntu22 and Octave6.4.0
  • Loading branch information
ptahmose authored Dec 7, 2024
1 parent fad8ad7 commit f0e345a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 18 deletions.
70 changes: 54 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ jobs:
matrix:
# Note: We use the latest version of Ubuntu 24.04 in order to get a more recent version of Octave (we get 8.4 currently)
# We better should use a version >6.4, otherwise the Octave-mex-support seems to be missing some functions.
os: [ubuntu-24.04, windows-latest] # Windows and Linux builds
os: [ubuntu-24.04, ubuntu-22.04, windows-latest] # Windows and Linux builds
outputs:
linuxx64_matlab_artifact: ${{ steps.prepare_linux_artifact.outputs.linuxx64_matlab_build }}
linuxx64_octave_artifact: ${{ steps.prepare_linux_artifact.outputs.linuxx64_octave_build }}
linuxx64_ubuntu24_matlab_artifact: ${{ steps.prepare_linux_artifact.outputs.linuxx64_ubuntu24_matlab_build }}
linuxx64_ubuntu24_octave_artifact: ${{ steps.prepare_linux_artifact.outputs.linuxx64_ubuntu24_octave_build }}
linuxx64_ubuntu22_matlab_artifact: ${{ steps.prepare_linux_artifact.outputs.linuxx64_ubuntu22_matlab_build }}
linuxx64_ubuntu22_octave_artifact: ${{ steps.prepare_linux_artifact.outputs.linuxx64_ubuntu22_octave_build }}
windowsx64_matlab_artifact: ${{ steps.prepare_windows_matlab_artifact.outputs.windowsx64_matlab_build }}
windowsx64_octave_artifact: ${{ steps.prepare_windows_octave_artifact.outputs.windowsx64_octave_build }}
steps:
Expand Down Expand Up @@ -65,18 +67,30 @@ jobs:
uses: matlab-actions/run-command@v2
with:
command: cd tests/MATLAB; results = runtests, assertSuccess(results);
- name: Prepare MATLAB artifact (Linux)
id: prepare_linux_matlab_artifact
if: runner.os == 'Linux'
- name: Prepare MATLAB artifact (Linux Ubuntu24)
id: prepare_linux_ubuntu24_matlab_artifact
if: matrix.os == 'ubuntu-24.04'
shell: bash
run: |
mkdir -p artifacts
name="MATLAB-MEXlibCZI-linux-ubuntu24_x64-$(git describe --always)"
mkdir -p artifacts/${name}
cp build/MEXlibCZI/MEXlibCZI.mexa64 artifacts/${name}/
echo "artifactName=${name}" >> "$GITHUB_ENV"
echo "artifactPath=artifacts/${name}" >> "$GITHUB_ENV"
echo "linuxx64_ubuntu24_matlab_build=${name}" >> "$GITHUB_OUTPUT"
- name: Prepare MATLAB artifact (Linux Ubuntu22)
id: prepare_linux_ubuntu22_matlab_artifact
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
mkdir -p artifacts
name="MATLAB-MEXlibCZI-linux-x64-$(git describe --always)"
name="MATLAB-MEXlibCZI-linux-ubuntu22_x64-$(git describe --always)"
mkdir -p artifacts/${name}
cp build/MEXlibCZI/MEXlibCZI.mexa64 artifacts/${name}/
echo "artifactName=${name}" >> "$GITHUB_ENV"
echo "artifactPath=artifacts/${name}" >> "$GITHUB_ENV"
echo "linuxx64_matlab_build=${name}" >> "$GITHUB_OUTPUT"
echo "linuxx64_ubuntu22_matlab_build=${name}" >> "$GITHUB_OUTPUT"
- name: install Octave (Windows)
if: runner.os == 'Windows'
shell: bash
Expand Down Expand Up @@ -123,8 +137,19 @@ jobs:
shell: bash
run: |
cd OctaveMex
octave --version
octave --eval "mkoctfile --mex octavelibczi.c"
# Get the version of Octave
octave_version=$(octave --version | head -n 1 | awk '{print $NF}')
echo "Detected Octave version: $octave_version"
# Define the version to compare against - for versions <= 6.4.0, we want to define "OCTAVEMEX_NO_GET_TYPED" in order to not use functions not available in older versions
max_version="6.4.0"
# Compare versions
if [[ "$(printf '%s\n' "$octave_version" "$max_version" | sort -V | head -n 1)" == "$octave_version" ]]; then
echo "Octave version is less than or equal to $max_version"
octave --eval "mkoctfile --mex octavelibczi.c -DOCTAVEMEX_NO_GET_TYPED"
else
echo "Octave version is greater than $max_version"
octave --eval "mkoctfile --mex octavelibczi.c"
fi
cp ../build/libmexlibczi/libmexlibczi.so . # now, copy the libmexlibczi.so to this folder
- name: Octave Unit-Tests (Linux)
if: runner.os == 'Linux'
Expand Down Expand Up @@ -173,19 +198,32 @@ jobs:
echo "artifactName=${name}" >> "$GITHUB_ENV"
echo "artifactPath=artifacts/${name}" >> "$GITHUB_ENV"
echo "windowsx64_octave_build=${name}" >> "$GITHUB_OUTPUT"
- name: Prepare Octave-mex artifact (Linux)
id: prepare_linux_octave_artifact
if: runner.os == 'Linux'
- name: Prepare Octave-mex artifact (Linux Ubuntu24)
id: prepare_linux_ubuntu24_octave_artifact
if: matrix.os == 'ubuntu-24.04'
shell: bash
run: |
mkdir -p artifacts
name="Octave-MEXlibCZI-linux-ubuntu24_x64-$(git describe --always)"
mkdir -p "artifacts/${name}"
cp "${GITHUB_WORKSPACE}/OctaveMex/libmexlibczi.so" "artifacts/${name}/"
cp "${GITHUB_WORKSPACE}/OctaveMex/octavelibczi.mex" "artifacts/${name}/"
echo "artifactName=${name}" >> "$GITHUB_ENV"
echo "artifactPath=artifacts/${name}" >> "$GITHUB_ENV"
echo "linuxx64_ubuntu24_octave_build=${name}" >> "$GITHUB_OUTPUT"
- name: Prepare Octave-mex artifact (Linux Ubuntu22)
id: prepare_linux_ubuntu22_octave_artifact
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
mkdir -p artifacts
name="Octave-MEXlibCZI-linux-x64-$(git describe --always)"
name="Octave-MEXlibCZI-linux-ubuntu22_x64-$(git describe --always)"
mkdir -p "artifacts/${name}"
cp "${GITHUB_WORKSPACE}/OctaveMex/libmexlibczi.so" "artifacts/${name}/"
cp "${GITHUB_WORKSPACE}/OctaveMex/octavelibczi.mex" "artifacts/${name}/"
echo "artifactName=${name}" >> "$GITHUB_ENV"
echo "artifactPath=artifacts/${name}" >> "$GITHUB_ENV"
echo "linuxx64_octave_build=${name}" >> "$GITHUB_OUTPUT"
echo "linuxx64_ubuntu22_octave_build=${name}" >> "$GITHUB_OUTPUT"
- name: Upload Octave-mex artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -201,7 +239,7 @@ jobs:
- name: Check out repository
uses: actions/checkout@v4
- name: Download All Artifacts
if: needs.build.outputs.linuxx64_matlab_artifact != '' || needs.build.outputs.windowsx64_matlab_artifact != '' || needs.build.outputs.linuxx64_octave_artifact != '' || needs.build.outputs.windowsx64_octave_artifact != ''
if: needs.build.outputs.linuxx64_ubuntu24_matlab_artifact != '' || needs.build.outputs.linuxx64_ubuntu22_matlab_artifact != '' || needs.build.outputs.windowsx64_matlab_artifact != '' || needs.build.outputs.linuxx64_ubuntu24_octave_artifact != '' || needs.build.outputs.linuxx64_ubuntu22_octave_artifact != '' || needs.build.outputs.windowsx64_octave_artifact != ''
uses: actions/download-artifact@v4
with:
path: ./artifacts # download to a specific folder
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cmake_minimum_required (VERSION 3.11)

set(MEXLIBCZI_MAJOR 0)
set(MEXLIBCZI_MINOR 3)
set(MEXLIBCZI_PATCH 3)
set(MEXLIBCZI_PATCH 4)
set(MEXLIBCZI_EXT "alpha")

if(WIN32)
Expand Down
6 changes: 5 additions & 1 deletion OctaveMex/octavelibczi.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ then enables a workaround to use mxGetData and cast the pointer to the desired t
to work, but it seems fishy and might be troublesome. It is therefore avoided, but this also means
that the mex-file built will not work with Octave <= 6.4.0.
*/
#define OCTAVEMEX_HAS_GET_TYPED 1
#ifdef OCTAVEMEX_NO_GET_TYPED
#define OCTAVEMEX_HAS_GET_TYPED 0
#else
#define OCTAVEMEX_HAS_GET_TYPED 1
#endif

static bool octaveMexIsNanOrInfDouble(double value)
{
Expand Down

0 comments on commit f0e345a

Please sign in to comment.