forked from tignear/node-openjtalk-binding
-
Notifications
You must be signed in to change notification settings - Fork 0
/
binding.gyp
143 lines (141 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
{
'includes': ["common.gypi"],
'variables': {
"conditions": [
['OS == "win"', {
"STATIC_LIB_SUFFIX%": ".lib",
"STATIC_LIB_PREFIX%": "",
}],
['OS != "win"', {
"STATIC_LIB_SUFFIX%": ".a",
"STATIC_LIB_PREFIX%": "lib",
}]
]
},
'targets': [
{
'target_name': 'openjtalk',
'type': 'none',
'dependencies': [
"openjtalk/jpcommon/build.gyp:*",
"openjtalk/mecab/build.gyp:mecab",
"openjtalk/mecab2njd/build.gyp:*",
"openjtalk/njd/build.gyp:*",
"openjtalk/njd_set_accent_phrase/build.gyp:*",
"openjtalk/njd_set_accent_type/build.gyp:*",
"openjtalk/njd_set_digit/build.gyp:*",
"openjtalk/njd_set_long_vowel/build.gyp:*",
"openjtalk/njd_set_pronunciation/build.gyp:*",
"openjtalk/njd_set_unvoiced_vowel/build.gyp:*",
"openjtalk/njd2jpcommon/build.gyp:*",
"openjtalk/njd_set_unvoiced_vowel/build.gyp:*",
"openjtalk/text2mecab/build.gyp:*",
"openjtalk/open_jtalk/build.gyp:*",
"openjtalk/mecab-naist-jdic/build.gyp:*",
]
},
{
"target_name": "addon",
"sources": ["addon.cc"],
"include_dirs": [
"<!@(node -p \"require('node-addon-api').include\")",
"./openjtalk/open_jtalk",
"./openjtalk/mecab/src",
"./openjtalk/njd",
"./openjtalk/jpcommon",
"./htsengine/include"
],
"defines": ["NAPI_CPP_EXCEPTIONS"],
'dependencies': [
'openjtalk', "htsengine/build.gyp:*"
],
"libraries": [
"<(PRODUCT_DIR)/open_jtalk<(STATIC_LIB_SUFFIX)",
"<(PRODUCT_DIR)/mecab<(STATIC_LIB_SUFFIX)",
"<(PRODUCT_DIR)/njd<(STATIC_LIB_SUFFIX)",
"<(PRODUCT_DIR)/jpcommon<(STATIC_LIB_SUFFIX)",
"<(PRODUCT_DIR)/htsengine<(STATIC_LIB_SUFFIX)",
"<(PRODUCT_DIR)/text2mecab<(STATIC_LIB_SUFFIX)",
"<(PRODUCT_DIR)/mecab2njd<(STATIC_LIB_SUFFIX)",
"<(PRODUCT_DIR)/njd_set_pronunciation<(STATIC_LIB_SUFFIX)",
"<(PRODUCT_DIR)/njd_set_digit<(STATIC_LIB_SUFFIX)",
"<(PRODUCT_DIR)/njd_set_accent_phrase<(STATIC_LIB_SUFFIX)",
"<(PRODUCT_DIR)/njd_set_accent_type<(STATIC_LIB_SUFFIX)",
"<(PRODUCT_DIR)/njd_set_unvoiced_vowel<(STATIC_LIB_SUFFIX)",
"<(PRODUCT_DIR)/njd_set_long_vowel<(STATIC_LIB_SUFFIX)",
"<(PRODUCT_DIR)/njd2jpcommon<(STATIC_LIB_SUFFIX)"
],
"cflags_cc":[
"-std=c++17",
"-fPIC",
"-O3",
"-fexceptions",
],
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'OTHER_CPLUSPLUSFLAGS': ['-std=c++17', '-stdlib=libc++', "-O3"],
'MACOSX_DEPLOYMENT_TARGET': '10.14',
},
'msbuild_settings': {
'ClCompile': {
'AdditionalOptions': ['/std:c++17', "/utf-8", "/Ob3", "/Zc:__cplusplus", "/DNDEBUG"],
'PreprocessorDefinitions': ["NOMINMAX"],
'ExceptionHandling': "Sync",
'Optimization': "MaxSpeed",
'IntrinsicFunctions': 'true',
'FavorSizeOrSpeed': 'Speed',
'OmitFramePointers': 'true',
'EnableFiberSafeOptimizations': 'true',
'WholeProgramOptimization': 'true'
},
'Link': {
'LinkTimeCodeGeneration': 'UseLinkTimeCodeGeneration', # /LTCG
},
'Lib': {
'LinkTimeCodeGeneration': 'true', # /LTCG
}
},
},
{ # https://github.com/mapbox/node-pre-gyp#2-add-a-new-target-to-bindinggyp
"target_name": "action_after_build_node",
"type": "none",
"dependencies": ["addon"],
"copies": [
{
"files": [
"<(PRODUCT_DIR)/addon.node",
],
"destination": "<(module_path)"
}
]
},
{
"target_name": "action_after_build_dic_tool",
"type": "none",
"dependencies": ["openjtalk"],
"copies": [
{
"files": [
"<(PRODUCT_DIR)/mecab-dict-index<(EXECUTABLE_SUFFIX)",
],
"destination": "<(module_path)"
}
]
},
{
"target_name": "action_after_build_dic",
"type": "none",
"dependencies": ["openjtalk"],
"copies": [
{
"files": [
"openjtalk/mecab-naist-jdic/char.bin",
"openjtalk/mecab-naist-jdic/matrix.bin",
"openjtalk/mecab-naist-jdic/sys.dic",
"openjtalk/mecab-naist-jdic/unk.dic", ],
"destination": "<(module_path)/dictionary"
}
]
}
]
}