@ -3,15 +3,14 @@
# - C V _ C L A N G - C l a n g - c o m p a t i b l e compiler ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" - Clang or AppleClang, see CMP0025 )
# - C V _ I C C - I n t e l c o m p i l e r
# - MSVC - M i c r o s o f t V i s u a l Compiler ( CMake variable )
# - M S V C 6 4 - a d d i t i o n a l f l a g , 6 4 - b i t
# - MINGW / CYGWIN / C M A K E _ C O M P I L E R _ I S _ M I N G W / CMAKE_COMPILER_IS_CYGWIN ( CMake original variables )
# - M I N G W 6 4 - 6 4 - b i t
#
# C P U P l a t f o r m s :
# - X 8 6 / X 8 6 _ 6 4
# - A R M - A R M C P U , n o t d e f i n e d f o r A A r c h 6 4
# - A A R C H 6 4 - A R M v 8 + ( 6 4 - b i t )
# - P P C 6 4 / P P C 6 4 L E - P o w e r P C
# - M I P S
#
# O S :
# - WIN32 - W i n d o w s | MINGW
@ -21,9 +20,8 @@
# - APPLE - M a c O S X | i O S
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ( CMAKE_CL_64 )
set ( MSVC64 1 )
endif ( )
ocv_declare_removed_variables ( MINGW64 MSVC64 )
# d o n o t use ( CMake variables ) : C M A K E _ C L _ 6 4
if ( NOT DEFINED CV_GCC AND CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
set ( CV_GCC 1 )
@ -51,7 +49,7 @@ variable_watch(CMAKE_COMPILER_IS_CLANGCC access_CMAKE_COMPILER_IS_CLANGCXX)
# D e t e c t I n t e l I C C c o m p i l e r
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if ( UNIX )
if ( __ICL )
if ( __ICL )
set ( CV_ICC __ICL )
elseif ( __ICC )
set ( CV_ICC __ICC )
@ -70,53 +68,65 @@ if(MSVC AND CMAKE_C_COMPILER MATCHES "icc|icl")
set ( CV_ICC __INTEL_COMPILER_FOR_WINDOWS )
endif ( )
if ( NOT DEFINED CMAKE_CXX_COMPILER_VERSION )
message ( WARNING "Compiler version is not available: CMAKE_CXX_COMPILER_VERSION is not set" )
if ( NOT DEFINED CMAKE_CXX_COMPILER_VERSION
A N D N O T O P E N C V _ S U P P R E S S _ M E S S A G E _ M I S S I N G _ C O M P I L E R _ V E R S I O N )
message ( WARNING "OpenCV: Compiler version is not available: CMAKE_CXX_COMPILER_VERSION is not set" )
endif ( )
if ( WIN32 AND CV_GCC )
execute_process ( COMMAND ${ CMAKE_CXX_COMPILER } -dumpmachine
O U T P U T _ V A R I A B L E O P E N C V _ G C C _ T A R G E T _ M A C H I N E
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
if ( OPENCV_GCC_TARGET_MACHINE MATCHES "amd64|x86_64|AMD64" )
set ( MINGW64 1 )
endif ( )
if ( ( NOT DEFINED CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR STREQUAL "" )
A N D N O T O P E N C V _ S U P P R E S S _ M E S S A G E _ M I S S I N G _ C M A K E _ S Y S T E M _ P R O C E S S O R )
message ( WARNING "OpenCV: CMAKE_SYSTEM_PROCESSOR is not defined. Perhaps CMake toolchain is broken" )
endif ( )
if ( NOT DEFINED CMAKE_SIZEOF_VOID_P
A N D N O T O P E N C V _ S U P P R E S S _ M E S S A G E _ M I S S I N G _ C M A K E _ S I Z E O F _ V O I D _ P )
message ( WARNING "OpenCV: CMAKE_SIZEOF_VOID_P is not defined. Perhaps CMake toolchain is broken" )
endif ( )
message ( STATUS "Detected processor: ${CMAKE_SYSTEM_PROCESSOR}" )
if ( MSVC64 OR MINGW64 )
set ( X86_64 1 )
elseif ( MINGW OR ( MSVC AND NOT CMAKE_CROSSCOMPILING ) )
set ( X86 1 )
if ( OPENCV_SKIP_SYSTEM_PROCESSOR_DETECTION )
# c u s t o m s e t u p : r e q u i r e d v a r i a b l e s a r e p a s s e d t h r o u g h c a c h e / C M a k e ' s c o m m a n d - l i n e
elseif ( CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*" )
set ( X86_64 1 )
elseif ( CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.* " )
elseif ( CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*" )
set ( X86 1 )
elseif ( CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)" )
set ( AARCH64 1 )
elseif ( CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)" )
set ( ARM 1 )
elseif ( CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)" )
set ( AARCH64 1 )
elseif ( CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le" )
set ( PPC64LE 1 )
elseif ( CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64" )
set ( PPC64 1 )
elseif ( CMAKE_SYSTEM_PROCESSOR MATCHES "^(mips.*|MIPS.*)" )
set ( MIPS 1 )
else ( )
if ( NOT OPENCV_SUPPRESS_MESSAGE_UNRECOGNIZED_SYSTEM_PROCESSOR )
message ( WARNING "OpenCV: unrecognized target processor configuration" )
endif ( )
endif ( )
# W o r k a r o u n d f o r 3 2 - b i t o p e r a t i n g s y s t e m s o n x 8 6 _ 6 4 / a a r c h 6 4 p r o c e s s o r
if ( CMAKE_SIZEOF_VOID_P EQUAL 4 AND NOT FORCE_X86_64 )
# W o r k a r o u n d f o r 3 2 - b i t o p e r a t i n g s y s t e m s o n x 8 6 _ 6 4
if ( CMAKE_SIZEOF_VOID_P EQUAL 4 AND X86_64
A N D N O T F O R C E _ X 8 6 _ 6 4 # deprecated ( 2019-12 )
A N D N O T O P E N C V _ F O R C E _ X 8 6 _ 6 4
)
message ( STATUS "sizeof(void) = 4 on 64 bit processor. Assume 32-bit compilation mode" )
if ( X86_64 )
if ( X86_64 )
unset ( X86_64 )
set ( X86 1 )
endif ( )
if ( AARCH64 )
endif ( )
# W o r k a r o u n d f o r 3 2 - b i t o p e r a t i n g s y s t e m s o n a a r c h 6 4 p r o c e s s o r
if ( CMAKE_SIZEOF_VOID_P EQUAL 4 AND AARCH64
A N D N O T O P E N C V _ F O R C E _ A A R C H 6 4
)
message ( STATUS "sizeof(void) = 4 on 64 bit processor. Assume 32-bit compilation mode" )
if ( AARCH64 )
unset ( AARCH64 )
set ( ARM 1 )
endif ( )
endif ( )
# S i m i l a r c o d e e x i s t s i n O p e n C V C o n f i g . c m a k e
if ( NOT DEFINED OpenCV_STATIC )
# l o o k f o r g l o b a l s e t t i n g
@ -130,14 +140,19 @@ endif()
if ( DEFINED OpenCV_ARCH AND DEFINED OpenCV_RUNTIME )
# c u s t o m o v e r r i d d e n v a l u e s
elseif ( MSVC )
if ( CMAKE_CL_64 )
set ( OpenCV_ARCH x64 )
elseif ( ( CMAKE_GENERATOR MATCHES "ARM" ) OR ( "${arch_hint}" STREQUAL "ARM" ) OR ( CMAKE_VS_EFFECTIVE_PLATFORMS MATCHES "ARM|arm" ) )
# s e e M o d u l e s / C m a k e G e n e r i c S y s t e m . c m a k e
set ( OpenCV_ARCH ARM )
# s e e M o d u l e s / C M a k e G e n e r i c S y s t e m . c m a k e
if ( "${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)" )
set ( arch_hint "x64" )
elseif ( "${CMAKE_GENERATOR_PLATFORM}" MATCHES "ARM64" )
set ( arch_hint "ARM64" )
elseif ( "${CMAKE_GENERATOR}" MATCHES "ARM" )
set ( arch_hint "ARM" )
elseif ( "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8" )
set ( arch_hint "x64" )
else ( )
set ( OpenCV_ARCH x86 )
endif ( )
if ( MSVC_VERSION EQUAL 1400 )
set ( OpenCV_RUNTIME vc8 )
elseif ( MSVC_VERSION EQUAL 1500 )
@ -160,7 +175,7 @@ elseif(MSVC)
elseif ( MINGW )
set ( OpenCV_RUNTIME mingw )
if ( MINGW64 )
if ( CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*" )
set ( OpenCV_ARCH x64 )
else ( )
set ( OpenCV_ARCH x86 )