Skip to content

Commit

Permalink
Update compliance tasks in python packaging pipeline and fix some com…
Browse files Browse the repository at this point in the history
…pile warnings (#8471)

1. Update SDLNativeRules from v2 to v3. The new one allows us setting excluded paths.
2. Update TSAUpload from v1 to v2. And add a config file ".gdn/.gdntsa" for it.
3. Fix some parentheses warnings
4. Update cmake to the latest.
5. Remove "--x86" build option from pipeline yaml files. Now we can auto-detect cpu architecture from python. So we don't need to ask user to specify it.
  • Loading branch information
snnn authored Jul 31, 2021
1 parent 330b8e7 commit 0510688
Show file tree
Hide file tree
Showing 57 changed files with 527 additions and 421 deletions.
3 changes: 3 additions & 0 deletions .gdn/.gdntsa
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"codebaseName": "onnxruntime_master"
}
24 changes: 12 additions & 12 deletions cgmanifests/submodules/cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
"Type": "other",
"other": {
"Name": "cmake",
"Version": "3.20.2",
"DownloadUrl": "https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz"
"Version": "3.21.0",
"DownloadUrl": "https://github.com/Kitware/CMake/releases/download/v3.21.0/cmake-3.21.0.tar.gz"
},
"comments": "manylinux dependency"
}
Expand Down Expand Up @@ -431,6 +431,16 @@
"comments": "git submodule at cmake/external/protobuf/third_party/googletest"
}
},
{
"component": {
"type": "git",
"git": {
"commitHash": "5916273f79a21551890fd3d56fc5375a78d1598d",
"repositoryUrl": "https://github.com/pytorch/cpuinfo.git"
},
"comments": "git submodule at cmake/external/pytorch_cpuinfo"
}
},
{
"component": {
"type": "git",
Expand Down Expand Up @@ -520,16 +530,6 @@
},
"comments": "git submodule at server/external/spdlog"
}
},
{
"component": {
"type": "git",
"git": {
"commitHash": "5916273f79a21551890fd3d56fc5375a78d1598d",
"repositoryUrl": "https://github.com/pytorch/cpuinfo.git"
},
"comments": "git submodule at cmake/external/pytorch_cpuinfo"
}
}
]
}
78 changes: 44 additions & 34 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,12 @@ if(onnxruntime_DISABLE_EXCEPTIONS)

