This repository has been archived by the owner on Sep 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
binding.gyp
88 lines (88 loc) · 2.69 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
# Looking into https://github.com/nodejs/node/blob/master/common.gypi can help when searching for the correct compiler settings
{
'variables': {
# Putting a variables dict inside another variables dict looks kind of
# weird. This is done so that 'external_root', etc are defined as
# variables within the outer variables dict here. This is necessary
# to get these variables defined for the conditions within this variables
# dict that operate on these variables.
'variables': {
'variables': {
'addon_root%': './src/algo/addon'
},
'addon_root%': '<(addon_root)',
'code_root%': '<(addon_root)/code',
'external_root%': '<(addon_root)/code/external',
},
'addon_root%': '<(addon_root)',
'code_src%': '<(code_root)/src',
'boost_include%': '<(external_root)/boost/include',
'json_include%': '<(external_root)/json/include',
},
'targets': [
{
'target_name': 'corona_school_matching',
'defines': [
'DEFINE_FOO',
'DEFINE_A_VALUE=value',
'NAPI_DISABLE_CPP_EXCEPTIONS',
],
'include_dirs': [
'<!@(node -p "require(\'node-addon-api\').include")',
'<@(boost_include)',
'<@(json_include)',
'<@(code_src)',
],
'sources': [
'<(addon_root)/index.cpp',
'<(code_src)/graph_creator.cpp',
'<(code_src)/matching.cpp'
],
'cflags!': [ '-fno-exceptions',],
'cflags_cc!': [ '-fno-exceptions', ],
'cflags_cc': [
'-std=c++17' , # use c++17
'-w', # do not show warnings (from boost etc.)
],
'linkflags': [
'-lstdc++fs -lc++fs -ld',
],
'conditions': [
['OS=="linux"', {
'defines': [
'LINUX_DEFINE',
],
'include_dirs': [
'include/linux',
],
}],
['OS=="mac"', {
'defines': [
'MAC_DEFINE',
],
'xcode_settings': { # define special things for macOS (in particular, without that, c++17 wouldn't work on macOS)
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'MACOSX_DEPLOYMENT_TARGET': '10.15',
'CLANG_CXX_LANGUAGE_STANDARD': 'c++17',
'CLANG_CXX_LIBRARY': 'libc++',
'WARNING_CFLAGS!': ['-Wall', '-Wextra'],
},
}],
['OS=="win"', {
'defines': [
'WINDOWS_SPECIFIC_DEFINE',
],
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [ '-std:c++17', '-IC:../<(boost_include)' ],
},
},
}, { # OS != "win",
'defines': [
'NON_WINDOWS_DEFINE',
],
}]
],
},
],
}