diff --git a/CMakeLists.txt b/CMakeLists.txt index 2973f4ca00..d7db8fd130 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -220,6 +220,7 @@ OCV_OPTION(ENABLE_VFPV3 "Enable VFPv3-D32 instructions" OCV_OPTION(ENABLE_NOISY_WARNINGS "Show all warnings even if they are too noisy" OFF ) 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 ) # uncategorized options # =================================================== @@ -666,7 +667,7 @@ endif() if(WIN32) status("") status(" Windows RT support:" HAVE_WINRT THEN YES ELSE NO) - if (ENABLE_WINRT_MODE) + if (ENABLE_WINRT_MODE OR ENABLE_WINRT_MODE_NATIVE) status(" Windows SDK v8.0:" ${WINDOWS_SDK_PATH}) status(" Visual Studio 2012:" ${VISUAL_STUDIO_PATH}) endif() diff --git a/cmake/OpenCVCRTLinkage.cmake b/cmake/OpenCVCRTLinkage.cmake index 8a297c6857..5265e3e8a6 100644 --- a/cmake/OpenCVCRTLinkage.cmake +++ b/cmake/OpenCVCRTLinkage.cmake @@ -9,7 +9,7 @@ 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 "") +if(WINDOWS_SDK_PATH STREQUAL "") set(HAVE_MSPDK FALSE) message(STATUS "Windows Platform SDK 8.0 was not found") else() @@ -19,7 +19,7 @@ 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 "") +if(VISUAL_STUDIO_PATH STREQUAL "") set(HAVE_MSVC2012 FALSE) message(STATUS "Visual Studio 2012 was not found") else() @@ -30,11 +30,15 @@ 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 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) + set(HAVE_WINRT TRUE) + set(HAVE_WINRT_CX FALSE) endif() -if (HAVE_WINRT) +if(HAVE_WINRT) add_definitions(/DWINVER=0x0602 /DNTDDI_VERSION=NTDDI_WIN8 /D_WIN32_WINNT=0x0602) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /appcontainer") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /appcontainer") diff --git a/modules/core/CMakeLists.txt b/modules/core/CMakeLists.txt index a1e71bf4f7..fe3eff33ab 100644 --- a/modules/core/CMakeLists.txt +++ b/modules/core/CMakeLists.txt @@ -8,8 +8,11 @@ endif() ocv_module_include_directories("${OpenCV_SOURCE_DIR}/modules/dynamicuda/include/" ${ZLIB_INCLUDE_DIR}) +if(HAVE_WINRT_CX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW") +endif() if(HAVE_WINRT) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW /GS /Gm- /AI\"${WINDOWS_SDK_PATH}/References/CommonConfiguration/Neutral\" /AI\"${VISUAL_STUDIO_PATH}/vcpackages\"") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GS /Gm- /AI\"${WINDOWS_SDK_PATH}/References/CommonConfiguration/Neutral\" /AI\"${VISUAL_STUDIO_PATH}/vcpackages\"") endif() if(ENABLE_DYNAMIC_CUDA)