Skip to content

Commit e0b6f60

Browse files
committed
feedback on Mex compiler and detect
1 parent d1fe32b commit e0b6f60

File tree

4 files changed

+32
-17
lines changed

4 files changed

+32
-17
lines changed

.github/workflows/ci-nojvm.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,20 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
os: [ubuntu-22.04,macos-latest,windows-latest]
18+
os: [ubuntu-22.04, macos-latest, windows-latest]
1919
release: [latest]
2020
startup-options: ["-nojvm"]
2121

2222
steps:
2323
- uses: actions/checkout@v4
2424

25+
# fixes `GLIBCXX_3.4.32' not found on run
26+
- name: g++-10 for Linux
27+
if: runner.os == 'Linux'
28+
run: |
29+
echo "CXX=g++-10" >> $GITHUB_ENV
30+
echo "CC=gcc-10" >> $GITHUB_ENV
31+
2532
- uses: ./.github/workflows/composite-install-matlab
2633

2734
- uses: ./.github/workflows/composite-buildtool

.github/workflows/ci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ jobs:
5151
steps:
5252
- uses: actions/checkout@v4
5353

54+
# fixes `GLIBCXX_3.4.32' not found on run
55+
- name: g++-10 for Linux
56+
if: runner.os == 'Linux'
57+
run: |
58+
echo "CXX=g++-10" >> $GITHUB_ENV
59+
echo "CC=gcc-10" >> $GITHUB_ENV
60+
5461
- uses: ./.github/workflows/composite-install-matlab
5562

5663
- uses: ./.github/workflows/composite-buildtool

.github/workflows/composite-buildtool/action.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ runs:
1313
startup-options: ${{ matrix.startup-options }}
1414
tasks: check
1515

16-
# fixes `GLIBCXX_3.4.32' not found on run
17-
- name: g++-10 CXX for linux
18-
if: runner.os == 'Linux'
19-
shell: bash
20-
run: |
21-
echo "CXX=g++-10" >> $GITHUB_ENV
22-
echo "CC=gcc-10" >> $GITHUB_ENV
23-
2416
- name: Test task
2517
if: ${{ matrix.release >= 'R2022b' || startsWith(matrix.release, 'latest') }}
2618
uses: matlab-actions/run-build@v2

buildfile.m

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,24 @@
55

66
if ~isMATLABReleaseOlderThan("R2024b")
77

8-
if ispc
9-
compiler_opt = "COMPFLAGS=/EHsc /std:c++17";
8+
cxx = mex.getCompilerConfigurations('c++');
9+
10+
disp("Mex using: " + cxx.Name + " " + cxx.Version)
11+
12+
compiler_opt = "CXXFLAGS=$CXXFLAGS -std=c++17";
13+
% FIXME: Windows oneAPI
14+
if startsWith(cxx.ShortName, "MSVCPP")
15+
compiler_opt = "COMPFLAGS=$COMPFLAGS /std:c++17";
1016
elseif ismac
11-
compiler_opt = "CXXFLAGS=-std=c++17";
12-
elseif isunix
13-
compiler_opt = "CXXFLAGS=-fPIC -std=c++17";
14-
else
15-
warning("Unsupported platform")
16-
return
17+
compiler_opt = "CXXFLAGS=$CXXFLAGS -std=c++17";
18+
elseif isunix && cxx.ShortName == "g++"
19+
compiler_opt = compiler_opt + " -fPIC";
20+
% FIXME: update when desired GCC != 10 for newer Matlab
21+
if isMATLABReleaseOlderThan("R2025b") && ~startsWith(cxx.Version, "10")
22+
% https://www.mathworks.com/help/matlab/matlab_external/choose-c-or-c-compilers.html
23+
warning("ensure the GCC version matches Matlab's expected version: GCC " + cxx_version + " detected")
24+
return
25+
end
1726
end
1827

1928
root = plan.RootFolder;

0 commit comments

Comments
 (0)