• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1project(
2    'es2panda_interop',
3    'cpp',
4    version: '1.0',
5    default_options: [
6        'cpp_std=c++17',
7        'buildtype=debug',
8    ],
9)
10
11sources = [
12    './src/common.cc',
13    './src/bridges.cc',
14    './src/generated/bridges.cc',
15    get_option('interop_src_dir') / 'common-interop.cc',
16    get_option('interop_src_dir') / 'callback-resource.cc',
17    get_option('interop_src_dir') / 'interop-logging.cc',
18    get_option('interop_src_dir') / 'napi/convertors-napi.cc',
19]
20
21cflags = [
22    '-DKOALA_INTEROP_MODULE=NativeModule',
23    '-DINTEROP_LIBRARY_NAME=' + get_option('lib_name'),
24    '-DKOALA_USE_NODE_VM',
25    '-DKOALA_NAPI',
26]
27
28if (target_machine.system() == 'windows')
29    cflags += ['-DKOALA_WINDOWS']
30    if (meson.get_compiler('cpp').get_id() == 'msvc')
31        # apply node.exe symbol loading hook
32        sources += [
33            get_option('interop_src_dir') / 'napi/win-dynamic-node.cc'
34        ]
35    endif
36else
37    cflags += ['-DKOALA_LINUX']
38endif
39
40shared_library(
41    get_option('lib_name'),
42    sources,
43    override_options: [
44        'b_lundef=false',
45    ],
46    install: true,
47    name_prefix: '',
48    name_suffix: 'node',
49    include_directories: [
50        './src/',
51        './include/',
52        get_option('panda_sdk_dir') / 'ohos_arm64/include/tools/es2panda/public',
53        get_option('panda_sdk_dir') / 'ohos_arm64/include/tools/es2panda',
54        get_option('interop_src_dir'),
55        get_option('interop_src_dir') / 'types',
56        get_option('interop_src_dir') / 'napi',
57        get_option('node_modules_dir') / 'node-api-headers/include',
58        get_option('node_modules_dir') / 'node-addon-api',
59    ],
60    cpp_args: cflags,
61    link_args: [],
62    dependencies: []
63)
64