Add macro definitions to optionally compile random and meta in.

This commit is contained in:
King_DuckZ 2020-05-01 19:57:03 +02:00
parent 51c69e6343
commit 58da9e761d
2 changed files with 15 additions and 0 deletions

View file

@ -5,6 +5,17 @@ project('wren', 'c',
) )
c_compiler = meson.get_compiler('c') c_compiler = meson.get_compiler('c')
c_opts = []
if get_option('wren_with_rand')
c_opts += '-DWREN_OPT_RANDOM=1'
else
c_opts += '-DWREN_OPT_RANDOM=0'
endif
if get_option('wren_with_meta')
c_opts += '-DWREN_OPT_META=1'
else
c_opts += '-DWREN_OPT_META=0'
endif
wren_incl = include_directories('wren/src/include', is_system: true) wren_incl = include_directories('wren/src/include', is_system: true)
wren_pvt_incl = include_directories('wren/src/vm', 'wren/src/optional') wren_pvt_incl = include_directories('wren/src/vm', 'wren/src/optional')
@ -46,6 +57,7 @@ if force_static
include_directories: [wren_incl, wren_pvt_incl], include_directories: [wren_incl, wren_pvt_incl],
dependencies: [threads_dep, m_dep], dependencies: [threads_dep, m_dep],
install: not force_static, install: not force_static,
c_args: c_opts,
) )
else else
wren = library(meson.project_name(), wren = library(meson.project_name(),
@ -54,6 +66,7 @@ else
include_directories: [wren_incl, wren_pvt_incl], include_directories: [wren_incl, wren_pvt_incl],
dependencies: [threads_dep, m_dep], dependencies: [threads_dep, m_dep],
install: not force_static, install: not force_static,
c_args: c_opts,
) )
endif endif
wren_dep = declare_dependency( wren_dep = declare_dependency(

View file

@ -1,2 +1,4 @@
option('build_testing', type: 'boolean', value: false) option('build_testing', type: 'boolean', value: false)
option('wren_with_cli', type: 'boolean', value: true) option('wren_with_cli', type: 'boolean', value: true)
option('wren_with_rand', type: 'boolean', value: false)
option('wren_with_meta', type: 'boolean', value: false)