aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
blob: b5be67a7cc8dda3614f53f5e4716f9446e8939db (plain) (blame)
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
project('ptxmc', 'c', default_options : ['c_std=c11'])
add_project_arguments('-D_GNU_SOURCE=1', language : [ 'c' ])

c_comp = meson.get_compiler('c')

conf_data = configuration_data()

if not c_comp.has_function_attribute('visibility:default') \
    or not c_comp.has_function_attribute('visibility:hidden')
  error('Your platform isn\'t supported. Use a gcc-like compiler on linux.')
else
  conf_data.set('PTX_EXPORT', '__attribute__((visibility("default")))')
  conf_data.set('PTX_IMPORT', 'extern')
endif

conf_data.set('HAS_ATTR_WUR', c_comp.has_function_attribute('warn_unused_result'))
conf_data.set('HAS_ATTR_ALWAYS_INLINE', c_comp.has_function_attribute('always_inline'))
conf_data.set('HAS_ATTR_MALLOC', c_comp.has_function_attribute('malloc'))
conf_data.set('HAS_ATTR_FORMAT', c_comp.has_function_attribute('format'))

conf_data.set('HAS_RESTRICT', c_comp.has_type('int *restrict'))

configure_file(input : 'include/config.h.in', output : 'config.h', configuration : conf_data)

add_project_dependencies(
  declare_dependency(include_directories : include_directories('.', 'include')),
  language : 'c'
)

export_dynamic = []

if c_comp.get_argument_syntax() == 'gcc'
  if c_comp.has_argument('-fvisibility=hidden')
    add_project_arguments('-fvisibility=hidden', language : 'c')
  endif
endif

subdir('src')

executable('ptxmc', prog_sources,
  gnu_symbol_visibility : 'hidden',
  export_dynamic : true)

plugin_kwargs = {
  'gnu_symbol_visibility' : 'hidden',
  'c_args' : ['-DPTX_PLUGIN=1'],
  'name_prefix' : 'm_',
  'name_suffix' : 'ptxplugin'
}

subdir('plugins')