-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbinding.gyp
116 lines (114 loc) · 5.45 KB
/
binding.gyp
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# Note: C++ standard is repeated in configurations multiple times for different configurations
{
"targets": [{
"target_name": "fuzzaldrinplusfast",
"sources": [ "src/fuzzaldrin.cc", "src/scorer.cc", "src/path_scorer.cc", "src/filter.cc", "src/query.cc", "src/matcher.cc", "src/tree.h" ],
"include_dirs": [
"<!@(node -p \"require('node-addon-api').include\")"
],
# Compiler flags:
'default_configuration': 'Release',
'configurations': {
# Release Settings
'Release': {
'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS', 'NDEBUG' ],
"cflags": [ "-fno-exceptions", "-Ofast" ],
"cflags_cc": [ "-fno-exceptions", "-Ofast", "-std=c++2a" ],
"xcode_settings": {
'GCC_OPTIMIZATION_LEVEL': '3', # stop gyp from defaulting to -Os
"CLANG_CXX_LIBRARY": "libc++",
"CLANG_CXX_LANGUAGE_STANDARD":"c++2a",
'MACOSX_DEPLOYMENT_TARGET': '10.15'
},
"msvs_settings": {
"VCCLCompilerTool": {
'ExceptionHandling': 0, # /EHsc
'MultiProcessorCompilation': 'true',
'StringPooling': 'true', # pool string literals
"AdditionalOptions": [
# C++ standard
"/std:c++latest",
"/O2", # optimizations
"/Ob3", # agressive inline
"/Oi", # intrinsic functions
"/Ot", # favor speed
"/DNDEBUG" # turn off asserts
],
'EnableFunctionLevelLinking': 'true',
'EnableIntrinsicFunctions': 'true',
'FavorSizeOrSpeed': 1, # /Ot, favor speed over size
'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
'OmitFramePointers': 'true',
'Optimization': 3, # /Ox, full optimization
'RuntimeTypeInfo': 'false',
}
}
},
# Debug Settings
'Debug': {
'defines': [ 'DEBUG', 'NAPI_CPP_EXCEPTIONS' ],
'cflags': [ '-g', '-O0' ],
"cflags_cc": [
'-fexceptions', # enable exceptions
# C++ standard
"-std=c++2a",
# Clang warnings
"-Wall",
"-Wextra", # reasonable and standard
"-Wshadow", # warn the user if a variable declaration shadows one from a parent context
"-Wnon-virtual-dtor", # warn the user if a class with virtual functions has a non-virtual destructor. This helps catch hard to track down memory errors
"-Wold-style-cast", # warn for c-style casts
"-Wcast-align", # warn for potential performance problem casts
"-Wunused", # warn on anything being unused
"-Woverloaded-virtual", # warn if you overload (not override) a virtual function
"-Wpedantic", # warn if non-standard C++ is used
"-Wconversion", # warn on type conversions that may lose data
"-Wsign-conversion", # warn on sign conversions
"-Wnull-dereference", # warn if a null dereference is detected
"-Wdouble-promotion", # warn if float is implicit promoted to double
"-Wformat=2", # warn on security issues around functions that format output (ie printf)
# GCC Warnings
"-Wmisleading-indentation", # warn if indentation implies blocks where blocks do not exist
"-Wduplicated-cond", # warn if if / else chain has duplicated conditions
"-Wduplicated-branches", # warn if if / else branches have duplicated code
"-Wlogical-op", # warn about logical operations being used where bitwise were probably wanted
"-Wuseless-cast", # warn if you perform a cast to the same type
], # GCC/CLANG
"msvs_settings": {
"VCCLCompilerTool": {
'ExceptionHandling': 2, # /EHsc
'BasicRuntimeChecks': 3, # /RTC1
'MinimalRebuild': 'false',
'OmitFramePointers': 'false',
'Optimization': 0, # /Od, no optimization
"AdditionalOptions": [
# C++ standard
"/std:c++latest",
# MSVC Warnings
# disable warnings on external headers
"/experimental:external",
"/external:W0",
"/external:I <!@(node -p \"require('node-addon-api').include\")",
"/external:anglebrackets",
"/Wall", # all warnings,
"/wd5044", # include path missing
"/wd4710", # function not inlined
"/wd4514", # unreferenced inline function has been removed
"/wd5045", # spectre mitigation insertion warning
"/wd4820", # 'bytes' bytes padding added after construct 'member_name'
"/wd4626", # assignment operator was implicitly defined as deleted
"/wd5027" # move operator was implicitly defined as deleted
],
},
}, # MSVC
"xcode_settings": {
'GCC_OPTIMIZATION_LEVEL': '0', # stop gyp from defaulting to -Os
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
"CLANG_CXX_LIBRARY": "libc++",
"CLANG_CXX_LANGUAGE_STANDARD":"c++2a",
'MACOSX_DEPLOYMENT_TARGET': '10.15'
} # XCODE
}, # Debug
}, # configurations
}] # targets
}