Skip to content

Commit

Permalink
[Bazel/MSVC] Make Kafka builds on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rongjiecomputer committed Jul 20, 2018
1 parent 77c7b11 commit d4fc213
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tensorflow/contrib/kafka/kernels/kafka_dataset_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.

#include "tensorflow/core/framework/dataset.h"

#include "src-cpp/rdkafkacpp.h"
#include "rdkafkacpp.h"

namespace tensorflow {

Expand Down
36 changes: 26 additions & 10 deletions third_party/kafka/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ cc_library(
"src-cpp/KafkaConsumerImpl.cpp",
"src-cpp/MessageImpl.cpp",
"src-cpp/MetadataImpl.cpp",
"src-cpp/ProducerImpl.cpp",
"src-cpp/QueueImpl.cpp",
"src-cpp/RdKafka.cpp",
"src-cpp/TopicImpl.cpp",
Expand Down Expand Up @@ -130,23 +131,38 @@ cc_library(
"src/tinycthread.h",
"src/xxhash.c",
"src/xxhash.h",
],
] + select({
"@org_tensorflow//tensorflow:windows": [
"src/rdkafka_sasl_win32.c",
"src/rdwin32.h",
"src/regexp.c",
"src/regexp.h",
],
"//conditions:default": [],
}),
hdrs = [
"config.h",
"src-cpp/rdkafkacpp.h",
"src-cpp/rdkafkacpp_int.h",
"src/lz4.c",
"src/snappy_compat.h",
],
copts = [
"-Iexternal/kafka/src",
"-Iexternal/kafka/src-cpp",
],
defines = [
],
linkopts = [
"-lpthread",
],
includes = ["src", "src-cpp"],
defines = ["LIBRDKAFKA_STATICLIB"],
copts = select({
"@org_tensorflow//tensorflow:windows": [
"-DWIN32_LEAN_AND_MEAN",
"-DWITHOUT_WIN32_CONFIG",
"-DWITH_ZLIB=1",
"-DWITH_SSL=1",
"-DWITH_SNAPPY=1",
],
"//conditions:default": [],
}),
linkopts = select({
"@org_tensorflow//tensorflow:windows": ["-defaultlib:crypt32.lib"],
"//conditions:default": ["-lpthread"],
}),
visibility = ["//visibility:public"],
deps = [
"@boringssl//:ssl",
Expand Down

0 comments on commit d4fc213

Please sign in to comment.