-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.m
executable file
·37 lines (24 loc) · 1.09 KB
/
build.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
% Path to EarthGRAM2016
root = pwd;
EarthGRAM2016_model_path = [root, filesep, 'EarthGRAM2016', filesep];
% Check path to EarthGRAM2016 model
if (~(exist(EarthGRAM2016_model_path, 'dir') == 7))
error('The path to the Earth GRAM model is invalid.');
end
% Check if NameRef.txt exists
if (~(exist([EarthGRAM2016_model_path, 'NameRef.txt'], 'file') == 2))
error('The file NameRef.txt in EarthGRAM2016 could not be found.');
end
% Define the include directory
include_dir = ['-I', EarthGRAM2016_model_path, 'Source'];
% Unix
if (computer('arch') == "glnxa64" || computer('arch') == "maci64")
lib_path = ['-L', EarthGRAM2016_model_path, 'Source/build'];
EarthGRAM2016_macro = ['-DEARTHGRAM2016_PATH=\"', EarthGRAM2016_model_path, '\"'];
% Windows
elseif (computer('arch') == "win64")
lib_path = ['-L', EarthGRAM2016_model_path, 'Source\build\Release'];
EarthGRAM2016_macro = ['-DEARTHGRAM2016_PATH=\\"', strrep(EarthGRAM2016_model_path,'\','\\'), '\\"'];
end
mex('-output', 'get_atm_density', EarthGRAM2016_macro, include_dir, lib_path, '-lEarthGRAM2016', 'mex_wrapper.cpp')
clear