-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbinding.gyp
More file actions
67 lines (66 loc) · 2.48 KB
/
Copy pathbinding.gyp
File metadata and controls
67 lines (66 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# ===
# This is the main GYP file, which builds better-sqlite3 with SQLite itself.
# ===
{
'includes': ['deps/common.gypi'],
'variables': {
# npm's implicit node-gyp rebuild should do nothing when the package
# contains a prebuild for the host. Explicit build scripts override this.
'force_build%': 0,
'prebuild_exists%': '<!(node lib/binding.js)',
},
'targets': [
{
'target_name': 'better_sqlite3',
'conditions': [
['force_build==1 or prebuild_exists==0', {
'dependencies': ['deps/sqlite3.gyp:sqlite3'],
'sources': ['src/better_sqlite3.cpp'],
'include_dirs': ["<!@(node -p \"require('node-addon-api').include\")"],
# NAPI_VERSION must stay >= 10. Node-API rejects napi_create_reference
# on non-object values for modules that declare an older version, which
# breaks named parameters (BindMap holds Napi::String references) and
# aggregate seeds/accumulators (references to arbitrary values). Both
# surface at runtime as "Error: Invalid argument".
# NAPI_DISABLE_CPP_EXCEPTIONS is the macro node-addon-api actually
# checks; NODE_ADDON_API_DISABLE_CPP_EXCEPTIONS does not exist.
'defines': ['NAPI_VERSION=10', 'NAPI_DISABLE_CPP_EXCEPTIONS'],
'cflags_cc': ['-std=c++20', '-fvisibility=hidden', '-fvisibility-inlines-hidden', '-flto'],
'ldflags': ['-flto'],
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': ['-std=c++20', '-stdlib=libc++'],
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
'LLVM_LTO': 'YES',
},
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': ['/std:c++20'],
'WholeProgramOptimization': 'true',
},
'VCLinkerTool': {
'LinkTimeCodeGeneration': 1,
},
},
'conditions': [['OS=="linux"', {
'ldflags': ['-flto', '-Wl,-Bsymbolic', '-Wl,--exclude-libs,ALL'],
'libraries': ['-ldl'],
}]],
}, {
'type': 'none',
}],
],
},
{
'target_name': 'test_extension',
'conditions': [
['force_build==1 or prebuild_exists==0', {
'dependencies': ['deps/sqlite3.gyp:sqlite3'],
'conditions': [['sqlite3 == ""', { 'sources': ['deps/test_extension.c'] }]],
}, {
'type': 'none',
}],
],
},
],
}