[video] Fix bookmark thumbnails of rotated videos
[xbmc.git] / cmake / scripts / windowsstore / ArchSetup.cmake
blobff18e4a6d4ec4e34fdc5ca8f8fe5b9e7ae1ec175
1 # Minimum SDK version we support
2 set(VS_MINIMUM_SDK_VERSION 10.0.18362.0)
4 if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION VERSION_LESS VS_MINIMUM_SDK_VERSION)
5   message(FATAL_ERROR "Detected Windows SDK version is ${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}.\n"
6     "Windows SDK ${VS_MINIMUM_SDK_VERSION} or higher is required.\n"
7     "INFO: Windows SDKs can be installed from the Visual Studio installer.")
8 endif()
10 # -------- Host Settings ---------
12 set(_gentoolset ${CMAKE_GENERATOR_TOOLSET})
13 string(REPLACE "host=" "" HOSTTOOLSET ${_gentoolset})
14 unset(_gentoolset)
16 # -------- Architecture settings ---------
18 check_symbol_exists(_X86_ "Windows.h" _X86_)
19 check_symbol_exists(_AMD64_ "Windows.h" _AMD64_)
20 check_symbol_exists(_ARM_ "Windows.h" _ARM_)
22 if(_X86_)
23    set(ARCH win32)
24    set(SDK_TARGET_ARCH x86)
25 elseif(_AMD64_)
26    set(ARCH x64)
27    set(SDK_TARGET_ARCH x64)
28 elseif(_ARM_)
29    set(ARCH arm)
30    set(SDK_TARGET_ARCH arm)
31 else()
32    message(FATAL_ERROR "Unsupported architecture")
33 endif()
35 unset(_X86_)
36 unset(_AMD64_)
37 unset(_ARM_)
39 # -------- Paths (mainly for find_package) ---------
41 set(PLATFORM_DIR platform/win32)
42 set(APP_RENDER_SYSTEM dx11)
43 set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/win10/main.cpp)
45 # Precompiled headers fail with per target output directory. (needs CMake 3.1)
46 set(PRECOMPILEDHEADER_DIR ${PROJECT_BINARY_DIR}/${CORE_BUILD_CONFIG}/objs)
48 set(CMAKE_SYSTEM_NAME WindowsStore)
49 set(CORE_SYSTEM_NAME "windowsstore")
50 set(PACKAGE_GUID "281d668b-5739-4abd-b3c2-ed1cda572ed2")
51 set(APP_MANIFEST_NAME package.appxmanifest)
52 set(DEPS_FOLDER_RELATIVE project/BuildDependencies)
54 # ToDo: currently host build tools are hardcoded to win32
55 # If we ever allow package.native other than 0_package.native-win32.list we will want to
56 # adapt this based on host
57 set(NATIVEPREFIX ${CMAKE_SOURCE_DIR}/${DEPS_FOLDER_RELATIVE}/win32)
58 set(DEPENDS_PATH ${CMAKE_SOURCE_DIR}/${DEPS_FOLDER_RELATIVE}/win10-${ARCH})
59 set(MINGW_LIBS_DIR ${CMAKE_SOURCE_DIR}/${DEPS_FOLDER_RELATIVE}/mingwlibs/win10-${ARCH})
61 # mingw libs
62 list(APPEND CMAKE_PREFIX_PATH ${MINGW_LIBS_DIR})
63 list(APPEND CMAKE_LIBRARY_PATH ${MINGW_LIBS_DIR}/bin)
65 if(NOT TARBALL_DIR)
66   set(TARBALL_DIR "${CMAKE_SOURCE_DIR}/project/BuildDependencies/downloads")
67 endif()
69 # -------- Compiler options ---------
71 add_options(CXX ALL_BUILDS "/wd\"4996\"")
72 add_options(CXX ALL_BUILDS "/wd\"4146\"")
73 add_options(CXX ALL_BUILDS "/wd\"4251\"")
74 add_options(CXX ALL_BUILDS "/wd\"4668\"")
75 add_options(CXX ALL_BUILDS "/wd\"5033\"")
76 set(ARCH_DEFINES -D_WINDOWS -DTARGET_WINDOWS -DTARGET_WINDOWS_STORE -DXBMC_EXPORT -DMS_UWP -DMS_STORE)
77 if(NOT SDK_TARGET_ARCH STREQUAL arm)
78   list(APPEND ARCH_DEFINES -D__SSE__ -D__SSE2__)
79 endif()
80 set(SYSTEM_DEFINES -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DHAS_DX -D__STDC_CONSTANT_MACROS
81                    -DTAGLIB_STATIC -DNPT_CONFIG_ENABLE_LOGGING
82                    -DPLT_HTTP_DEFAULT_USER_AGENT="UPnP/1.0 DLNADOC/1.50 Kodi"
83                    -DPLT_HTTP_DEFAULT_SERVER="UPnP/1.0 DLNADOC/1.50 Kodi"
84                    -DUNICODE -D_UNICODE
85                    -DFRIBIDI_STATIC
86                    $<$<CONFIG:Debug>:-DD3D_DEBUG_INFO>)
88 # Additional SYSTEM_DEFINES
89 list(APPEND SYSTEM_DEFINES -DHAS_WIN10_NETWORK)
91 # The /MP option enables /FS by default.
92 if(DEFINED ENV{MAXTHREADS})
93   set(MP_FLAG "/MP$ENV{MAXTHREADS}")
94 else()
95   set(MP_FLAG "/MP")
96 endif()
97 set(CMAKE_CXX_FLAGS "${MP_FLAG} ${CMAKE_CXX_FLAGS} /EHsc /await /permissive-")
98 # Google Test needs to use shared version of runtime libraries
99 set(gtest_force_shared_crt ON CACHE STRING "" FORCE)
102 # -------- Linker options ---------
104 # For #pragma comment(lib X)
105 # TODO: It would certainly be better to handle these libraries via CMake modules.
106 link_directories(${MINGW_LIBS_DIR}/lib
107                  ${DEPENDS_PATH}/lib)
109 list(APPEND DEPLIBS bcrypt.lib d3d11.lib WS2_32.lib dxguid.lib dloadhelper.lib WindowsApp.lib)
111 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /WINMD:NO")
112 set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:msvcrt /DEBUG:FASTLINK /OPT:NOREF /OPT:NOICF")
114 # Make the Release version create a PDB
115 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
116 # Minimize the size or the resulting DLLs
117 set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF")
118 # remove warning
119 set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4264")
122 # -------- Visual Studio options ---------
124 if(CMAKE_GENERATOR MATCHES "Visual Studio")
125   set_property(GLOBAL PROPERTY USE_FOLDERS ON)
126 endif()
128 # -------- Build options ---------
130 set(ENABLE_OPTICAL OFF CACHE BOOL "" FORCE)