diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 6edda8136b338f..117cf5d2765e6f 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -35,7 +35,20 @@ if(THREADING STREQUAL "OMP") SHA256 "591ea4a7e08bbe0062648916f42bded71d24c27f00af30a8f31a29b5878ea0cc" USE_NEW_LOCATION TRUE) else() - message(FATAL_ERROR "Intel OMP is not available on current platform") + message(WARNING "Pre-built Intel OMP is not available on current platform. System OMP will be used.") + find_package(OpenMP) + if(OpenMP_CXX_FOUND) + foreach(OpenMP_LIB ${OpenMP_CXX_LIBRARIES}) + string(FIND ${OpenMP_LIB} "omp" OpenMP_LIB_OMP_INDEX) + if(NOT OpenMP_LIB_OMP_INDEX EQUAL -1) + cmake_path(GET OpenMP_LIB PARENT_PATH OpenMP_LIB_DIR) + set(OMP_LIB ${OpenMP_LIB} CACHE FILEPATH "Path to OMP library") + set(OMP ${OpenMP_LIB_DIR} CACHE FILEPATH "Path to OMP root folder") + return() + endif() + endforeach() + endif() + message(FATAL_ERROR "System OpenMP has not been found") endif() update_deps_cache(OMP "${OMP}" "Path to OMP root folder") debug_message(STATUS "intel_omp=" ${OMP}) diff --git a/cmake/developer_package/compile_flags/sdl.cmake b/cmake/developer_package/compile_flags/sdl.cmake index d399ec4f62fe0d..4bc0edd33c4975 100644 --- a/cmake/developer_package/compile_flags/sdl.cmake +++ b/cmake/developer_package/compile_flags/sdl.cmake @@ -29,7 +29,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG OR OV_COMPILER_IS_INTEL_LLVM # Remove all symbol table and relocation information from the executable set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -s") endif() - if(NOT MINGW) + if(NOT MINGW AND NOT APPLE) set(OV_LINKER_FLAGS "${OV_LINKER_FLAGS} -z noexecstack -z relro -z now") endif() elseif(OV_COMPILER_IS_CLANG OR OV_COMPILER_IS_INTEL_LLVM) diff --git a/cmake/developer_package/plugins/plugins.cmake b/cmake/developer_package/plugins/plugins.cmake index c76ed82388f3cc..4be67e24cdb6c7 100644 --- a/cmake/developer_package/plugins/plugins.cmake +++ b/cmake/developer_package/plugins/plugins.cmake @@ -93,7 +93,11 @@ function(ov_add_plugin) endif() if(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CROSSCOMPILING) - target_link_options(${OV_PLUGIN_NAME} PRIVATE -Wl,--unresolved-symbols=ignore-in-shared-libs) + if (APPLE) + target_link_options(${OV_PLUGIN_NAME} PRIVATE -Wl,-undefined,dynamic_lookup) + else() + target_link_options(${OV_PLUGIN_NAME} PRIVATE -Wl,--unresolved-symbols=ignore-in-shared-libs) + endif() endif() set(custom_filter "") diff --git a/cmake/features.cmake b/cmake/features.cmake index 4063e2f8545ced..59dd3b286f0cc1 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -92,10 +92,7 @@ else() set(THREADING_DEFAULT "TBB") endif() -set(THREADING_OPTIONS "TBB" "TBB_AUTO" "SEQ") -if(NOT APPLE) - list(APPEND THREADING_OPTIONS "OMP") -endif() +set(THREADING_OPTIONS "TBB" "TBB_AUTO" "SEQ" "OMP") set(THREADING "${THREADING_DEFAULT}" CACHE STRING "Threading") set_property(CACHE THREADING PROPERTY STRINGS ${THREADING_OPTIONS}) diff --git a/src/cmake/ov_parallel.cmake b/src/cmake/ov_parallel.cmake index 0f5be2ed43518a..cfb69ce7b1445f 100644 --- a/src/cmake/ov_parallel.cmake +++ b/src/cmake/ov_parallel.cmake @@ -329,6 +329,11 @@ function(ov_set_threading_interface_for TARGET_NAME) elseif (THREADING STREQUAL "OMP") if (WIN32) set(omp_lib_name libiomp5md) + elseif (ARM OR AARCH64) + get_filename_component(OpenMP_CXX_LIB_NAME ${OMP_LIB} NAME) + string(REGEX REPLACE "^lib" "" OpenMP_CXX_LIB_NAME ${OpenMP_CXX_LIB_NAME}) + string(REGEX REPLACE "\\.[^.]*$" "" OpenMP_CXX_LIB_NAME ${OpenMP_CXX_LIB_NAME}) + set(omp_lib_name ${OpenMP_CXX_LIB_NAME}) else () set(omp_lib_name iomp5) endif () @@ -343,7 +348,11 @@ function(ov_set_threading_interface_for TARGET_NAME) set(lib_dbg_path ${lib_rel_path}) endif () else () - set(lib_rel_path ${OMP}/lib) + if (ARM OR AARCH64) + set(lib_rel_path ${OMP}) + else() + set(lib_rel_path ${OMP}/lib) + endif () set(lib_dbg_path ${lib_rel_path}) endif () diff --git a/src/plugins/intel_cpu/thirdparty/ACLConfig.cmake b/src/plugins/intel_cpu/thirdparty/ACLConfig.cmake index 09774aa4bec493..a142b5277202e5 100644 --- a/src/plugins/intel_cpu/thirdparty/ACLConfig.cmake +++ b/src/plugins/intel_cpu/thirdparty/ACLConfig.cmake @@ -264,6 +264,16 @@ elseif(NOT TARGET arm_compute::arm_compute) get_filename_component(toolchain_prefix "${CMAKE_CXX_COMPILER}" DIRECTORY) list(APPEND ARM_COMPUTE_OPTIONS toolchain_prefix="${toolchain_prefix}/") elseif(APPLE) + # we need to bypass this information in case of custom compiler is passed + # to cmake call. Such compiler and compiler prefix need to be passed to scons + get_filename_component(cxx_compiler "${CMAKE_CXX_COMPILER}" NAME) + get_filename_component(c_compiler "${CMAKE_C_COMPILER}" NAME) + get_filename_component(compiler_prefix "${CMAKE_CXX_COMPILER}" DIRECTORY) + + set(cmake_build_env + CC=${c_compiler} + CXX=${cxx_compiler}) + if(CMAKE_OSX_DEPLOYMENT_TARGET) set(extra_cxx_flags "${extra_cxx_flags} -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}") set(minos_added ON) @@ -275,8 +285,9 @@ elseif(NOT TARGET arm_compute::arm_compute) endif() set(extra_cxx_flags "${extra_cxx_flags} --sysroot ${CMAKE_OSX_SYSROOT}") endif() - - set(extra_cxx_flags "${extra_cxx_flags} -Wno-error=return-stack-address") + if(OV_COMPILER_IS_CLANG) + set(extra_cxx_flags "${extra_cxx_flags} -Wno-error=return-stack-address") + endif() get_filename_component(compiler_prefix "${CMAKE_CXX_COMPILER}" DIRECTORY) list(APPEND ARM_COMPUTE_OPTIONS compiler_prefix="${compiler_prefix}/")