Merge pull request #1280 from asmorkalov:winrt_detect_fix

This commit is contained in:
Roman Donchenko 2013-08-16 19:03:45 +04:00 committed by OpenCV Buildbot
commit e8f85903c5
2 changed files with 34 additions and 29 deletions

View File

@ -4,37 +4,39 @@ endif()
#INCLUDE (CheckIncludeFiles)
if (ENABLE_WINRT_MODE)
set(HAVE_WINRT True)
set(HAVE_WINRT FALSE)
# search Windows Platform SDK
message(STATUS "Checking for Windows Platfrom 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 "")
message(ERROR "Windows Platform SDK 8.0 was not found!")
set(HAVE_WINRT False)
endif()
# 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")
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 "")
message(ERROR "Visual Studio 2012 was not found!")
set(HAVE_WINRT False)
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")
else()
set(HAVE_MSVC2012 TRUE)
endif()
if (HAVE_WINRT)
TRY_COMPILE(HAVE_WINRT
"${OPENCV_BINARY_DIR}/CMakeFiles/CMakeTmp"
"${OpenCV_SOURCE_DIR}/cmake/checks/winrttest.cpp"
CMAKE_FLAGS "\"kernel.lib\" \"user32.lib\""
OUTPUT_VARIABLE OUTPUT)
endif()
TRY_COMPILE(HAVE_WINRT_SDK
"${OPENCV_BINARY_DIR}/CMakeFiles/CMakeTmp"
"${OpenCV_SOURCE_DIR}/cmake/checks/winrttest.cpp")
if (HAVE_WINRT)
add_definitions(/DWINVER=0x0602 /DNTDDI_VERSION=NTDDI_WIN8 /D_WIN32_WINNT=0x0602)
endif()
endif(ENABLE_WINRT_MODE)
if (ENABLE_WINRT_MODE AND HAVE_WINRT_SDK AND HAVE_MSVC2012 AND HAVE_MSPDK)
set(HAVE_WINRT TRUE)
endif()
if (HAVE_WINRT)
add_definitions(/DWINVER=0x0602 /DNTDDI_VERSION=NTDDI_WIN8 /D_WIN32_WINNT=0x0602)
endif()
if(NOT BUILD_SHARED_LIBS AND BUILD_WITH_STATIC_CRT)
foreach(flag_var

View File

@ -1,6 +1,9 @@
mkdir build_winrt_arm
cd build_winrt_arm
rem call "C:\Program Files\Microsoft Visual Studio 11.0\VC\bin\x86_arm\vcvarsx86_arm.bat"
set msvc_path=C:\Program Files\Microsoft Visual Studio 11.0
cmake.exe -GNinja -DWITH_TBB=ON -DBUILD_TBB=ON -DCMAKE_BUILD_TYPE=Release -DWITH_FFMPEG=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_python=OFF -DCMAKE_TOOLCHAIN_FILE=..\winrt\arm.winrt.toolchain.cmake ..\..
call "%msvc_path%\Common7\Tools\VsDevCmd.bat"
call "%msvc_path%\VC\bin\x86_arm\vcvarsx86_arm.bat"
cmake.exe -GNinja -DCMAKE_BUILD_TYPE=Release -DENABLE_WINRT_MODE=ON -DWITH_FFMPEG=OFF -DWITH_MSMF=OFF -DWITH_DSHOW=OFF -DWITH_VFW=OFF -DWITH_TIFF=OFF -DWITH_OPENEXR=OFF -DWITH_CUDA=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_python=OFF -DBUILD_opencv_java=OFF -DCMAKE_TOOLCHAIN_FILE=..\winrt\arm.winrt.toolchain.cmake %* ..\..