From 20419905c342cb800ea2c4d8fd20b454df2e608d Mon Sep 17 00:00:00 2001 From: Ilya Lavrenov Date: Tue, 15 Nov 2022 22:59:27 +0400 Subject: [PATCH] Fixed compilation with gcc-12 (#13983) * Fixed compilation with gcc-12 * Made python to be a mandatory dependency for gpu plugin * Apply suggestions from code review --- cmake/developer_package/target_flags.cmake | 4 ---- src/common/preprocessing/CMakeLists.txt | 2 +- src/plugins/intel_cpu/thirdparty/CMakeLists.txt | 2 +- .../intel_gpu/src/kernel_selector/CMakeLists.txt | 11 +++-------- src/plugins/intel_gpu/thirdparty/CMakeLists.txt | 7 +++++-- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/cmake/developer_package/target_flags.cmake b/cmake/developer_package/target_flags.cmake index 61e534c19c8..2cab5281b0e 100644 --- a/cmake/developer_package/target_flags.cmake +++ b/cmake/developer_package/target_flags.cmake @@ -81,8 +81,4 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$") set(OV_COMPILER_IS_CLANG ON) endif() -if(CMAKE_CXX_COMPILER MATCHES ".*conda.*") - set(OV_COMPILER_IS_CONDA ON) -endif() - get_property(OV_GENERATOR_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) diff --git a/src/common/preprocessing/CMakeLists.txt b/src/common/preprocessing/CMakeLists.txt index 09c708dd99d..2b75c127cd8 100644 --- a/src/common/preprocessing/CMakeLists.txt +++ b/src/common/preprocessing/CMakeLists.txt @@ -25,7 +25,7 @@ macro(ie_avx512_core_optimization_flags flags) set(${flags} -xCORE-AVX512) else() set(${flags} -mavx512f -mavx512bw -mavx512dq -mfma) - if(OV_COMPILER_IS_CONDA) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12) list(APPEND ${flags} -Wno-error=maybe-uninitialized -Wno-maybe-uninitialized) endif() endif() diff --git a/src/plugins/intel_cpu/thirdparty/CMakeLists.txt b/src/plugins/intel_cpu/thirdparty/CMakeLists.txt index c68380e128d..18edb7bfb2a 100644 --- a/src/plugins/intel_cpu/thirdparty/CMakeLists.txt +++ b/src/plugins/intel_cpu/thirdparty/CMakeLists.txt @@ -56,7 +56,7 @@ function(ie_add_onednn) if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG) ie_add_compiler_flags(-Wno-undef) ie_add_compiler_flags(-Wno-missing-declarations) - if(OV_COMPILER_IS_CONDA) + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12 AND CMAKE_COMPILER_IS_GNUCXX) ie_add_compiler_flags(-Wno-error=array-bounds) ie_add_compiler_flags(-Wno-error=stringop-overflow=) endif() diff --git a/src/plugins/intel_gpu/src/kernel_selector/CMakeLists.txt b/src/plugins/intel_gpu/src/kernel_selector/CMakeLists.txt index 05d543c4774..06ecceae019 100644 --- a/src/plugins/intel_gpu/src/kernel_selector/CMakeLists.txt +++ b/src/plugins/intel_gpu/src/kernel_selector/CMakeLists.txt @@ -4,12 +4,7 @@ set(TARGET_NAME "openvino_intel_gpu_kernels") -find_host_package(PythonInterp 3 QUIET) -if(NOT PYTHONINTERP_FOUND) - message(WARNING "[clDNN] Project requires Python 3.x interpreter to build (with python loader). CMake could not detect it correctly. - If you have installed this interpreter, please disregard this warning or specify PYTHON_EXECUTABLE in CMake command-line." - ) -endif() +find_host_package(PythonInterp 3 REQUIRED) file(GLOB_RECURSE LIBRARY_SRC "${CMAKE_CURRENT_SOURCE_DIR}/*.h" @@ -81,13 +76,13 @@ set_target_properties(${TARGET_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_REL if(WIN32) target_link_libraries(${TARGET_NAME} PRIVATE setupapi) -elseif((NOT ANDROID) AND (UNIX)) +elseif((NOT ANDROID) AND UNIX) target_link_libraries(${TARGET_NAME} PRIVATE pthread) endif() if(WIN32) set(TUNING_CACHE_PATH "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$") -else((NOT ANDROID) AND (UNIX)) +else() set(TUNING_CACHE_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/") endif() diff --git a/src/plugins/intel_gpu/thirdparty/CMakeLists.txt b/src/plugins/intel_gpu/thirdparty/CMakeLists.txt index cef26d50ecc..5ad0f7f14cb 100644 --- a/src/plugins/intel_gpu/thirdparty/CMakeLists.txt +++ b/src/plugins/intel_gpu/thirdparty/CMakeLists.txt @@ -23,8 +23,11 @@ if(ENABLE_ONEDNN_FOR_GPU) execute_process(COMMAND git apply --verbose ../onednn_gpu.patch WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/onednn_gpu") if(CMAKE_COMPILER_IS_GNUCXX) - ie_add_compiler_flags(-Wno-undef -Wno-suggest-override -Wno-missing-declarations) - if(OV_COMPILER_IS_CONDA) + ie_add_compiler_flags(-Wno-undef -Wno-missing-declarations) + if(SUGGEST_OVERRIDE_SUPPORTED) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-suggest-override") + endif() + if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 12) ie_add_compiler_flags(-Wno-error=array-bounds -Wno-error=stringop-overflow= -Wno-error=unused-result) endif() endif()