Repository navigation
Expand file tree
/
Copy pathmeson.build
More file actions
132 lines (115 loc) · 3.12 KB
/
Copy pathmeson.build
File metadata and controls
132 lines (115 loc) · 3.12 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
project(
'moist',
'fortran',
version: '1.2.1-alpha',
license: 'MPL-2.0',
meson_version: '>=0.57',
default_options: [
'buildtype=debugoptimized',
'default_library=both',
'c_std=c11',
],
)
lib_version = meson.project_version().split('-')[0]
install = not (meson.is_subproject() and get_option('default_library') == 'static')
# C (C API tests, Python shim) and C++ (ducc0 FFT, FINUFFT)
add_languages('c', 'cpp', required: true, native: false)
# General configuration information
inc_dirs = []
lib_deps = []
subdir('config')
# Collect source of the project
srcs = []
subdir('src')
# MSVC-style objects name their C++ runtime themselves
if cxx.get_argument_syntax() != 'msvc'
is_libcxx = cxx.get_define('_LIBCPP_VERSION', prefix: '#include <cstddef>') != ''
lib_deps += cxx.find_library(is_libcxx ? 'c++' : 'stdc++')
endif
# Windows DLLs export every symbol, which clashes with the executables' own static subprojects
moist_link_args = []
if host_machine.system() == 'windows'
moist_link_args = cxx.get_supported_link_arguments('-Wl,--exclude-libs,ALL')
endif
# src/moist/data at -O0
data_lib = static_library(
'moist-data',
sources: data_srcs,
dependencies: lib_deps,
fortran_args: fc.get_argument_syntax() == 'msvc' ? '/Od' : '-O0',
pic: true,
install: false,
)
# Library target
moist_lib = library(
meson.project_name(),
sources: srcs,
version: lib_version,
dependencies: lib_deps,
include_directories: inc_dirs,
objects: data_lib.extract_all_objects(recursive: false),
link_args: moist_link_args,
install: install,
)
# Export dependency for other projects and test suite
moist_inc = [
moist_lib.private_dir_include(),
data_lib.private_dir_include(),
include_directories('include'),
]
moist_dep = declare_dependency(
link_with: moist_lib,
include_directories: moist_inc,
dependencies: lib_deps,
variables: {'includedir': meson.current_source_dir() / 'include'},
)
# Add applications
subdir('app')
# Package the license files
moist_lic = files(
'LICENSE',
'THIRD_PARTY_NOTICES.md',
)
moist_header = files(
'include/moist.h',
)
if install
# Distribute the license files in share/licenses/<name>
install_data(
moist_lic,
install_dir: get_option('datadir')/'licenses'/meson.project_name()
)
if get_option('api')
install_headers(
moist_header,
)
endif
module_id = meson.project_name() / fc_id + '-' + fc.version()
meson.add_install_script(
find_program(files('config'/'install-mod.py')),
get_option('includedir') / module_id,
)
pkg = import('pkgconfig')
pkg.generate(
moist_lib,
name: 'moist',
description: 'Modular and Open-source Implicit Solvation Toolkit',
version: meson.project_version(),
subdirs: ['', module_id],
)
asciidoc = find_program('asciidoctor', required: false)
if asciidoc.found() and get_option('docs')
install_man(
configure_file(
command: [asciidoc, '-b', 'manpage', '@INPUT@', '-o', '@OUTPUT@'],
input: files('man/moist.adoc'),
output: '@BASENAME@',
)
)
endif
endif
# add the testsuite
subdir('test')
if get_option('python')
subdir('python'/'moist')
endif