aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTsuda Kageyu <tsuda.kageyu@gmail.com>2017-06-09 08:53:25 +0900
committerGitHub <noreply@github.com>2017-06-09 08:53:25 +0900
commit662f340f933077a926de443c9882f483973570e3 (patch)
treec851b4f762975c7354fa2a3f1aa7f01276818d77
parent48d8c0a808e80f14479e5ef1e000f50ae5fe7cac (diff)
parent5ebd3d5276ad86e36fddcb95217f6dbf62746633 (diff)
Merge pull request #824 from evpobr/fix-createfile2
Fix WinRT configuring
-rw-r--r--CMakeLists.txt5
-rw-r--r--ConfigureChecks.cmake4
-rw-r--r--taglib/toolkit/tfilestream.cpp2
3 files changed, 10 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bbd7d7cc..3e081ea2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,6 +46,11 @@ option(BUILD_BINDINGS "Build the bindings" ON)
option(NO_ITUNES_HACKS "Disable workarounds for iTunes bugs" OFF)
+option(PLATFORM_WINRT "Enable WinRT support" OFF)
+if(PLATFORM_WINRT)
+ add_definitions(-DPLATFORM_WINRT)
+endif()
+
add_definitions(-DHAVE_CONFIG_H)
set(TESTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests/")
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index e39d97b2..5e5fca2f 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -209,3 +209,7 @@ if(BUILD_TESTS AND NOT BUILD_SHARED_LIBS)
endif()
endif()
+# Detect WinRT mode
+if(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set(PLATFORM WINRT 1)
+endif()
diff --git a/taglib/toolkit/tfilestream.cpp b/taglib/toolkit/tfilestream.cpp
index 219913af..17a09f3d 100644
--- a/taglib/toolkit/tfilestream.cpp
+++ b/taglib/toolkit/tfilestream.cpp
@@ -51,7 +51,7 @@ namespace
{
const DWORD access = readOnly ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE);
-#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)
+#if defined (PLATFORM_WINRT)
return CreateFile2(path.wstr().c_str(), access, FILE_SHARE_READ, OPEN_EXISTING, NULL);
#else
return CreateFileW(path.wstr().c_str(), access, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);