Skip to content

Commit

Permalink
Merge pull request #3959 from opensim-org/configure_matlab_from_api_d…
Browse files Browse the repository at this point in the history
…istro

Modify configure script to handle API distribution.
  • Loading branch information
nickbianco authored Dec 12, 2024
2 parents 4ef23e6 + ad3a765 commit 00387c7
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions Bindings/Java/Matlab/configureOpenSim.m.in
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ function [openSimFolder] = uiGetOpenSimFolder()
appDir = fullfile(openSimFolder, [name ext '.app']);
if exist(appDir, 'dir')
openSimFolder = fullfile(appDir, 'Contents', 'Resources', 'OpenSim');
else
% This could be an API install
api_distro = true
showMessage('Application not found, assuming API distribution.', 'Info', false);
end
end
end
Expand All @@ -120,8 +124,13 @@ try
while ~correctFolder
openSimFolder = uiGetOpenSimFolder();
% Check if the user selected a valid folder.
if api_distro
subfoldername = 'etc';
else
subfoldername = '@CMAKE_INSTALL_SYSCONFDIR@';
end
buildInfoFile = fullfile(openSimFolder, ...
'@CMAKE_INSTALL_SYSCONFDIR@', 'OpenSim_buildinfo.txt');
subfoldername, 'OpenSim_buildinfo.txt');
if exist(buildInfoFile)
correctFolder = true;
else
Expand All @@ -137,8 +146,13 @@ try
%% Edit the Java class path (need full path for print)
toolboxLocal = fullfile(matlabroot, 'toolbox', 'local');
% Create the string names used
if api_distro
jarPath = 'share/java'
else
jarPath = '@OPENSIM_INSTALL_JAVAJARDIR@'
end
OpenSimJarPath = fullfile(openSimFolder, ...
'@OPENSIM_INSTALL_JAVAJARDIR@', '@SWIG_JAVA_JAR_NAME@');
jarPath, '@SWIG_JAVA_JAR_NAME@');
classFileTool = fullfile(toolboxLocal, 'classpath.txt');
% Keep track of if (1) we detected existing OpenSim
% and (2) if we had issues removing existing OpenSim entries.
Expand All @@ -162,8 +176,13 @@ try
end

%% Edit the Java library path.
if api_distro
libPath = 'lib'
else
libPath = '@OPENSIM_INSTALL_SHAREDLIBDIR@'
end
% Create the string names used
OpenSimLibPath = fullfile(openSimFolder, '@OPENSIM_INSTALL_SHAREDLIBDIR@');
OpenSimLibPath = fullfile(openSimFolder, libPath);
libraryFileTool = fullfile(toolboxLocal, 'librarypath.txt');
if matlabOlderThan2012b
rmPrev = rmPrev | editPathTxtFile(libraryFileTool, OpenSimLibPath);
Expand Down

0 comments on commit 00387c7

Please sign in to comment.