Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions wrap_Matlab/mexAll.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,31 @@
% Add path to the c file names
includeFiles = cellfun(@(x) fullfile(basePath, x), CFileNames, 'UniformOutput', false);

% Compile the shared files (M_wrapper.c plus everything in basePath) to
% object files once, rather than recompiling all of them from source for
% every one of the ~24 features below:
sourcesToCache = [{'M_wrapper.c'}, includeFiles];
objDir = tempname;
mkdir(objDir);
cleanupObj = onCleanup(@() rmdir(objDir,'s'));
fprintf('Compiling %u shared C files (once)...\n',numel(sourcesToCache));
for i = 1:numel(sourcesToCache)
mex(ipath{:}, '-c', '-outdir', objDir, sourcesToCache{i});
end
objFiles = dir(objDir);
objFiles = fullfile(objDir, {objFiles(~[objFiles.isdir]).name});

% Get function names
featureNames = GetAllFeatureNames(true);

% mex all feature functions separately
% mex all feature functions separately, linking each against the cached
% shared objects instead of recompiling them
numFeatures = length(featureNames);
for i = 1:numFeatures
featureName = featureNames{i};

fprintf('[%u/%u]: Compiling %s...\n', i,numFeatures,featureName);
mex(ipath{:}, ['catch22_', featureName,'.c'], 'M_wrapper.c', includeFiles{:})
mex(ipath{:}, ['catch22_', featureName,'.c'], objFiles{:})
fprintf('\n');
end

Expand Down
Loading