Compiles the sparse mcsquare reader as mex interface for the current platform call matRad_compileMCsquareSparseReader() matRad_compileMCsquareSparseReader(dest) matRad_compileMCsquareSparseReader(dest,sourceFolder) input: dest: (optional) destination for mex file. Default: location of this file sourceFolder: (optional) path to folder. Default: location of this file References https://aapm.onlinelibrary.wiley.com/doi/abs/10.1118/1.4943377 http://www.openmcsquare.org/ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright 2020 the matRad development team. This file is part of the matRad project. It is subject to the license terms in the LICENSE file found in the top-level directory of this distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part of the matRad project, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the LICENSE file. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function matRad_compileMCsquareSparseReader(dest,sourceFolder) 0002 % Compiles the sparse mcsquare reader as mex interface 0003 % for the current platform 0004 % 0005 % call 0006 % matRad_compileMCsquareSparseReader() 0007 % matRad_compileMCsquareSparseReader(dest) 0008 % matRad_compileMCsquareSparseReader(dest,sourceFolder) 0009 % 0010 % input: 0011 % dest: (optional) destination for mex file. Default: location of this 0012 % file 0013 % sourceFolder: (optional) path to folder. Default: location of this 0014 % file 0015 % 0016 % References 0017 % 0018 % https://aapm.onlinelibrary.wiley.com/doi/abs/10.1118/1.4943377 0019 % http://www.openmcsquare.org/ 0020 % 0021 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0022 % 0023 % Copyright 2020 the matRad development team. 0024 % 0025 % This file is part of the matRad project. It is subject to the license 0026 % terms in the LICENSE file found in the top-level directory of this 0027 % distribution and at https://github.com/e0404/matRad/LICENSES.txt. No part 0028 % of the matRad project, including this file, may be copied, modified, 0029 % propagated, or distributed except according to the terms contained in the 0030 % LICENSE file. 0031 % 0032 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0033 0034 0035 matRad_cfg = MatRad_Config.instance(); 0036 0037 if nargin < 1 0038 dest = fileparts(mfilename('fullpath')); 0039 end 0040 0041 if nargin < 2 0042 sourceFolder = fileparts(mfilename('fullpath')); 0043 end 0044 0045 if exist ('OCTAVE_VERSION', 'builtin') 0046 ccName = eval('mkoctfile -p CXX'); 0047 else 0048 myCCompiler = mex.getCompilerConfigurations('C','Selected'); 0049 ccName = myCCompiler.ShortName; 0050 end 0051 0052 %These settings have only been tested for MSVC and g++. You may need to adapt for other compilers 0053 if ~isempty(strfind(ccName,'MSVC')) %Not use contains(...) because of octave 0054 flags{1,1} = 'COMPFLAGS'; 0055 flags{1,2} = '/O2'; 0056 else 0057 flags{1,1} = 'CXXFLAGS'; 0058 flags{1,2} = '-std=c++11 -O2 -fPIC'; 0059 end 0060 0061 flagstring = ''; 0062 0063 %For Octave, the flags will be set in the environment, while they 0064 %will be parsed as string arguments in MATLAB 0065 for flag = 1:size(flags,1) 0066 if exist ('OCTAVE_VERSION', 'builtin') 0067 setenv(flags{flag,1},flags{flag,2}); 0068 else 0069 flagstring = [flagstring flags{flag,1} '="' flags{flag,2} '" ']; 0070 end 0071 end 0072 0073 mexCall = ['mex -largeArrayDims ' flagstring ' ' sourceFolder filesep 'matRad_sparseBeamletsReaderMCsquare.cpp']; 0074 0075 matRad_cfg.dispDebug('Compiler call: %s\n',mexCall); 0076 0077 currDir = pwd; 0078 cd(dest); 0079 eval(mexCall); 0080 cd(currDir); 0081 0082 end