-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeson.build
78 lines (78 loc) · 3.23 KB
/
meson.build
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
project('dynamic HD scripts',['c','cpp','fortran','cython'],
version: '3.13',
default_options:['cpp_std=gnu++11','warning_level=0',
'optimization=0','default_library=static',
'cython_language=cpp'])
add_project_arguments('-DPROCESSED_CELL_COUNTER','-DDARWIN',language:'cpp')
add_project_arguments('-cpp','-c','-fmessage-length=0','-fPIC',language:'fortran')
bin_dir = meson.project_source_root() / 'bin'
lib_dir = meson.project_source_root() / 'lib'
cpp_src = []
cpp_test_src = []
fortran_src = []
fortran_test_src = ['/Users/thomasriddick/Documents/code/fruit_3.4.1/src_copy/fruit.f90']
cpp_src_path = 'Dynamic_HD_Cpp_Code/src'
fortran_src_path = 'Dynamic_HD_Fortran_Code/src'
cython_src_path = 'Dynamic_HD_Scripts/Dynamic_HD_Scripts/interface/cpp_interface'
cpp_subdirs = ['algorithms','base','drivers']
if get_option('build_unit_tests')
cpp_subdirs += ['gtest','testing']
endif
foreach cpp_subdir : cpp_subdirs
subdir(cpp_src_path / cpp_subdir)
endforeach
fortran_subdirs = ['algorithms','base','drivers',
'testing','icosohedral_hd_and_lake_model',
'latlon_hd_and_lake_model']
foreach fortran_subdir : fortran_subdirs
subdir(fortran_src_path / fortran_subdir)
endforeach
cpp_inc = include_directories(['Dynamic_HD_Cpp_Code/include',
'Dynamic_HD_Cpp_Code/src',
'Dynamic_HD_Cpp_Code'])
fortran_inc = include_directories(['Dynamic_HD_Fortran_Code/include'])
cpp = meson.get_compiler('cpp')
netcdf_fortran_lib = dependency('netcdf', language: 'fortran')
lib_cpp = library('dyhd_cpp',cpp_src,
include_directories: cpp_inc)
if get_option('build_unit_tests')
e = executable('cpp_unit_tests',
cpp_test_src,
include_directories: cpp_inc,
link_with: lib_cpp,
install: true,
install_dir: bin_dir)
test('Cpp unit tests',e)
endif
if get_option('build_cython')
py = import('python').find_installation(
meson.get_external_property('python_installation_path'))
py_dependency = py.dependency()
numpy_inc = run_command(py,['-c',
'import numpy as np; print(np.get_include())'],check : true).stdout().strip()
cython_libraries = []
subdir(cython_src_path)
foreach cython_library : cython_libraries
py.extension_module(cython_library,
cython_src_path /
cython_library + '.pyx',
include_directories: [numpy_inc,cpp_inc],
dependencies: py_dependency,
link_with: lib_cpp,
install: true,
install_dir: lib_dir)
endforeach
endif
lib_fortran = library('dyhd_fortran',fortran_src,
include_directories: fortran_inc,
dependencies: netcdf_fortran_lib)
if get_option('build_unit_tests')
fe = executable('fortran_unit_tests',
fortran_test_src,
include_directories: fortran_inc,
dependencies: netcdf_fortran_lib,
link_with: lib_fortran,
install: true,
install_dir: bin_dir)
test('Fortran unit tests',fe)
endif