From 587402859e07326f741eceeb2fc6b9bc3a13dcc7 Mon Sep 17 00:00:00 2001 From: GregoryMorse Date: Thu, 8 May 2014 18:06:06 +0800 Subject: [PATCH] Add VS2013 support Fix indentation in output that made it look like changes were dependent on WinRT when they are independent libraries. Defaults needed flipping otherwise undesired behavior. Change is tested with combinations. Fixed and tested Windows Phone v8.0/v8.1 SDK for Universal Windows Apps (Windows Phone v8.1 Silverlight App support not included) and fix initial cache causing problem --- CMakeLists.txt | 8 +++-- cmake/OpenCVCRTLinkage.cmake | 58 ++++++++++++++++++++++++++---------- 2 files changed, 49 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b610ecf971..c6050c4a7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -223,6 +223,10 @@ OCV_OPTION(ENABLE_NOISY_WARNINGS "Show all warnings even if they are too no OCV_OPTION(OPENCV_WARNINGS_ARE_ERRORS "Treat warnings as errors" OFF ) OCV_OPTION(ENABLE_WINRT_MODE "Build with Windows Runtime support" OFF IF WIN32 ) OCV_OPTION(ENABLE_WINRT_MODE_NATIVE "Build with Windows Runtime native C++ support" OFF IF WIN32 ) +OCV_OPTION(ENABLE_LIBVS2013 "Build VS2013 with Visual Studio 2013 libraries" OFF IF WIN32 AND (MSVC_VERSION EQUAL 1800) ) +OCV_OPTION(ENABLE_WINSDK81 "Build VS2013 with Windows 8.1 SDK" OFF IF WIN32 AND (MSVC_VERSION EQUAL 1800) ) +OCV_OPTION(ENABLE_WINPHONESDK80 "Build with Windows Phone 8.0 SDK" OFF IF WIN32 AND (MSVC_VERSION EQUAL 1700) ) +OCV_OPTION(ENABLE_WINPHONESDK81 "Build VS2013 with Windows Phone 8.1 SDK" OFF IF WIN32 AND (MSVC_VERSION EQUAL 1800) ) # uncategorized options # =================================================== @@ -745,8 +749,8 @@ if(WIN32) status("") status(" Windows RT support:" HAVE_WINRT THEN YES ELSE NO) if (ENABLE_WINRT_MODE OR ENABLE_WINRT_MODE_NATIVE) - status(" Windows SDK v8.0:" ${WINDOWS_SDK_PATH}) - status(" Visual Studio 2012:" ${VISUAL_STUDIO_PATH}) + status(" Windows (Phone) SDK v8.0/v8.1:" ${WINDOWS_SDK_PATH}) + status(" Visual Studio 2012/2013:" ${VISUAL_STUDIO_PATH}) endif() endif(WIN32) diff --git a/cmake/OpenCVCRTLinkage.cmake b/cmake/OpenCVCRTLinkage.cmake index 5265e3e8a6..c84ed6f2ef 100644 --- a/cmake/OpenCVCRTLinkage.cmake +++ b/cmake/OpenCVCRTLinkage.cmake @@ -6,34 +6,62 @@ endif() set(HAVE_WINRT FALSE) -# search Windows Platform SDK -message(STATUS "Checking for Windows Platform SDK") -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 Platform SDK 8.0 was not found") +# 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() else() set(HAVE_MSPDK TRUE) endif() -#search for Visual Studio 11.0 install directory -message(STATUS "Checking for Visual Studio 2012") -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 was not found") +#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() else() - set(HAVE_MSVC2012 TRUE) + set(HAVE_MSVC2013 TRUE) endif() try_compile(HAVE_WINRT_SDK "${OpenCV_BINARY_DIR}" "${OpenCV_SOURCE_DIR}/cmake/checks/winrttest.cpp") -if(ENABLE_WINRT_MODE AND HAVE_WINRT_SDK AND HAVE_MSVC2012 AND HAVE_MSPDK) +if(ENABLE_WINRT_MODE AND HAVE_WINRT_SDK AND (HAVE_MSVC2012 OR HAVE_MSVC2013) AND HAVE_MSPDK) set(HAVE_WINRT TRUE) set(HAVE_WINRT_CX TRUE) -elseif(ENABLE_WINRT_MODE_NATIVE AND HAVE_WINRT_SDK AND HAVE_MSVC2012 AND HAVE_MSPDK) +elseif(ENABLE_WINRT_MODE_NATIVE AND HAVE_WINRT_SDK AND (HAVE_MSVC2012 OR HAVE_MSVC2013) AND HAVE_MSPDK) set(HAVE_WINRT TRUE) set(HAVE_WINRT_CX FALSE) endif()