2020-04-24 23:49:46 +00:00
|
|
|
project('wren', 'c',
|
|
|
|
version: '0.2.0',
|
|
|
|
meson_version: '>=0.49.2',
|
2020-04-30 22:49:52 +00:00
|
|
|
default_options: ['buildtype=release', 'c_std=c99', 'build_testing=true'],
|
2020-04-24 23:49:46 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
c_compiler = meson.get_compiler('c')
|
|
|
|
|
|
|
|
wren_incl = include_directories('wren/src/include', is_system: true)
|
|
|
|
wren_pvt_incl = include_directories('wren/src/vm', 'wren/src/optional')
|
|
|
|
module_incl = include_directories('wren/src/module')
|
|
|
|
cli_incl = include_directories('wren/src/cli')
|
|
|
|
|
|
|
|
threads_dep = dependency('threads')
|
|
|
|
libuv_dep = c_compiler.find_library('libuv', required: true)
|
|
|
|
m_dep = c_compiler.find_library('m', required: true)
|
|
|
|
|
|
|
|
opt_src = [
|
|
|
|
'wren/src/optional/wren_opt_random.c',
|
|
|
|
'wren/src/optional/wren_opt_meta.c',
|
|
|
|
]
|
|
|
|
|
|
|
|
vm_src = [
|
|
|
|
'wren/src/vm/wren_debug.c',
|
|
|
|
'wren/src/vm/wren_core.c',
|
|
|
|
'wren/src/vm/wren_utils.c',
|
|
|
|
'wren/src/vm/wren_vm.c',
|
|
|
|
'wren/src/vm/wren_value.c',
|
|
|
|
'wren/src/vm/wren_primitive.c',
|
|
|
|
'wren/src/vm/wren_compiler.c',
|
|
|
|
]
|
|
|
|
|
|
|
|
module_src = [
|
|
|
|
'wren/src/module/io.c',
|
|
|
|
'wren/src/module/timer.c',
|
|
|
|
'wren/src/module/repl.c',
|
|
|
|
'wren/src/module/os.c',
|
|
|
|
'wren/src/module/scheduler.c',
|
|
|
|
]
|
|
|
|
|
2020-04-30 22:33:51 +00:00
|
|
|
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
|
2020-04-24 23:49:46 +00:00
|
|
|
wren_dep = declare_dependency(
|
|
|
|
include_directories: [wren_incl],
|
|
|
|
link_with: wren,
|
|
|
|
)
|
|
|
|
|
|
|
|
if get_option('wren_with_cli')
|
|
|
|
cli = executable(meson.project_name(),
|
|
|
|
'wren/src/cli/main.c',
|
|
|
|
'wren/src/cli/path.c',
|
|
|
|
'wren/src/cli/modules.c',
|
|
|
|
'wren/src/cli/vm.c',
|
|
|
|
module_src,
|
2020-04-30 22:33:51 +00:00
|
|
|
install: not force_static,
|
2020-04-24 23:49:46 +00:00
|
|
|
include_directories: [cli_incl, module_incl],
|
|
|
|
dependencies: [wren_dep, libuv_dep],
|
|
|
|
c_args: ['-D_XOPEN_SOURCE=600'],
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
if get_option('build_testing')
|
|
|
|
test_api_src = [
|
|
|
|
'wren/test/api/main.c',
|
|
|
|
'wren/test/api/reset_stack_after_foreign_construct.c',
|
|
|
|
'wren/test/api/new_vm.c',
|
|
|
|
'wren/test/api/get_variable.c',
|
|
|
|
'wren/test/api/slots.c',
|
|
|
|
'wren/test/api/lists.c',
|
|
|
|
'wren/test/api/user_data.c',
|
|
|
|
'wren/test/api/call.c',
|
|
|
|
'wren/test/api/foreign_class.c',
|
|
|
|
'wren/test/api/call_wren_call_root.c',
|
|
|
|
'wren/test/api/handle.c',
|
|
|
|
'wren/test/api/resolution.c',
|
|
|
|
'wren/test/api/error.c',
|
|
|
|
'wren/test/api/call_calls_foreign.c',
|
|
|
|
'wren/test/api/reset_stack_after_call_abort.c',
|
|
|
|
'wren/test/api/benchmark.c',
|
|
|
|
]
|
|
|
|
|
|
|
|
test_unit_src = [
|
|
|
|
'wren/test/unit/main.c',
|
|
|
|
'wren/test/unit/test.c',
|
|
|
|
'wren/test/unit/path_test.c',
|
|
|
|
]
|
|
|
|
|
|
|
|
test_api = executable('api_' + meson.project_name(),
|
|
|
|
test_api_src,
|
|
|
|
module_src,
|
|
|
|
'wren/src/cli/path.c',
|
|
|
|
'wren/src/cli/modules.c',
|
|
|
|
'wren/src/cli/vm.c',
|
|
|
|
install: false,
|
|
|
|
dependencies: [wren_dep, libuv_dep],
|
|
|
|
include_directories: [cli_incl, module_incl],
|
|
|
|
c_args: ['-D_XOPEN_SOURCE=600'],
|
|
|
|
)
|
|
|
|
test(meson.project_name() + ' api test', test_api)
|
|
|
|
|
|
|
|
test_unit = executable('unit_' + meson.project_name(),
|
|
|
|
test_unit_src,
|
|
|
|
module_src,
|
|
|
|
'wren/src/cli/path.c',
|
|
|
|
'wren/src/cli/modules.c',
|
|
|
|
'wren/src/cli/vm.c',
|
|
|
|
install: false,
|
|
|
|
include_directories: [cli_incl, module_incl],
|
|
|
|
dependencies: [wren_dep, libuv_dep],
|
|
|
|
c_args: ['-D_XOPEN_SOURCE=600'],
|
|
|
|
)
|
|
|
|
test(meson.project_name() + ' unit test', test_unit)
|
|
|
|
endif
|
|
|
|
|
2020-04-30 22:33:51 +00:00
|
|
|
if not force_static
|
2020-04-24 23:49:46 +00:00
|
|
|
install_headers(
|
|
|
|
'wren/src/include/wren.h',
|
|
|
|
'wren/src/include/wren.hpp',
|
|
|
|
)
|
|
|
|
endif
|