diff options
Diffstat (limited to 'cmake/scripts/windowsstore')
| -rw-r--r-- | cmake/scripts/windowsstore/ArchSetup.cmake | 121 | ||||
| -rw-r--r-- | cmake/scripts/windowsstore/CFlagOverrides.cmake | 12 | ||||
| -rw-r--r-- | cmake/scripts/windowsstore/CXXFlagOverrides.cmake | 12 | ||||
| -rw-r--r-- | cmake/scripts/windowsstore/Install.cmake | 0 | ||||
| -rw-r--r-- | cmake/scripts/windowsstore/Macros.cmake | 181 | ||||
| -rw-r--r-- | cmake/scripts/windowsstore/PathSetup.cmake | 34 | ||||
| -rw-r--r-- | cmake/scripts/windowsstore/tools/patch.cmake | 37 |
7 files changed, 397 insertions, 0 deletions
diff --git a/cmake/scripts/windowsstore/ArchSetup.cmake b/cmake/scripts/windowsstore/ArchSetup.cmake new file mode 100644 index 0000000..6c6622c --- /dev/null +++ b/cmake/scripts/windowsstore/ArchSetup.cmake | |||
| @@ -0,0 +1,121 @@ | |||
| 1 | # -------- Architecture settings --------- | ||
| 2 | |||
| 3 | check_symbol_exists(_X86_ "Windows.h" _X86_) | ||
| 4 | check_symbol_exists(_AMD64_ "Windows.h" _AMD64_) | ||
| 5 | check_symbol_exists(_ARM_ "Windows.h" _ARM_) | ||
| 6 | |||
| 7 | if(_X86_) | ||
| 8 | set(ARCH win32) | ||
| 9 | set(SDK_TARGET_ARCH x86) | ||
| 10 | elseif(_AMD64_) | ||
| 11 | set(ARCH x64) | ||
| 12 | set(SDK_TARGET_ARCH x64) | ||
| 13 | elseif(_ARM_) | ||
| 14 | set(ARCH arm) | ||
| 15 | set(SDK_TARGET_ARCH arm) | ||
| 16 | else() | ||
| 17 | message(FATAL_ERROR "Unsupported architecture") | ||
| 18 | endif() | ||
| 19 | |||
| 20 | unset(_X86_) | ||
| 21 | unset(_AMD64_) | ||
| 22 | unset(_ARM_) | ||
| 23 | |||
| 24 | # -------- Paths (mainly for find_package) --------- | ||
| 25 | |||
| 26 | set(PLATFORM_DIR platform/win32) | ||
| 27 | set(CORE_MAIN_SOURCE ${CMAKE_SOURCE_DIR}/xbmc/platform/win10/main.cpp) | ||
| 28 | |||
| 29 | # Precompiled headers fail with per target output directory. (needs CMake 3.1) | ||
| 30 | set(PRECOMPILEDHEADER_DIR ${PROJECT_BINARY_DIR}/${CORE_BUILD_CONFIG}/objs) | ||
| 31 | |||
| 32 | set(CMAKE_SYSTEM_NAME WindowsStore) | ||
| 33 | set(CORE_SYSTEM_NAME "windowsstore") | ||
| 34 | set(PACKAGE_GUID "281d668b-5739-4abd-b3c2-ed1cda572ed2") | ||
| 35 | set(APP_MANIFEST_NAME package.appxmanifest) | ||
| 36 | set(DEPS_FOLDER_RELATIVE project/BuildDependencies) | ||
| 37 | |||
| 38 | set(DEPENDENCIES_DIR ${CMAKE_SOURCE_DIR}/${DEPS_FOLDER_RELATIVE}/win10-${ARCH}) | ||
| 39 | set(MINGW_LIBS_DIR ${CMAKE_SOURCE_DIR}/${DEPS_FOLDER_RELATIVE}/mingwlibs/win10-${ARCH}) | ||
| 40 | |||
| 41 | # mingw libs | ||
| 42 | list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${MINGW_LIBS_DIR}) | ||
| 43 | list(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${MINGW_LIBS_DIR}/bin) | ||
| 44 | # dependencies | ||
| 45 | list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${DEPENDENCIES_DIR}) | ||
| 46 | # for python | ||
| 47 | set(PYTHON_INCLUDE_DIR ${DEPENDENCIES_DIR}/include/python) | ||
| 48 | |||
| 49 | |||
| 50 | # -------- Compiler options --------- | ||
| 51 | |||
| 52 | add_options(CXX ALL_BUILDS "/wd\"4996\"") | ||
| 53 | add_options(CXX ALL_BUILDS "/wd\"4146\"") | ||
| 54 | add_options(CXX ALL_BUILDS "/wd\"4251\"") | ||
| 55 | add_options(CXX ALL_BUILDS "/wd\"4668\"") | ||
| 56 | set(ARCH_DEFINES -D_WINDOWS -DTARGET_WINDOWS -DTARGET_WINDOWS_STORE -DXBMC_EXPORT -DMS_UWP) | ||
| 57 | if(NOT SDK_TARGET_ARCH STREQUAL arm) | ||
| 58 | list(APPEND ARCH_DEFINES -D__SSE__ -D__SSE2__) | ||
| 59 | endif() | ||
| 60 | set(SYSTEM_DEFINES -DNOMINMAX -DHAS_DX -D__STDC_CONSTANT_MACROS | ||
| 61 | -DFMT_HEADER_ONLY -DTAGLIB_STATIC -DNPT_CONFIG_ENABLE_LOGGING | ||
| 62 | -DPLT_HTTP_DEFAULT_USER_AGENT="UPnP/1.0 DLNADOC/1.50 Kodi" | ||
| 63 | -DPLT_HTTP_DEFAULT_SERVER="UPnP/1.0 DLNADOC/1.50 Kodi" | ||
| 64 | -DUNICODE -D_UNICODE | ||
| 65 | $<$<CONFIG:Debug>:-DD3D_DEBUG_INFO>) | ||
| 66 | |||
| 67 | # Additional SYSTEM_DEFINES | ||
| 68 | list(APPEND SYSTEM_DEFINES -DHAS_IRSERVERSUITE -DHAS_WIN10_NETWORK) | ||
| 69 | |||
| 70 | # The /MP option enables /FS by default. | ||
| 71 | set(CMAKE_CXX_FLAGS "/MP ${CMAKE_CXX_FLAGS} /ZW /EHsc /await") | ||
| 72 | # Google Test needs to use shared version of runtime libraries | ||
| 73 | set(gtest_force_shared_crt ON CACHE STRING "" FORCE) | ||
| 74 | |||
| 75 | |||
| 76 | # -------- Linker options --------- | ||
| 77 | |||
| 78 | # For #pragma comment(lib X) | ||
| 79 | # TODO: It would certainly be better to handle these libraries via CMake modules. | ||
| 80 | link_directories(${MINGW_LIBS_DIR}/lib | ||
| 81 | ${DEPENDENCIES_DIR}/lib) | ||
| 82 | |||
| 83 | list(APPEND DEPLIBS d3d11.lib WS2_32.lib dxguid.lib dloadhelper.lib) | ||
| 84 | if(ARCH STREQUAL win32 OR ARCH STREQUAL x64) | ||
| 85 | list(APPEND DEPLIBS DInput8.lib DSound.lib winmm.lib Mpr.lib Iphlpapi.lib PowrProf.lib setupapi.lib dwmapi.lib) | ||
| 86 | endif() | ||
| 87 | # NODEFAULTLIB option | ||
| 88 | |||
| 89 | set(_nodefaultlibs_RELEASE libcmt) | ||
| 90 | set(_nodefaultlibs_DEBUG libcmt msvcrt) | ||
| 91 | foreach(_lib ${_nodefaultlibs_RELEASE}) | ||
| 92 | set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:\"${_lib}\"") | ||
| 93 | endforeach() | ||
| 94 | foreach(_lib ${_nodefaultlibs_DEBUG}) | ||
| 95 | set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:\"${_lib}\"") | ||
| 96 | endforeach() | ||
| 97 | |||
| 98 | # Make the Release version create a PDB | ||
| 99 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") | ||
| 100 | # Minimize the size or the resulting DLLs | ||
| 101 | set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF") | ||
| 102 | # remove warning | ||
| 103 | set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4264") | ||
| 104 | |||
| 105 | |||
| 106 | # -------- Visual Studio options --------- | ||
| 107 | |||
| 108 | if(CMAKE_GENERATOR MATCHES "Visual Studio") | ||
| 109 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
| 110 | |||
| 111 | # Generate a batch file that opens Visual Studio with the necessary env variables set. | ||
| 112 | file(WRITE ${CMAKE_BINARY_DIR}/kodi-sln.bat | ||
| 113 | "@echo off\n" | ||
| 114 | "set KODI_HOME=%~dp0\n" | ||
| 115 | "set PATH=%~dp0\\system\n" | ||
| 116 | "start %~dp0\\${PROJECT_NAME}.sln") | ||
| 117 | endif() | ||
| 118 | |||
| 119 | # -------- Build options --------- | ||
| 120 | |||
| 121 | 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 0000000..0cd1c4d --- /dev/null +++ b/cmake/scripts/windowsstore/CFlagOverrides.cmake | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | # compiler flags | ||
| 2 | string(APPEND CMAKE_C_FLAGS_INIT " /D_UNICODE /DUNICODE /MP /DWIN32 /D_WINDOWS /W3 /Zi /DTARGET_WINDOWS") | ||
| 3 | string(APPEND CMAKE_C_FLAGS_INIT " /DWINAPI_FAMILY=2 /DTARGET_WINDOWS_STORE /D_WINSOCK_DEPRECATED_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE") | ||
| 4 | string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " /D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0") | ||
| 5 | string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " /MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG") | ||
| 6 | # linker flags | ||
| 7 | string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " /DYNAMICBASE /NXCOMPAT /APPCONTAINER") | ||
| 8 | # win32 specific flags | ||
| 9 | if("$ENV{Platform}" STREQUAL X86) | ||
| 10 | string(APPEND CMAKE_C_FLAGS_INIT " /arch:SSE2") | ||
| 11 | string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " /SAFESEH") | ||
| 12 | endif() | ||
diff --git a/cmake/scripts/windowsstore/CXXFlagOverrides.cmake b/cmake/scripts/windowsstore/CXXFlagOverrides.cmake new file mode 100644 index 0000000..2219af4 --- /dev/null +++ b/cmake/scripts/windowsstore/CXXFlagOverrides.cmake | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | # compiler flags | ||
| 2 | string(APPEND CMAKE_CXX_FLAGS_INIT " /D_UNICODE /DUNICODE /MP /DWIN32 /D_WINDOWS /W3 /GR /Zi /EHsc /DTARGET_WINDOWS") | ||
| 3 | string(APPEND CMAKE_CXX_FLAGS_INIT " /DWINAPI_FAMILY=2 /DTARGET_WINDOWS_STORE /D_WINSOCK_DEPRECATED_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE") | ||
| 4 | string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " /D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0") | ||
| 5 | string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " /MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG") | ||
| 6 | # linker flags | ||
| 7 | string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " /DYNAMICBASE /NXCOMPAT /APPCONTAINER") | ||
| 8 | # win32 specific flags | ||
| 9 | if("$ENV{Platform}" STREQUAL X86) | ||
| 10 | string(APPEND CMAKE_CXX_FLAGS_INIT " /arch:SSE2") | ||
| 11 | string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " /SAFESEH") | ||
| 12 | endif() | ||
diff --git a/cmake/scripts/windowsstore/Install.cmake b/cmake/scripts/windowsstore/Install.cmake new file mode 100644 index 0000000..e69de29 --- /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 0000000..6e7d1d0 --- /dev/null +++ b/cmake/scripts/windowsstore/Macros.cmake | |||
| @@ -0,0 +1,181 @@ | |||
| 1 | function(core_link_library lib wraplib) | ||
| 2 | message(AUTHOR_WARNING "core_link_library is not compatible with windows.") | ||
| 3 | endfunction() | ||
| 4 | |||
| 5 | function(find_soname lib) | ||
| 6 | # Windows uses hardcoded dlls in xbmc/DllPaths_win32.h. | ||
| 7 | # Therefore the output of this function is unused. | ||
| 8 | endfunction() | ||
| 9 | |||
| 10 | # Add precompiled header to target | ||
| 11 | # Arguments: | ||
| 12 | # target existing target that will be set up to compile with a precompiled header | ||
| 13 | # pch_header the precompiled header file | ||
| 14 | # pch_source the precompiled header source file | ||
| 15 | # Optional Arguments: | ||
| 16 | # PCH_TARGET build precompiled header as separate target with the given name | ||
| 17 | # so that the same precompiled header can be used for multiple libraries | ||
| 18 | # EXCLUDE_SOURCES if not all target sources shall use the precompiled header, | ||
| 19 | # the relevant files can be listed here | ||
| 20 | # On return: | ||
| 21 | # Compiles the pch_source into a precompiled header and adds the header to | ||
| 22 | # the given target | ||
| 23 | function(add_precompiled_header target pch_header pch_source) | ||
| 24 | cmake_parse_arguments(PCH "" "PCH_TARGET" "EXCLUDE_SOURCES" ${ARGN}) | ||
| 25 | |||
| 26 | if(PCH_PCH_TARGET) | ||
| 27 | set(pch_binary ${PRECOMPILEDHEADER_DIR}/${PCH_PCH_TARGET}.pch) | ||
| 28 | else() | ||
| 29 | set(pch_binary ${PRECOMPILEDHEADER_DIR}/${target}.pch) | ||
| 30 | endif() | ||
| 31 | |||
| 32 | # Set compile options and dependency for sources | ||
| 33 | get_target_property(sources ${target} SOURCES) | ||
| 34 | list(REMOVE_ITEM sources ${pch_source}) | ||
| 35 | foreach(exclude_source IN LISTS PCH_EXCLUDE_SOURCES) | ||
| 36 | list(REMOVE_ITEM sources ${exclude_source}) | ||
| 37 | endforeach() | ||
| 38 | set_source_files_properties(${sources} | ||
| 39 | PROPERTIES COMPILE_FLAGS "/Yu\"${pch_header}\" /Fp\"${pch_binary}\" /FI\"${pch_header}\"" | ||
| 40 | OBJECT_DEPENDS "${pch_binary}") | ||
| 41 | |||
| 42 | # Set compile options for precompiled header | ||
| 43 | if(NOT PCH_PCH_TARGET OR NOT TARGET ${PCH_PCH_TARGET}_pch) | ||
| 44 | set_source_files_properties(${pch_source} | ||
| 45 | PROPERTIES COMPILE_FLAGS "/Yc\"${pch_header}\" /Fp\"${pch_binary}\"" | ||
| 46 | OBJECT_OUTPUTS "${pch_binary}") | ||
| 47 | endif() | ||
| 48 | |||
| 49 | # Compile precompiled header | ||
| 50 | if(PCH_PCH_TARGET) | ||
| 51 | # As own target for usage in multiple libraries | ||
| 52 | if(NOT TARGET ${PCH_PCH_TARGET}_pch) | ||
| 53 | add_library(${PCH_PCH_TARGET}_pch STATIC ${pch_source}) | ||
| 54 | set_target_properties(${PCH_PCH_TARGET}_pch PROPERTIES COMPILE_PDB_NAME vc140 | ||
| 55 | COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR} | ||
| 56 | FOLDER "Build Utilities") | ||
| 57 | endif() | ||
| 58 | # From VS2012 onwards, precompiled headers have to be linked against (LNK2011). | ||
| 59 | target_link_libraries(${target} PUBLIC ${PCH_PCH_TARGET}_pch) | ||
| 60 | set_target_properties(${target} PROPERTIES COMPILE_PDB_NAME vc140 | ||
| 61 | COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR}) | ||
| 62 | else() | ||
| 63 | # As part of the target | ||
| 64 | target_sources(${target} PRIVATE ${pch_source}) | ||
| 65 | endif() | ||
| 66 | endfunction() | ||
| 67 | |||
| 68 | macro(winstore_set_assets target) | ||
| 69 | file(GLOB ASSET_FILES "${CMAKE_SOURCE_DIR}/tools/windows/packaging/uwp/media/*.png") | ||
| 70 | set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1) | ||
| 71 | set_property(SOURCE ${ASSET_FILES} PROPERTY VS_DEPLOYMENT_LOCATION "media") | ||
| 72 | source_group("media" FILES ${ASSET_FILES}) | ||
| 73 | set(RESOURCES ${RESOURCES} ${ASSET_FILES} | ||
| 74 | "${CMAKE_SOURCE_DIR}/tools/windows/packaging/uwp/kodi_temp_key.pfx") | ||
| 75 | set(LICENSE_FILES | ||
| 76 | ${CMAKE_SOURCE_DIR}/LICENSE.GPL | ||
| 77 | ${CMAKE_SOURCE_DIR}/copying.txt | ||
| 78 | ${CMAKE_SOURCE_DIR}/privacy-policy.txt) | ||
| 79 | if(EXISTS "${CMAKE_SOURCE_DIR}/known_issues.txt") | ||
| 80 | list(APPEND LICENSE_FILES ${CMAKE_SOURCE_DIR}/known_issues.txt) | ||
| 81 | endif() | ||
| 82 | set_property(SOURCE ${LICENSE_FILES} PROPERTY VS_DEPLOYMENT_CONTENT 1) | ||
| 83 | list(APPEND RESOURCES ${LICENSE_FILES}) | ||
| 84 | endmacro() | ||
| 85 | |||
| 86 | macro(winstore_generate_manifest target) | ||
| 87 | configure_file( | ||
| 88 | ${CMAKE_SOURCE_DIR}/tools/windows/packaging/uwp/${APP_MANIFEST_NAME}.in | ||
| 89 | ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME} | ||
| 90 | @ONLY) | ||
| 91 | set(RESOURCES ${RESOURCES} ${CMAKE_CURRENT_BINARY_DIR}/${APP_MANIFEST_NAME}) | ||
| 92 | endmacro() | ||
| 93 | |||
| 94 | macro(add_deployment_content_group path link match exclude) | ||
| 95 | set(_link "") | ||
| 96 | set(_exclude "") | ||
| 97 | file(TO_NATIVE_PATH ${path} _path) | ||
| 98 | file(TO_NATIVE_PATH ${match} _match) | ||
| 99 | if (NOT "${link}" STREQUAL "") | ||
| 100 | file(TO_NATIVE_PATH ${link} _link) | ||
| 101 | set(_link "${_link}\\") | ||
| 102 | endif() | ||
| 103 | if(NOT "${exclude}" STREQUAL "") | ||
| 104 | string(REPLACE "/" "\\" _exclude ${exclude}) | ||
| 105 | endif() | ||
| 106 | string(CONCAT UWP_DEPLOYMENT_CONTENT_STR "${UWP_DEPLOYMENT_CONTENT_STR}" | ||
| 107 | " <EmbedResources Include=\"${_path}\\${_match}\" Exclude=\"${_exclude}\">\n" | ||
| 108 | " <Link>${_link}%(RecursiveDir)%(FileName)%(Extension)</Link>\n" | ||
| 109 | " <DeploymentContent>true</DeploymentContent>\n" | ||
| 110 | " </EmbedResources>\n") | ||
| 111 | endmacro() | ||
| 112 | |||
| 113 | macro(winstore_append_props target) | ||
| 114 | # exclude debug dlls from packaging | ||
| 115 | set(DEBUG_DLLS zlibd.dll freetyped.dll sqlite3d.dll) | ||
| 116 | foreach(_dll ${DEBUG_DLLS}) | ||
| 117 | if (DEBUG_DLLS_EXCLUDE) | ||
| 118 | list(APPEND DEBUG_DLLS_EXCLUDE "\;$(BuildRootPath)/dlls/${_dll}") | ||
| 119 | else() | ||
| 120 | list(APPEND DEBUG_DLLS_EXCLUDE "$(BuildRootPath)/dlls/${_dll}") | ||
| 121 | endif() | ||
| 122 | string(CONCAT DEBUG_DLLS_LINKAGE_PROPS "${DEBUG_DLLS_LINKAGE_PROPS}" | ||
| 123 | " <ItemGroup Label=\"Binaries\">\n" | ||
| 124 | " <None Include=\"$(BinPath)\\${_dll}\" Condition=\"'$(Configuration)'=='Debug'\">\n" | ||
| 125 | " <DeploymentContent>true</DeploymentContent>\n" | ||
| 126 | " </None>\n" | ||
| 127 | " </ItemGroup>\n") | ||
| 128 | endforeach(_dll DEBUG_DLLS) | ||
| 129 | |||
| 130 | add_deployment_content_group($(BuildRootPath)/dlls "" *.dll "${DEBUG_DLLS_EXCLUDE}") | ||
| 131 | add_deployment_content_group($(BuildRootPath)/system system **/* "$(BuildRootPath)/**/*.glsl") | ||
| 132 | add_deployment_content_group($(BuildRootPath)/media media **/* "") | ||
| 133 | add_deployment_content_group($(BuildRootPath)/userdata userdata **/* "") | ||
| 134 | add_deployment_content_group($(BuildRootPath)/addons addons **/* "") | ||
| 135 | add_deployment_content_group($(BinaryAddonsPath) addons **/* "") | ||
| 136 | |||
| 137 | foreach(xbt_file ${XBT_FILES}) | ||
| 138 | file(RELATIVE_PATH relative ${CMAKE_CURRENT_BINARY_DIR} ${xbt_file}) | ||
| 139 | file(TO_NATIVE_PATH ${relative} relative) | ||
| 140 | string(CONCAT XBT_FILE_PROPS "${XBT_FILE_PROPS}" | ||
| 141 | " <ItemGroup Label=\"SkinsMedia\">\n" | ||
| 142 | " <None Include=\"$(BuildRootPath)\\${relative}\">\n" | ||
| 143 | " <Link>${relative}</Link>\n" | ||
| 144 | " <DeploymentContent>true</DeploymentContent>\n" | ||
| 145 | " </None>\n" | ||
| 146 | " </ItemGroup>\n") | ||
| 147 | endforeach() | ||
| 148 | |||
| 149 | set(VCPROJECT_PROPS_FILE "${CMAKE_CURRENT_BINARY_DIR}/${target}.props") | ||
| 150 | file(TO_NATIVE_PATH ${DEPENDENCIES_DIR} DEPENDENCIES_DIR_NATIVE) | ||
| 151 | file(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR} CMAKE_CURRENT_BINARY_DIR_NATIVE) | ||
| 152 | file(TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/project/Win32BuildSetup/BUILD_WIN32/addons BINARY_ADDONS_DIR_NATIVE) | ||
| 153 | |||
| 154 | file(WRITE ${VCPROJECT_PROPS_FILE} | ||
| 155 | "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" | ||
| 156 | "<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n" | ||
| 157 | " <ImportGroup Label=\"PropertySheets\" />\n" | ||
| 158 | " <PropertyGroup Label=\"APP_DLLS\">\n" | ||
| 159 | " <BinPath>${DEPENDENCIES_DIR_NATIVE}\\bin</BinPath>\n" | ||
| 160 | " <BuildRootPath>${CMAKE_CURRENT_BINARY_DIR_NATIVE}</BuildRootPath>\n" | ||
| 161 | " <BinaryAddonsPath>${BINARY_ADDONS_DIR_NATIVE}</BinaryAddonsPath>\n" | ||
| 162 | " </PropertyGroup>\n" | ||
| 163 | "${DEBUG_DLLS_LINKAGE_PROPS}" | ||
| 164 | "${XBT_FILE_PROPS}" | ||
| 165 | " <ItemGroup>\n" | ||
| 166 | "${UWP_DEPLOYMENT_CONTENT_STR}" | ||
| 167 | " </ItemGroup>\n" | ||
| 168 | " <Target Name=\"_CollectCustomResources\" Inputs=\"@(EmbedResources)\" Outputs=\"@(EmbedResources->'$(OutputPath)\\PackageLayout\\%(Link)')\" BeforeTargets=\"AssignTargetPaths\">\n" | ||
| 169 | " <Message Text=\"Collecting package resources...\"/>\n" | ||
| 170 | " <ItemGroup>\n" | ||
| 171 | " <None Include=\"@(EmbedResources)\" />\n" | ||
| 172 | " </ItemGroup>\n" | ||
| 173 | " </Target>\n" | ||
| 174 | "</Project>") | ||
| 175 | endmacro() | ||
| 176 | |||
| 177 | macro(winstore_add_target_properties target) | ||
| 178 | winstore_set_assets(${target}) | ||
| 179 | winstore_generate_manifest(${target}) | ||
| 180 | winstore_append_props(${target}) | ||
| 181 | 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 0000000..8550616 --- /dev/null +++ b/cmake/scripts/windowsstore/PathSetup.cmake | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | if(NOT prefix) | ||
| 2 | set(prefix ${CMAKE_INSTALL_PREFIX}) | ||
| 3 | else() | ||
| 4 | set(CMAKE_INSTALL_PREFIX ${prefix}) | ||
| 5 | endif() | ||
| 6 | if(NOT exec_prefix) | ||
| 7 | set(exec_prefix ${prefix}) | ||
| 8 | endif() | ||
| 9 | if(NOT libdir) | ||
| 10 | set(libdir ${prefix}/lib) | ||
| 11 | endif() | ||
| 12 | if(NOT bindir) | ||
| 13 | set(bindir ${prefix}/bin) | ||
| 14 | endif() | ||
| 15 | if(NOT includedir) | ||
| 16 | set(includedir ${prefix}/include) | ||
| 17 | endif() | ||
| 18 | if(NOT datarootdir) | ||
| 19 | set(datarootdir ${prefix}/share) | ||
| 20 | endif() | ||
| 21 | if(NOT datadir) | ||
| 22 | set(datadir ${datarootdir}) | ||
| 23 | endif() | ||
| 24 | |||
| 25 | list(APPEND final_message "-- PATH config --") | ||
| 26 | list(APPEND final_message "Prefix: ${prefix}") | ||
| 27 | list(APPEND final_message "Libdir: ${libdir}") | ||
| 28 | list(APPEND final_message "Bindir: ${bindir}") | ||
| 29 | list(APPEND final_message "Includedir: ${includedir}") | ||
| 30 | list(APPEND final_message "Datarootdir: ${datarootdir}") | ||
| 31 | list(APPEND final_message "Datadir: ${datadir}") | ||
| 32 | |||
| 33 | set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/kodi\" | ||
| 34 | -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 0000000..0a342fa --- /dev/null +++ b/cmake/scripts/windowsstore/tools/patch.cmake | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | find_program(PATCH_FOUND NAMES patch patch.exe) | ||
| 2 | if(PATCH_FOUND) | ||
| 3 | message(STATUS "patch utility found at ${PATCH_FOUND}") | ||
| 4 | else() | ||
| 5 | set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-3") | ||
| 6 | set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip") | ||
| 7 | set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}") | ||
| 8 | set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE}) | ||
| 9 | |||
| 10 | # download the archive containing patch.exe | ||
| 11 | message(STATUS "Downloading patch utility from ${PATCH_URL}...") | ||
| 12 | file(DOWNLOAD "${PATCH_URL}" "${PATCH_DOWNLOAD}" STATUS PATCH_DL_STATUS LOG PATCH_LOG SHOW_PROGRESS) | ||
| 13 | list(GET PATCH_DL_STATUS 0 PATCH_RETCODE) | ||
| 14 | if(NOT PATCH_RETCODE EQUAL 0) | ||
| 15 | message(FATAL_ERROR "ERROR downloading ${PATCH_URL} - status: ${PATCH_DL_STATUS} log: ${PATCH_LOG}") | ||
| 16 | endif() | ||
| 17 | |||
| 18 | # extract the archive containing patch.exe | ||
| 19 | execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${PATCH_DOWNLOAD} | ||
| 20 | WORKING_DIRECTORY ${BUILD_DIR}) | ||
| 21 | |||
| 22 | # make sure the extraction worked and that patch.exe is there | ||
| 23 | set(PATCH_PATH ${BUILD_DIR}/${PATCH_ARCHIVE_NAME}) | ||
| 24 | set(PATCH_BINARY_PATH ${PATCH_PATH}/bin/patch.exe) | ||
| 25 | if(NOT EXISTS ${PATCH_PATH} OR NOT EXISTS ${PATCH_BINARY_PATH}) | ||
| 26 | message(FATAL_ERROR "ERROR extracting patch utility from ${PATCH_PATH}") | ||
| 27 | endif() | ||
| 28 | |||
| 29 | # copy patch.exe into the output directory | ||
| 30 | file(INSTALL ${PATCH_BINARY_PATH} DESTINATION ${ADDON_DEPENDS_PATH}/bin) | ||
| 31 | |||
| 32 | # make sure that cmake can find the copied patch.exe | ||
| 33 | find_program(PATCH_FOUND NAMES patch patch.exe) | ||
| 34 | if(NOT PATCH_FOUND) | ||
| 35 | message(FATAL_ERROR "ERROR installing patch utility from ${PATCH_BINARY_PATH} to ${ADDON_DEPENDS_PATH}/bin") | ||
| 36 | endif() | ||
| 37 | endif() | ||
