mirror of
https://github.com/opencv/opencv.git
synced 2026-11-09 18:04:29 -06:00
Merge pull request #30567 from pratham-mcw:windows-arm64-clangcl
Enable clang-cl build on Windows ARM64 with KleidiCV HAL
This commit is contained in:
@@ -179,7 +179,7 @@ OCV_OPTION(WITH_CAP_IOS "Enable iOS video capture" ON
|
||||
OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" (NOT CV_DISABLE_OPTIMIZATION)
|
||||
VISIBLE_IF (ARM OR AARCH64) AND NOT IOS AND NOT XROS)
|
||||
OCV_OPTION(WITH_KLEIDICV "Use KleidiCV library for ARM platforms" (NOT CV_DISABLE_OPTIMIZATION)
|
||||
VISIBLE_IF (AARCH64 AND (ANDROID OR UNIX)))
|
||||
VISIBLE_IF (AARCH64 AND (ANDROID OR UNIX OR CV_CLANG_CL)))
|
||||
OCV_OPTION(WITH_NDSRVP "Use Andes RVP extension" (NOT CV_DISABLE_OPTIMIZATION)
|
||||
VISIBLE_IF RISCV)
|
||||
OCV_OPTION(WITH_HAL_RVV "Use HAL RVV optimizations" (NOT CV_DISABLE_OPTIMIZATION)
|
||||
|
||||
@@ -320,7 +320,7 @@ if(MSVC)
|
||||
set(OPENCV_EXTRA_CXX_FLAGS "${OPENCV_EXTRA_CXX_FLAGS} /FS")
|
||||
endif()
|
||||
|
||||
if(AARCH64 AND NOT MSVC_VERSION LESS 1930)
|
||||
if(AARCH64 AND NOT MSVC_VERSION LESS 1930 AND NOT CV_CLANG_CL)
|
||||
set(OPENCV_EXTRA_FLAGS "${OPENCV_EXTRA_FLAGS} /D _ARM64_DISTINCT_NEON_TYPES")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Compilers:
|
||||
# - CV_GCC - GNU compiler (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
# - CV_CLANG - Clang-compatible compiler (CMAKE_CXX_COMPILER_ID MATCHES "Clang" - Clang or AppleClang, see CMP0025)
|
||||
# - CV_CLANG_CL - clang-cl, Clang with MSVC-compatible command line (CV_CLANG AND MSVC)
|
||||
# - CV_ICC - Intel compiler
|
||||
# - MSVC - Microsoft Visual Compiler (CMake variable)
|
||||
# - MINGW / CYGWIN / CMAKE_COMPILER_IS_MINGW / CMAKE_COMPILER_IS_CYGWIN (CMake original variables)
|
||||
@@ -29,6 +30,9 @@ endif()
|
||||
if(NOT DEFINED CV_CLANG AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") # Clang or AppleClang (see CMP0025)
|
||||
set(CV_CLANG 1)
|
||||
endif()
|
||||
if(NOT DEFINED CV_CLANG_CL AND CV_CLANG AND MSVC)
|
||||
set(CV_CLANG_CL 1)
|
||||
endif()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
@@ -44,7 +44,7 @@ if(WITH_NEON)
|
||||
target_compile_definitions(carotene_objs PRIVATE "-DWITH_NEON")
|
||||
endif()
|
||||
|
||||
if(MINGW)
|
||||
if(MINGW OR CV_CLANG_CL)
|
||||
target_compile_definitions(carotene_objs PRIVATE "-D_USE_MATH_DEFINES=1")
|
||||
endif()
|
||||
|
||||
|
||||
@@ -9,4 +9,11 @@ if(HAVE_KLEIDICV)
|
||||
$<TARGET_PROPERTY:kleidicv,COMPILE_OPTIONS>
|
||||
"-Wno-old-style-cast" "-Wno-unused-function"
|
||||
)
|
||||
if(CV_CLANG_CL)
|
||||
foreach(_kleidicv_tgt kleidicv kleidicv_neon kleidicv_thread kleidicv_sve2 kleidicv_sme kleidicv_sme2 kleidicv_hal)
|
||||
if(TARGET ${_kleidicv_tgt})
|
||||
target_compile_options(${_kleidicv_tgt} PRIVATE "-Wno-everything")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -177,6 +177,10 @@ if(HAVE_CUDA)
|
||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wenum-compare -Wunused-function -Wshadow)
|
||||
endif()
|
||||
|
||||
if(CV_CLANG_CL AND AARCH64)
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/src/persistence.cpp" PROPERTIES COMPILE_OPTIONS "/O1")
|
||||
endif()
|
||||
|
||||
ocv_create_module(${extra_libs})
|
||||
|
||||
ocv_target_link_libraries(${the_module} PRIVATE
|
||||
|
||||
@@ -22,6 +22,10 @@ ocv_glob_module_sources()
|
||||
ocv_module_include_directories()
|
||||
ocv_create_module()
|
||||
|
||||
if(CV_CLANG_CL AND AARCH64)
|
||||
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/src/ts_gtest.cpp" PROPERTIES COMPILE_OPTIONS "/O1")
|
||||
endif()
|
||||
|
||||
# generate config file
|
||||
set(OPENCV_TESTS_CONFIG_FILE "${CMAKE_BINARY_DIR}/opencv_tests_config.hpp")
|
||||
set(OPENCV_TESTS_CONFIG_STR "")
|
||||
|
||||
Reference in New Issue
Block a user