Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Data2Dynamics/d2d
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasneubrand committed Apr 30, 2024
2 parents a122c8a + db161d1 commit d72b88d
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions arFramework3/Subfunctions/arCompile.m
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ function arCompile(varargin)
else
for j=1:length(objects_dat)
if(~exist(objects_dat{j}, 'file') || forceFullCompile)
if(isempty(compiled_cluster_path))
if(isempty(compiled_cluster_path)) % the error happens in the next line!!!
mex('-c',verbose{:},mexopt{:},'-outdir',['./Compiled/' c_version_code '/' mexext '/'], ...
includesstr{:}, [source_dir '/Compiled/' c_version_code '/' file_dat{j}]);
else
Expand All @@ -539,8 +539,8 @@ function arCompile(varargin)
end
end

includesstr=strrep(includesstr,'"', '');
objectsstr = unique( objectsstr, 'stable' );
includesstr = strrep(includesstr, '"', '');
objectsstr = unique(objectsstr, 'stable');

%% compile and link main mex file
if(~exist([ar.fkt '.' mexext],'file') || forceFullCompile || forceCompileLast)
Expand Down Expand Up @@ -582,6 +582,7 @@ function arCompile(varargin)
if ( chunks > 1 )
cCfg = mex.getCompilerConfigurations('C');
libloc = [cCfg.Location, '/VC/bin']; % Add directory containing lib.exe to the path (this could be further generalized)
% for me libloc does not exist. maybe this is the problem?! -> maybe the changes below were not neccessary

curEnv = getenv('path');
if ( isempty( strfind( curEnv, libloc ) ) )
Expand All @@ -597,10 +598,18 @@ function arCompile(varargin)
libNames = cell(1, chunks);

for a = 1 : chunks
fprintf( 'Assembling chunk %d/%d into library\n', a, chunks );
libNames{a} = fullfile('Compiled', c_version_code, [ 'lib' num2str(a) '_' ar.fkt(end-31:end) '.lib' ] );
curChunk = cellfun(@(st)[st, ' '], objectsstr( (a-1)*chunkSize+1 : min(a*chunkSize, numel(objectsstr)) ), 'UniformOutput', false);
system(['vcvars32 & lib /out:' libNames{a} ' ' [ curChunk{:} ] ] );
fprintf( 'Assembling chunk %d/%d into library\n', a, chunks );
libNames{a} = fullfile('Compiled', c_version_code, [ 'lib' num2str(a) '_' ar.fkt(end-31:end) '.lib' ] );
curChunk = cellfun(@(st)[st, ' '], objectsstr( (a-1)*chunkSize+1 : min(a*chunkSize, numel(objectsstr)) ), 'UniformOutput', false);
[~, cmdout] = system(['vcvars32 & lib /out:' libNames{a} ' ' [ curChunk{:} ] ] ); % why always vcvars32? Shouldn't we check if 32 or 64 bit?
% Check if the system command produced the typical console output
% otherwise there might be an error
if(~contains(cmdout, 'Microsoft Corporation'))
warning('arCompile:VisualStudioTools', ...
['Please check if Visual Studio (or Visual C++ Tools) are installed.\n' ...
'Add C:\Program Files\Microsoft Visual Studio\[year]\[edition]\VC\Auxiliary\Build to PATH variables.\n' ...
'See: https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#download-and-install-the-tools .']);
end
end
fprintf( 'Linking chunks\n' );
mex(mexopt{:},verbose{:},'-output', ar.fkt, includesstr{:}, '-DHAS_PTHREAD=1', ...
Expand Down

0 comments on commit d72b88d

Please sign in to comment.