summaryrefslogtreecommitdiffstats
path: root/project/cmake/scripts/windows/ArchSetup.cmake
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2016-11-24 21:27:41 +0100
committermanuel <manuel@mausz.at>2016-11-24 21:27:41 +0100
commit8cdf8dec703d882b46ca50a769fabb95ffc48e2c (patch)
treef7fe8233508f79d3dc94f8f445ce6342e7dfbdbb /project/cmake/scripts/windows/ArchSetup.cmake
parent5823b05feb29a59510c32a9c28ca18b50b9b6399 (diff)
downloadkodi-pvr-build-8cdf8dec703d882b46ca50a769fabb95ffc48e2c.tar.gz
kodi-pvr-build-8cdf8dec703d882b46ca50a769fabb95ffc48e2c.tar.bz2
kodi-pvr-build-8cdf8dec703d882b46ca50a769fabb95ffc48e2c.zip
sync with upstream
Diffstat (limited to 'project/cmake/scripts/windows/ArchSetup.cmake')
-rw-r--r--project/cmake/scripts/windows/ArchSetup.cmake89
1 files changed, 89 insertions, 0 deletions
diff --git a/project/cmake/scripts/windows/ArchSetup.cmake b/project/cmake/scripts/windows/ArchSetup.cmake
new file mode 100644
index 0000000..431b641
--- /dev/null
+++ b/project/cmake/scripts/windows/ArchSetup.cmake
@@ -0,0 +1,89 @@
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()