Force compiling wren as a static lib

This commit is contained in:
King_DuckZ 2020-05-01 00:33:51 +02:00
parent 640cc0e493
commit 32f4a01586
3 changed files with 20 additions and 11 deletions

View file

@ -10,7 +10,6 @@ wren_dep = dependency('wren', version: '>=0.2.0',
'default_library=static',
'build_testing=false',
'wren_with_cli=false',
'wren_installable=false',
],
static: true,
)

View file

@ -38,13 +38,24 @@ module_src = [
'wren/src/module/scheduler.c',
]
force_static = meson.is_subproject()
if force_static
wren = static_library(meson.project_name(),
opt_src,
vm_src,
include_directories: [wren_incl, wren_pvt_incl],
dependencies: [threads_dep, m_dep],
install: not force_static,
)
else
wren = library(meson.project_name(),
opt_src,
vm_src,
include_directories: [wren_incl, wren_pvt_incl],
dependencies: [threads_dep, m_dep],
install: get_option('wren_installable'),
install: not force_static,
)
endif
wren_dep = declare_dependency(
include_directories: [wren_incl],
link_with: wren,
@ -57,7 +68,7 @@ if get_option('wren_with_cli')
'wren/src/cli/modules.c',
'wren/src/cli/vm.c',
module_src,
install: get_option('wren_installable'),
install: not force_static,
include_directories: [cli_incl, module_incl],
dependencies: [wren_dep, libuv_dep],
c_args: ['-D_XOPEN_SOURCE=600'],
@ -117,7 +128,7 @@ if get_option('build_testing')
test(meson.project_name() + ' unit test', test_unit)
endif
if get_option('wren_installable')
if not force_static
install_headers(
'wren/src/include/wren.h',
'wren/src/include/wren.hpp',

View file

@ -1,3 +1,2 @@
option('build_testing', type: 'boolean', value: false)
option('wren_with_cli', type: 'boolean', value: true)
option('wren_installable', type: 'boolean', value: true)