未验证 提交 8eee89d7 编写于 作者: T Twice 提交者: GitHub

cmake: include third party headers as system headers to avoid warnings (#5879)

Co-authored-by: Noneflow-ci-bot <69100618+oneflow-ci-bot@users.noreply.github.com>
上级 daa45910
......@@ -25,8 +25,6 @@ execute_process(
include_directories(${CFG_INCLUDE_DIR})
list(APPEND ONEFLOW_INCLUDE_SRC_DIRS ${CFG_INCLUDE_DIR})
function(GENERATE_CFG_AND_PYBIND11_CPP SRCS HDRS PYBIND_SRCS ROOT_DIR)
list(APPEND CFG_SOURCE_FILE_CONVERT_PROTO
oneflow/core/common/error.proto
......
......@@ -52,10 +52,6 @@ function(target_treat_warnings_as_errors target)
# disable for pointer operations of intrusive linked lists
target_try_compile_options(${target} -Wno-error=array-bounds)
# avoid check of memcpy for non-trivial types in opencv headers
target_try_compile_options(${target} -Wno-error=class-memaccess)
endif()
endfunction()
......@@ -369,7 +365,7 @@ set(ONEFLOW_INCLUDE_DIR "${ONEFLOW_PYTHON_DIR}/oneflow/include")
add_custom_target(of_include_copy
COMMAND ${CMAKE_COMMAND} -E remove_directory "${ONEFLOW_INCLUDE_DIR}" && ${CMAKE_COMMAND} -E make_directory "${ONEFLOW_INCLUDE_DIR}")
add_dependencies(of_include_copy oneflow_internal)
foreach(of_include_src_dir ${ONEFLOW_INCLUDE_SRC_DIRS})
foreach(of_include_src_dir ${ONEFLOW_THIRD_PARTY_INCLUDE_DIRS} ${CFG_INCLUDE_DIR})
set(oneflow_all_include_file)
file(GLOB_RECURSE oneflow_all_include_file "${of_include_src_dir}/*.*")
copy_files("${oneflow_all_include_file}" "${of_include_src_dir}" "${ONEFLOW_INCLUDE_DIR}" of_include_copy)
......
......@@ -181,7 +181,7 @@ if (RPC_BACKEND MATCHES "GRPC")
list(APPEND oneflow_third_party_dependencies grpc)
endif()
list(APPEND ONEFLOW_INCLUDE_SRC_DIRS
list(APPEND ONEFLOW_THIRD_PARTY_INCLUDE_DIRS
${ZLIB_INCLUDE_DIR}
${GFLAGS_INCLUDE_DIR}
${GLOG_INCLUDE_DIR}
......@@ -203,7 +203,7 @@ list(APPEND ONEFLOW_INCLUDE_SRC_DIRS
)
if (NOT WITH_XLA)
list(APPEND ONEFLOW_INCLUDE_SRC_DIRS ${RE2_INCLUDE_DIR})
list(APPEND ONEFLOW_THIRD_PARTY_INCLUDE_DIRS ${RE2_INCLUDE_DIR})
endif()
if (BUILD_CUDA)
......@@ -217,7 +217,7 @@ if (BUILD_CUDA)
list(APPEND oneflow_third_party_dependencies cub_copy_headers_to_destination)
list(APPEND oneflow_third_party_dependencies nccl)
list(APPEND ONEFLOW_INCLUDE_SRC_DIRS
list(APPEND ONEFLOW_THIRD_PARTY_INCLUDE_DIRS
${CUDNN_INCLUDE_DIRS}
${CUB_INCLUDE_DIR}
${NCCL_INCLUDE_DIR}
......@@ -243,11 +243,11 @@ if(BUILD_HWLOC)
list(APPEND oneflow_third_party_dependencies hwloc)
list(APPEND oneflow_third_party_libs ${HWLOC_STATIC_LIBRARIES})
list(APPEND oneflow_third_party_libs ${PCIACCESS_STATIC_LIBRARIES})
list(APPEND ONEFLOW_INCLUDE_SRC_DIRS ${HWLOC_INCLUDE_DIR})
list(APPEND ONEFLOW_THIRD_PARTY_INCLUDE_DIRS ${HWLOC_INCLUDE_DIR})
add_definitions(-DWITH_HWLOC)
endif()
include_directories(${ONEFLOW_INCLUDE_SRC_DIRS})
include_directories(SYSTEM ${ONEFLOW_THIRD_PARTY_INCLUDE_DIRS})
if(WITH_XLA)
list(APPEND oneflow_third_party_dependencies tensorflow_copy_libs_to_destination)
......
......@@ -85,7 +85,7 @@ void GatherKernelUtilImpl<DeviceType::kCPU, T, K>::Forward(DeviceCtx* ctx, const
const T* from = in + outer_idx * gather_dim_size * inner_dim_size + idx * inner_dim_size;
std::copy(from, from + inner_dim_size, to);
} else {
std::memset(to, 0, inner_dim_size * sizeof(K));
std::memset(reinterpret_cast<void*>(to), 0, inner_dim_size * sizeof(K));
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册