Skip to content

Commit

Permalink
initial octave support
Browse files Browse the repository at this point in the history
  • Loading branch information
mcg1969 committed Apr 9, 2024
1 parent beb58c0 commit 3f7ae2b
Show file tree
Hide file tree
Showing 17 changed files with 60 additions and 5 deletions.
49 changes: 46 additions & 3 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
branches:
- master
jobs:
build:
build-mex:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -33,12 +33,55 @@ jobs:
name: mexfiles-${{ matrix.os }}
path: |
Solver/Mexfun/*.mex*
build-oct:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest,windows-latest,macos-latest,macos-14]
steps:
- name: Retrieve the source code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Octave
shell: bash
run: |
if [ "${{ matrix.os }}" = ubuntu-latest ]; then
sudo apt update
sudo apt install --no-install-recommends octave
octave_dir=o_lin
elif [ "${{ matrix.os }}" = windows-latest ]; then
choco install octave.portable
octave_dir=o_win
else
brew install octave
if [ "${{ matrix.os }}" = macos-latest ]; then
octave_dir=o_maci
else
octave_dir=o_maca
fi
fi
echo "OCTAVE_DIR=$octave_dir" >> $GITHUB_ENV
- name: Build Octave mex files
shell: bash
run: |
octave_dir=Solver/Mexfun/$OCTAVE_DIR
octave --eval 'computer'
octave --eval 'install_sdpt3 -rebuild'
mkdir -p $octave_dir
mv Solver/Mexfun/*.mex $octave_dir
- uses: actions/upload-artifact@v4
with:
name: mexfiles-oct-${{ matrix.os }}
path: |
Solver/Mexfun/$OCTAVE_DIR/*.mex*
package:
needs: build
needs: [build-mex,build-oct]
runs-on: ubuntu-latest
steps:
- name: Retrieve the source code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/download-artifact@v4
Expand Down
Binary file removed Solver/Mexfun/o_win/mexMatvec.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mexProd2.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mexProd2nz.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mexexpand.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mexinprod.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mexmat.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mexnnz.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mexqops.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mexschur.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mexschurfun.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mexskron.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mexsmat.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mexsvec.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mextriang.mex
Binary file not shown.
Binary file removed Solver/Mexfun/o_win/mextriangsp.mex
Binary file not shown.
16 changes: 14 additions & 2 deletions install_sdpt3.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ function install_sdpt3( varargin )
mdir = '';
if ISOCTAVE && VERSION >= 4,
switch computer,
case 'x86_64-pc-linux-gnu',
mdir = 'o_lin';
case 'x86_64-apple-darwin21.6.0',
mdir = 'o_maci';
case 'aarch64-apple-darwin23.4.0',
mdir = 'o_maca';
case 'i686-w64-mingw32',
mdir = 'o_win';
end
Expand Down Expand Up @@ -93,15 +99,20 @@ function install_sdpt3( varargin )
% Octave has mwSize and mwIndex hardcoded in mex.h as ints.
% There is no definition for mwSignedIndex so include it here.
% This means that Octave ignores the -largeArrayDims flag.
cmd = 'mkoctfile';
flags{end+1} = '--mex';
flags{end+1} = '--verbose';
if VERSION < 3.08,
flags{end+1} = '-DmwSignedIndex=int';
end
else
cmd = 'mex';
if ispc,
flags = {'-DPC'};
elseif isunix,
flags = {'-DUNIX'};
end
flags{end+1}={'-v'};
if strcmp(COMPUTER(end-1:end),'64') && ( VERSION >= 7.03 ),
flags{end+1} = '-largeArrayDims';
elseif VERSION < 7.03,
Expand Down Expand Up @@ -141,8 +152,9 @@ function install_sdpt3( varargin )
for i=1:length(targets64),
targ = targets64{i};
mfile = [ targ(1:min(strfind(targ,'.'))), mext ];
temp = [ 'mex ', flags, ' ', targets64{i}, '.c ', libs ];
fprintf( ' %s: %s\n', mfile, targ );
temp = [ cmd, flags, ' ', targets64{i}, '.c ', libs ];
fprintf(' %s\n', temp);
% fprintf( ' %s: %s\n', mfile, targ );
eval( temp, 'failed=true;' ); %#ok
end
cd( olddir );
Expand Down

0 comments on commit 3f7ae2b

Please sign in to comment.