diff --git a/meson.build b/meson.build index db4c8f0..37f3c1e 100644 --- a/meson.build +++ b/meson.build @@ -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, ) diff --git a/subprojects/wren/meson.build b/subprojects/wren/meson.build index 943409b..d3825bf 100644 --- a/subprojects/wren/meson.build +++ b/subprojects/wren/meson.build @@ -38,13 +38,24 @@ module_src = [ 'wren/src/module/scheduler.c', ] -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'), -) +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: 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', diff --git a/subprojects/wren/meson_options.txt b/subprojects/wren/meson_options.txt index 143e01a..9e7a81f 100644 --- a/subprojects/wren/meson_options.txt +++ b/subprojects/wren/meson_options.txt @@ -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)