Skip to content

Commit

Permalink
[Windows Fix] A more localized fix for onnx_proto compilation issues …
Browse files Browse the repository at this point in the history
…using VS.
  • Loading branch information
ayermolo authored and rdzhabarov committed Jan 8, 2019
1 parent dca5cd7 commit 38d7924
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
12 changes: 0 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
14 changes: 14 additions & 0 deletions lib/Importer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.