Skip to content

Commit fc255c1

Browse files
Stephen Parentewebmakersteve
authored andcommitted
Windows support for native bindings
1 parent cb3923f commit fc255c1

File tree

4 files changed

+296
-197
lines changed

4 files changed

+296
-197
lines changed

binding.gyp

Lines changed: 69 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,98 @@
11
{
22
"variables": {
33
# may be redefined in command line on configuration stage
4-
"BUILD_LIBRDKAFKA%": "<!(echo ${BUILD_LIBRDKAFKA:-1})",
5-
"WITH_SASL%": "<!(echo ${WITH_SASL:-1})",
6-
"WITH_LZ4%": "<!(echo ${WITH_LZ4:-0})"
4+
# "build_librdkafka%": "<!(echo ${BUILD_LIBRDKAFKA:-1})"
5+
"build_librdkafka%": "1"
76
},
87
"targets": [
98
{
109
"target_name": "node-librdkafka",
11-
"sources": [ "<!@(ls -1 src/*.cc)", ],
10+
'sources': [
11+
'src/binding.cc',
12+
'src/callbacks.cc',
13+
'src/common.cc',
14+
'src/config.cc',
15+
'src/connection.cc',
16+
'src/errors.cc',
17+
'src/kafka-consumer.cc',
18+
'src/producer.cc',
19+
'src/topic.cc',
20+
'src/workers.cc'
21+
],
1222
"include_dirs": [
1323
"<!(node -e \"require('nan')\")",
1424
"<(module_root_dir)/"
1525
],
1626
'conditions': [
17-
[ "<(BUILD_LIBRDKAFKA)==1",
18-
{
19-
"dependencies": [
20-
"<(module_root_dir)/deps/librdkafka.gyp:librdkafka_cpp"
21-
],
22-
"include_dirs": [ "deps/librdkafka/src-cpp" ],
23-
},
24-
# Else link against globally installed rdkafka and use
25-
# globally installed headers. On Debian, you should
26-
# install the librdkafka1, librdkafka++1, and librdkafka-dev
27-
# .deb packages.
28-
{
29-
"libraries": ["-lrdkafka", "-lrdkafka++"],
30-
"include_dirs": [
31-
"/usr/include/librdkafka",
32-
"/usr/local/include/librdkafka"
33-
],
34-
},
35-
],
36-
[
37-
'OS=="linux"',
38-
{
39-
'cflags_cc' : [
40-
'-std=c++11'
41-
],
42-
'cflags_cc!': [
43-
'-fno-rtti'
44-
]
45-
}
46-
],
4727
[
4828
'OS=="win"',
4929
{
5030
'cflags_cc' : [
5131
'-std=c++11'
52-
]
53-
}
54-
],
55-
[
56-
'OS=="mac"',
57-
{
58-
'xcode_settings': {
59-
'MACOSX_DEPLOYMENT_TARGET': '10.11',
60-
'GCC_ENABLE_CPP_RTTI': 'YES',
61-
'OTHER_CPLUSPLUSFLAGS': [
62-
'-std=c++11'
63-
],
32+
],
33+
'msvs_settings': {
34+
'VCCLCompilerTool': {
35+
'AdditionalOptions': [
36+
'/GR'
37+
],
38+
'AdditionalUsingDirectories': [
39+
'<(module_root_dir)/deps/librdkafka/win32/outdir/v120/x64/Release/'
40+
]
41+
}
6442
},
65-
}
66-
],
67-
[ "<(WITH_SASL)==1",
43+
'msvs_version': '2013',
44+
'msbuild_toolset': 'v120',
45+
"dependencies": [
46+
"<(module_root_dir)/deps/librdkafka.gyp:librdkafkacpp"
47+
],
48+
'include_dirs': [
49+
'deps/librdkafka/src-cpp'
50+
]
51+
},
6852
{
69-
'libraries' : ['-lsasl2'],
7053
'conditions': [
71-
[ 'OS=="mac"',
54+
[ "<(build_librdkafka)==1",
7255
{
73-
'xcode_settings': {
74-
'libraries' : ['-lsasl2']
75-
}
56+
"dependencies": [
57+
"<(module_root_dir)/deps/librdkafka.gyp:librdkafkacpp"
58+
],
59+
"include_dirs": [ "deps/librdkafka/src-cpp" ],
60+
},
61+
# Else link against globally installed rdkafka and use
62+
# globally installed headers. On Debian, you should
63+
# install the librdkafka1, librdkafka++1, and librdkafka-dev
64+
# .deb packages.
65+
{
66+
"libraries": ["-lrdkafka", "-lrdkafka++"],
67+
"include_dirs": [
68+
"/usr/include/librdkafka",
69+
"/usr/local/include/librdkafka"
70+
],
71+
},
72+
],
73+
[
74+
'OS=="linux"',
75+
{
76+
'cflags_cc' : [
77+
'-std=c++11'
78+
],
79+
'cflags_cc!': [
80+
'-fno-rtti'
81+
]
7682
}
7783
],
78-
]
79-
}
80-
],
81-
[ "<(WITH_LZ4)==1",
82-
{
83-
'libraries' : ['-llz4'],
84-
'conditions': [
85-
[ 'OS=="mac"',
84+
[
85+
'OS=="mac"',
8686
{
8787
'xcode_settings': {
88-
'libraries' : ['-llz4']
89-
}
88+
'MACOSX_DEPLOYMENT_TARGET': '10.11',
89+
'GCC_ENABLE_CPP_RTTI': 'YES',
90+
'OTHER_CPLUSPLUSFLAGS': [
91+
'-std=c++11'
92+
],
93+
},
9094
}
91-
],
95+
]
9296
]
9397
}
9498
]

0 commit comments

Comments
 (0)