Skip to content
This repository has been archived by the owner on Sep 29, 2020. It is now read-only.

Commit

Permalink
startup only for mex-wholeBodyModel
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielenava committed Aug 4, 2016
1 parent e4dfd35 commit ffcdb98
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,11 @@ enable_testing()

add_subdirectory(tests)

#STARTUP MEX-TOOLBOX
# The following line is to properly configure the installation script of the Mex-toolbox
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/startup_Mex.m.in ${CMAKE_BINARY_DIR}/startup_Mex.m)
# Install configuration files
install(FILES ${CMAKE_BINARY_DIR}/startup_Mex.m DESTINATION ${CMAKE_INSTALL_PREFIX}/mex)



45 changes: 45 additions & 0 deletions startup_Mex.m.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
%% startup_Mex.m
% Run this script only once to permanently add the required folders for using mexWholebodymodel toolbox to your
% MATLAB path.

fprintf('\nmexWholeBodyModel Toolbox\n');

installDir = '@CMAKE_BINARY_DIR@/install';
mexDir = [installDir, filesep, 'mex'];
mexWrapDir = [mexDir, filesep, 'mexwbi-wrappers'];
mexUtDir = [mexDir, filesep, 'mexwbi-utilities'];

if exist(mexDir, 'dir')
addpath(mexDir);
end

if exist(mexUtDir, 'dir')
addpath(mexDir);
end

if exist(mexWrapDir, 'dir')
addpath(mexDir);
end

fileDir = userpath;
pathSeparatorLocation = strfind(fileDir, pathsep);

if isempty(fileDir)
error('Empty userpath. Please set the userpath before running this script');
elseif size(pathSeparatorLocation, 2) > 1
error('Multiple userpaths. Please set a single userpath before running this script');
end

if (~isempty(pathSeparatorLocation))
fileDir(pathSeparatorLocation) = [];
end

fprintf('Saving paths to %s\n\n', [fileDir, filesep, 'pathdef.m']);

if (~savepath([fileDir, filesep, 'pathdef.m']))
fprintf(['A file called pathdef.m has been created in your %s folder.\n', ...
'This should be enough to permanentely add all the Mex-Toolbox to ', ...
'your MATLAB installation.\n'], fileDir);
else
disp('There was an error generating pathdef.m To proceed please manually add the contents of variables mexDir, mexUtDir, mexWrapDir to your matlabpath');
end

0 comments on commit ffcdb98

Please sign in to comment.