Permalink
Browse files

[Windows Fix] A more localized fix for onnx_proto compilation issues …

…using VS.
  • Loading branch information...
ayermolo authored and rdzhabarov committed Jan 8, 2019
1 parent dca5cd7 commit 38d792406f9d100179d38fce5e247e7b9e2ae44d
Showing with 14 additions and 12 deletions.
  1. +0 −12 CMakeLists.txt
  2. +14 −0 lib/Importer/CMakeLists.txt
@@ -67,18 +67,6 @@ if (GLOW_WITH_OPENCL)
find_package(OpenCL REQUIRED)
endif ()

# sets pre processor flag so some of glow projects
# can link against protobuf libray that is build as DLL.
if(MSVC AND LINK_PROTOBUF_AS_DLL)
# For protobuf warning when it is build as dll.
# Supresses a warning that is treated as error.
# Basically one of the header files has interface class
# containing STL string. Which might cause issues
# if things are build with different compilers.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251")
add_definitions(-DPROTOBUF_USE_DLLS)
endif()

# Prefer LLVM 7.
find_package(LLVM 7 CONFIG)

@@ -48,3 +48,17 @@ target_link_libraries(Importer
Support)
target_link_libraries(Importer PUBLIC onnx_proto ${PROTOBUF_LIBRARY})

if (MSVC AND LINK_PROTOBUF_AS_DLL)
# For protobuf warning when it is build as dll.
# Supresses a warning that is treated as error.
# Basically one of the header files has interface class
# containing STL string. Which might cause issues
# if things are build with different compilers.
#
# Sets general warning level as 2 for this project.
# There are few warnings that are treated as errors that
# come from VS include headers
target_compile_options(onnx_proto PUBLIC /wd4251)
target_compile_options(onnx_proto PUBLIC /W2)
target_compile_definitions(onnx_proto PUBLIC -DPROTOBUF_USE_DLLS)
endif()

0 comments on commit 38d7924

Please sign in to comment.