2020-04-30 22:14:55 +00:00
|
|
|
project('wrenpp', 'cpp',
|
2022-05-15 21:09:49 +00:00
|
|
|
version: '0.1.3',
|
2020-04-24 23:49:46 +00:00
|
|
|
meson_version: '>=0.49.2',
|
2022-04-29 10:32:59 +00:00
|
|
|
default_options: ['buildtype=release', 'cpp_std=c++20', 'b_ndebug=if-release']
|
2020-04-24 23:49:46 +00:00
|
|
|
)
|
|
|
|
|
2020-04-30 22:14:55 +00:00
|
|
|
wren_dep = dependency('wren', version: '>=0.2.0',
|
|
|
|
fallback: ['wren', 'wren_dep'],
|
|
|
|
default_options: [
|
|
|
|
'default_library=static',
|
|
|
|
'build_testing=false',
|
2020-05-01 19:14:01 +00:00
|
|
|
'wren_with_rand=' + get_option('wren_with_rand').to_string(),
|
|
|
|
'wren_with_meta=' + get_option('wren_with_meta').to_string(),
|
2020-04-30 22:14:55 +00:00
|
|
|
],
|
|
|
|
static: true,
|
|
|
|
)
|
2022-04-29 10:32:59 +00:00
|
|
|
public_incl = [include_directories('include')]
|
2020-04-24 23:49:46 +00:00
|
|
|
|
2020-04-26 20:06:53 +00:00
|
|
|
os = host_machine.system()
|
|
|
|
if os == 'gnu'
|
|
|
|
os = 'hurd'
|
|
|
|
elif os == 'linux'
|
|
|
|
os = 'gnu'
|
|
|
|
endif
|
|
|
|
|
2020-04-27 10:05:03 +00:00
|
|
|
arch = host_machine.cpu_family()
|
2020-04-26 20:06:53 +00:00
|
|
|
if arch == 'x86_64'
|
|
|
|
arch = 'amd64'
|
|
|
|
endif
|
|
|
|
|
|
|
|
ptr_size = 0
|
|
|
|
func_ptr_size = 0
|
|
|
|
|
|
|
|
conf = configuration_data()
|
|
|
|
if os == 'gnu' and arch == 'amd64'
|
|
|
|
ptr_size = 8
|
|
|
|
func_ptr_size = 8
|
2022-04-24 01:41:14 +00:00
|
|
|
elif os == 'gnu' and arch == 'aarch64'
|
|
|
|
ptr_size = 8
|
|
|
|
func_ptr_size = 8
|
2020-04-26 20:06:53 +00:00
|
|
|
endif
|
|
|
|
|
2022-05-15 18:12:20 +00:00
|
|
|
compiler_opts = []
|
|
|
|
if get_option('wrenpp_with_name_guessing')
|
|
|
|
compiler_opts += ['-DWRENPP_WITH_NAME_GUESSING']
|
|
|
|
endif
|
2022-05-23 02:19:54 +00:00
|
|
|
if get_option('wrenpp_with_sse42')
|
|
|
|
compiler_opts += ['-msse4.2']
|
|
|
|
endif
|
2022-05-15 18:12:20 +00:00
|
|
|
|
2020-04-26 20:06:53 +00:00
|
|
|
conf.set('POINTER_SIZE', ptr_size)
|
|
|
|
conf.set('FUNC_POINTER_SIZE', func_ptr_size)
|
2021-02-10 22:14:13 +00:00
|
|
|
conf.set('WRENPP_NAME', meson.project_name())
|
2022-05-23 02:19:54 +00:00
|
|
|
conf.set('WRENPP_WITH_SSE42', get_option('wrenpp_with_sse42'))
|
2020-04-26 20:06:53 +00:00
|
|
|
|
|
|
|
project_config_file = configure_file(
|
2022-04-29 10:32:59 +00:00
|
|
|
input: 'src/pvt_config.h.in',
|
|
|
|
output: 'pvt_config.h',
|
2020-04-26 20:06:53 +00:00
|
|
|
configuration: conf
|
|
|
|
)
|
|
|
|
|
2022-04-29 10:32:59 +00:00
|
|
|
subdir('include')
|
|
|
|
|
2020-04-30 20:50:46 +00:00
|
|
|
wrenpp = library(meson.project_name(),
|
2020-04-26 20:06:53 +00:00
|
|
|
project_config_file,
|
2020-05-02 20:55:10 +00:00
|
|
|
'src/vm.cpp',
|
|
|
|
'src/configuration.cpp',
|
|
|
|
'src/def_configuration.cpp',
|
|
|
|
'src/dynafunc_maker.cpp',
|
|
|
|
'src/dynafunc_' + arch + '_' + os + '.S',
|
|
|
|
'src/handle.cpp',
|
|
|
|
'src/vm_fun.cpp',
|
2022-04-29 16:16:57 +00:00
|
|
|
'src/callback_manager.cpp',
|
2022-05-14 15:06:25 +00:00
|
|
|
'src/class_manager.cpp',
|
2022-05-18 16:48:18 +00:00
|
|
|
'src/wren_class_name_from_type.cpp',
|
2022-05-23 02:19:54 +00:00
|
|
|
'src/crc32.cpp',
|
2022-05-24 14:07:16 +00:00
|
|
|
'src/module_and_name.cpp',
|
2020-04-24 23:49:46 +00:00
|
|
|
dependencies: [wren_dep],
|
2020-04-30 20:50:46 +00:00
|
|
|
include_directories: public_incl,
|
2022-05-14 17:49:29 +00:00
|
|
|
install: (not meson.is_subproject() or get_option('default_library')=='shared'),
|
2022-05-15 18:12:20 +00:00
|
|
|
c_args: compiler_opts,
|
|
|
|
cpp_args: compiler_opts,
|
2020-04-24 23:49:46 +00:00
|
|
|
)
|
2020-04-30 20:50:46 +00:00
|
|
|
wrenpp_dep = declare_dependency(
|
|
|
|
link_with: wrenpp,
|
|
|
|
include_directories: public_incl,
|
2022-05-15 18:12:20 +00:00
|
|
|
compile_args: compiler_opts,
|
2020-04-30 20:50:46 +00:00
|
|
|
)
|
|
|
|
|
2020-05-02 20:41:58 +00:00
|
|
|
if get_option('build_examples')
|
|
|
|
subdir('examples')
|
|
|
|
endif
|
2021-02-02 13:04:27 +00:00
|
|
|
if get_option('build_testing')
|
|
|
|
subdir('test')
|
|
|
|
endif
|