summaryrefslogtreecommitdiffstats
path: root/project/cmake/scripts/windows
diff options
context:
space:
mode:
Diffstat (limited to 'project/cmake/scripts/windows')
-rw-r--r--project/cmake/scripts/windows/ArchSetup.cmake89
-rw-r--r--project/cmake/scripts/windows/CFlagOverrides.cmake5
-rw-r--r--project/cmake/scripts/windows/CXXFlagOverrides.cmake5
-rw-r--r--project/cmake/scripts/windows/Install.cmake0
-rw-r--r--project/cmake/scripts/windows/Macros.cmake66
-rw-r--r--project/cmake/scripts/windows/PathSetup.cmake34
-rw-r--r--project/cmake/scripts/windows/tools/patch.cmake37
7 files changed, 0 insertions, 236 deletions
diff --git a/project/cmake/scripts/windows/ArchSetup.cmake b/project/cmake/scripts/windows/ArchSetup.cmake
deleted file mode 100644
index 431b641..0000000
--- a/project/cmake/scripts/windows/ArchSetup.cmake
+++ /dev/null
@@ -1,89 +0,0 @@
1# -------- Architecture settings ---------
2
3set(ARCH win32)
4
5
6# -------- Paths (mainly for find_package) ---------
7
8set(PLATFORM_DIR platform/win32)
9
10# Precompiled headers fail with per target output directory. (needs CMake 3.1)
11set(PRECOMPILEDHEADER_DIR ${PROJECT_BINARY_DIR}/${CORE_BUILD_CONFIG}/objs)
12
13set(CMAKE_SYSTEM_NAME Windows)
14list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32)
15list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg)
16list(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg/bin)
17list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${PROJECT_SOURCE_DIR}/../BuildDependencies)
18
19set(PYTHON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/../BuildDependencies/include/python)
20
21
22# -------- Compiler options ---------
23
24add_options(CXX ALL_BUILDS "/wd\"4996\"")
25set(ARCH_DEFINES -D_WINDOWS -DTARGET_WINDOWS)
26set(SYSTEM_DEFINES -DNOMINMAX -D_USE_32BIT_TIME_T -DHAS_DX -D__STDC_CONSTANT_MACROS
27 -DTAGLIB_STATIC -DNPT_CONFIG_ENABLE_LOGGING
28 -DPLT_HTTP_DEFAULT_USER_AGENT="UPnP/1.0 DLNADOC/1.50 Kodi"
29 -DPLT_HTTP_DEFAULT_SERVER="UPnP/1.0 DLNADOC/1.50 Kodi"
30 $<$<CONFIG:Debug>:-DD3D_DEBUG_INFO -D_ITERATOR_DEBUG_LEVEL=0>)
31
32# Make sure /FS is set for Visual Studio in order to prevent simultanious access to pdb files.
33if(CMAKE_GENERATOR MATCHES "Visual Studio")
34 set(CMAKE_CXX_FLAGS "/MP /FS ${CMAKE_CXX_FLAGS}")
35endif()
36
37# Google Test needs to use shared version of runtime libraries
38set(gtest_force_shared_crt ON CACHE STRING "" FORCE)
39
40
41# -------- Linker options ---------
42
43set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
44
45# For #pragma comment(lib X)
46# TODO: It would certainly be better to handle these libraries via CMake modules.
47link_directories(${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg/bin
48 ${PROJECT_SOURCE_DIR}/../BuildDependencies/lib)
49
50# Additional libraries
51list(APPEND DEPLIBS d3d11.lib DInput8.lib DSound.lib winmm.lib Mpr.lib Iphlpapi.lib
52 PowrProf.lib setupapi.lib dwmapi.lib yajl.lib dxguid.lib DelayImp.lib)
53
54# NODEFAULTLIB option
55set(_nodefaultlibs_RELEASE libcmt)
56set(_nodefaultlibs_DEBUG libcmt msvcrt)
57foreach(_lib ${_nodefaultlibs_RELEASE})
58 set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:\"${_lib}\"")
59endforeach()
60foreach(_lib ${_nodefaultlibs_DEBUG})
61 set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:\"${_lib}\"")
62endforeach()
63
64# DELAYLOAD option
65set(_delayloadlibs zlib.dll libmysql.dll libxslt.dll dnssd.dll dwmapi.dll ssh.dll sqlite3.dll
66 avcodec-57.dll avfilter-6.dll avformat-57.dll avutil-55.dll
67 postproc-54.dll swresample-2.dll swscale-4.dll d3dcompiler_47.dll)
68foreach(_lib ${_delayloadlibs})
69 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:\"${_lib}\"")
70endforeach()
71
72# Make the Release version create a PDB
73set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
74# Minimize the size or the resulting DLLs
75set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF")
76
77
78# -------- Visual Studio options ---------
79
80if(CMAKE_GENERATOR MATCHES "Visual Studio")
81 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
82
83 # Generate a batch file that opens Visual Studio with the necessary env variables set.
84 file(WRITE ${CMAKE_BINARY_DIR}/kodi-sln.bat
85 "@echo off\n"
86 "set KODI_HOME=%~dp0\n"
87 "set PATH=%~dp0\\system\n"
88 "start %~dp0\\${PROJECT_NAME}.sln")
89endif()
diff --git a/project/cmake/scripts/windows/CFlagOverrides.cmake b/project/cmake/scripts/windows/CFlagOverrides.cmake
deleted file mode 100644
index 3158e75..0000000
--- a/project/cmake/scripts/windows/CFlagOverrides.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
1if(MSVC)
2 set(CMAKE_C_FLAGS_INIT "/MP /DWIN32 /D_WINDOWS /W3 /Zi /arch:SSE2")
3 set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0")
4 set(CMAKE_C_FLAGS_RELEASE_INIT "/MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
5endif()
diff --git a/project/cmake/scripts/windows/CXXFlagOverrides.cmake b/project/cmake/scripts/windows/CXXFlagOverrides.cmake
deleted file mode 100644
index 0b52dc6..0000000
--- a/project/cmake/scripts/windows/CXXFlagOverrides.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
1if(MSVC)
2 set(CMAKE_CXX_FLAGS_INIT "/MP /DWIN32 /D_WINDOWS /W3 /GR /Zi /EHsc /arch:SSE2")
3 set(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Ob0 /Od /RTC1 /D_ITERATOR_DEBUG_LEVEL=0")
4 set(CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /Ox /Ob2 /Oi /Ot /Oy /GL /DNDEBUG")
5endif()
diff --git a/project/cmake/scripts/windows/Install.cmake b/project/cmake/scripts/windows/Install.cmake
deleted file mode 100644
index e69de29..0000000
--- a/project/cmake/scripts/windows/Install.cmake
+++ /dev/null
diff --git a/project/cmake/scripts/windows/Macros.cmake b/project/cmake/scripts/windows/Macros.cmake
deleted file mode 100644
index 2d3500d..0000000
--- a/project/cmake/scripts/windows/Macros.cmake
+++ /dev/null
@@ -1,66 +0,0 @@
1function(core_link_library lib wraplib)
2 message(AUTHOR_WARNING "core_link_library is not compatible with windows.")
3endfunction()
4
5function(find_soname lib)
6 # Windows uses hardcoded dlls in xbmc/DllPaths_win32.h.
7 # Therefore the output of this function is unused.
8endfunction()
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
23function(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()
66endfunction()
diff --git a/project/cmake/scripts/windows/PathSetup.cmake b/project/cmake/scripts/windows/PathSetup.cmake
deleted file mode 100644
index 8550616..0000000
--- a/project/cmake/scripts/windows/PathSetup.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
1if(NOT prefix)
2 set(prefix ${CMAKE_INSTALL_PREFIX})
3else()
4 set(CMAKE_INSTALL_PREFIX ${prefix})
5endif()
6if(NOT exec_prefix)
7 set(exec_prefix ${prefix})
8endif()
9if(NOT libdir)
10 set(libdir ${prefix}/lib)
11endif()
12if(NOT bindir)
13 set(bindir ${prefix}/bin)
14endif()
15if(NOT includedir)
16 set(includedir ${prefix}/include)
17endif()
18if(NOT datarootdir)
19 set(datarootdir ${prefix}/share)
20endif()
21if(NOT datadir)
22 set(datadir ${datarootdir})
23endif()
24
25list(APPEND final_message "-- PATH config --")
26list(APPEND final_message "Prefix: ${prefix}")
27list(APPEND final_message "Libdir: ${libdir}")
28list(APPEND final_message "Bindir: ${bindir}")
29list(APPEND final_message "Includedir: ${includedir}")
30list(APPEND final_message "Datarootdir: ${datarootdir}")
31list(APPEND final_message "Datadir: ${datadir}")
32
33set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/kodi\"
34 -DINSTALL_PATH=\"${datarootdir}/kodi\")
diff --git a/project/cmake/scripts/windows/tools/patch.cmake b/project/cmake/scripts/windows/tools/patch.cmake
deleted file mode 100644
index 0ef2952..0000000
--- a/project/cmake/scripts/windows/tools/patch.cmake
+++ /dev/null
@@ -1,37 +0,0 @@
1find_program(PATCH_FOUND NAMES patch patch.exe)
2if(PATCH_FOUND)
3 message(STATUS "patch utility found at ${PATCH_FOUND}")
4else()
5 set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-1")
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()
37endif()