if(MSVC)
string(REGEX REPLACE "/EHsc" "/EHs-c-" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
# Eigen throw_std_bad_alloc calls 'new' instead of throwing which results in a nodiscard warning.
# It also has unreachable code as there's no good way to avoid EIGEN_EXCEPTIONS being set in macros.h
# TODO: see if we can limit the code this is disabled for.
string(APPEND CMAKE_CXX_FLAGS " /wd4834 /wd4702")
if(onnxruntime_DEV_MODE)
# Eigen throw_std_bad_alloc calls 'new' instead of throwing which results in a nodiscard warning.
# It also has unreachable code as there's no good way to avoid EIGEN_EXCEPTIONS being set in macros.h
# TODO: see if we can limit the code this is disabled for.
string(APPEND CMAKE_CXX_FLAGS " /wd4834 /wd4702")
endif()
add_compile_definitions("_HAS_EXCEPTIONS=0")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables")
Expand Down Expand Up @@ -497,8 +499,12 @@ endmacro()
if (MSVC)
#Always enable exception handling, even for Windows ARM
if(NOT onnxruntime_DISABLE_EXCEPTIONS)
string(APPEND CMAKE_CXX_FLAGS " /EHsc /wd26812")
string(APPEND CMAKE_C_FLAGS " /EHsc /wd26812")
string(APPEND CMAKE_CXX_FLAGS " /EHsc")
string(APPEND CMAKE_C_FLAGS " /EHsc")
if(onnxruntime_DEV_MODE)
string(APPEND CMAKE_CXX_FLAGS " /wd26812")
string(APPEND CMAKE_C_FLAGS " /wd26812")
endif()
endif()
string(APPEND CMAKE_CXX_FLAGS " /experimental:external /external:W0 /external:templates- /external:I ${CMAKE_CURRENT_SOURCE_DIR} /external:I ${CMAKE_CURRENT_BINARY_DIR}")
if(onnxruntime_USE_AVX)
Expand Down Expand Up @@ -620,9 +626,11 @@ if (onnxruntime_BUILD_UNIT_TESTS)
add_subdirectory(${PROJECT_SOURCE_DIR}/external/googletest EXCLUDE_FROM_ALL)
set_msvc_c_cpp_compiler_warning_level(3)
set_target_properties(gmock PROPERTIES FOLDER "External/GTest")
# disable treating all warnings as errors for gmock
target_compile_options(gmock PRIVATE "-w")
target_compile_options(gtest PRIVATE "-w")
if(NOT MSVC)
# disable treating all warnings as errors for gmock
target_compile_options(gmock PRIVATE "-w")
target_compile_options(gtest PRIVATE "-w")
endif()
set_target_properties(gmock_main PROPERTIES FOLDER "External/GTest")
set_target_properties(gtest PROPERTIES FOLDER "External/GTest")
set_target_properties(gtest_main PROPERTIES FOLDER "External/GTest")
Expand Down Expand Up @@ -705,6 +713,7 @@ else()
# use protobuf as a submodule
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
set(protobuf_BUILD_PROTOC_BINARIES OFF CACHE BOOL "Build protobuf tests" FORCE)
set(protobuf_WITH_ZLIB OFF CACHE BOOL "Build with zlib support" FORCE)
endif()
if(onnxruntime_DISABLE_RTTI)
set(protobuf_DISABLE_RTTI OFF CACHE BOOL "Remove runtime type information in the binaries" FORCE)
Expand All @@ -730,7 +739,7 @@ if(UNIX AND onnxruntime_ENABLE_LTO AND NOT onnxruntime_PREFER_SYSTEM_LIB)
target_link_options(protoc PRIVATE "-Wl,--no-as-needed")
endif()

if(MSVC)
if(MSVC AND onnxruntime_DEV_MODE)
target_compile_options(${PROTOBUF_LIB} PRIVATE "/wd5054")
endif()

Expand Down Expand Up @@ -856,23 +865,25 @@ if (WIN32)
# parallel build
# These compiler opitions cannot be forwarded to NVCC, so cannot use add_compiler_options
string(APPEND CMAKE_CXX_FLAGS " /MP")
# class needs to have dll-interface to be used by clients
list(APPEND ORT_WARNING_FLAGS "/wd4251")
# issued by thrust nonstandard extension used: nameless struct/union
list(APPEND ORT_WARNING_FLAGS "/wd4201")
if(onnxruntime_USE_OPENMP)
list(APPEND ORT_WARNING_FLAGS "/wd6993") # Code analysis ignores OpenMP constructs
endif()
# operator 'operator-name': deprecated between enumerations of different types
list(APPEND ORT_WARNING_FLAGS "/wd5054")
# Treat warning as error if onnxruntime_DEV_MODE is ON
# For cross-compiled ARM64 binaries, there are too many warnings to fix, hence ignore warnings for now
if (onnxruntime_DEV_MODE AND NOT CMAKE_CROSSCOMPILING)
# treat warnings as errors
list(APPEND ORT_WARNING_FLAGS "/WX")
foreach(type EXE STATIC SHARED)
set(CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS} /WX")
endforeach()
if(onnxruntime_DEV_MODE)
# class needs to have dll-interface to be used by clients
list(APPEND ORT_WARNING_FLAGS "/wd4251")
# issued by thrust nonstandard extension used: nameless struct/union
list(APPEND ORT_WARNING_FLAGS "/wd4201")
if(onnxruntime_USE_OPENMP)
list(APPEND ORT_WARNING_FLAGS "/wd6993") # Code analysis ignores OpenMP constructs
endif()
# operator 'operator-name': deprecated between enumerations of different types
list(APPEND ORT_WARNING_FLAGS "/wd5054")
# Treat warning as error if onnxruntime_DEV_MODE is ON
# For cross-compiled ARM64 binaries, there are too many warnings to fix, hence ignore warnings for now
if (onnxruntime_DEV_MODE AND NOT CMAKE_CROSSCOMPILING)
# treat warnings as errors
list(APPEND ORT_WARNING_FLAGS "/WX")
foreach(type EXE STATIC SHARED)
set(CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS} /WX")
endforeach()
endif()
endif()

# set linker flags to minimize the binary size.
Expand Down Expand Up @@ -901,7 +912,6 @@ if (WIN32)
else()
add_definitions(-DPLATFORM_POSIX)
check_cxx_compiler_flag(-Wunused-but-set-variable HAS_UNUSED_BUT_SET_VARIABLE)
check_cxx_compiler_flag(-Wunused-parameter HAS_UNUSED_PARAMETER)
check_cxx_compiler_flag(-Wunused-variable HAS_UNUSED_VARIABLE)
check_cxx_compiler_flag(-Wcast-function-type HAS_CAST_FUNCTION_TYPE)
check_cxx_compiler_flag(-Wparentheses HAS_PARENTHESES)
Expand Down Expand Up @@ -929,9 +939,7 @@ else()
#we may have extra null pointer checkings in debug build, it's not an issue
list(APPEND ORT_WARNING_FLAGS -Wno-nonnull-compare)
endif()
if(HAS_PARENTHESES)
list(APPEND ORT_WARNING_FLAGS -Wno-parentheses)
endif()

if(HAS_AMBIGUOUS_REVERSED_OPERATOR)
list(APPEND ORT_WARNING_FLAGS -Wno-ambiguous-reversed-operator)
endif()
Expand Down Expand Up @@ -1048,6 +1056,10 @@ function(onnxruntime_set_compile_flags target_name)
target_compile_options(${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options -Wall>" "$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wall>")
target_compile_options(${target_name} PRIVATE "$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wextra>")
if(onnxruntime_DEV_MODE)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
#external/protobuf/src/google/protobuf/arena.h:445:18: error: unused parameter 'p'
target_compile_options(${target_name} PRIVATE "-Wno-unused-parameter")
endif()
target_compile_options(${target_name} PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:--compiler-options -Werror>" "$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Werror>")
endif()

Expand Down Expand Up @@ -1520,9 +1532,7 @@ if (onnxruntime_USE_TVM)
set(DISABLED_WARNINGS_FOR_TVM "/wd4100" "/wd4244" "/wd4251" "/wd4267" "/wd4275" "/wd4389" "/wd4456")
else()
set(DISABLED_WARNINGS_FOR_TVM "-Wno-error=ignored-qualifiers" "-Wno-unused-parameter" "-Wno-ignored-qualifiers")
if(HAS_UNUSED_PARAMETER)
list(APPEND DISABLED_WARNINGS_FOR_TVM "-Wno-error=unused-parameter")
endif()
list(APPEND DISABLED_WARNINGS_FOR_TVM "-Wno-error=unused-parameter")
if(HAS_CATCH_VALUE)
#TODO: send a PR to TVM and fix it
list(APPEND DISABLED_WARNINGS_FOR_TVM "-Wno-error=catch-value")
Expand Down
1 change: 0 additions & 1 deletion cmake/onnxruntime_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#pragma once

#cmakedefine HAS_UNUSED_BUT_SET_VARIABLE
#cmakedefine HAS_UNUSED_PARAMETER
#cmakedefine HAS_UNUSED_VARIABLE
#cmakedefine HAS_CAST_FUNCTION_TYPE
#cmakedefine HAS_PARENTHESES
Expand Down
4 changes: 3 additions & 1 deletion cmake/onnxruntime_graph.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ endif()
onnxruntime_add_static_library(onnxruntime_graph ${onnxruntime_graph_lib_src})
add_dependencies(onnxruntime_graph onnx_proto flatbuffers)
onnxruntime_add_include_to_target(onnxruntime_graph onnxruntime_common onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)

if(NOT MSVC)
target_compile_options(onnxruntime_graph PRIVATE "-Wno-parentheses")
endif()
if (onnxruntime_ENABLE_TRAINING)
#TODO: the graph library should focus on ONNX IR, it shouldn't depend on math libraries like MKLML/OpenBlas
target_include_directories(onnxruntime_graph PRIVATE ${MKLML_INCLUDE_DIR})
Expand Down
6 changes: 4 additions & 2 deletions cmake/onnxruntime_opschema_lib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ endif()

onnxruntime_add_static_library(ort_opschema_lib ${contrib_ops_schema_src})
target_compile_options(ort_opschema_lib PRIVATE -D_OPSCHEMA_LIB_=1)

set (OPSCHEMA_LIB_DEPENDENCIES onnx onnx_proto protobuf::libprotobuf flatbuffers)
if(NOT MSVC)
target_compile_options(ort_opschema_lib PRIVATE "-Wno-parentheses")
endif()
set (OPSCHEMA_LIB_DEPENDENCIES onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)

# ${CMAKE_CURRENT_BINARY_DIR} is so that #include "onnxruntime_config.h" is found
target_include_directories(ort_opschema_lib PRIVATE ${ONNXRUNTIME_ROOT} ${ORTTRAINING_ROOT} ${CMAKE_CURRENT_BINARY_DIR})
Expand Down
33 changes: 17 additions & 16 deletions cmake/onnxruntime_providers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ onnxruntime_add_static_library(onnxruntime_providers ${onnxruntime_providers_src

if (MSVC)
target_compile_options(onnxruntime_providers PRIVATE "/bigobj")
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
if(onnxruntime_DEV_MODE AND NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
target_compile_options(onnxruntime_providers PRIVATE "/wd4244")
endif()
endif()
Expand Down Expand Up @@ -336,15 +336,17 @@ if (onnxruntime_USE_CUDA)
foreach(ORT_FLAG ${ORT_WARNING_FLAGS})
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler \"${ORT_FLAG}\">")
endforeach()
if (UNIX)
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler -Wno-reorder>"
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wno-reorder>")
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler -Wno-error=sign-compare>"
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wno-error=sign-compare>")
else()
#mutex.cuh(91): warning C4834: discarding return value of function with 'nodiscard' attribute
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler /wd4834>")
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler /wd4127>")
if (onnxruntime_DEV_MODE)
if (UNIX)
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler -Wno-reorder>"
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wno-reorder>")
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler -Wno-error=sign-compare>"
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wno-error=sign-compare>")
else()
#mutex.cuh(91): warning C4834: discarding return value of function with 'nodiscard' attribute
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler /wd4834>")
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler /wd4127>")
endif()
endif()
onnxruntime_add_include_to_target(onnxruntime_providers_cuda onnxruntime_common onnxruntime_framework onnx onnx_proto ${PROTOBUF_LIB} flatbuffers)
if (onnxruntime_ENABLE_TRAINING OR onnxruntime_ENABLE_TRAINING_OPS)
Expand Down Expand Up @@ -651,6 +653,9 @@ if (onnxruntime_USE_OPENVINO)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/../include/onnxruntime/core/providers/openvino DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/onnxruntime/core/providers)
set_target_properties(onnxruntime_providers_openvino PROPERTIES LINKER_LANGUAGE CXX)
set_target_properties(onnxruntime_providers_openvino PROPERTIES FOLDER "ONNXRuntime")
if(NOT MSVC)
target_compile_options(onnxruntime_providers_openvino PRIVATE "-Wno-parentheses")
endif()
add_dependencies(onnxruntime_providers_openvino onnxruntime_providers_shared ${onnxruntime_EXTERNAL_DEPENDENCIES})
target_include_directories(onnxruntime_providers_openvino SYSTEM PUBLIC ${ONNXRUNTIME_ROOT} ${CMAKE_CURRENT_BINARY_DIR} ${eigen_INCLUDE_DIRS} ${OPENVINO_INCLUDE_DIR_LIST} ${PYTHON_INCLUDE_DIRS})
target_link_libraries(onnxruntime_providers_openvino ${ONNXRUNTIME_PROVIDERS_SHARED} ${OPENVINO_LIB_LIST})
Expand Down Expand Up @@ -1080,13 +1085,9 @@ if (onnxruntime_USE_ROCM)

target_link_libraries(onnxruntime_providers_rocm PRIVATE ${ONNXRUNTIME_ROCM_LIBS})
set_target_properties(onnxruntime_providers_rocm PROPERTIES FOLDER "ONNXRuntime")
target_compile_options(onnxruntime_providers_rocm PRIVATE -Wno-sign-compare -D__HIP_PLATFORM_HCC__=1)
check_cxx_compiler_flag(-Wno-unused-parameter HAS_NO_UNUSED_PARAMETER)
if (HAS_NO_UNUSED_PARAMETER)
if(NOT MSVC)
target_compile_options(onnxruntime_providers_rocm PRIVATE -Wno-sign-compare -D__HIP_PLATFORM_HCC__=1)
target_compile_options(onnxruntime_providers_rocm PRIVATE -Wno-unused-parameter)
endif()
check_cxx_compiler_flag(-Wno-undefined-var-template HAS_NO_UNDEFINED_VAR_TEMPLATE)
if (HAS_NO_UNDEFINED_VAR_TEMPLATE)
target_compile_options(onnxruntime_providers_rocm PRIVATE -Wno-undefined-var-template)
endif()
# During transition to separate hipFFT repo, put hipfft/include early
Expand Down
3 changes: 3 additions & 0 deletions cmake/onnxruntime_session.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ onnxruntime_add_include_to_target(onnxruntime_session onnxruntime_common onnxrun
if(onnxruntime_ENABLE_INSTRUMENT)
target_compile_definitions(onnxruntime_session PUBLIC ONNXRUNTIME_ENABLE_INSTRUMENT)
endif()
if(NOT MSVC)
set_source_files_properties(${ONNXRUNTIME_ROOT}/core/session/environment.cc PROPERTIES COMPILE_FLAGS "-Wno-parentheses")
endif()
target_include_directories(onnxruntime_session PRIVATE ${ONNXRUNTIME_ROOT} ${eigen_INCLUDE_DIRS})
target_link_libraries(onnxruntime_session PRIVATE nlohmann_json::nlohmann_json)
if(onnxruntime_ENABLE_EXTENSION_CUSTOM_OPS)
Expand Down
20 changes: 6 additions & 14 deletions cmake/onnxruntime_unittests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -664,20 +664,19 @@ AddTest(
TARGET onnxruntime_test_all
SOURCES ${all_tests} ${onnxruntime_unittest_main_src}
LIBS
onnx_test_runner_common ${onnxruntime_test_providers_libs} ${onnxruntime_test_common_libs} re2::re2
onnx_test_runner_common ${onnxruntime_test_providers_libs} ${onnxruntime_test_common_libs}
onnx_test_data_proto nlohmann_json::nlohmann_json
DEPENDS ${all_dependencies}
)

if(NOT MSVC)
target_compile_options(onnxruntime_test_all PRIVATE "-Wno-parentheses")
endif()
# the default logger tests conflict with the need to have an overall default logger
# so skip in this type of
target_compile_definitions(onnxruntime_test_all PUBLIC -DSKIP_DEFAULT_LOGGER_TESTS)
if (CMAKE_SYSTEM_NAME STREQUAL "iOS")
target_compile_definitions(onnxruntime_test_all_xc PUBLIC -DSKIP_DEFAULT_LOGGER_TESTS)
endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
target_compile_options(onnxruntime_test_all PUBLIC "-Wno-unused-const-variable")
endif()
if(onnxruntime_RUN_MODELTEST_IN_DEBUG_MODE)
target_compile_definitions(onnxruntime_test_all PUBLIC -DRUN_MODELTEST_IN_DEBUG_MODE)
endif()
Expand Down Expand Up @@ -713,15 +712,8 @@ target_compile_definitions(onnx_test_data_proto PRIVATE "-DONNX_API=")
if(WIN32)
target_compile_options(onnx_test_data_proto PRIVATE "/wd4125" "/wd4456" "/wd4100" "/wd4267" "/wd6011" "/wd6387" "/wd28182")
else()
if(HAS_UNUSED_PARAMETER)
target_compile_options(onnx_test_data_proto PRIVATE "-Wno-unused-parameter")
endif()
if(HAS_UNUSED_VARIABLE)
target_compile_options(onnx_test_data_proto PRIVATE "-Wno-unused-variable")
endif()
if(HAS_UNUSED_BUT_SET_VARIABLE)
target_compile_options(onnx_test_data_proto PRIVATE "-Wno-unused-but-set-variable")
endif()
#Once we upgrade protobuf to 3.17.3+, we can remove this
target_compile_options(onnx_test_data_proto PRIVATE "-Wno-unused-parameter")
endif()
add_dependencies(onnx_test_data_proto onnx_proto ${onnxruntime_EXTERNAL_DEPENDENCIES})
onnxruntime_add_include_to_target(onnx_test_data_proto onnx_proto)
Expand Down
19 changes: 6 additions & 13 deletions cmake/tensorboard/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,19 @@ foreach(_proto ${tensorboard_proto_srcs})
list(APPEND tensorboard_cpp_srcs ${_tensorboard_cpp_srcs})
endforeach()

add_library(tensorboard ${tensorboard_cpp_srcs})
onnxruntime_add_static_library(tensorboard ${tensorboard_cpp_srcs})
target_include_directories(tensorboard PUBLIC $<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES> "${CMAKE_CURRENT_BINARY_DIR}")
target_compile_definitions(tensorboard PUBLIC $<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_COMPILE_DEFINITIONS>)

if(NOT WIN32)
if(HAS_UNUSED_PARAMETER)
target_compile_options(tensorboard PRIVATE "-Wno-unused-parameter")
endif()
if(WIN32)
target_compile_options(tensorboard PRIVATE /wd4100 /wd4996 /wd4244 /wd4267 /wd4309)
set_target_properties(tensorboard PROPERTIES FOLDER "External/tensorboard")
else()
target_compile_options(tensorboard PRIVATE "-Wno-unused-parameter")
if(HAS_UNUSED_BUT_SET_VARIABLE)
target_compile_options(tensorboard PRIVATE "-Wno-unused-but-set-variable")
endif()
endif()
if(UNIX)
target_compile_options(tensorboard PRIVATE "-Wno-unused-variable")
target_compile_options(tensorboard PRIVATE "-Wno-deprecated-declarations")
endif()

if(WIN32)
target_compile_options(tensorboard PRIVATE /wd4100 /wd4996 /wd4244 /wd4267 /wd4309)
endif()


set_target_properties(tensorboard PROPERTIES FOLDER "External/tensorboard")
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.15.8" />
<PackageReference Include="Google.Protobuf" Version="3.16.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.Targets" Version="2.1.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.5.2" />
<PackageReference Include="Google.Protobuf" Version="3.15.8" />
<PackageReference Include="Google.Protobuf" Version="3.16.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
Expand Down
Loading

0 comments on commit 0510688

Please sign in to comment.