aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt22
-rw-r--r--cmake/installdata/windowsstore/addons.txt3
-rw-r--r--cmake/installdata/windowsstore/dlls.txt2
-rw-r--r--cmake/installdata/windowsstore/irss.txt2
-rw-r--r--cmake/installdata/windowsstore/python.txt1
-rw-r--r--cmake/modules/FindCurl.cmake2
-rw-r--r--cmake/modules/FindD3DX11Effects.cmake26
-rw-r--r--cmake/modules/FindIConv.cmake36
-rw-r--r--cmake/modules/FindSSE.cmake10
-rw-r--r--cmake/platform/windowsstore/defines.txt1
-rw-r--r--cmake/platform/windowsstore/windowsstore.cmake1
-rw-r--r--cmake/scripts/common/Macros.cmake14
-rw-r--r--cmake/scripts/windowsstore/ArchSetup.cmake118
-rw-r--r--cmake/scripts/windowsstore/CFlagOverrides.cmake12
-rw-r--r--cmake/scripts/windowsstore/CXXFlagOverrides.cmake12
-rw-r--r--cmake/scripts/windowsstore/Install.cmake0
-rw-r--r--cmake/scripts/windowsstore/Macros.cmake170
-rw-r--r--cmake/scripts/windowsstore/PathSetup.cmake34
-rw-r--r--cmake/scripts/windowsstore/tools/patch.cmake37
-rw-r--r--cmake/treedata/windowsstore/externals.txt1
-rw-r--r--cmake/treedata/windowsstore/subdirs.txt16
-rw-r--r--lib/gtest/CMakeLists.txt4
-rw-r--r--lib/win32/Effects11/CMakeLists.txt18
-rw-r--r--xbmc/rendering/CMakeLists.txt2
24 files changed, 520 insertions, 24 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c3a91b5486..acee78f7b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -128,6 +128,11 @@ endif()
if(CORE_SYSTEM_NAME STREQUAL android)
list(APPEND required_deps Zip)
endif()
+if(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ #uses header only version of Fmt
+ list(REMOVE_ITEM required_deps Fmt)
+ list(REMOVE_ITEM required_deps LibDvd)
+endif()
# Optional dependencies. Keep in alphabetical order please
set(optional_deps Alsa
@@ -270,7 +275,7 @@ set_target_properties(pack-skins PROPERTIES FOLDER "Build Utilities")
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/system/players/VideoPlayer)
set(LIBCEC_SONAME "${CEC_SONAME}")
-if(NOT CORE_SYSTEM_NAME STREQUAL windows AND NOT CORE_SYSTEM_NAME STREQUAL android)
+if(NOT CORE_SYSTEM_NAME STREQUAL windows AND NOT CORE_SYSTEM_NAME STREQUAL android AND NOT CORE_SYSTEM_NAME STREQUAL windowsstore)
configure_file(${CMAKE_SOURCE_DIR}/xbmc/DllPaths_generated.h.in
${CORE_BUILD_DIR}/DllPaths_generated.h @ONLY)
elseif(CORE_SYSTEM_NAME STREQUAL android)
@@ -280,8 +285,12 @@ endif()
# main library (used for main binary and tests)
add_library(lib${APP_NAME_LC} STATIC $<TARGET_OBJECTS:compileinfo>)
+if (CORE_SYSTEM_NAME STREQUAL windowsstore)
+ add_dependencies(lib${APP_NAME_LC} libcpluff ffmpeg)
+else()
+ add_dependencies(lib${APP_NAME_LC} libcpluff ffmpeg dvdnav crossguid ${PLATFORM_GLOBAL_TARGET_DEPS})
+endif()
set_target_properties(lib${APP_NAME_LC} PROPERTIES PREFIX "")
-add_dependencies(lib${APP_NAME_LC} libcpluff ffmpeg dvdnav crossguid ${PLATFORM_GLOBAL_TARGET_DEPS})
# Other files (IDE)
set(OTHER_FILES cmake/README.md)
@@ -302,6 +311,9 @@ endif()
# main binary
if(NOT CORE_SYSTEM_NAME STREQUAL android)
+ if(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ winstore_add_target_properties(${APP_NAME_LC})
+ endif()
add_executable(${APP_NAME_LC} ${CORE_MAIN_SOURCE} "${RESOURCES}" ${OTHER_FILES})
set_target_properties(${APP_NAME_LC} PROPERTIES ENABLE_EXPORTS ON)
else()
@@ -316,7 +328,11 @@ unset(_MAIN_LIBRARIES)
if(WIN32)
set_target_properties(${APP_NAME_LC} PROPERTIES WIN32_EXECUTABLE ON)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${APP_NAME_LC})
- target_sources(${APP_NAME_LC} PRIVATE ${CMAKE_SOURCE_DIR}/xbmc/platform/win32/app.manifest)
+ if(NOT CORE_SYSTEM_NAME STREQUAL windowsstore)
+ target_sources(${APP_NAME_LC} PRIVATE ${CMAKE_SOURCE_DIR}/xbmc/platform/win32/app.manifest)
+ else()
+ set_target_properties(${APP_NAME_LC} PROPERTIES VS_USER_PROPS ${VCPROJECT_PROPS_FILE})
+ endif()
elseif(CORE_SYSTEM_NAME STREQUAL android)
# Nothing
elseif(CORE_SYSTEM_NAME STREQUAL ios)
diff --git a/cmake/installdata/windowsstore/addons.txt b/cmake/installdata/windowsstore/addons.txt
new file mode 100644
index 0000000000..4b8678b682
--- /dev/null
+++ b/cmake/installdata/windowsstore/addons.txt
@@ -0,0 +1,3 @@
+addons/repository.pvr-win32.xbmc.org/*
+project/BuildDependencies/win10-${ARCH}/addons/*
+system/addon-manifest-uwp.xml \ No newline at end of file
diff --git a/cmake/installdata/windowsstore/dlls.txt b/cmake/installdata/windowsstore/dlls.txt
new file mode 100644
index 0000000000..a927b3d4ab
--- /dev/null
+++ b/cmake/installdata/windowsstore/dlls.txt
@@ -0,0 +1,2 @@
+project/BuildDependencies/win10-${ARCH}/bin/*.dll dlls
+project/BuildDependencies/mingwlibs/win10-${ARCH}/bin/*.dll dlls
diff --git a/cmake/installdata/windowsstore/irss.txt b/cmake/installdata/windowsstore/irss.txt
new file mode 100644
index 0000000000..6fd8d484e7
--- /dev/null
+++ b/cmake/installdata/windowsstore/irss.txt
@@ -0,0 +1,2 @@
+system/IRSSmap.xml
+system/X10-Lola-IRSSmap.xml
diff --git a/cmake/installdata/windowsstore/python.txt b/cmake/installdata/windowsstore/python.txt
new file mode 100644
index 0000000000..db57ebca1e
--- /dev/null
+++ b/cmake/installdata/windowsstore/python.txt
@@ -0,0 +1 @@
+project/BuildDependencies/win10-${ARCH}/bin/Python KEEP_DIR_STRUCTURE system \ No newline at end of file
diff --git a/cmake/modules/FindCurl.cmake b/cmake/modules/FindCurl.cmake
index ed4d81f387..d0759a6106 100644
--- a/cmake/modules/FindCurl.cmake
+++ b/cmake/modules/FindCurl.cmake
@@ -20,7 +20,7 @@ endif()
find_path(CURL_INCLUDE_DIR NAMES curl/curl.h
PATHS ${PC_CURL_INCLUDEDIR})
-find_library(CURL_LIBRARY NAMES curl libcurl
+find_library(CURL_LIBRARY NAMES curl libcurl libcurl_imp
PATHS ${PC_CURL_LIBDIR})
set(CURL_VERSION ${PC_CURL_VERSION})
diff --git a/cmake/modules/FindD3DX11Effects.cmake b/cmake/modules/FindD3DX11Effects.cmake
index 3fdf7d7468..d0e201fee4 100644
--- a/cmake/modules/FindD3DX11Effects.cmake
+++ b/cmake/modules/FindD3DX11Effects.cmake
@@ -4,19 +4,21 @@
# D3DCOMPILER_DLL - Path to the Direct3D Compiler
# FXC - Path to the DirectX Effects Compiler (FXC)
-find_file(D3DCOMPILER_DLL
- NAMES d3dcompiler_47.dll d3dcompiler_46.dll
- PATHS
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/Redist/D3D/${SDK_TARGET_ARCH}"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/Redist/D3D/${SDK_TARGET_ARCH}"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/Redist/D3D/${SDK_TARGET_ARCH}"
- "$ENV{WindowsSdkDir}Redist/d3d/${SDK_TARGET_ARCH}"
- NO_DEFAULT_PATH)
-if(NOT D3DCOMPILER_DLL)
- message(WARNING "Could NOT find Direct3D Compiler")
+if(NOT CORE_SYSTEM_NAME STREQUAL windowsstore)
+ find_file(D3DCOMPILER_DLL
+ NAMES d3dcompiler_47.dll d3dcompiler_46.dll
+ PATHS
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/Redist/D3D/${SDK_TARGET_ARCH}"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/Redist/D3D/${SDK_TARGET_ARCH}"
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/Redist/D3D/${SDK_TARGET_ARCH}"
+ "$ENV{WindowsSdkDir}Redist/d3d/${SDK_TARGET_ARCH}"
+ NO_DEFAULT_PATH)
+ if(NOT D3DCOMPILER_DLL)
+ message(WARNING "Could NOT find Direct3D Compiler")
+ endif()
+ mark_as_advanced(D3DCOMPILER_DLL)
+ copy_file_to_buildtree(${D3DCOMPILER_DLL} DIRECTORY .)
endif()
-mark_as_advanced(D3DCOMPILER_DLL)
-copy_file_to_buildtree(${D3DCOMPILER_DLL} DIRECTORY .)
find_program(FXC fxc
PATHS
diff --git a/cmake/modules/FindIConv.cmake b/cmake/modules/FindIConv.cmake
new file mode 100644
index 0000000000..a2428b80f1
--- /dev/null
+++ b/cmake/modules/FindIConv.cmake
@@ -0,0 +1,36 @@
+#.rst:
+# FindICONV
+# --------
+# Finds the ICONV library
+#
+# This will will define the following variables::
+#
+# ICONV_FOUND - system has ICONV
+# ICONV_INCLUDE_DIRS - the ICONV include directory
+# ICONV_LIBRARIES - the ICONV libraries
+#
+# and the following imported targets::
+#
+# ICONV::ICONV - The ICONV library
+
+find_path(ICONV_INCLUDE_DIR NAMES iconv.h)
+
+find_library(ICONV_LIBRARY NAMES iconv libiconv)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(iconv
+ REQUIRED_VARS ICONV_LIBRARY ICONV_INCLUDE_DIR)
+
+if(ICONV_FOUND)
+ set(ICONV_LIBRARIES ${ICONV_LIBRARY})
+ set(ICONV_INCLUDE_DIRS ${ICONV_INCLUDE_DIR})
+
+ if(NOT TARGET ICONV::ICONV)
+ add_library(ICONV::ICONV UNKNOWN IMPORTED)
+ set_target_properties(ICONV::ICONV PROPERTIES
+ IMPORTED_LOCATION "${ICONV_LIBRARY}"
+ INTERFACE_INCLUDE_DIRECTORIES "${ICONV_INCLUDE_DIR}")
+ endif()
+endif()
+
+mark_as_advanced(ICONV_INCLUDE_DIR ICONV_LIBRARY)
diff --git a/cmake/modules/FindSSE.cmake b/cmake/modules/FindSSE.cmake
index d001b03376..bbfdc21d82 100644
--- a/cmake/modules/FindSSE.cmake
+++ b/cmake/modules/FindSSE.cmake
@@ -94,10 +94,12 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
endif()
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
# TODO
- set(_SSE_TRUE true)
- set(_SSE_OK true)
- set(_SSE2_TRUE true)
- set(_SSE2_OK true)
+ if(ARCH STREQUAL win32 OR ARCH STREQUAL x64)
+ set(_SSE_TRUE true)
+ set(_SSE_OK true)
+ set(_SSE2_TRUE true)
+ set(_SSE2_OK true)
+ endif()
endif()
include(FindPackageHandleStandardArgs)
diff --git a/cmake/platform/windowsstore/defines.txt b/cmake/platform/windowsstore/defines.txt
new file mode 100644
index 0000000000..e962feb24d
--- /dev/null
+++ b/cmake/platform/windowsstore/defines.txt
@@ -0,0 +1 @@
+-DTARGET_WINDOWS -DTARGET_WINDOWS_STORE -DNOMINMAX -D_CRT_SECURE_NO_WARNINGS -D_WINSOCKAPI_ \ No newline at end of file
diff --git a/cmake/platform/windowsstore/windowsstore.cmake b/cmake/platform/windowsstore/windowsstore.cmake
new file mode 100644
index 0000000000..b8de319f13
--- /dev/null
+++ b/cmake/platform/windowsstore/windowsstore.cmake
@@ -0,0 +1 @@
+set(PLATFORM_REQUIRED_DEPS zlib iconv) \ No newline at end of file
diff --git a/cmake/scripts/common/Macros.cmake b/cmake/scripts/common/Macros.cmake
index 205117720c..4c17eb247b 100644
--- a/cmake/scripts/common/Macros.cmake
+++ b/cmake/scripts/common/Macros.cmake
@@ -72,11 +72,15 @@ function(core_add_library name)
add_library(${name} STATIC ${SOURCES} ${HEADERS} ${OTHERS})
set_target_properties(${name} PROPERTIES PREFIX "")
set(core_DEPENDS ${name} ${core_DEPENDS} CACHE STRING "" FORCE)
- add_dependencies(${name} libcpluff ffmpeg dvdnav crossguid ${PLATFORM_GLOBAL_TARGET_DEPS})
+ set(lib_DEPS libcpluff ffmpeg crossguid ${PLATFORM_GLOBAL_TARGET_DEPS})
+ if(NOT CORE_SYSTEM_NAME STREQUAL windowsstore)
+ list(APPEND lib_DEPS dvdnav)
+ endif()
+ add_dependencies(${name} ${lib_DEPS})
set(CORE_LIBRARY ${name} PARENT_SCOPE)
# Add precompiled headers to Kodi main libraries
- if(CORE_SYSTEM_NAME STREQUAL windows)
+ if(CORE_SYSTEM_NAME MATCHES windows)
add_precompiled_header(${name} pch.h ${CMAKE_SOURCE_DIR}/xbmc/platform/win32/pch.cpp PCH_TARGET kodi)
set_language_cxx(${name})
target_link_libraries(${name} PUBLIC effects11)
@@ -102,7 +106,11 @@ function(core_add_test_library name)
set_target_properties(${name} PROPERTIES PREFIX ""
EXCLUDE_FROM_ALL 1
FOLDER "Build Utilities/tests")
- add_dependencies(${name} libcpluff ffmpeg dvdnav crossguid)
+ set(lib_DEPS libcpluff ffmpeg crossguid ${PLATFORM_GLOBAL_TARGET_DEPS})
+ if(NOT CORE_SYSTEM_NAME STREQUAL windowsstore)
+ list(APPEND lib_DEPS dvdnav)
+ endif()
+ add_dependencies(${name} ${lib_DEPS})
set(test_archives ${test_archives} ${name} CACHE STRING "" FORCE)
endif()
foreach(src IN LISTS SOURCES SUPPORTED_SOURCES HEADERS OTHERS)
diff --git a/cmake/scripts/windowsstore/ArchSetup.cmake b/cmake/scripts/windowsstore/ArchSetup.cmake
new file mode 100644
index 0000000000..4b2de40f46
--- /dev/null
+++ b/cmake/scripts/windowsstore/ArchSetup.cmake
@@ -0,0 +1,118 @@
+# -------- Architecture settings ---------
+
+check_symbol_exists(_X86_ "Windows.h" _X86_)
+check_symbol_exists(_AMD64_ "Windows.h" _AMD64_)
+check_symbol_exists(_ARM_ "Windows.h" _ARM_)
+
+if(_X86_)
+ set(ARCH win32)
+ set(SDK_TARGET_ARCH x86)
+elseif(_AMD64_)
+ set(ARCH x64)
+ set(SDK_TARGET_ARCH x64)
+elseif(_ARM_)
+ set(ARCH arm)
+ set(SDK_TARGET_ARCH arm)
+else()
+ message(FATAL_ERROR "Unsupported architecture")
+endif()
+
+unset(_X86_)
+unset(_AMD64_)
+unset(_ARM_)
+
+# -------- Paths (mainly for find_package) ---------
+
+set(PLATFORM_DIR platform/win32)
+set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/win10/main.cpp)
+
+# Precompiled headers fail with per target output directory. (needs CMake 3.1)
+set(PRECOMPILEDHEADER_DIR ${PROJECT_BINARY_DIR}/${CORE_BUILD_CONFIG}/objs)
+
+set(CMAKE_SYSTEM_NAME WindowsStore)
+set(CORE_SYSTEM_NAME "windowsstore")
+set(PACKAGE_GUID "281d668b-5739-4abd-b3c2-ed1cda572ed2")
+set(APP_MANIFEST_NAME package.appxmanifest)
+set(DEPS_FOLDER_RELATIVE project/BuildDependencies)
+
+set(DEPENDENCIES_DIR ${CMAKE_SOURCE_DIR}/${DEPS_FOLDER_RELATIVE}/win10-${ARCH})
+set(MINGW_LIBS_DIR ${CMAKE_SOURCE_DIR}/${DEPS_FOLDER_RELATIVE}/mingwlibs/win10-${ARCH})
+
+# mingw libs
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${MINGW_LIBS_DIR})
+list(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${MINGW_LIBS_DIR}/bin)
+# dependencies
+list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${DEPENDENCIES_DIR})
+# for python
+set(PYTHON_INCLUDE_DIR ${DEPENDENCIES_DIR}/include/python)
+
+
+# -------- Compiler options ---------
+
+add_options(CXX ALL_BUILDS "/wd\"4996\"")
+add_options(CXX ALL_BUILDS "/wd\"4146\"")
+add_options(CXX ALL_BUILDS "/wd\"4251\"")
+add_options(CXX ALL_BUILDS "/wd\"4668\"")
+set(ARCH_DEFINES -D_WINDOWS -DTARGET_WINDOWS -DTARGET_WINDOWS_STORE -DXBMC_EXPORT -DMS_UWP)
+if(NOT SDK_TARGET_ARCH STREQUAL arm)
+ list(APPEND ARCH_DEFINES -D__SSE__ -D__SSE2__)
+endif()
+set(SYSTEM_DEFINES -DNOMINMAX -DHAS_DX -D__STDC_CONSTANT_MACROS
+ -DFMT_HEADER_ONLY -DTAGLIB_STATIC -DNPT_CONFIG_ENABLE_LOGGING
+ -DPLT_HTTP_DEFAULT_USER_AGENT="UPnP/1.0 DLNADOC/1.50 Kodi"
+ -DPLT_HTTP_DEFAULT_SERVER="UPnP/1.0 DLNADOC/1.50 Kodi"
+ -DUNICODE -D_UNICODE
+ $<$<CONFIG:Debug>:-DD3D_DEBUG_INFO>)
+
+# The /MP option enables /FS by default.
+set(CMAKE_CXX_FLAGS "/MP ${CMAKE_CXX_FLAGS} /ZW /EHsc /await")
+# Google Test needs to use shared version of runtime libraries
+set(gtest_force_shared_crt ON CACHE STRING "" FORCE)
+
+
+# -------- Linker options ---------
+
+# For #pragma comment(lib X)
+# TODO: It would certainly be better to handle these libraries via CMake modules.
+link_directories(${MINGW_LIBS_DIR}/lib
+ ${DEPENDENCIES_DIR}/lib)
+
+list(APPEND DEPLIBS d3d11.lib WS2_32.lib dxguid.lib dloadhelper.lib)
+if(ARCH STREQUAL win32 OR ARCH STREQUAL x64)
+ list(APPEND DEPLIBS DInput8.lib DSound.lib winmm.lib Mpr.lib Iphlpapi.lib PowrProf.lib setupapi.lib dwmapi.lib)
+endif()
+# NODEFAULTLIB option
+
+set(_nodefaultlibs_RELEASE libcmt)
+set(_nodefaultlibs_DEBUG libcmt msvcrt)
+foreach(_lib ${_nodefaultlibs_RELEASE})
+ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:\"${_lib}\"")
+endforeach()
+foreach(_lib ${_nodefaultlibs_DEBUG})
+ set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:\"${_lib}\"")
+endforeach()
+
+# Make the Release version create a PDB
+set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
+# Minimize the size or the resulting DLLs
+set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF")
+# remove warning
+set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4264")
+
+
+# -------- Visual Studio options ---------
+
+if(CMAKE_GENERATOR MATCHES "Visual Studio")
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+
+ # Generate a batch file that opens Visual Studio with the necessary env variables set.
+ file(WRITE ${CMAKE_BINARY_DIR}/kodi-sln.bat
+ "@echo off\n"
+ "set KODI_HOME=%~dp0\n"
+ "set PATH=%~dp0\\system\n"
+ "start %~dp0\\${PROJECT_NAME}.sln")
+endif()
+
+# -------- Build options ---------
+
+set(ENABLE_OPTICAL OFF CACHE BOOL "" FORCE)
diff --git a/cmake/scripts/windowsstore/CFlagOverrides.cmake b/cmake/scripts/windowsstore/CFlagOverrides.cmake
new file mode 100644
index 0000000000..0cd1c4d74a
--- /dev/null
+++ b/cmake/scripts/windowsstore/CFlagOverrides.cmake
@@ -0,0 +1,12 @@
+# compiler flags
+string(APPEND CMAKE_C_FLAGS_INIT " /D_UNICODE /DUNICODE /MP /DWIN32 /D_WINDOWS /W3 /Zi /DTARGET_WINDOWS")
+string(APPEND CMAKE_C_FLAGS_INIT " /DWINAPI_FAMILY=2 /DTARGET_WINDOWS_STORE /D_WINSOCK_DEPRECATED_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE")
+string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " /D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0")
+string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " /MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
+# linker flags
+string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " /DYNAMICBASE /NXCOMPAT /APPCONTAINER")
+# win32 specific flags
+if("$ENV{Platform}" STREQUAL X86)
+ string(APPEND CMAKE_C_FLAGS_INIT " /arch:SSE2")
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " /SAFESEH")
+endif()
diff --git a/cmake/scripts/windowsstore/CXXFlagOverrides.cmake b/cmake/scripts/windowsstore/CXXFlagOverrides.cmake
new file mode 100644
index 0000000000..2219af4bd0
--- /dev/null
+++ b/cmake/scripts/windowsstore/CXXFlagOverrides.cmake
@@ -0,0 +1,12 @@
+# compiler flags
+string(APPEND CMAKE_CXX_FLAGS_INIT " /D_UNICODE /DUNICODE /MP /DWIN32 /D_WINDOWS /W3 /GR /Zi /EHsc /DTARGET_WINDOWS")
+string(APPEND CMAKE_CXX_FLAGS_INIT " /DWINAPI_FAMILY=2 /DTARGET_WINDOWS_STORE /D_WINSOCK_DEPRECATED_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE")
+string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " /D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0")
+string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " /MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
+# linker flags
+string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " /DYNAMICBASE /NXCOMPAT /APPCONTAINER")
+# win32 specific flags
+if("$ENV{Platform}" STREQUAL X86)
+ string(APPEND CMAKE_CXX_FLAGS_INIT " /arch:SSE2")
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " /SAFESEH")
+endif()
diff --git a/cmake/scripts/windowsstore/Install.cmake b/cmake/scripts/windowsstore/Install.cmake
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/cmake/scripts/windowsstore/Install.cmake
diff --git a/cmake/scripts/windowsstore/Macros.cmake b/cmake/scripts/windowsstore/Macros.cmake
new file mode 100644
index 0000000000..abae11be2d
--- /dev/null
+++ b/cmake/scripts/windowsstore/Macros.cmake
@@ -0,0 +1,170 @@
+function(core_link_library lib wraplib)
+ message(AUTHOR_WARNING "core_link_library is not compatible with windows.")
+endfunction()
+
+function(find_soname lib)
+ # Windows uses hardcoded dlls in xbmc/DllPaths_win32.h.
+ # Therefore the output of this function is unused.
+endfunction()
+
+# Add precompiled header to target
+# Arguments:
+# target existing target that will be set up to compile with a precompiled header
+# pch_header the precompiled header file
+# pch_source the precompiled header source file
+# Optional Arguments:
+# PCH_TARGET build precompiled header as separate target with the given name
+# so that the same precompiled header can be used for multiple libraries
+# EXCLUDE_SOURCES if not all target sources shall use the precompiled header,
+# the relevant files can be listed here
+# On return:
+# Compiles the pch_source into a precompiled header and adds the header to
+# the given target
+function(add_precompiled_header target pch_header pch_source)
+ cmake_parse_arguments(PCH "" "PCH_TARGET" "EXCLUDE_SOURCES" ${ARGN})
+
+ if(PCH_PCH_TARGET)
+ set(pch_binary ${PRECOMPILEDHEADER_DIR}/${PCH_PCH_TARGET}.pch)
+ else()
+ set(pch_binary ${PRECOMPILEDHEADER_DIR}/${target}.pch)
+ endif()
+
+ # Set compile options and dependency for sources
+ get_target_property(sources ${target} SOURCES)
+ list(REMOVE_ITEM sources ${pch_source})
+ foreach(exclude_source IN LISTS PCH_EXCLUDE_SOURCES)
+ list(REMOVE_ITEM sources ${exclude_source})
+ endforeach()
+ set_source_files_properties(${sources}
+ PROPERTIES COMPILE_FLAGS "/Yu\"${pch_header}\" /Fp\"${pch_binary}\" /FI\"${pch_header}\""
+ OBJECT_DEPENDS "${pch_binary}")
+
+ # Set compile options for precompiled header
+ if(NOT PCH_PCH_TARGET OR NOT TARGET ${PCH_PCH_TARGET}_pch)
+ set_source_files_properties(${pch_source}
+ PROPERTIES COMPILE_FLAGS "/Yc\"${pch_header}\" /Fp\"${pch_binary}\""
+ OBJECT_OUTPUTS "${pch_binary}")
+ endif()
+
+ # Compile precompiled header
+ if(PCH_PCH_TARGET)
+ # As own target for usage in multiple libraries
+ if(NOT TARGET ${PCH_PCH_TARGET}_pch)
+ add_library(${PCH_PCH_TARGET}_pch STATIC ${pch_source})
+ set_target_properties(${PCH_PCH_TARGET}_pch PROPERTIES COMPILE_PDB_NAME vc140
+ COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR}
+ FOLDER "Build Utilities")
+ endif()
+ # From VS2012 onwards, precompiled headers have to be linked against (LNK2011).
+ target_link_libraries(${target} PUBLIC ${PCH_PCH_TARGET}_pch)
+ set_target_properties(${target} PROPERTIES COMPILE_PDB_NAME vc140
+ COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR})
+ else()
+ # As part of the target
+ target_sources(${target} PRIVATE ${pch_source})
+ endif()
+endfunction()
+
+macro(winstore_set_assets target)
+ file(GLOB ASSET_FILES "${CMAKE_SOURCE_DIR}/tools/windows/packaging/uwp/media/*.png")
+ set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1)
+ set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_LOCATION "media")
+ source_group("media" FILES ${ASSET_FILES})
+ set(RESOURCES ${RESOURCES} ${ASSET_FILES}
+ "${CMAKE_SOURCE_DIR}/tools/windows/packaging/uwp/kodi_temp_key.pfx")
+endmacro()
+
+macro(winstore_generate_manifest target)
+ configure_file(
+ ${CMAKE_SOURCE_DIR}/tools/windows/packaging/uwp/${APP_MANIFEST_NAME}.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME}
+ @ONLY)
+ set(RESOURCES ${RESOURCES} ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME})
+endmacro()
+
+macro(add_deployment_content_group path link match exclude)
+ set(_link "")
+ set(_exclude "")
+ file(TO_NATIVE_PATH ${path} _path)
+ file(TO_NATIVE_PATH ${match} _match)
+ if (NOT "${link}" STREQUAL "")
+ file(TO_NATIVE_PATH ${link} _link)
+ set(_link "${_link}\\")
+ endif()
+ if(NOT "${exclude}" STREQUAL "")
+ string(REPLACE "/" "\\" _exclude ${exclude})
+ endif()
+ string(CONCAT UWP_DEPLOYMENT_CONTENT_STR "${UWP_DEPLOYMENT_CONTENT_STR}"
+ " <EmbedResources Include=\"${_path}\\${_match}\" Exclude=\"${_exclude}\">\n"
+ " <Link>${_link}%(RecursiveDir)%(FileName)%(Extension)</Link>\n"
+ " <DeploymentContent>true</DeploymentContent>\n"
+ " </EmbedResources>\n")
+endmacro()
+
+macro(winstore_append_props target)
+ # exclude debug dlls from packaging
+ set(DEBUG_DLLS zlibd.dll freetyped.dll sqlite3d.dll)
+ foreach(_dll ${DEBUG_DLLS})
+ if (DEBUG_DLLS_EXCLUDE)
+ list(APPEND DEBUG_DLLS_EXCLUDE "\;$(BuildRootPath)/dlls/${_dll}")
+ else()
+ list(APPEND DEBUG_DLLS_EXCLUDE "$(BuildRootPath)/dlls/${_dll}")
+ endif()
+ string(CONCAT DEBUG_DLLS_LINKAGE_PROPS "${DEBUG_DLLS_LINKAGE_PROPS}"
+ " <ItemGroup Label=\"Binaries\">\n"
+ " <None Include=\"$(BinPath)\\${_dll}\" Condition=\"'$(Configuration)'=='Debug'\">\n"
+ " <DeploymentContent>true</DeploymentContent>\n"
+ " </None>\n"
+ " </ItemGroup>\n")
+ endforeach(_dll DEBUG_DLLS)
+
+ add_deployment_content_group($(BuildRootPath)/dlls "" *.dll "${DEBUG_DLLS_EXCLUDE}")
+ add_deployment_content_group($(BuildRootPath)/system system **/* "$(BuildRootPath)/**/*.glsl")
+ add_deployment_content_group($(BuildRootPath)/media media **/* "")
+ add_deployment_content_group($(BuildRootPath)/userdata userdata **/* "")
+ add_deployment_content_group($(BuildRootPath)/addons addons **/* "")
+ add_deployment_content_group($(BinaryAddonsPath) addons **/* "")
+
+ foreach(xbt_file ${XBT_FILES})
+ file(RELATIVE_PATH relative ${CMAKE_CURRENT_BINARY_DIR} ${xbt_file})
+ file(TO_NATIVE_PATH ${relative} relative)
+ string(CONCAT XBT_FILE_PROPS "${XBT_FILE_PROPS}"
+ " <ItemGroup Label=\"SkinsMedia\">\n"
+ " <None Include=\"$(BuildRootPath)\\${relative}\">\n"
+ " <Link>${relative}</Link>\n"
+ " <DeploymentContent>true</DeploymentContent>\n"
+ " </None>\n"
+ " </ItemGroup>\n")
+ endforeach()
+
+ set(VCPROJECT_PROPS_FILE "${CMAKE_CURRENT_BINARY_DIR}/${target}.props")
+ file(TO_NATIVE_PATH ${DEPENDENCIES_DIR} DEPENDENCIES_DIR_NATIVE)
+ file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR} CMAKE_CURRENT_BINARY_DIR_NATIVE)
+
+ file(WRITE ${VCPROJECT_PROPS_FILE}
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
+ "<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n"
+ " <ImportGroup Label=\"PropertySheets\" />\n"
+ " <PropertyGroup Label=\"APP_DLLS\">\n"
+ " <BinPath>${DEPENDENCIES_DIR_NATIVE}\\bin</BinPath>\n"
+ " <BuildRootPath>${CMAKE_CURRENT_BINARY_DIR_NATIVE}</BuildRootPath>\n"
+ " </PropertyGroup>\n"
+ "${DEBUG_DLLS_LINKAGE_PROPS}"
+ "${XBT_FILE_PROPS}"
+ " <ItemGroup>\n"
+ "${UWP_DEPLOYMENT_CONTENT_STR}"
+ " </ItemGroup>\n"
+ " <Target Name=\"_CollectCustomResources\" Inputs=\"@(EmbedResources)\" Outputs=\"@(EmbedResources->'$(OutputPath)\\PackageLayout\\%(Link)')\" BeforeTargets=\"AssignTargetPaths\">\n"
+ " <Message Text=\"Collecting package resources...\"/>\n"
+ " <ItemGroup>\n"
+ " <None Include=\"@(EmbedResources)\" />\n"
+ " </ItemGroup>\n"
+ " </Target>\n"
+ "</Project>")
+endmacro()
+
+macro(winstore_add_target_properties target)
+ winstore_set_assets(${target})
+ winstore_generate_manifest(${target})
+ winstore_append_props(${target})
+endmacro() \ No newline at end of file
diff --git a/cmake/scripts/windowsstore/PathSetup.cmake b/cmake/scripts/windowsstore/PathSetup.cmake
new file mode 100644
index 0000000000..8550616cd7
--- /dev/null
+++ b/cmake/scripts/windowsstore/PathSetup.cmake
@@ -0,0 +1,34 @@
+if(NOT prefix)
+ set(prefix ${CMAKE_INSTALL_PREFIX})
+else()
+ set(CMAKE_INSTALL_PREFIX ${prefix})
+endif()
+if(NOT exec_prefix)
+ set(exec_prefix ${prefix})
+endif()
+if(NOT libdir)
+ set(libdir ${prefix}/lib)
+endif()
+if(NOT bindir)
+ set(bindir ${prefix}/bin)
+endif()
+if(NOT includedir)
+ set(includedir ${prefix}/include)
+endif()
+if(NOT datarootdir)
+ set(datarootdir ${prefix}/share)
+endif()
+if(NOT datadir)
+ set(datadir ${datarootdir})
+endif()
+
+list(APPEND final_message "-- PATH config --")
+list(APPEND final_message "Prefix: ${prefix}")
+list(APPEND final_message "Libdir: ${libdir}")
+list(APPEND final_message "Bindir: ${bindir}")
+list(APPEND final_message "Includedir: ${includedir}")
+list(APPEND final_message "Datarootdir: ${datarootdir}")
+list(APPEND final_message "Datadir: ${datadir}")
+
+set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/kodi\"
+ -DINSTALL_PATH=\"${datarootdir}/kodi\")
diff --git a/cmake/scripts/windowsstore/tools/patch.cmake b/cmake/scripts/windowsstore/tools/patch.cmake
new file mode 100644
index 0000000000..0ef2952219
--- /dev/null
+++ b/cmake/scripts/windowsstore/tools/patch.cmake
@@ -0,0 +1,37 @@
+find_program(PATCH_FOUND NAMES patch patch.exe)
+if(PATCH_FOUND)
+ message(STATUS "patch utility found at ${PATCH_FOUND}")
+else()
+ set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-1")
+ set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip")
+ set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}")
+ set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE})
+
+ # download the archive containing patch.exe
+ message(STATUS "Downloading patch utility from ${PATCH_URL}...")
+ file(DOWNLOAD "${PATCH_URL}" "${PATCH_DOWNLOAD}" STATUS PATCH_DL_STATUS LOG PATCH_LOG SHOW_PROGRESS)
+ list(GET PATCH_DL_STATUS 0 PATCH_RETCODE)
+ if(NOT PATCH_RETCODE EQUAL 0)
+ message(FATAL_ERROR "ERROR downloading ${PATCH_URL} - status: ${PATCH_DL_STATUS} log: ${PATCH_LOG}")
+ endif()
+
+ # extract the archive containing patch.exe
+ execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${PATCH_DOWNLOAD}
+ WORKING_DIRECTORY ${BUILD_DIR})
+
+ # make sure the extraction worked and that patch.exe is there
+ set(PATCH_PATH ${BUILD_DIR}/${PATCH_ARCHIVE_NAME})
+ set(PATCH_BINARY_PATH ${PATCH_PATH}/bin/patch.exe)
+ if(NOT EXISTS ${PATCH_PATH} OR NOT EXISTS ${PATCH_BINARY_PATH})
+ message(FATAL_ERROR "ERROR extracting patch utility from ${PATCH_PATH}")
+ endif()
+
+ # copy patch.exe into the output directory
+ file(INSTALL ${PATCH_BINARY_PATH} DESTINATION ${ADDON_DEPENDS_PATH}/bin)
+
+ # make sure that cmake can find the copied patch.exe
+ find_program(PATCH_FOUND NAMES patch patch.exe)
+ if(NOT PATCH_FOUND)
+ message(FATAL_ERROR "ERROR installing patch utility from ${PATCH_BINARY_PATH} to ${ADDON_DEPENDS_PATH}/bin")
+ endif()
+endif()
diff --git a/cmake/treedata/windowsstore/externals.txt b/cmake/treedata/windowsstore/externals.txt
new file mode 100644
index 0000000000..989677e6c9
--- /dev/null
+++ b/cmake/treedata/windowsstore/externals.txt
@@ -0,0 +1 @@
+lib/win32/Effects11 Effects11
diff --git a/cmake/treedata/windowsstore/subdirs.txt b/cmake/treedata/windowsstore/subdirs.txt
new file mode 100644
index 0000000000..268781dfca
--- /dev/null
+++ b/cmake/treedata/windowsstore/subdirs.txt
@@ -0,0 +1,16 @@
+xbmc/platform/win10 platform_win10
+xbmc/input/windows input/windows
+xbmc/input/touch input/touch
+xbmc/input/touch/generic input/touch/generic
+xbmc/network/win10 network/win10
+xbmc/network/mdns network/mdns
+xbmc/peripherals/bus/win10 peripherals/bus/win10
+xbmc/powermanagement/windows powermanagement/windows
+xbmc/storage/windows storage/windows
+xbmc/filesystem/win32 filesystem/win32
+xbmc/filesystem/win10 filesystem/win10
+xbmc/utils/win32 utils_win32
+xbmc/rendering/dx rendering_dx
+xbmc/threads/platform/win threads_win
+xbmc/windowing/win10 windowing/win10
+xbmc/cores/VideoPlayer/Process/windows cores/VideoPlayer/Process/windows
diff --git a/lib/gtest/CMakeLists.txt b/lib/gtest/CMakeLists.txt
index 621d0f0421..f7e27ac88b 100644
--- a/lib/gtest/CMakeLists.txt
+++ b/lib/gtest/CMakeLists.txt
@@ -91,6 +91,10 @@ cxx_library(gtest "${cxx_strict}" src/gtest-all.cc)
cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
target_link_libraries(gtest_main gtest)
+if(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ set_target_properties(gtest PROPERTIES STATIC_LIBRARY_FLAGS "/ignore:4264")
+endif()
+
# If the CMake version supports it, attach header directory information
# to the targets for when we are part of a parent build (ie being pulled
# in via add_subdirectory() rather than being a standalone build).
diff --git a/lib/win32/Effects11/CMakeLists.txt b/lib/win32/Effects11/CMakeLists.txt
index abee71285b..a71fa221c5 100644
--- a/lib/win32/Effects11/CMakeLists.txt
+++ b/lib/win32/Effects11/CMakeLists.txt
@@ -10,6 +10,18 @@ target_include_directories(effects11
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Binary
)
+
+if(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ target_compile_definitions(effects11 PRIVATE
+ _WIN7_PLATFORM_UPDATE
+ WIN32
+ _WINDOWS
+ _LIB
+ D3DXFX_LARGEADDRESS_HANDLE
+ _WIN32_WINNT=0x0A00
+ _CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS
+ )
+else()
target_compile_definitions(effects11 PRIVATE
_WIN7_PLATFORM_UPDATE
WIN32
@@ -19,7 +31,13 @@ target_compile_definitions(effects11 PRIVATE
_WIN32_WINNT=0x0600
_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS
)
+endif()
+
add_precompiled_header(effects11 pchfx.h d3dxGlobal.cpp)
set_target_properties(effects11 PROPERTIES FOLDER lib)
source_group_by_folder(effects11)
set(core_DEPENDS effects11 ${core_DEPENDS} CACHE STRING "" FORCE)
+
+if(CORE_SYSTEM_NAME STREQUAL windowsstore)
+ set_target_properties(effects11 PROPERTIES STATIC_LIBRARY_FLAGS "/ignore:4264")
+endif()
diff --git a/xbmc/rendering/CMakeLists.txt b/xbmc/rendering/CMakeLists.txt
index 8251d0f8bd..6f1b7f1043 100644
--- a/xbmc/rendering/CMakeLists.txt
+++ b/xbmc/rendering/CMakeLists.txt
@@ -4,7 +4,7 @@ set(HEADERS RenderSystem.h
RenderSystemTypes.h)
core_add_library(rendering)
-if(NOT CORE_SYSTEM_NAME STREQUAL windows)
+if(NOT CORE_SYSTEM_NAME STREQUAL windows AND NOT CORE_SYSTEM_NAME STREQUAL windowsstore)
if(HAVE_SSE)
target_compile_options(${CORE_LIBRARY} PRIVATE -msse)
endif()