Skip to content

Commit

Permalink
Fixes include path when using external protobuf
Browse files Browse the repository at this point in the history
  • Loading branch information
taku910 committed Apr 10, 2023
1 parent 2b07137 commit 119e58d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ else()
protobuf_generate_cpp(SPM_MODEL_PROTO_SRCS SPM_MODEL_PROTO_HDRS sentencepiece_model.proto)
set(PROTOBUF_LITE_SRCS "")
include_directories(${PROTOBUF_INCLUDE_DIR})
if (MSVC)
add_definitions("/D_USE_EXTERNAL_PROTOBUF")
else()
add_definitions("-D_USE_EXTERNAL_PROTOBUF")
endif()
endif()

include_directories(${CMAKE_CURRENT_BINARY_DIR})
Expand Down
5 changes: 5 additions & 0 deletions src/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
#include "common.h"
#include "third_party/absl/flags/flag.h"
#include "third_party/absl/flags/parse.h"

#ifdef _USE_EXTERNAL_PROTOBUF
#include "google/protobuf/message_lite.h"
#else
#include "third_party/protobuf-lite/google/protobuf/message_lite.h"
#endif

ABSL_DECLARE_FLAG(int32, minloglevel);

Expand Down

0 comments on commit 119e58d

Please sign in to comment.