diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 452f107..999bbdb 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -9,7 +9,7 @@ on: branches: - master jobs: - build: + build-mex: runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -33,12 +33,54 @@ 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 liboctave-dev + elif [ "${{ matrix.os }}" = windows-latest ]; then + choco install octave.portable + else + brew install octave + fi + - name: Build Octave mex files + if: matrix.os != 'windows-latest' + run: | + octave --eval 'computer' + octave --eval 'install_sdpt3 -rebuild' + - name: Build Octave mex files + if: matrix.os == 'windows-latest' + shell: cmd + run: | + set PATH=C:\ProgramData\Chocolatey\bin:%PATH% + echo "%PATH%" + octave.exe --eval 'computer' + if %errorlevel% neq 0 exit /b %errorlevel% + octave.exe --eval 'install_sdpt3 -rebuild' + if %errorlevel% neq 0 exit /b %errorlevel% + - uses: actions/upload-artifact@v4 + with: + name: mexfiles-oct-${{ matrix.os }} + path: | + Solver/Mexfun/*.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 diff --git a/Solver/Mexfun/o_win/mexMatvec.mex b/Solver/Mexfun/o_win/mexMatvec.mex deleted file mode 100644 index e220568..0000000 Binary files a/Solver/Mexfun/o_win/mexMatvec.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mexProd2.mex b/Solver/Mexfun/o_win/mexProd2.mex deleted file mode 100644 index 5e19a3a..0000000 Binary files a/Solver/Mexfun/o_win/mexProd2.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mexProd2nz.mex b/Solver/Mexfun/o_win/mexProd2nz.mex deleted file mode 100644 index 4b311de..0000000 Binary files a/Solver/Mexfun/o_win/mexProd2nz.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mexexpand.mex b/Solver/Mexfun/o_win/mexexpand.mex deleted file mode 100644 index 443ccda..0000000 Binary files a/Solver/Mexfun/o_win/mexexpand.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mexinprod.mex b/Solver/Mexfun/o_win/mexinprod.mex deleted file mode 100644 index c2c2c3a..0000000 Binary files a/Solver/Mexfun/o_win/mexinprod.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mexmat.mex b/Solver/Mexfun/o_win/mexmat.mex deleted file mode 100644 index 02d15b5..0000000 Binary files a/Solver/Mexfun/o_win/mexmat.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mexnnz.mex b/Solver/Mexfun/o_win/mexnnz.mex deleted file mode 100644 index 8762e39..0000000 Binary files a/Solver/Mexfun/o_win/mexnnz.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mexqops.mex b/Solver/Mexfun/o_win/mexqops.mex deleted file mode 100644 index bf039ec..0000000 Binary files a/Solver/Mexfun/o_win/mexqops.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mexschur.mex b/Solver/Mexfun/o_win/mexschur.mex deleted file mode 100644 index 40550cf..0000000 Binary files a/Solver/Mexfun/o_win/mexschur.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mexschurfun.mex b/Solver/Mexfun/o_win/mexschurfun.mex deleted file mode 100644 index b9ed5ed..0000000 Binary files a/Solver/Mexfun/o_win/mexschurfun.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mexskron.mex b/Solver/Mexfun/o_win/mexskron.mex deleted file mode 100644 index 5639b79..0000000 Binary files a/Solver/Mexfun/o_win/mexskron.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mexsmat.mex b/Solver/Mexfun/o_win/mexsmat.mex deleted file mode 100644 index 0864077..0000000 Binary files a/Solver/Mexfun/o_win/mexsmat.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mexsvec.mex b/Solver/Mexfun/o_win/mexsvec.mex deleted file mode 100644 index db4a3bd..0000000 Binary files a/Solver/Mexfun/o_win/mexsvec.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mextriang.mex b/Solver/Mexfun/o_win/mextriang.mex deleted file mode 100644 index d7abaab..0000000 Binary files a/Solver/Mexfun/o_win/mextriang.mex and /dev/null differ diff --git a/Solver/Mexfun/o_win/mextriangsp.mex b/Solver/Mexfun/o_win/mextriangsp.mex deleted file mode 100644 index c52d3cd..0000000 Binary files a/Solver/Mexfun/o_win/mextriangsp.mex and /dev/null differ diff --git a/install_sdpt3.m b/install_sdpt3.m index 796ad2e..3f2768b 100644 --- a/install_sdpt3.m +++ b/install_sdpt3.m @@ -36,6 +36,7 @@ function install_sdpt3( varargin ) page_output_immediately( true, 'local' ); end + line = '---------------------------------------------------------------------------'; fprintf( '\n%s\nSDPT3 installation script\n Directory: %s\n %s %s on %s\n%s\n', ... line, mpath, prog, version, COMPUTER, line ); @@ -45,6 +46,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 @@ -88,19 +95,23 @@ function install_sdpt3( varargin ) % Note the use of 0.01 here. That's because version 7 had more than 10 % minor releases, so 7.10-7.14 need to be ordered after 7.01-7.09. libs = {}; - flags = {'-O'}; + flags = {}; if ISOCTAVE, % 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'; if VERSION < 3.08, flags{end+1} = '-DmwSignedIndex=int'; end else + cmd = 'mex'; + flags = {'-O'}; if ispc, - flags = {'-DPC'}; + flags{end+1} = '-DPC'; elseif isunix, - flags = {'-DUNIX'}; + flags{end+1} = '-DUNIX'; end if strcmp(COMPUTER(end-1:end),'64') && ( VERSION >= 7.03 ), flags{end+1} = '-largeArrayDims'; @@ -132,18 +143,19 @@ function install_sdpt3( varargin ) libs{end+1} = '-lmwlapack'; end end - libs = sprintf( ' %s', libs{:} ); - flags = sprintf( ' %s', flags{:} ); olddir = pwd; cd( mbase ); failed = false; - fprintf( 'Template: mex%s %s\n', flags, libs ); + fprintf( 'Template: %s%s %s\n', cmd, sprintf( ' %s', flags{:} ), sprintf( ' %s', libs{:} ) ); 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 ); - eval( temp, 'failed=true;' ); %#ok + targ = [ targets64{i}, '.', mext ]; + sfile = [ targets64{i}, '.c' ]; + fprintf( ' %s\n', targ ); + if ISOCTAVE, + mkoctfile(flags{:}, sfile, libs{:}); + else + mex(flags{:}, sfile, libs{:}); + end end cd( olddir ); if failed,