2012-02-03 12:26:49 +01:00
|
|
|
if(NOT MSVC)
|
2012-02-03 13:33:48 +01:00
|
|
|
message(FATAL_ERROR "CRT options are available only for MSVC")
|
2012-02-03 12:26:49 +01:00
|
|
|
endif()
|
|
|
|
|
2013-07-19 11:43:05 +02:00
|
|
|
#INCLUDE (CheckIncludeFiles)
|
|
|
|
|
2013-08-15 15:01:38 +02:00
|
|
|
set(HAVE_WINRT FALSE)
|
|
|
|
|
2014-05-08 12:06:06 +02:00
|
|
|
# search Windows (Phone) Platform SDK
|
|
|
|
message(STATUS "Checking for Windows (Phone) Platform SDK 8.0/8.1")
|
|
|
|
unset(WINDOWS_SDK_PATH CACHE)
|
|
|
|
GET_FILENAME_COMPONENT(WINDOWS_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhoneApp\\v8.1;InstallationFolder]" ABSOLUTE CACHE)
|
|
|
|
if((NOT ENABLE_WINPHONESDK81) OR (NOT (MSVC_VERSION EQUAL 1800)) OR (WINDOWS_SDK_PATH STREQUAL ""))
|
|
|
|
unset(WINDOWS_SDK_PATH CACHE)
|
|
|
|
GET_FILENAME_COMPONENT(WINDOWS_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\WindowsPhone\\v8.0;InstallationFolder]" ABSOLUTE CACHE)
|
|
|
|
if((NOT ENABLE_WINPHONESDK80) OR (MSVC_VERSION LESS 1700) OR (WINDOWS_SDK_PATH STREQUAL ""))
|
|
|
|
unset(WINDOWS_SDK_PATH CACHE)
|
|
|
|
GET_FILENAME_COMPONENT(WINDOWS_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]" ABSOLUTE CACHE)
|
|
|
|
if((NOT ENABLE_WINSDK81) OR (NOT (MSVC_VERSION EQUAL 1800)) OR (WINDOWS_SDK_PATH STREQUAL ""))
|
|
|
|
set(HAVE_MSPDK FALSE)
|
|
|
|
unset(WINDOWS_SDK_PATH CACHE)
|
|
|
|
GET_FILENAME_COMPONENT(WINDOWS_SDK_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]" ABSOLUTE CACHE)
|
|
|
|
if(WINDOWS_SDK_PATH STREQUAL "")
|
|
|
|
set(HAVE_MSPDK FALSE)
|
|
|
|
message(STATUS "Windows (Phone) Platform SDK 8.0/8.1 was not found")
|
|
|
|
else()
|
|
|
|
set(HAVE_MSPDK TRUE)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(HAVE_MSPDK TRUE)
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
set(HAVE_MSPDK TRUE)
|
|
|
|
endif()
|
2013-08-15 15:01:38 +02:00
|
|
|
else()
|
|
|
|
set(HAVE_MSPDK TRUE)
|
|
|
|
endif()
|
|
|
|
|
2014-05-08 12:06:06 +02:00
|
|
|
#search for Visual Studio 11.0/12.0 install directory
|
|
|
|
message(STATUS "Checking for Visual Studio 2012/2013")
|
|
|
|
unset(VISUAL_STUDIO_PATH CACHE)
|
|
|
|
GET_FILENAME_COMPONENT(VISUAL_STUDIO_PATH [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Setup\\VS;ProductDir] REALPATH CACHE)
|
|
|
|
if((NOT ENABLE_LIBVS2013) OR (NOT (MSVC_VERSION EQUAL 1800)) OR (VISUAL_STUDIO_PATH STREQUAL ""))
|
|
|
|
set(HAVE_MSVC2013 FALSE)
|
|
|
|
unset(VISUAL_STUDIO_PATH CACHE)
|
|
|
|
GET_FILENAME_COMPONENT(VISUAL_STUDIO_PATH [HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Setup\\VS;ProductDir] REALPATH CACHE)
|
|
|
|
if(VISUAL_STUDIO_PATH STREQUAL "")
|
|
|
|
set(HAVE_MSVC2012 FALSE)
|
|
|
|
message(STATUS "Visual Studio 2012/2013 not found")
|
|
|
|
else()
|
|
|
|
set(HAVE_MSVC2012 TRUE)
|
|
|
|
endif()
|
2013-08-15 15:01:38 +02:00
|
|
|
else()
|
2014-05-08 12:06:06 +02:00
|
|
|
set(HAVE_MSVC2013 TRUE)
|
2013-08-15 15:01:38 +02:00
|
|
|
endif()
|
|
|
|
|
2013-08-22 13:46:13 +02:00
|
|
|
try_compile(HAVE_WINRT_SDK
|
|
|
|
"${OpenCV_BINARY_DIR}"
|
2013-08-15 15:01:38 +02:00
|
|
|
"${OpenCV_SOURCE_DIR}/cmake/checks/winrttest.cpp")
|
|
|
|
|
2014-05-08 12:06:06 +02:00
|
|
|
if(ENABLE_WINRT_MODE AND HAVE_WINRT_SDK AND (HAVE_MSVC2012 OR HAVE_MSVC2013) AND HAVE_MSPDK)
|
2013-08-15 15:01:38 +02:00
|
|
|
set(HAVE_WINRT TRUE)
|
2013-12-22 17:28:50 +01:00
|
|
|
set(HAVE_WINRT_CX TRUE)
|
2014-05-08 12:06:06 +02:00
|
|
|
elseif(ENABLE_WINRT_MODE_NATIVE AND HAVE_WINRT_SDK AND (HAVE_MSVC2012 OR HAVE_MSVC2013) AND HAVE_MSPDK)
|
2013-12-22 17:28:50 +01:00
|
|
|
set(HAVE_WINRT TRUE)
|
|
|
|
set(HAVE_WINRT_CX FALSE)
|
2013-08-15 15:01:38 +02:00
|
|
|
endif()
|
|
|
|
|
2013-12-22 17:28:50 +01:00
|
|
|
if(HAVE_WINRT)
|
2013-08-15 15:01:38 +02:00
|
|
|
add_definitions(/DWINVER=0x0602 /DNTDDI_VERSION=NTDDI_WIN8 /D_WIN32_WINNT=0x0602)
|
2013-08-28 17:36:57 +02:00
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /appcontainer")
|
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /appcontainer")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /appcontainer")
|
2013-08-15 15:01:38 +02:00
|
|
|
endif()
|
2013-07-19 11:43:05 +02:00
|
|
|
|
2012-02-03 12:26:49 +01:00
|
|
|
if(NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT)
|
|
|
|
foreach(flag_var
|
|
|
|
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
|
|
|
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
|
|
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
|
|
|
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
|
|
|
if(${flag_var} MATCHES "/MD")
|
|
|
|
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
|
|
|
endif()
|
|
|
|
if(${flag_var} MATCHES "/MDd")
|
|
|
|
string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}")
|
|
|
|
endif()
|
|
|
|
endforeach(flag_var)
|
|
|
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:msvcrt.lib /NODEFAULTLIB:msvcrtd.lib")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libcmt.lib")
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libcmtd.lib")
|
|
|
|
else()
|
|
|
|
foreach(flag_var
|
|
|
|
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
|
|
|
CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO
|
|
|
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
|
|
|
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
|
|
|
if(${flag_var} MATCHES "/MT")
|
|
|
|
string(REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}")
|
|
|
|
endif()
|
|
|
|
if(${flag_var} MATCHES "/MTd")
|
|
|
|
string(REGEX REPLACE "/MTd" "/MDd" ${flag_var} "${${flag_var}}")
|
|
|
|
endif()
|
|
|
|
endforeach(flag_var)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} LESS 2.8 AND NOT ${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} LESS 8.6)
|
|
|
|
include(ProcessorCount)
|
|
|
|
ProcessorCount(N)
|
|
|
|
if(NOT N EQUAL 0)
|
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP${N} ")
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP${N} ")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2012-03-02 15:48:35 +01:00
|
|
|
if(NOT BUILD_WITH_DEBUG_INFO AND NOT MSVC)
|
2012-02-03 12:26:49 +01:00
|
|
|
string(REPLACE "/debug" "" CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
|
|
|
string(REPLACE "/DEBUG" "" CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
|
|
|
string(REPLACE "/INCREMENTAL:YES" "/INCREMENTAL:NO" CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
|
|
|
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
|
|
|
|
|
|
|
string(REPLACE "/debug" "" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
|
|
|
|
string(REPLACE "/DEBUG" "" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
|
|
|
|
string(REPLACE "/INCREMENTAL:YES" "/INCREMENTAL:NO" CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
|
|
|
|
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_MODULE_LINKER_FLAGS_DEBUG "${CMAKE_MODULE_LINKER_FLAGS_DEBUG}")
|
|
|
|
|
|
|
|
string(REPLACE "/debug" "" CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
|
|
|
string(REPLACE "/DEBUG" "" CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
|
|
|
string(REPLACE "/INCREMENTAL:YES" "/INCREMENTAL:NO" CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
|
|
|
string(REPLACE "/INCREMENTAL " "/INCREMENTAL:NO " CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
|
|
|
|
|
|
|
|
string(REPLACE "/Zi" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
|
|
|
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
|
|
|
endif()
|