-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes to build MATLAB toolboxes on CI #3521
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,8 +130,6 @@ jobs: | |
with: | ||
working_directory: ${{ matrix.working_directory || '.' }} | ||
flags: ${{ matrix.test_flags }} | ||
# Don't test matlab on Windows (see setup-dependencies/action.yml) | ||
if: matrix.config != 'matlab' || runner.os != 'Windows' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MATLAB For Windows should work with the fixes to Windows builds. |
||
|
||
- name: Cross Test ${{ matrix.config }} on ${{ matrix.os }} | ||
uses: ./.github/actions/test | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,9 +115,15 @@ $(icetoolbox_file):: $(icethunk_target) $(slice2matlab_path) $(lang_srcdir)/lib/ | |
cp -rf $(cpp_bindir)/slice2matlab $(lang_srcdir)/toolbox/build/ | ||
# Doc files | ||
cp -rf $(lang_srcdir)/toolbox/doc $(lang_srcdir)/toolbox/build | ||
ifneq (,$(MATLAB_COMMAND)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MATLAB_COMMAND is set by CI to the executable that we need to run. We were already using this in the tests, but there were a few additional places where we still used matlab directly. |
||
cd $(lang_srcdir)/toolbox && $(MATLAB_COMMAND) "addFolderToPath '`realpath build`'" | ||
cd $(lang_srcdir)/toolbox && $(MATLAB_COMMAND) "buildToolbox '$(version)'" | ||
cd $(lang_srcdir)/toolbox && $(MATLAB_COMMAND) "removeFolderFromPath '`realpath build`'" | ||
else | ||
cd $(lang_srcdir)/toolbox && $(MATLAB_HOME)/bin/matlab -nodisplay -r "addFolderToPath '`realpath build`'" | ||
cd $(lang_srcdir)/toolbox && $(MATLAB_HOME)/bin/matlab -nodisplay -r "buildToolbox '$(version)'" | ||
cd $(lang_srcdir)/toolbox && $(MATLAB_HOME)/bin/matlab -nodisplay -r "removeFolderFromPath '`realpath build`'" | ||
endif | ||
|
||
clean:: | ||
rm -rf $(icetoolbox_file) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,36 +6,30 @@ | |
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration> | ||
<RootDir>$([System.IO.Path]::GetFullPath( $(MSBuildThisFileDirectory)..\msbuild ))</RootDir> | ||
<ToolboxDir>$(MSBuildThisFileDirectory)..\toolbox\build</ToolboxDir> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This MSBuild project was trying to guess the version and the matlab home using the matlab executable from path. It was far too complicated. I simplified to use a default and allow override with env variables. It was the usage of matlab here what was causing the CI issues. |
||
<MatlabVersion Condition="'$(MatlabVersion)' == ''">R2024a</MatlabVersion> | ||
<MatlabHome Condition="'$(MatlabHome)' == ''">C:\Program Files\MATLAB\$(MatlabVersion)</MatlabHome> | ||
<!-- Override with the env settings --> | ||
<MatlabVersion Condition="'$(MATLAB_VERSION)' != ''">$(MATLAB_VERSION)</MatlabVersion> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this go up on line 10? Presumably if you set MATLAB_VERSION but not MATLAB_HOME, you want MatlabHome to be set correctly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Fixed |
||
<MatlabHome Condition="'$(MATLAB_HOME)' != ''">$(MATLAB_HOME)</MatlabHome> | ||
</PropertyGroup> | ||
|
||
<Choose> | ||
<When Condition="'$(MATLAB_COMMAND)' != ''"> | ||
<PropertyGroup> | ||
<MatlabCommand>$(MATLAB_COMMAND)</MatlabCommand> | ||
</PropertyGroup> | ||
</When> | ||
<Otherwise> | ||
<PropertyGroup> | ||
<MatlabCommand>"$(MatlabHome)\bin\matlab.exe" -nodesktop -nosplash -wait -log -minimize</MatlabCommand> | ||
</PropertyGroup> | ||
</Otherwise> | ||
</Choose> | ||
|
||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<Import Project="$(MSBuildThisFileDirectory)..\..\config\icebuilder.props"/> | ||
<Import Project="$(MSBuildThisFileDirectory)..\..\config\ice.common.targets"/> | ||
|
||
<Target Name="MatlabHome" Condition="'$(MatlabHome)' == ''"> | ||
<Exec Command="where matlab" ConsoleToMSBuild="true" EchoOff="yes"> | ||
<Output TaskParameter="ConsoleOutput" PropertyName="MatlabExe" /> | ||
</Exec> | ||
<PropertyGroup> | ||
<MatlabExe>$(MatlabExe.Split(';')[0])</MatlabExe> | ||
</PropertyGroup> | ||
<Error Text="Cannot detect a valid MATLAB installation" Condition="!Exists('$(MatlabExe)')"/> | ||
<CreateProperty Value="$([System.IO.Path]::GetFullPath( '$(MatlabExe)\..\..' ))"> | ||
<Output TaskParameter="Value" PropertyName="MatlabHome" /> | ||
</CreateProperty> | ||
</Target> | ||
|
||
<Target Name="MatlabVersion" Condition="'$(MatlabVersion)' == ''" DependsOnTargets="MatlabHome"> | ||
<Exec Command=""$(MatlabHome)\bin\matlab.exe" -nodesktop -nosplash -wait -log -minimize -r "fprintf(2, '%%s', version('-release'));exit(0);"" | ||
EchoOff="yes" | ||
ConsoleToMSBuild="true"> | ||
<Output TaskParameter="ConsoleOutput" PropertyName="MatlabOut"/> | ||
</Exec> | ||
<CreateProperty Value="$(MatlabOut.Substring($(MatlabOut.LastIndexOf(';'))).Replace(';',''))"> | ||
<Output TaskParameter="Value" PropertyName="MatlabVersion" /> | ||
</CreateProperty> | ||
</Target> | ||
|
||
<Target Name="NuGetRestore" DependsOnTargets="GetNuGet"> | ||
<Exec Command="$(NuGetExe) restore $(MSBuildThisFileDirectory)..\..\cpp\msbuild\ice.sln" /> | ||
</Target> | ||
|
@@ -47,7 +41,7 @@ | |
Properties="Platform=$(Platform);Configuration=$(Configuration)" /> | ||
</Target> | ||
|
||
<Target Name="BuildDist" DependsOnTargets="BuildCppDist;NuGetRestore;MatlabHome"> | ||
<Target Name="BuildDist" DependsOnTargets="BuildCppDist;NuGetRestore"> | ||
<MSBuild Projects="$(MSBuildThisFileDirectory)ice.sln" | ||
BuildInParallel="true" | ||
Properties="Platform=$(Platform);Configuration=$(Configuration);MatlabHome=$(MatlabHome)" /> | ||
|
@@ -105,7 +99,7 @@ | |
</Task> | ||
</UsingTask> | ||
|
||
<Target Name="Package" DependsOnTargets="BuildDist;MatlabHome;MatlabVersion"> | ||
<Target Name="Package" DependsOnTargets="BuildDist"> | ||
<RemoveDir Directories="$(ToolboxDir)" /> | ||
<MakeDir Directories="$(ToolboxDir);$(ToolboxDir)\doc" /> | ||
|
||
|
@@ -124,14 +118,14 @@ | |
<WriteFileWithReplacements InputFile="$(MSBuildThisFileDirectory)..\toolbox\info.template.xml" | ||
OutputFile="$(MSBuildThisFileDirectory)..\toolbox\info.xml" | ||
Tokens="@MatlabVersion@" | ||
Replacements="R$(MatlabVersion)"/> | ||
Replacements="$(MatlabVersion)"/> | ||
<MSBuild Projects="ice.toolbox.targets" | ||
Properties="Configuration=$(Configuration);Platform=x64" /> | ||
<Exec Command=""$(MatlabHome)\bin\matlab.exe" -nodesktop -nosplash -wait -log -minimize -r "cd('$(MSBuildThisFileDirectory)..\toolbox');addFolderToPath '$(ToolboxDir)'"" | ||
<Exec Command="$(MatlabCommand) "cd('$(MSBuildThisFileDirectory)..\toolbox');addFolderToPath '$(ToolboxDir)'"" | ||
WorkingDirectory="$(MSBuildThisFileDirectory)"/> | ||
<Exec Command=""$(MatlabHome)\bin\matlab.exe" -nodesktop -nosplash -wait -log -minimize -r "cd('$(MSBuildThisFileDirectory)..\toolbox');buildToolbox '3.8a0'"" | ||
<Exec Command="$(MatlabCommand) "cd('$(MSBuildThisFileDirectory)..\toolbox');buildToolbox '3.8a0'"" | ||
WorkingDirectory="$(MSBuildThisFileDirectory)"/> | ||
<Exec Command=""$(MatlabHome)\bin\matlab.exe" -nodesktop -nosplash -wait -log -minimize -r "cd('$(MSBuildThisFileDirectory)..\toolbox');removeFolderFromPath '$(ToolboxDir)'"" | ||
<Exec Command="$(MatlabCommand) "cd('$(MSBuildThisFileDirectory)..\toolbox');removeFolderFromPath '$(ToolboxDir)'"" | ||
WorkingDirectory="$(MSBuildThisFileDirectory)"/> | ||
<Delete Files="toolbox.prj"/> | ||
</Target> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were missing the C++ dependencies here