summaryrefslogtreecommitdiffstats
path: root/project
diff options
context:
space:
mode:
Diffstat (limited to 'project')
-rw-r--r--project/cmake/CMakeLists.txt367
-rw-r--r--project/cmake/README.md166
-rw-r--r--project/cmake/addons/CMakeLists.txt156
-rw-r--r--project/cmake/addons/README28
-rw-r--r--project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.flac/platforms.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.lame/platforms.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.vorbis/platforms.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt1
-rw-r--r--project/cmake/addons/addons/audioencoder.wav/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.argustv/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt1
-rw-r--r--project/cmake/addons/addons/pvr.demo/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.demo/pvr.demo.txt1
-rw-r--r--project/cmake/addons/addons/pvr.dvblink/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt1
-rw-r--r--project/cmake/addons/addons/pvr.dvbviewer/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt1
-rw-r--r--project/cmake/addons/addons/pvr.filmon/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.filmon/pvr.filmon.txt1
-rw-r--r--project/cmake/addons/addons/pvr.hts/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.hts/pvr.hts.txt1
-rw-r--r--project/cmake/addons/addons/pvr.iptvsimple/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt1
-rw-r--r--project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt1
-rw-r--r--project/cmake/addons/addons/pvr.mythtv/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt1
-rw-r--r--project/cmake/addons/addons/pvr.nextpvr/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt1
-rw-r--r--project/cmake/addons/addons/pvr.njoy/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt1
-rw-r--r--project/cmake/addons/addons/pvr.pctv/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt1
-rw-r--r--project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt1
-rw-r--r--project/cmake/addons/addons/pvr.vuplus/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt1
-rw-r--r--project/cmake/addons/addons/pvr.wmc/platforms.txt1
-rw-r--r--project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt1
-rw-r--r--project/cmake/addons/bootstrap/CMakeLists.txt95
-rw-r--r--project/cmake/addons/bootstrap/README.md48
-rw-r--r--project/cmake/addons/bootstrap/bootstrap.cmake38
-rw-r--r--project/cmake/addons/bootstrap/repositories/binary-addons.txt1
-rw-r--r--project/cmake/addons/depends/common/kodi-platform/deps.txt4
-rw-r--r--project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt2
-rw-r--r--project/cmake/addons/depends/common/p8-platform/p8-platform.txt1
-rw-r--r--project/cmake/addons/depends/common/tinyxml/tinyxml.txt2
-rw-r--r--project/cmake/installdata/addon-bindings.txt28
-rw-r--r--project/cmake/installdata/common/addons.txt40
-rw-r--r--project/cmake/installdata/common/common.txt13
-rw-r--r--project/cmake/installdata/darwin/runtime.txt1
-rw-r--r--project/cmake/installdata/linux/lirc.txt1
-rw-r--r--project/cmake/installdata/test-reference-data.txt10
-rw-r--r--project/cmake/installdata/windows/addons.txt1
-rw-r--r--project/cmake/installdata/windows/dlls.txt6
-rw-r--r--project/cmake/installdata/windows/irss.txt2
-rw-r--r--project/cmake/kodi-config.cmake.in22
-rw-r--r--project/cmake/modules/FindAML.cmake35
-rw-r--r--project/cmake/modules/FindASS.cmake18
-rw-r--r--project/cmake/modules/FindAlsa.cmake20
-rw-r--r--project/cmake/modules/FindAvahi.cmake26
-rw-r--r--project/cmake/modules/FindBluray.cmake57
-rw-r--r--project/cmake/modules/FindCCache.cmake6
-rw-r--r--project/cmake/modules/FindCEC.cmake58
-rw-r--r--project/cmake/modules/FindCXX11.cmake18
-rw-r--r--project/cmake/modules/FindCdio.cmake20
-rw-r--r--project/cmake/modules/FindCpluff.cmake46
-rw-r--r--project/cmake/modules/FindCrossGUID.cmake56
-rw-r--r--project/cmake/modules/FindCurl.cmake37
-rw-r--r--project/cmake/modules/FindD3DX11Effects.cmake49
-rw-r--r--project/cmake/modules/FindDbus.cmake21
-rw-r--r--project/cmake/modules/FindEGL.cmake48
-rw-r--r--project/cmake/modules/FindEMBEDDED.cmake17
-rw-r--r--project/cmake/modules/FindFFMPEG.cmake99
-rw-r--r--project/cmake/modules/FindFreeType.cmake18
-rw-r--r--project/cmake/modules/FindFribidi.cmake18
-rw-r--r--project/cmake/modules/FindGIF.cmake46
-rw-r--r--project/cmake/modules/FindJsonSchemaBuilder.cmake19
-rw-r--r--project/cmake/modules/FindLibDvd.cmake116
-rw-r--r--project/cmake/modules/FindLibSmbClient.cmake65
-rw-r--r--project/cmake/modules/FindLibUSB.cmake45
-rw-r--r--project/cmake/modules/FindLzo2.cmake22
-rw-r--r--project/cmake/modules/FindMMAL.cmake36
-rw-r--r--project/cmake/modules/FindMicroHttpd.cmake106
-rw-r--r--project/cmake/modules/FindMySqlClient.cmake53
-rw-r--r--project/cmake/modules/FindNFS.cmake58
-rw-r--r--project/cmake/modules/FindOpenGLES.cmake48
-rw-r--r--project/cmake/modules/FindOpenGl.cmake43
-rw-r--r--project/cmake/modules/FindPCRE.cmake91
-rw-r--r--project/cmake/modules/FindPlist.cmake58
-rw-r--r--project/cmake/modules/FindPulseAudio.cmake72
-rw-r--r--project/cmake/modules/FindPython.cmake43
-rw-r--r--project/cmake/modules/FindRTMP.cmake21
-rw-r--r--project/cmake/modules/FindSSE.cmake105
-rw-r--r--project/cmake/modules/FindSSH.cmake21
-rw-r--r--project/cmake/modules/FindSWIG.cmake14
-rw-r--r--project/cmake/modules/FindSdl.cmake46
-rw-r--r--project/cmake/modules/FindShairplay.cmake63
-rw-r--r--project/cmake/modules/FindSqlite3.cmake19
-rw-r--r--project/cmake/modules/FindTagLib.cmake62
-rw-r--r--project/cmake/modules/FindTexturePacker.cmake23
-rw-r--r--project/cmake/modules/FindTinyXML.cmake68
-rw-r--r--project/cmake/modules/FindUDev.cmake22
-rw-r--r--project/cmake/modules/FindUUID.cmake43
-rw-r--r--project/cmake/modules/FindVAAPI.cmake47
-rw-r--r--project/cmake/modules/FindVDPAU.cmake32
-rw-r--r--project/cmake/modules/FindX.cmake21
-rw-r--r--project/cmake/modules/FindXRandR.cmake22
-rw-r--r--project/cmake/modules/FindXslt.cmake18
-rw-r--r--project/cmake/modules/FindYajl.cmake27
-rw-r--r--project/cmake/modules/FindZip.cmake46
-rw-r--r--project/cmake/platform/osx/defines.txt (renamed from project/cmake/platform/darwin/defines.txt)0
-rw-r--r--project/cmake/scripts/android/archsetup.cmake30
-rw-r--r--project/cmake/scripts/android/install.cmake0
l---------project/cmake/scripts/android/macros.cmake1
l---------project/cmake/scripts/android/pathsetup.cmake1
-rw-r--r--project/cmake/scripts/common/addon-helpers.cmake80
-rw-r--r--project/cmake/scripts/common/archsetup.cmake99
-rw-r--r--project/cmake/scripts/common/checkcommits.cmake75
-rw-r--r--project/cmake/scripts/common/generateversionedfiles.cmake13
-rw-r--r--project/cmake/scripts/common/generatorsetup.cmake24
-rw-r--r--project/cmake/scripts/common/macros.cmake373
-rw-r--r--project/cmake/scripts/common/managestring.cmake235
-rw-r--r--project/cmake/scripts/common/pathsetup.cmake3
-rw-r--r--project/cmake/scripts/common/prepare-env.cmake33
-rw-r--r--project/cmake/scripts/common/projectmacros.cmake84
-rw-r--r--project/cmake/scripts/darwin/archsetup.cmake34
-rw-r--r--project/cmake/scripts/darwin/install.cmake0
-rw-r--r--project/cmake/scripts/darwin/macros.cmake108
-rw-r--r--project/cmake/scripts/darwin/pathsetup.cmake32
-rw-r--r--project/cmake/scripts/freebsd/archsetup.cmake19
-rw-r--r--project/cmake/scripts/freebsd/install.cmake58
-rw-r--r--project/cmake/scripts/freebsd/macros.cmake1
-rw-r--r--project/cmake/scripts/freebsd/pathsetup.cmake1
-rw-r--r--project/cmake/scripts/ios/archsetup.cmake38
l---------project/cmake/scripts/ios/install.cmake1
l---------project/cmake/scripts/ios/macros.cmake1
l---------project/cmake/scripts/ios/pathsetup.cmake1
-rw-r--r--project/cmake/scripts/linux/archsetup.cmake21
-rw-r--r--project/cmake/scripts/linux/install.cmake93
-rw-r--r--project/cmake/scripts/linux/macros.cmake79
-rw-r--r--project/cmake/scripts/linux/pathsetup.cmake34
-rw-r--r--project/cmake/scripts/rbpi/archsetup.cmake32
l---------project/cmake/scripts/rbpi/install.cmake1
l---------project/cmake/scripts/rbpi/macros.cmake1
l---------project/cmake/scripts/rbpi/pathsetup.cmake1
-rw-r--r--project/cmake/scripts/windows/archsetup.cmake91
-rw-r--r--project/cmake/scripts/windows/install.cmake0
-rw-r--r--project/cmake/scripts/windows/macros.cmake143
-rw-r--r--project/cmake/scripts/windows/pathsetup.cmake34
-rw-r--r--project/cmake/treedata/android/subdirs.txt16
-rw-r--r--project/cmake/treedata/common/addons.txt7
-rw-r--r--project/cmake/treedata/common/cores.txt8
-rw-r--r--project/cmake/treedata/common/events.txt2
-rw-r--r--project/cmake/treedata/common/externals.txt3
-rw-r--r--project/cmake/treedata/common/filesystem.txt3
-rw-r--r--project/cmake/treedata/common/interfaces.txt9
-rw-r--r--project/cmake/treedata/common/music.txt5
-rw-r--r--project/cmake/treedata/common/network.txt6
-rw-r--r--project/cmake/treedata/common/peripherals.txt4
-rw-r--r--project/cmake/treedata/common/profiles.txt3
-rw-r--r--project/cmake/treedata/common/pvr.txt7
-rw-r--r--project/cmake/treedata/common/settings.txt4
-rw-r--r--project/cmake/treedata/common/subdirs.txt25
-rw-r--r--project/cmake/treedata/common/tests.txt10
-rw-r--r--project/cmake/treedata/common/video.txt5
-rw-r--r--project/cmake/treedata/common/videoplayer.txt12
-rw-r--r--project/cmake/treedata/darwin/subdirs.txt12
-rw-r--r--project/cmake/treedata/freebsd/subdirs.txt4
-rw-r--r--project/cmake/treedata/ios/subdirs.txt15
-rw-r--r--project/cmake/treedata/linux/subdirs.txt12
-rw-r--r--project/cmake/treedata/optional/common/X11.txt1
-rw-r--r--project/cmake/treedata/optional/common/cec.txt1
-rw-r--r--project/cmake/treedata/optional/common/nonfree.txt1
-rw-r--r--project/cmake/treedata/optional/common/opengl.txt1
-rw-r--r--project/cmake/treedata/optional/common/opengles.txt1
-rw-r--r--project/cmake/treedata/rbpi/omxplayer.txt1
-rw-r--r--project/cmake/treedata/rbpi/subdirs.txt12
-rw-r--r--project/cmake/treedata/windows/subdirs.txt15
182 files changed, 5364 insertions, 94 deletions
diff --git a/project/cmake/CMakeLists.txt b/project/cmake/CMakeLists.txt
new file mode 100644
index 0000000..03b3752
--- /dev/null
+++ b/project/cmake/CMakeLists.txt
@@ -0,0 +1,367 @@
1cmake_minimum_required(VERSION 3.1)
2project(kodi)
3
4list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/modules)
5if(DEPENDS_DIR)
6 list(APPEND CMAKE_PREFIX_PATH ${DEPENDS_DIR})
7endif()
8
9set(CMAKE_CXX_STANDARD 11)
10set(CMAKE_CXX_STANDARD_REQUIRED ON)
11set(CMAKE_CXX_EXTENSIONS OFF)
12
13# general
14option(VERBOSE "Enable verbose output?" OFF)
15option(ENABLE_DVDCSS "Enable libdvdcss support?" ON)
16option(ENABLE_UPNP "Enable UPnP support?" ON)
17option(ENABLE_NONFREE "Enable non-free components?" ON)
18option(ENABLE_MICROHTTPD "Enable MicroHttpd webserver?" ON)
19option(ENABLE_MYSQLCLIENT "Enable MySql support?" ON)
20option(ENABLE_AVAHI "Enable Avahi support?" ON)
21option(ENABLE_RTMP "Enable RTMP support?" ON)
22option(ENABLE_BLURAY "Enable BluRay support?" ON)
23option(ENABLE_PLIST "Enable AirPlay support?" ON)
24option(ENABLE_NFS "Enable NFS support?" ON)
25option(ENABLE_AIRTUNES "Enable AirTunes support?" ON)
26option(ENABLE_CEC "Enable CEC support?" ON)
27if(UNIX)
28 if(NOT APPLE)
29 option(ENABLE_INTERNAL_FFMPEG "Enable internal ffmpeg?" ON)
30 else()
31 option(ENABLE_VTB "Enable VTB support?" OFF)
32 endif()
33 option(FFMPEG_PATH "Path to external ffmpeg?" "")
34 option(ENABLE_INTERNAL_CROSSGUID "Enable internal crossguid?" ON)
35 option(ENABLE_ALSA "Enable ALSA support?" ON)
36 option(ENABLE_PULSEAUDIO "Enable PulseAudio support?" ON)
37 option(ENABLE_DBUS "Enable dbus support?" ON)
38 option(ENABLE_LIBUSB "Enable libusb support?" ON)
39 option(ENABLE_UDEV "Enable UDev support?" ON)
40 option(ENABLE_OPENGL "Enable OpenGL?" ON)
41 option(ENABLE_OPENGLES "Enable OpenGLES?" ON)
42 option(ENABLE_OPENSSL "Enable OpenSSL?" ON)
43 option(ENABLE_SDL "Enable SDL?" OFF)
44 option(ENABLE_X11 "Enable X11 support?" ON)
45 option(ENABLE_EGL "Enable EGL?" OFF)
46 option(ENABLE_VAAPI "Enable VAAPI support?" ON)
47 option(ENABLE_VDPAU "Enable VDPAU support?" ON)
48 option(ENABLE_OPTICAL "Enable optical support?" ON)
49endif()
50# System options
51if(NOT WIN32)
52 option(WITH_ARCH "build with given arch" OFF)
53 option(WITH_CPU "build with given cpu" OFF)
54 option(ENABLE_CCACHE "Enable Ccache support" ON)
55endif()
56
57get_filename_component(CORE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../.. ABSOLUTE)
58set(CORE_BUILD_DIR build)
59
60include(scripts/common/generatorsetup.cmake)
61include(scripts/common/addoptions.cmake)
62include(scripts/common/archsetup.cmake)
63include(scripts/common/macros.cmake)
64include(scripts/common/managestring.cmake)
65include(scripts/common/projectmacros.cmake)
66include(scripts/common/pathsetup.cmake)
67include(ExternalProject)
68
69core_find_git_rev()
70core_find_versions()
71
72set(INCLUDES ${CORE_SOURCE_DIR}
73 ${CORE_SOURCE_DIR}/addons/library.xbmc.addon
74 ${CORE_SOURCE_DIR}/lib
75 ${CORE_SOURCE_DIR}/lib/gtest/include
76 ${CORE_SOURCE_DIR}/xbmc
77 ${CORE_SOURCE_DIR}/xbmc/${PLATFORM_DIR}
78 ${CORE_SOURCE_DIR}/xbmc/cores/VideoPlayer
79 ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR})
80
81find_package(PkgConfig)
82if(CMAKE_CROSSCOMPILING)
83 if(PKG_CONFIG_EXECUTABLE)
84 message(STATUS "CMAKE_CROSSCOMPILING: ${CMAKE_CROSSCOMPILING}")
85 set(PKG_CONFIG_FOUND TRUE)
86 endif()
87endif()
88
89find_package(Threads REQUIRED)
90list(APPEND DEPLIBS ${CMAKE_THREAD_LIBS_INIT})
91
92# Required dependencies
93set(required_deps Sqlite3 FreeType PCRE Cpluff LibDvd
94 TinyXML Python Yajl Xslt
95 JPEG Lzo2 Fribidi TagLib FFMPEG CrossGUID)
96if(NOT WIN32)
97 list(APPEND required_deps LibSmbClient ZLIB)
98else()
99 list(APPEND required_deps D3DX11Effects)
100endif()
101if(CORE_SYSTEM_NAME STREQUAL android)
102 list(APPEND required_deps Zip)
103endif()
104
105# Optional dependencies
106set(optional_deps MicroHttpd MySqlClient SSH
107 Alsa UDev Dbus Avahi
108 PulseAudio VDPAU VAAPI)
109
110# Required, dyloaded deps
111set(required_dyload Curl ASS)
112
113# Optional, dyloaded deps
114set(dyload_optional RTMP CEC Bluray Plist NFS)
115
116# Required by shared objects we link
117set(required_dep_libs PNG EXPAT)
118
119# Required tools
120find_package(TexturePacker REQUIRED)
121find_package(JsonSchemaBuilder REQUIRED)
122
123foreach(dep ${required_dep_libs})
124 find_package(${dep} REQUIRED)
125endforeach()
126
127foreach(dep ${required_deps})
128 core_require_dep(${dep})
129endforeach()
130
131foreach(dep ${optional_deps})
132 core_optional_dep(${dep})
133endforeach()
134
135if(NOT UDEV_FOUND)
136 core_optional_dep(LibUSB)
137endif()
138
139foreach(dep ${required_dyload})
140 core_require_dyload_dep(${dep})
141endforeach()
142
143foreach(dep ${dyload_optional})
144 core_optional_dyload_dep(${dep})
145endforeach()
146
147if(ENABLE_OPENSSL)
148 core_require_dep(OpenSSL)
149 list(APPEND DEP_DEFINES "-DHAVE_OPENSSL=1")
150endif()
151
152if(ENABLE_UPNP)
153 list(APPEND DEP_DEFINES "-DUSE_UPNP=1")
154endif()
155
156if(ENABLE_NONFREE)
157 list(APPEND DEP_DEFINES "-DHAVE_XBMC_NONFREE=1")
158endif()
159
160if(ENABLE_OPTICAL)
161 list(APPEND DEP_DEFINES -DHAS_DVD_DRIVE)
162 core_require_dep(Cdio)
163endif()
164
165if(ENABLE_AIRTUNES)
166 find_package(Shairplay)
167 if(SHAIRPLAY_FOUND)
168 core_require_dyload_dep(Shairplay)
169 endif()
170endif()
171
172if(ENABLE_VTB)
173 list(APPEND DEP_DEFINES -DHAVE_VIDEOTOOLBOXDECODER=1)
174endif()
175
176if(NOT WIN32)
177 core_optional_dep(OpenGl)
178 if(OPENGL_FOUND)
179 if(NOT APPLE)
180 core_optional_dep(Sdl)
181 else()
182 core_require_dep(Sdl)
183 endif()
184 core_optional_dep(X ENABLE_X11)
185 core_optional_dep(XRandR ENABLE_X11)
186 else()
187 core_optional_dep(OpenGLES ENABLE_OPENGLES)
188 if(OPENGLES_FOUND)
189 core_optional_dep(EGL ENABLE_EGL)
190 core_optional_dep(OMX ENABLE_OMX)
191 core_optional_dep(AML ENABLE_AML)
192 core_optional_dep(X ENABLE_X11)
193 core_optional_dep(Sdl)
194 endif()
195 endif()
196
197 if(CORE_SYSTEM_NAME STREQUAL rbpi)
198 core_require_dep(MMAL)
199 endif()
200endif()
201
202if(ENABLE_CCACHE)
203 core_optional_dep(CCache)
204endif()
205
206# Compile Info
207add_custom_command(OUTPUT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp
208 COMMAND ${CMAKE_COMMAND} -DCORE_SOURCE_DIR=${CORE_SOURCE_DIR}
209 -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME}
210 -DCORE_BUILD_DIR=${CORE_BUILD_DIR}
211 -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
212 -DARCH_DEFINES="${ARCH_DEFINES}"
213 -DAPP_SCMID=${APP_SCMID}
214 -Dprefix=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}
215 -P ${PROJECT_SOURCE_DIR}/scripts/common/generateversionedfiles.cmake
216 DEPENDS ${CORE_SOURCE_DIR}/version.txt
217 ${CORE_SOURCE_DIR}/addons/xbmc.addon/addon.xml.in
218 ${CORE_SOURCE_DIR}/addons/kodi.guilib/addon.xml.in
219 ${CORE_SOURCE_DIR}/xbmc/CompileInfo.cpp.in)
220list(APPEND install_data addons/xbmc.addon/addon.xml)
221add_library(compileinfo OBJECT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp)
222target_compile_options(compileinfo PRIVATE "${SYSTEM_DEFINES}")
223
224# RC File
225if(WIN32)
226 configure_file(${CORE_SOURCE_DIR}/xbmc/win32/XBMC_PC.rc.in
227 ${CORE_BUILD_DIR}/xbmc/win32/XBMC_PC.rc @ONLY)
228 add_library(resources OBJECT ${CORE_BUILD_DIR}/xbmc/win32/XBMC_PC.rc)
229 target_include_directories(resources PRIVATE ${CORE_SOURCE_DIR}/tools/windows/packaging/media)
230 set(RESOURCES $<TARGET_OBJECTS:resources>)
231endif()
232
233include_directories(${INCLUDES} ${SYSTEM_INCLUDES})
234add_compile_options(${ARCH_DEFINES} "${SYSTEM_DEFINES}" ${DEP_DEFINES} ${PATH_DEFINES})
235
236set(core_DEPENDS "" CACHE STRING "" FORCE)
237set(test_archives "" CACHE STRING "" FORCE)
238set(test_sources "" CACHE STRING "" FORCE)
239mark_as_advanced(core_DEPENDS)
240mark_as_advanced(test_archives)
241mark_as_advanced(test_sources)
242
243file(STRINGS ${PROJECT_SOURCE_DIR}/installdata/addon-bindings.txt bindings)
244foreach(binding ${bindings})
245 list(APPEND addon_bindings ${CORE_SOURCE_DIR}/${binding})
246endforeach()
247
248add_subdirectory(${CORE_SOURCE_DIR}/lib/gtest ${CORE_BUILD_DIR}/gtest EXCLUDE_FROM_ALL)
249
250# Subdirs
251core_add_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/common/*.txt
252 ${PROJECT_SOURCE_DIR}/treedata/${CORE_SYSTEM_NAME}/*.txt)
253core_add_optional_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/optional/common/*.txt
254 ${PROJECT_SOURCE_DIR}/treedata/optional/${CORE_SYSTEM_NAME}/*.txt)
255
256# copy files to build tree
257copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/common/*.txt
258 ${PROJECT_SOURCE_DIR}/installdata/${CORE_SYSTEM_NAME}/*.txt)
259
260list(APPEND SKINS "${CORE_SOURCE_DIR}/addons/skin.estuary\;${CORE_SOURCE_DIR}")
261list(APPEND SKINS "${CORE_SOURCE_DIR}/addons/skin.estouchy\;${CORE_SOURCE_DIR}")
262
263# These are skins that are copied into place from the source tree
264foreach(skin ${SKINS})
265 list(GET skin 0 dir)
266 list(GET skin 1 relative)
267 copy_skin_to_buildtree(${dir} ${relative})
268endforeach()
269
270add_custom_target(pack-skins ALL
271 DEPENDS TexturePacker::TexturePacker export-files ${XBT_FILES})
272
273core_link_library(exif system/libexif)
274if(CORE_SYSTEM_NAME STREQUAL linux)
275 core_link_library(sse4 system/libsse4)
276endif()
277
278core_link_library(XBMC_addon addons/library.xbmc.addon/libXBMC_addon)
279core_link_library(XBMC_codec addons/library.xbmc.codec/libXBMC_codec)
280core_link_library(KODI_guilib addons/library.kodi.guilib/libKODI_guilib)
281core_link_library(KODI_adsp addons/library.kodi.adsp/libKODI_adsp)
282core_link_library(XBMC_pvr addons/library.xbmc.pvr/libXBMC_pvr)
283
284file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/system/players/VideoPlayer)
285add_custom_target(wrap-libraries ALL DEPENDS ${WRAP_FILES})
286
287set(LIBCEC_SONAME "${CEC_SONAME}")
288if(NOT CORE_SYSTEM_NAME STREQUAL windows AND NOT CORE_SYSTEM_NAME STREQUAL android)
289 configure_file(${CORE_SOURCE_DIR}/xbmc/DllPaths_generated.h.in
290 ${CORE_BUILD_DIR}/DllPaths_generated.h @ONLY)
291elseif(CORE_SYSTEM_NAME STREQUAL android)
292 configure_file(${CORE_SOURCE_DIR}/xbmc/DllPaths_generated_android.h.in
293 ${CORE_BUILD_DIR}/DllPaths_generated_android.h @ONLY)
294endif()
295
296# Codegen
297add_subdirectory(${CORE_SOURCE_DIR}/xbmc/interfaces/swig build/swig)
298
299# Other files (IDE)
300set(OTHER_FILES README.md)
301
302# main binary
303add_executable(${APP_NAME_LC} ${CORE_MAIN_SOURCE} $<TARGET_OBJECTS:compileinfo> "${RESOURCES}" ${OTHER_FILES})
304whole_archive(_MAIN_LIBRARIES ${core_DEPENDS})
305target_link_libraries(${APP_NAME_LC} ${SYSTEM_LDFLAGS} ${_MAIN_LIBRARIES} ${DEPLIBS} ${CMAKE_DL_LIBS})
306unset(_MAIN_LIBRARIES)
307add_dependencies(${APP_NAME_LC} export-files)
308if(NOT WIN32)
309 set_target_properties(${APP_NAME_LC} PROPERTIES SUFFIX ".bin")
310else()
311 set_target_properties(${APP_NAME_LC} PROPERTIES WIN32_EXECUTABLE ON)
312 copy_main_dlls_to_buildtree()
313endif()
314
315# testing
316copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/test-reference-data.txt 1)
317add_executable(${APP_NAME_LC}-test EXCLUDE_FROM_ALL ${CORE_SOURCE_DIR}/xbmc/test/xbmc-test.cpp $<TARGET_OBJECTS:compileinfo>)
318whole_archive(_TEST_LIBRARIES ${core_DEPENDS} gtest ${test_archives})
319target_link_libraries(${APP_NAME_LC}-test ${SYSTEM_LDFLAGS} ${_TEST_LIBRARIES} ${DEPLIBS} ${CMAKE_DL_LIBS})
320unset(_TEST_LIBRARIES)
321add_dependencies(${APP_NAME_LC}-test export-files)
322
323# make test and make check (cannot be executed when cross compiling)
324if(NOT CMAKE_CROSSCOMPILING)
325 enable_testing()
326 gtest_add_tests(${APP_NAME_LC}-test "" ${test_sources})
327 add_custom_target(check ${CMAKE_CTEST_COMMAND} WORKING_DIRECTORY ${PROJECT_BINARY_DIR})
328 add_dependencies(check ${APP_NAME_LC}-test)
329
330 # For testing commit series
331 add_custom_target(check-commits ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/scripts/common/checkcommits.cmake
332 -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR})
333endif()
334
335# link wrapper
336if(FFMPEG_LINK_EXECUTABLE)
337 set(CMAKE_CXX_LINK_EXECUTABLE "${FFMPEG_LINK_EXECUTABLE}")
338endif()
339
340# randr
341if(ENABLE_X11 AND XRANDR_FOUND)
342 add_executable(kodi-xrandr ${CORE_SOURCE_DIR}/xbmc-xrandr.c)
343 target_link_libraries(kodi-xrandr ${SYSTEM_LDFLAGS} ${X_LIBRARIES} m ${XRANDR_LIBRARIES})
344endif()
345
346# XBMCHelper
347if(CORE_SYSTEM_TYPE STREQUAL darwin)
348 add_subdirectory(${CORE_SOURCE_DIR}/tools/EventClients/Clients/OSXRemote build/XBMCHelper)
349endif()
350
351include(scripts/${CORE_SYSTEM_NAME}/install.cmake)
352
353# Status
354message(STATUS "#---- CONFIGURATION ----#")
355foreach(msg ${final_message})
356 message(STATUS ${msg})
357endforeach()
358
359if(VERBOSE)
360 message(STATUS "\n#---- Internal Variables ----# ")
361 message(STATUS "DEPLIBS: ${DEPLIBS}")
362 message(STATUS "SYSTEM_LDFLAGS: ${SYSTEM_LDFLAGS}")
363 message(STATUS "core_DEPENDS: ${core_DEPENDS}")
364 message(STATUS "CMAKE_DL_LIBS: ${CMAKE_DL_LIBS}")
365endif()
366message(STATUS "#-----------------------#")
367
diff --git a/project/cmake/README.md b/project/cmake/README.md
new file mode 100644
index 0000000..c0f94d8
--- /dev/null
+++ b/project/cmake/README.md
@@ -0,0 +1,166 @@
1# Kodi CMake based buildsystem
2
3This files describes Kodi's CMake based buildsystem. CMake is a cross-platform
4tool for generating makefiles as well as project files used by IDEs.
5
6The current version of the buildsystem is capable of building the main Kodi
7executable (but no packaging or dependency management yet) for the following
8platforms:
9
10- Linux (GNU Makefiles)
11- Windows (NMake Makefiles, Visual Studio 12 (2013))
12- OSX (GNU Makefiles, Xcode)
13- Android (GNU Makefiles)
14
15Before building Kodi with CMake, please ensure that you have the platform
16specific dependencies installed.
17
18While the legacy build systems typically used in-source builds it's recommended
19to use out-of-source builds with CMake. The necessary runtime dependencies such
20as dlls, skins and configuration files are copied over to the build directory
21automatically.
22
23## Dependency installation
24
25### Linux
26
27The dependencies required to build on Linux can be found in
28[docs/README.xxx](https://github.com/xbmc/xbmc/tree/master/docs).
29
30### Raspberry Pi
31
32The cross compilation environment for the Raspberry Pi as well as the
33dependencies have to be installed as explained in
34[docs/README.raspberrypi](https://github.com/xbmc/xbmc/tree/master/docs/README.raspberrypi).
35
36### Windows
37
38For Windows the dependencies can be found in the
39[Wiki](http://kodi.wiki/view/HOW-TO:Compile_Kodi_for_Windows) (Step 1-4). If not already available on your pc, you should
40install the [Windows Software Development Kit (SDK)](https://dev.windows.com/en-us/downloads/sdk-archive) for your Windows version. This is required for HLSL shader offline compiling with the [Effect-Compiler Tool](https://msdn.microsoft.com/de-de/library/windows/desktop/bb232919(v=vs.85).aspx) (fxc.exe).
41
42On Windows, the CMake based buildsystem requires that the binary dependencies
43are downloaded using `DownloadBuildDeps.bat` and `DownloadMingwBuildEnv.bat`
44and that the mingw libs (ffmpeg, libdvd and others) are built using
45`make-mingwlibs.bat`.
46
47### OSX
48
49For OSX the required dependencies can be found in
50[docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.osx).
51
52On OSX it is necessary to build the dependencies in `tools/depends` using
53`./bootstrap && ./configure --host=<PLATFORM> && make`. The other steps such
54as `make -C tools/depends/target/xbmc` and `make xcode_depends` are not needed
55as these steps are covered already by the CMake project.
56
57### Android
58
59The dependencies needed to compile for Android can be found in
60[docs/README.osx](https://github.com/xbmc/xbmc/tree/master/docs/README.android)
61. All described steps have to be executed (except 5.2 which is replaced by the
62respective CMake command below).
63
64## Building Kodi
65
66This section lists the necessary commands for building Kodi with CMake.
67CMake supports different generators that can be classified into two categories:
68single- and multiconfiguration generators.
69
70A single configuration generator (GNU/NMake Makefiles) generates project files
71for a single build type (e.g. Debug, Release) specified at configure time.
72Multi configuration generators (Visual Studio, Xcode) allow to specify the
73build type at compile time.
74
75All examples below are for out-of-source builds with Kodi checked out to
76`<KODI_SRC>`:
77
78```
79mkdir kodi-build && cd kodi-build
80```
81
82### Linux with GNU Makefiles
83
84```
85cmake <KODI_SRC>/project/cmake/
86cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc)
87./kodi.bin
88```
89
90`CMAKE_BUILD_TYPE` defaults to `Release`.
91
92### Raspberry Pi with GNU Makefiles
93
94```
95cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/
96cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc)
97```
98
99### Windows with NMake Makefiles
100
101```
102cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release <KODI_SRC>/project/cmake/
103cmake --build . # or: nmake
104kodi.exe
105```
106
107### Windows with Visual Studio project files
108
109```
110cmake -G "Visual Studio 12" <KODI_SRC>/project/cmake/
111cmake --build . --config "Debug" # or: Build solution with Visual Studio
112set KODI_HOME="%CD%" && Debug\kodi.exe
113```
114
115### OSX with GNU Makefiles
116
117```
118cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/
119cmake --build . -- VERBOSE=1 -j$(sysctl -n hw.ncpu) # or: make VERBOSE=1 -j$(sysctl -n hw.ncpu)
120./kodi.bin
121```
122
123### OSX with Xcode project files
124
125```
126cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake -G "Xcode" <KODI_SRC>/project/cmake/
127cmake --build . --config "Release" -- -verbose -jobs $(sysctl -n hw.ncpu) # or: Build solution with Xcode
128KODI_HOME=$(pwd) ./Release/kodi.bin
129```
130
131### Android with GNU Makefiles
132
133```
134cmake -DCMAKE_TOOLCHAIN_FILE=<KODI_SRC>/tools/depends/target/Toolchain.cmake <KODI_SRC>/project/cmake/
135cmake --build . -- VERBOSE=1 -j$(nproc) # or: make VERBOSE=1 -j$(nproc)
136```
137
138## Extra targets
139
140When using the makefile builds a few extra targets are defined:
141
142- `make check` builds and executes the test suite.
143
144## Debugging the build
145
146This section covers some tips that can be useful for debugging a CMake
147based build.
148
149### Verbosity (show compiler and linker parameters)
150
151In order to see the exact compiler commands `make` and `nmake` can be
152executed with a `VERBOSE=1` parameter.
153
154On Windows, this is unfortunately not enough because `nmake` uses
155temporary files to workaround `nmake`'s command string length limitations.
156In order to see verbose output the file
157[Modules/Platform/Windows.cmake](https://github.com/Kitware/CMake/blob/master/Modules/Platform/Windows.cmake#L40)
158in the local CMake installation has to be adapted by uncommenting these
159lines:
160
161```
162# uncomment these out to debug nmake and borland makefiles
163#set(CMAKE_START_TEMP_FILE "")
164#set(CMAKE_END_TEMP_FILE "")
165#set(CMAKE_VERBOSE_MAKEFILE 1)
166```
diff --git a/project/cmake/addons/CMakeLists.txt b/project/cmake/addons/CMakeLists.txt
index 0773713..8fc1a23 100644
--- a/project/cmake/addons/CMakeLists.txt
+++ b/project/cmake/addons/CMakeLists.txt
@@ -1,15 +1,31 @@
1project(kodi-addons) 1project(kodi-addons)
2 2
3cmake_minimum_required(VERSION 2.8) 3if(WIN32)
4 # there seems to be a bug in the CMake generator implementation in CMake 2.8.x releases for WIN32
5 cmake_minimum_required(VERSION 3.0)
6else()
7 cmake_minimum_required(VERSION 2.8)
8endif()
4 9
5list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}) 10list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
6 11
12option(ADDON_TARBALL_CACHING "Cache downloaded addon source tarballs?" ON)
13if(ADDON_TARBALL_CACHING)
14 message(STATUS "Addon source tarball caching is enabled")
15else()
16 message(STATUS "Addon source tarball caching is disabled")
17endif()
18
7if(NOT CMAKE_BUILD_TYPE) 19if(NOT CMAKE_BUILD_TYPE)
8 set(CMAKE_BUILD_TYPE Release) 20 set(CMAKE_BUILD_TYPE Release)
9endif() 21endif()
10 22
11if(NOT CORE_SYSTEM_NAME) 23if(NOT CORE_SYSTEM_NAME)
12 string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME) 24 if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
25 set(CORE_SYSTEM_NAME "osx")
26 else()
27 string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME)
28 endif()
13endif() 29endif()
14 30
15include(ExternalProject) 31include(ExternalProject)
@@ -65,6 +81,7 @@ list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
65set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} 81set(BUILD_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
66 -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> 82 -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
67 -DPACKAGE_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig 83 -DPACKAGE_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig
84 -DDEPENDS_PATH=${DEPENDS_PATH}
68 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} 85 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
69 -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE} 86 -DCMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE}
70 -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX} 87 -DCMAKE_USER_MAKE_RULES_OVERRIDE_CXX=${CMAKE_USER_MAKE_RULES_OVERRIDE_CXX}
@@ -78,16 +95,26 @@ if(MSVC)
78 set_property(GLOBAL PROPERTY USE_FOLDERS ON) 95 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
79endif() 96endif()
80 97
98option(PACKAGE_ZIP "Prepare built addons for packaging" OFF)
81if(PACKAGE_ZIP) 99if(PACKAGE_ZIP)
82 # needed for project installing 100 # needed for project installing
83 list(APPEND BUILD_ARGS -DPACKAGE_ZIP=1) 101 list(APPEND BUILD_ARGS -DPACKAGE_ZIP=ON)
84 MESSAGE("package zip specified") 102
103 # figure out where to store the packaged ZIP archives
104 if(NOT PACKAGE_DIR)
105 set(PACKAGE_DIR "${BUILD_DIR}/zips")
106 else()
107 file(TO_CMAKE_PATH "${PACKAGE_DIR}" PACKAGE_DIR)
108 endif()
109 list(APPEND BUILD_ARGS -DPACKAGE_DIR=${PACKAGE_DIR})
110
111 MESSAGE(STATUS "ZIP packaging enabled (destination: ${PACKAGE_DIR})")
85endif() 112endif()
86 113
87if(CMAKE_TOOLCHAIN_FILE) 114if(CMAKE_TOOLCHAIN_FILE)
88 list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) 115 list(APPEND BUILD_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE})
89 MESSAGE("toolchain specified") 116 MESSAGE(STATUS "Toolchain specified")
90 MESSAGE(${BUILD_ARGS}) 117 MESSAGE(STATUS ${BUILD_ARGS})
91endif() 118endif()
92 119
93if(NOT ADDONS_TO_BUILD) 120if(NOT ADDONS_TO_BUILD)
@@ -97,16 +124,25 @@ else()
97 separate_arguments(ADDONS_TO_BUILD) 124 separate_arguments(ADDONS_TO_BUILD)
98endif() 125endif()
99 126
127if(NOT ADDONS_DEFINITION_DIR)
128 set(ADDONS_DEFINITION_DIR ${PROJECT_SOURCE_DIR}/addons)
129else()
130 file(TO_CMAKE_PATH "${ADDONS_DEFINITION_DIR}" ADDONS_DEFINITION_DIR)
131endif()
132get_filename_component(ADDONS_DEFINITION_DIR "${ADDONS_DEFINITION_DIR}" ABSOLUTE)
133
100if(ADDON_SRC_PREFIX) 134if(ADDON_SRC_PREFIX)
101 message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}") 135 message(STATUS "Overriding addon source directory prefix: ${ADDON_SRC_PREFIX}")
102endif() 136endif()
103 137
104if(NOT KODI_LIB_DIR) 138if(NOT APP_LIB_DIR)
105 set(KODI_LIB_DIR "${DEPENDS_PATH}/lib/kodi") 139 set(APP_LIB_DIR "${DEPENDS_PATH}/lib/kodi")
106else() 140else()
107 file(TO_CMAKE_PATH "${KODI_LIB_DIR}" KODI_LIB_DIR) 141 file(TO_CMAKE_PATH "${APP_LIB_DIR}" APP_LIB_DIR)
108endif() 142endif()
109 143
144set(APP_PREFIX "${CMAKE_INSTALL_PREFIX}")
145
110# check for platform specific stuff 146# check for platform specific stuff
111if(EXISTS ${PLATFORM_DIR}/defines.txt) 147if(EXISTS ${PLATFORM_DIR}/defines.txt)
112 file(STRINGS ${PLATFORM_DIR}/defines.txt platformdefines) 148 file(STRINGS ${PLATFORM_DIR}/defines.txt platformdefines)
@@ -119,21 +155,23 @@ endif()
119# include check_target_platform() function 155# include check_target_platform() function
120include(${APP_ROOT}/project/cmake/scripts/common/check_target_platform.cmake) 156include(${APP_ROOT}/project/cmake/scripts/common/check_target_platform.cmake)
121 157
122# check install permissions
123set(ADDON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}) 158set(ADDON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
124check_install_permissions(${CMAKE_INSTALL_PREFIX} can_write) 159if(NOT WIN32)
125if(NOT ${can_write} AND NOT WIN32) 160 # check install permissions
126 set(NEED_SUDO TRUE) 161 check_install_permissions(${CMAKE_INSTALL_PREFIX} can_write)
127 set(ADDON_INSTALL_DIR ${CMAKE_BINARY_DIR}/.install) 162 if(NOT ${can_write} AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
128 message(STATUS "NEED_SUDO: ${NEED_SUDO}") 163 set(NEED_SUDO TRUE)
164 set(ADDON_INSTALL_DIR ${CMAKE_BINARY_DIR}/.install)
165 message(STATUS "NEED_SUDO: ${NEED_SUDO}")
166 endif()
129endif() 167endif()
130 168
131### prepare the build environment for the binary addons 169### prepare the build environment for the binary addons
132# copy the prepare-env.cmake script to the depends path so that we can include it 170# copy the prepare-env.cmake script to the depends path so that we can include it
133file(COPY ${APP_ROOT}/project/cmake/scripts/common/prepare-env.cmake DESTINATION ${KODI_LIB_DIR}) 171file(COPY ${APP_ROOT}/project/cmake/scripts/common/prepare-env.cmake DESTINATION ${APP_LIB_DIR})
134 172
135# add the location of prepare-env.cmake to CMAKE_MODULE_PATH so that it is found 173# add the location of prepare-env.cmake to CMAKE_MODULE_PATH so that it is found
136list(APPEND CMAKE_MODULE_PATH ${KODI_LIB_DIR}) 174list(APPEND CMAKE_MODULE_PATH ${APP_LIB_DIR})
137 175
138# include prepare-env.cmake which contains the logic to install the addon header bindings etc 176# include prepare-env.cmake which contains the logic to install the addon header bindings etc
139include(prepare-env) 177include(prepare-env)
@@ -141,17 +179,61 @@ include(prepare-env)
141### add the depends subdirectory for any general dependencies 179### add the depends subdirectory for any general dependencies
142add_subdirectory(depends) 180add_subdirectory(depends)
143 181
182# add a custom target "package-addons" which will package and install all addons
183add_custom_target(package-addons)
184
144### get and build all the binary addons 185### get and build all the binary addons
145# look for all the addons to be built 186# look for all the addons to be built
146file(GLOB_RECURSE addons ${PROJECT_SOURCE_DIR}/addons/*.txt) 187file(GLOB_RECURSE addons ${ADDONS_DEFINITION_DIR}/*.txt)
188
189#if there are no addons assume that bootstrapping hasn't happened yet
190if(NOT addons)
191 message(STATUS "Bootstrapping all default repositories as no addons were found...")
192 set(BOOTSTRAP_BUILD_DIR "${BUILD_DIR}/bootstrap")
193
194 # make sure that the bootstraps build addon exists
195 if(NOT EXISTS ${BOOTSTRAP_BUILD_DIR})
196 file(MAKE_DIRECTORY ${BOOTSTRAP_BUILD_DIR})
197 endif()
198
199 # generate the bootstrap buildsystem
200 execute_process(COMMAND ${CMAKE_COMMAND} ${PROJECT_SOURCE_DIR}/bootstrap
201 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
202 -DCMAKE_INSTALL_PREFIX:PATH=${ADDONS_DEFINITION_DIR}
203 -DBUILD_DIR:PATH=${BOOTSTRAP_BUILD_DIR}
204 -DADDONS_TO_BUILD=${ADDONS_TO_BUILD}
205 WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR})
206
207 # execute the generated bootstrap buildsystem
208 execute_process(COMMAND ${CMAKE_COMMAND} --build ${BOOTSTRAP_BUILD_DIR}
209 WORKING_DIRECTORY ${BOOTSTRAP_BUILD_DIR})
210
211 # now look for all the addons to be built again
212 file(GLOB_RECURSE addons ${ADDONS_DEFINITION_DIR}/*.txt)
213
214 if(NOT addons)
215 message(FATAL_ERROR "No addons available to be built")
216 endif()
217endif()
218
147foreach(addon ${addons}) 219foreach(addon ${addons})
148 if(NOT (addon MATCHES platforms.txt)) 220 if(NOT (addon MATCHES platforms.txt))
149 file(STRINGS ${addon} def) 221 file(STRINGS ${addon} def)
150 separate_arguments(def) 222 separate_arguments(def)
151 list(GET def 0 id) 223 list(GET def 0 id)
152 224
225 set(ADDON_FOUND FALSE)
226 # try to find a perfect match
153 list(FIND ADDONS_TO_BUILD ${id} idx) 227 list(FIND ADDONS_TO_BUILD ${id} idx)
154 if(idx GREATER -1 OR ADDONS_TO_BUILD STREQUAL "all") 228 if(idx GREATER -1 OR "${ADDONS_TO_BUILD}" STREQUAL "all")
229 set(ADDON_FOUND TRUE)
230 # Maybe we have a regex
231 elseif(id MATCHES "${ADDONS_TO_BUILD}")
232 message(STATUS "Pattern ${ADDONS_TO_BUILD} matches ${id}, building addon")
233 set(ADDON_FOUND TRUE)
234 endif()
235
236 if(ADDON_FOUND)
155 get_filename_component(dir ${addon} PATH) 237 get_filename_component(dir ${addon} PATH)
156 238
157 # check if the addon has a platforms.txt 239 # check if the addon has a platforms.txt
@@ -180,6 +262,19 @@ foreach(addon ${addons})
180 if(deflength GREATER 2 AND "${SOURCE_DIR}" STREQUAL "") 262 if(deflength GREATER 2 AND "${SOURCE_DIR}" STREQUAL "")
181 list(GET def 2 revision) 263 list(GET def 2 revision)
182 264
265 # we need access to a git executable
266 find_package(Git REQUIRED)
267
268 # resolve revision to git hash
269 execute_process(COMMAND ${GIT_EXECUTABLE} ls-remote ${url} ${revision} OUTPUT_VARIABLE revision_hash)
270 # git ls-remote only works on branches and tag names but not on revisions
271 if(NOT "${revision_hash}" STREQUAL "")
272 string(REPLACE "\t" ";" revision_list ${revision_hash})
273 list(GET revision_list 0 revision_hash)
274 message(STATUS "${id}: git branch/tag ${revision} resolved to hash: ${revision_hash}")
275 set(revision ${revision_hash})
276 endif()
277
183 # Note: downloading specific revisions via http in the format below is probably github specific 278 # Note: downloading specific revisions via http in the format below is probably github specific
184 # if we ever use other repositories, this might need adapting 279 # if we ever use other repositories, this might need adapting
185 set(url ${url}/archive/${revision}.tar.gz) 280 set(url ${url}/archive/${revision}.tar.gz)
@@ -210,7 +305,7 @@ foreach(addon ${addons})
210 # download the addon if necessary 305 # download the addon if necessary
211 if(NOT "${archive_name}" STREQUAL "") 306 if(NOT "${archive_name}" STREQUAL "")
212 # download and extract the addon 307 # download and extract the addon
213 if(NOT EXISTS ${BUILD_DIR}/download/${archive_name}.tar.gz) 308 if(NOT ADDON_TARBALL_CACHING OR NOT EXISTS ${BUILD_DIR}/download/${archive_name}.tar.gz)
214 # cleanup any of the previously downloaded archives of this addon 309 # cleanup any of the previously downloaded archives of this addon
215 file(GLOB archives "${BUILD_DIR}/download/${id}*.tar.gz") 310 file(GLOB archives "${BUILD_DIR}/download/${id}*.tar.gz")
216 if(archives) 311 if(archives)
@@ -275,6 +370,25 @@ foreach(addon ${addons})
275 add_dependencies(${id} ${${id}_DEPS}) 370 add_dependencies(${id} ${${id}_DEPS})
276 endif() 371 endif()
277 endif() 372 endif()
373
374 if(CROSS_AUTOCONF AND AUTOCONF_FILES)
375 if(EXISTS ${SOURCE_DIR}/bootstrap/autoreconf.txt)
376 file(STRINGS ${SOURCE_DIR}/bootstrap/autoreconf.txt conf_dirs)
377 foreach(conf_dir ${conf_dirs})
378 foreach(afile ${AUTOCONF_FILES})
379 message(STATUS "copying ${afile} to ${SOURCE_DIR}/${conf_dir}")
380 file(COPY ${afile} DESTINATION ${SOURCE_DIR}/${conf_dir})
381 endforeach()
382 endforeach()
383 endif()
384 endif()
385
386 # create a forwarding target to the addon-package target
387 add_custom_target(package-${id}
388 COMMAND ${CMAKE_COMMAND} --build ${id}-prefix/src/${id}-build --target addon-package
389 DEPENDS ${id})
390 add_dependencies(package-addons package-${id})
391
278 else() 392 else()
279 message(FATAL_ERROR "${id}: invalid or missing addon source directory at ${SOURCE_DIR}") 393 message(FATAL_ERROR "${id}: invalid or missing addon source directory at ${SOURCE_DIR}")
280 endif() 394 endif()
@@ -297,4 +411,4 @@ endif()
297 411
298# add custom target "supported_addons" that returns all addons that are supported on this platform 412# add custom target "supported_addons" that returns all addons that are supported on this platform
299string(REPLACE ";" " " ALL_ADDONS_BUILDING "${ALL_ADDONS_BUILDING}") 413string(REPLACE ";" " " ALL_ADDONS_BUILDING "${ALL_ADDONS_BUILDING}")
300add_custom_target(supported_addons COMMAND ${CMAKE_COMMAND} -E echo "ALL_ADDONS_BUILDING: ${ALL_ADDONS_BUILDING}" VERBATIM) 414add_custom_target(supported_addons COMMAND ${CMAKE_COMMAND} -E echo "ALL_ADDONS_BUILDING: ${ALL_ADDONS_BUILDING}" VERBATIM) \ No newline at end of file
diff --git a/project/cmake/addons/README b/project/cmake/addons/README
index b901bb7..a0f2c32 100644
--- a/project/cmake/addons/README
+++ b/project/cmake/addons/README
@@ -1,7 +1,8 @@
1KODI ADDONS 1KODI ADDONS
2=========== 2===========
3This directory contains the cmake-based buildsystem for addons. It looks into 3This directory contains the cmake-based buildsystem for addons. It looks into
4the "addons" sub-directory and parses all *.txt files recursively. Each addon 4the directory pointed to by the ADDONS_DEFINITION_DIR option (which defaults to
5the "addons" sub-directory) and parses all *.txt files recursively. Each addon
5must have its own <addon-id>.txt file in a separate sub-directory which must 6must have its own <addon-id>.txt file in a separate sub-directory which must
6follow one of the defined format: 7follow one of the defined format:
7 <addon-id> <git-url> <git-revision> 8 <addon-id> <git-url> <git-revision>
@@ -22,13 +23,26 @@ are:
22 * platforms.txt: List of platforms to build an addon for (or "all"). It is 23 * platforms.txt: List of platforms to build an addon for (or "all"). It is
23 also supported to specify negated platforms with a leading exclamation mark 24 also supported to specify negated platforms with a leading exclamation mark
24 (i), e.g. "!windows". 25 (i), e.g. "!windows".
25 Available platforms are: linux, windows, darwin, ios, android, rbpi 26 Available platforms are: linux, windows, osx, ios, android, rbpi, freebsd
27
28ATTENTION: If no addon definitions could be found the buildsystem assumes that
29 the bootstrapping of the addon definition repositories hasn't been
30 performed yet and automatically executes the addon bootstrapping
31 buildsystem located in the "bootstrap" sub-directory with the default
32 settings (i.e. all addons from all pre-defined addon definition
33 repositories are bootstrapped into the directory pointed to by the
34 ADDONS_DEFINITION_DIR option).
26 35
27The buildsystem uses the following variables (which can be passed into it when 36The buildsystem uses the following variables (which can be passed into it when
28executing cmake with the -D<variable-name>=<value> option) to e.g. access 37executing cmake with the -D<variable-name>=<value> option) to e.g. access
29specific paths: 38specific paths:
30 * ADDONS_TO_BUILD is a quoted, space delimited list of <addon-id>s that 39 * ADDONS_TO_BUILD has two variations, which are tested in order:
31 you want to build (default is "all"). 40 - a quoted, space delimited list of <addon-id>s that
41 you want to build (default is "all").
42 - a regular expression that every <addon-id> is matched against
43 e.g.: ADDONS_TO_BUILD=pvr.* to build all pvr addons
44 * ADDONS_DEFINITION_DIR points to the directory containing the definitions
45 for the addons to be built.
32 * ADDON_SRC_PREFIX can be used to override the addon repository location. 46 * ADDON_SRC_PREFIX can be used to override the addon repository location.
33 It must point to the locally available parent directory of the addon(s) to build 47 It must point to the locally available parent directory of the addon(s) to build
34 <addon-id> will be appended to this path automatically 48 <addon-id> will be appended to this path automatically
@@ -45,11 +59,15 @@ specific paths:
45 absolute representation of ../../.. starting from this directory). 59 absolute representation of ../../.. starting from this directory).
46 * BUILD_DIR points to the directory where the addons and their dependencies 60 * BUILD_DIR points to the directory where the addons and their dependencies
47 will be downloaded and built. 61 will be downloaded and built.
48 * PACKAGE_ZIP=1 will mean the add-ons will be 'packaged' into a common folder, 62 * PACKAGE_ZIP=ON means that the add-ons will be 'packaged' into a common folder,
49 rather than being placed in <CMAKE_INSTALL_PREFIX>/lib/kodi/addons and 63 rather than being placed in <CMAKE_INSTALL_PREFIX>/lib/kodi/addons and
50 <CMAKE_INSTALL_PREFIX>/share/kodi/addons. 64 <CMAKE_INSTALL_PREFIX>/share/kodi/addons.
65 * PACKAGE_DIR points to the directory where the ZIP archived addons will be
66 stored after they have been packaged (defaults to <BUILD_DIR>/zips)
51 * ARCH_DEFINES specifies the platform-specific C/C++ preprocessor defines 67 * ARCH_DEFINES specifies the platform-specific C/C++ preprocessor defines
52 (defaults to empty). 68 (defaults to empty).
69 * ADDON_TARBALL_CACHING specifies whether downloaded addon source tarballs
70 should be cached or not (defaults to ON).
53 71
54The buildsystem makes some assumptions about the environment which must be met 72The buildsystem makes some assumptions about the environment which must be met
55by whoever uses it: 73by whoever uses it:
diff --git a/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt b/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt
deleted file mode 100644
index 5886cfa..0000000
--- a/project/cmake/addons/addons/audioencoder.flac/audioencoder.flac.txt
+++ /dev/null
@@ -1 +0,0 @@
1audioencoder.flac https://github.com/xbmc/audioencoder.flac 84acb14
diff --git a/project/cmake/addons/addons/audioencoder.flac/platforms.txt b/project/cmake/addons/addons/audioencoder.flac/platforms.txt
deleted file mode 100644
index 174a52e..0000000
--- a/project/cmake/addons/addons/audioencoder.flac/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1!ios \ No newline at end of file
diff --git a/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt b/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt
deleted file mode 100644
index a55dc44..0000000
--- a/project/cmake/addons/addons/audioencoder.lame/audioencoder.lame.txt
+++ /dev/null
@@ -1 +0,0 @@
1audioencoder.lame https://github.com/xbmc/audioencoder.lame 3eb59de
diff --git a/project/cmake/addons/addons/audioencoder.lame/platforms.txt b/project/cmake/addons/addons/audioencoder.lame/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/audioencoder.lame/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt b/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt
deleted file mode 100644
index 8decf52..0000000
--- a/project/cmake/addons/addons/audioencoder.vorbis/audioencoder.vorbis.txt
+++ /dev/null
@@ -1 +0,0 @@
1audioencoder.vorbis https://github.com/xbmc/audioencoder.vorbis d556a68
diff --git a/project/cmake/addons/addons/audioencoder.vorbis/platforms.txt b/project/cmake/addons/addons/audioencoder.vorbis/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/audioencoder.vorbis/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt b/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt
deleted file mode 100644
index b3209f6..0000000
--- a/project/cmake/addons/addons/audioencoder.wav/audioencoder.wav.txt
+++ /dev/null
@@ -1 +0,0 @@
1audioencoder.wav https://github.com/xbmc/audioencoder.wav 40aaedf
diff --git a/project/cmake/addons/addons/audioencoder.wav/platforms.txt b/project/cmake/addons/addons/audioencoder.wav/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/audioencoder.wav/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.argustv/platforms.txt b/project/cmake/addons/addons/pvr.argustv/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.argustv/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt b/project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt
deleted file mode 100644
index 88ccde4..0000000
--- a/project/cmake/addons/addons/pvr.argustv/pvr.argustv.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.argustv https://github.com/kodi-pvr/pvr.argustv 96ee875
diff --git a/project/cmake/addons/addons/pvr.demo/platforms.txt b/project/cmake/addons/addons/pvr.demo/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.demo/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.demo/pvr.demo.txt b/project/cmake/addons/addons/pvr.demo/pvr.demo.txt
deleted file mode 100644
index 1307381..0000000
--- a/project/cmake/addons/addons/pvr.demo/pvr.demo.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.demo https://github.com/kodi-pvr/pvr.demo b4b7de1
diff --git a/project/cmake/addons/addons/pvr.dvblink/platforms.txt b/project/cmake/addons/addons/pvr.dvblink/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.dvblink/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt b/project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt
deleted file mode 100644
index 1aa96d8..0000000
--- a/project/cmake/addons/addons/pvr.dvblink/pvr.dvblink.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.dvblink https://github.com/kodi-pvr/pvr.dvblink 5d505b8
diff --git a/project/cmake/addons/addons/pvr.dvbviewer/platforms.txt b/project/cmake/addons/addons/pvr.dvbviewer/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.dvbviewer/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt b/project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt
deleted file mode 100644
index db25aa2..0000000
--- a/project/cmake/addons/addons/pvr.dvbviewer/pvr.dvbviewer.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.dvbviewer https://github.com/manuelm/pvr.dvbviewer master \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.filmon/platforms.txt b/project/cmake/addons/addons/pvr.filmon/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.filmon/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.filmon/pvr.filmon.txt b/project/cmake/addons/addons/pvr.filmon/pvr.filmon.txt
deleted file mode 100644
index 2e7142c..0000000
--- a/project/cmake/addons/addons/pvr.filmon/pvr.filmon.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.filmon https://github.com/kodi-pvr/pvr.filmon 413fe9e
diff --git a/project/cmake/addons/addons/pvr.hts/platforms.txt b/project/cmake/addons/addons/pvr.hts/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.hts/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.hts/pvr.hts.txt b/project/cmake/addons/addons/pvr.hts/pvr.hts.txt
deleted file mode 100644
index 5f913f8..0000000
--- a/project/cmake/addons/addons/pvr.hts/pvr.hts.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.hts https://github.com/kodi-pvr/pvr.hts 4bf1a97
diff --git a/project/cmake/addons/addons/pvr.iptvsimple/platforms.txt b/project/cmake/addons/addons/pvr.iptvsimple/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.iptvsimple/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt b/project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt
deleted file mode 100644
index d1d4d3c..0000000
--- a/project/cmake/addons/addons/pvr.iptvsimple/pvr.iptvsimple.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.iptvsimple https://github.com/kodi-pvr/pvr.iptvsimple a2e6c6f
diff --git a/project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt b/project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.mediaportal.tvserver/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt b/project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt
deleted file mode 100644
index 665dfff..0000000
--- a/project/cmake/addons/addons/pvr.mediaportal.tvserver/pvr.mediaportal.tvserver.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.mediaportal.tvserver https://github.com/kodi-pvr/pvr.mediaportal.tvserver 6f8ca82
diff --git a/project/cmake/addons/addons/pvr.mythtv/platforms.txt b/project/cmake/addons/addons/pvr.mythtv/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.mythtv/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt b/project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt
deleted file mode 100644
index de930ab..0000000
--- a/project/cmake/addons/addons/pvr.mythtv/pvr.mythtv.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.mythtv https://github.com/kodi-pvr/pvr.mythtv ef9cf41
diff --git a/project/cmake/addons/addons/pvr.nextpvr/platforms.txt b/project/cmake/addons/addons/pvr.nextpvr/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.nextpvr/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt b/project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt
deleted file mode 100644
index ecb73d2..0000000
--- a/project/cmake/addons/addons/pvr.nextpvr/pvr.nextpvr.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.nextpvr https://github.com/kodi-pvr/pvr.nextpvr 1ecbf87
diff --git a/project/cmake/addons/addons/pvr.njoy/platforms.txt b/project/cmake/addons/addons/pvr.njoy/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.njoy/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt b/project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt
deleted file mode 100644
index fec1b59..0000000
--- a/project/cmake/addons/addons/pvr.njoy/pvr.njoy.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.njoy https://github.com/kodi-pvr/pvr.njoy fcd6294
diff --git a/project/cmake/addons/addons/pvr.pctv/platforms.txt b/project/cmake/addons/addons/pvr.pctv/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.pctv/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt b/project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt
deleted file mode 100644
index b17bdc7..0000000
--- a/project/cmake/addons/addons/pvr.pctv/pvr.pctv.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.pctv https://github.com/kodi-pvr/pvr.pctv 0a0924e
diff --git a/project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt b/project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.vdr.vnsi/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt b/project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt
deleted file mode 100644
index 72b4954..0000000
--- a/project/cmake/addons/addons/pvr.vdr.vnsi/pvr.vdr.vnsi.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.vdr.vnsi https://github.com/kodi-pvr/pvr.vdr.vnsi 3a28e39
diff --git a/project/cmake/addons/addons/pvr.vuplus/platforms.txt b/project/cmake/addons/addons/pvr.vuplus/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.vuplus/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt b/project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt
deleted file mode 100644
index 36d60af..0000000
--- a/project/cmake/addons/addons/pvr.vuplus/pvr.vuplus.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.vuplus https://github.com/kodi-pvr/pvr.vuplus d6abad3
diff --git a/project/cmake/addons/addons/pvr.wmc/platforms.txt b/project/cmake/addons/addons/pvr.wmc/platforms.txt
deleted file mode 100644
index baa6044..0000000
--- a/project/cmake/addons/addons/pvr.wmc/platforms.txt
+++ /dev/null
@@ -1 +0,0 @@
1all \ No newline at end of file
diff --git a/project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt b/project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt
deleted file mode 100644
index 1455925..0000000
--- a/project/cmake/addons/addons/pvr.wmc/pvr.wmc.txt
+++ /dev/null
@@ -1 +0,0 @@
1pvr.wmc https://github.com/kodi-pvr/pvr.wmc cf28e4c
diff --git a/project/cmake/addons/bootstrap/CMakeLists.txt b/project/cmake/addons/bootstrap/CMakeLists.txt
new file mode 100644
index 0000000..86950b8
--- /dev/null
+++ b/project/cmake/addons/bootstrap/CMakeLists.txt
@@ -0,0 +1,95 @@
1project(kodi-addons-bootstrap)
2
3cmake_minimum_required(VERSION 2.8)
4
5list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
6
7# make sure CMAKE_INSTALL_PREFIX is properly set
8if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
9 set(CMAKE_INSTALL_PREFIX "${PROJECT_SOURCE_DIR}/../addons")
10endif()
11list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX})
12
13# figure out where the build directory is located
14if(NOT BUILD_DIR)
15 set(BUILD_DIR "${CMAKE_BINARY_DIR}/build")
16else()
17 file(TO_CMAKE_PATH "${BUILD_DIR}" BUILD_DIR)
18endif()
19get_filename_component(BUILD_DIR "${BUILD_DIR}" ABSOLUTE)
20
21# make sure that the repositories to build have been specified
22if(NOT REPOSITORY_TO_BUILD)
23 set(REPOSITORY_TO_BUILD_DEFAULT ON)
24 set(REPOSITORY_TO_BUILD "all")
25 set(REPOSITORY_REVISION "")
26 message(STATUS "Bootstrapping all repositories")
27else()
28 set(REPOSITORY_TO_BUILD_DEFAULT OFF)
29 message(STATUS "Bootstrapping following repository: ${REPOSITORY_TO_BUILD}")
30endif()
31
32# figure out which addons to bootstrap (defaults to all)
33if(NOT ADDONS_TO_BUILD)
34 set(ADDONS_TO_BUILD "all")
35 message(STATUS "Bootstrapping all addons")
36else()
37 message(STATUS "Bootstrapping following addons: ${ADDONS_TO_BUILD}")
38endif()
39
40include(ExternalProject)
41
42function(bootstrap_repo repo_id repo_url repo_revision)
43 message(STATUS "Bootstrapping addons from ${repo_id} (${repo_url} ${repo_revision})...")
44 externalproject_add(${repo_id}
45 GIT_REPOSITORY ${repo_url}
46 GIT_TAG ${repo_revision}
47 PREFIX ${BUILD_DIR}/${repo_id}
48 CONFIGURE_COMMAND ""
49 BUILD_COMMAND ""
50 INSTALL_COMMAND ${CMAKE_COMMAND}
51 -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
52 -DPROJECT_SOURCE_DIR=<SOURCE_DIR>
53 -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
54 -DADDONS_TO_BUILD=${ADDONS_TO_BUILD}
55 -P ${PROJECT_SOURCE_DIR}/bootstrap.cmake
56 )
57endfunction()
58
59# look for all addons repository definitions
60set(REPOSITORY_TO_BUILD_FOUND OFF)
61file(GLOB repos repositories/*.txt)
62foreach(repo ${repos})
63 file(STRINGS ${repo} repo_definition)
64 separate_arguments(repo_definition)
65 list(GET repo_definition 0 repo_id)
66
67 list(FIND REPOSITORY_TO_BUILD ${repo_id} idx)
68 if(idx GREATER -1 OR REPOSITORY_TO_BUILD STREQUAL "all")
69 set(REPOSITORY_TO_BUILD_FOUND ON)
70
71 # get the URL of the repository
72 list(GET repo_definition 1 repo_url)
73
74 # get the revision of the repository if not provided as an argument
75 if(NOT REPOSITORY_REVISION)
76 list(GET repo_definition 2 repo_revision)
77 else()
78 set(repo_revision "${REPOSITORY_REVISION}")
79 endif()
80
81 bootstrap_repo(${repo_id} ${repo_url} ${repo_revision})
82 endif()
83endforeach()
84
85# if we have been asked to bootstrap a specific repository (not the default one) and
86# it couldn't be found in the predefined repository definitions we assume that it's a
87# URL to a specific repository
88if(NOT REPOSITORY_TO_BUILD_DEFAULT AND NOT REPOSITORY_TO_BUILD_FOUND)
89 # default to the master branch if no revision has been provided
90 if(NOT REPOSITORY_REVISION)
91 set(REPOSITORY_REVISION "master")
92 endif()
93
94 bootstrap_repo(binary-addons-custom ${REPOSITORY_TO_BUILD} ${REPOSITORY_REVISION})
95endif()
diff --git a/project/cmake/addons/bootstrap/README.md b/project/cmake/addons/bootstrap/README.md
new file mode 100644
index 0000000..b886b5b
--- /dev/null
+++ b/project/cmake/addons/bootstrap/README.md
@@ -0,0 +1,48 @@
1# KODI ADDON DEFINITIONS BOOTSTRAPPING
2This directory contains the cmake-based buildsystem for addon definitions
3bootstrapping which downloads the addon definitions from one or more addon
4definitions repositories. These addon definitions are then used by the addon
5buildsystem to figure out which addons and which versions to build. It looks
6into the "repositories" sub-directory and parses all *.txt files recursively.
7Each addon definitions repository must have its own <repository>.txt file which
8must follow the following defined format:
9```
10<repository> <git-url> <git-revision>
11```
12where
13* `<repository>` is the identification of the repository.
14* `<git-url>` must be the URL of the git repository containing the addon
15 definitions
16* `<git-revision>` must be a valid git tag/branch/commit in the addon
17 definitions repository's git repository which will be used for the build
18
19The buildsystem uses the following variables (which can be passed into it when
20executing cmake with the `-D<variable-name>=<value>` option):
21* `CMAKE_INSTALL_PREFIX` points to the directory where the downloaded addon
22definitions will be installed to (defaults to `../addons`).
23* `BUILD_DIR` points to the directory where the addon definitions repositories
24will be downloaded to.
25* `REPOSITORY_TO_BUILD` specifies a single addon definitions repository to be
26downloaded and processed (defaults to `"all"`).
27* `REPOSITORY_REVISION` specifies the git revision in the addon definitions
28repository which will be used for the build. This option is only valid in
29combination with the `REPOSITORY_TO_BUILD` option (defaults to the git
30revision specified in the repository's definition file).
31* `ADDONS_TO_BUILD` is a quoted, space delimited list of `<addon-id>`s that
32should be bootstrapped (default is `"all"`).
33
34To trigger the cmake-based buildsystem the following command must be executed
35with <path> being the path to this directory (absolute or relative, allowing for
36in-source and out-of-source builds).
37```
38cmake <path> -G <generator>
39```
40
41cmake supports multiple generators, see
42http://www.cmake.org/cmake/help/v2.8.8/cmake.html#section_Generators for a list.
43
44In case of additional options the call might look like this
45```
46cmake <path> [-G <generator>] \
47 -DCMAKE_INSTALL_PREFIX="<path-to-install-directory>"
48``` \ No newline at end of file
diff --git a/project/cmake/addons/bootstrap/bootstrap.cmake b/project/cmake/addons/bootstrap/bootstrap.cmake
new file mode 100644
index 0000000..c78910c
--- /dev/null
+++ b/project/cmake/addons/bootstrap/bootstrap.cmake
@@ -0,0 +1,38 @@
1list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
2
3# make sure that the installation location has been specified
4if(NOT CMAKE_INSTALL_PREFIX)
5 message(FATAL_ERROR "CMAKE_INSTALL_PREFIX has not been specified")
6endif()
7
8# figure out which addons to bootstrap (defaults to all)
9if(NOT ADDONS_TO_BUILD)
10 set(ADDONS_TO_BUILD "all")
11else()
12 separate_arguments(ADDONS_TO_BUILD)
13endif()
14
15# find all addon definitions and go through them
16file(GLOB_RECURSE ADDON_DEFINITIONS ${PROJECT_SOURCE_DIR}/*.txt)
17foreach(ADDON_DEFINITION_FILE ${ADDON_DEFINITIONS})
18 # ignore platforms.txt
19 if(NOT (ADDON_DEFINITION_FILE MATCHES platforms.txt))
20 # read the addon definition file
21 file(STRINGS ${ADDON_DEFINITION_FILE} ADDON_DEFINITION)
22 separate_arguments(ADDON_DEFINITION)
23
24 # extract the addon definition's identifier
25 list(GET ADDON_DEFINITION 0 ADDON_ID)
26
27 # check if the addon definition should be built
28 list(FIND ADDONS_TO_BUILD ${ADDON_ID} ADDONS_TO_BUILD_IDX)
29 if(ADDONS_TO_BUILD_IDX GREATER -1 OR "${ADDONS_TO_BUILD}" STREQUAL "all")
30 # get the path to the addon definition directory
31 get_filename_component(ADDON_DEFINITION_DIR ${ADDON_DEFINITION_FILE} PATH)
32
33 # install the addon definition
34 message(STATUS "Bootstrapping ${ADDON_ID} addon...")
35 file(INSTALL ${ADDON_DEFINITION_DIR} DESTINATION ${CMAKE_INSTALL_PREFIX})
36 endif()
37 endif()
38endforeach()
diff --git a/project/cmake/addons/bootstrap/repositories/binary-addons.txt b/project/cmake/addons/bootstrap/repositories/binary-addons.txt
new file mode 100644
index 0000000..8674f06
--- /dev/null
+++ b/project/cmake/addons/bootstrap/repositories/binary-addons.txt
@@ -0,0 +1 @@
binary-addons https://github.com/xbmc/repo-binary-addons.git master \ No newline at end of file
diff --git a/project/cmake/addons/depends/common/kodi-platform/deps.txt b/project/cmake/addons/depends/common/kodi-platform/deps.txt
index f0e8246..b953815 100644
--- a/project/cmake/addons/depends/common/kodi-platform/deps.txt
+++ b/project/cmake/addons/depends/common/kodi-platform/deps.txt
@@ -1,2 +1,2 @@
1kodi 1tinyxml
2tinyxml \ No newline at end of file 2p8-platform
diff --git a/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt b/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt
index 009c72b..de42267 100644
--- a/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt
+++ b/project/cmake/addons/depends/common/kodi-platform/kodi-platform.txt
@@ -1 +1 @@
kodi-platform https://github.com/xbmc/kodi-platform 48bdd985 kodi-platform https://github.com/xbmc/kodi-platform fed924e764b4c9c722f7f5d825ce70d4b61ae54f
diff --git a/project/cmake/addons/depends/common/p8-platform/p8-platform.txt b/project/cmake/addons/depends/common/p8-platform/p8-platform.txt
new file mode 100644
index 0000000..7db4e36
--- /dev/null
+++ b/project/cmake/addons/depends/common/p8-platform/p8-platform.txt
@@ -0,0 +1 @@
p8-platform https://github.com/Pulse-Eight/platform.git 38343e0acd6a636ac46139aa666aee4a8d1f13db
diff --git a/project/cmake/addons/depends/common/tinyxml/tinyxml.txt b/project/cmake/addons/depends/common/tinyxml/tinyxml.txt
index 456b0c5..f8e05e8 100644
--- a/project/cmake/addons/depends/common/tinyxml/tinyxml.txt
+++ b/project/cmake/addons/depends/common/tinyxml/tinyxml.txt
@@ -1 +1 @@
tinyxml http://mirrors.xbmc.org/build-deps/sources/tinyxml-2.6.2_2.tar.gz tinyxml http://mirrors.kodi.tv/build-deps/sources/tinyxml-2.6.2_2.tar.gz
diff --git a/project/cmake/installdata/addon-bindings.txt b/project/cmake/installdata/addon-bindings.txt
new file mode 100644
index 0000000..fbcdf99
--- /dev/null
+++ b/project/cmake/installdata/addon-bindings.txt
@@ -0,0 +1,28 @@
1xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_cpp_dll.h
2xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_dll.h
3xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_addon_types.h
4xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_dll.h
5xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_adsp_types.h
6xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_dll.h
7xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_audiodec_types.h
8xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_dll.h
9xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_audioenc_types.h
10xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_codec_types.h
11xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_epg_types.h
12xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h
13xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h
14xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_dll.h
15xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_scr_types.h
16xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_dll.h
17xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_vis_types.h
18xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_stream_utils.hpp
19xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_dll.h
20xbmc/addons/kodi-addon-dev-kit/include/kodi/kodi_inputstream_types.h
21xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_addon.h
22xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_adsp.h
23xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h
24xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_pvr.h
25xbmc/addons/kodi-addon-dev-kit/include/kodi/libXBMC_codec.h
26xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h
27xbmc/cores/AudioEngine/Utils/AEChannelData.h
28xbmc/filesystem/IFileTypes.h
diff --git a/project/cmake/installdata/common/addons.txt b/project/cmake/installdata/common/addons.txt
new file mode 100644
index 0000000..7d406ad
--- /dev/null
+++ b/project/cmake/installdata/common/addons.txt
@@ -0,0 +1,40 @@
1addons/kodi.adsp/*
2addons/kodi.audiodecoder/*
3addons/kodi.resource/*
4addons/kodi.vfs/*
5addons/xbmc.audioencoder/*
6addons/xbmc.codec/*
7addons/xbmc.core/*
8addons/xbmc.gui/*
9addons/xbmc.metadata/*
10addons/xbmc.pvr/*
11addons/xbmc.python/*
12addons/xbmc.webinterface/*
13addons/library.xbmc.addon/*
14addons/library.xbmc.codec/*
15addons/library.xbmc.gui/*
16addons/library.xbmc.pvr/*
17addons/repository.xbmc.org/*
18addons/webinterface.default/*
19addons/screensaver.xbmc.builtin.dim/*
20addons/screensaver.xbmc.builtin.black/*
21addons/script.module.pil/*
22addons/script.module.pysqlite/*
23addons/audioencoder.xbmc.builtin.aac/*
24addons/audioencoder.xbmc.builtin.wav/*
25addons/audioencoder.xbmc.builtin.wma/*
26addons/resource.language.en_gb/*
27addons/resource.uisounds.confluence/*
28addons/resource.images.weathericons.default/*
29addons/metadata.local/*
30addons/metadata.album.universal/*
31addons/metadata.artists.universal/*
32addons/metadata.common.allmusic.com/*
33addons/metadata.common.fanart.tv/*
34addons/metadata.common.htbackdrops.com/*
35addons/metadata.common.imdb.com/*
36addons/metadata.common.musicbrainz.org/*
37addons/metadata.common.theaudiodb.com/*
38addons/metadata.common.themoviedb.org/*
39addons/metadata.themoviedb.org/*
40addons/metadata.tvdb.com/*
diff --git a/project/cmake/installdata/common/common.txt b/project/cmake/installdata/common/common.txt
new file mode 100644
index 0000000..c1e52f0
--- /dev/null
+++ b/project/cmake/installdata/common/common.txt
@@ -0,0 +1,13 @@
1media/*
2sounds/*
3system/keymaps/*
4system/library/*
5system/players/VideoPlayer/etc/*
6system/shaders/*
7system/settings/*
8userdata/*
9system/addon-manifest.xml
10system/colors.xml
11system/peripherals.xml
12system/playercorefactory.xml
13system/keyboardlayouts/*
diff --git a/project/cmake/installdata/darwin/runtime.txt b/project/cmake/installdata/darwin/runtime.txt
new file mode 100644
index 0000000..e1bb711
--- /dev/null
+++ b/project/cmake/installdata/darwin/runtime.txt
@@ -0,0 +1 @@
tools/darwin/runtime/preflight
diff --git a/project/cmake/installdata/linux/lirc.txt b/project/cmake/installdata/linux/lirc.txt
new file mode 100644
index 0000000..1b48478
--- /dev/null
+++ b/project/cmake/installdata/linux/lirc.txt
@@ -0,0 +1 @@
system/Lircmap.xml
diff --git a/project/cmake/installdata/test-reference-data.txt b/project/cmake/installdata/test-reference-data.txt
new file mode 100644
index 0000000..895079a
--- /dev/null
+++ b/project/cmake/installdata/test-reference-data.txt
@@ -0,0 +1,10 @@
1xbmc/utils/test/CXBMCTinyXML-test.xml
2xbmc/utils/test/data/language/Spanish/strings.po
3xbmc/filesystem/test/reffile.txt
4xbmc/filesystem/test/reffile.txt.rar
5xbmc/filesystem/test/reffile.txt.zip
6xbmc/filesystem/test/refRARnormal.rar
7xbmc/filesystem/test/refRARstored.rar
8xbmc/network/test/data/test.html
9xbmc/network/test/data/test.png
10xbmc/network/test/data/test-ranges.txt
diff --git a/project/cmake/installdata/windows/addons.txt b/project/cmake/installdata/windows/addons.txt
new file mode 100644
index 0000000..92bf9b3
--- /dev/null
+++ b/project/cmake/installdata/windows/addons.txt
@@ -0,0 +1 @@
addons/repository.pvr-win32.xbmc.org/*
diff --git a/project/cmake/installdata/windows/dlls.txt b/project/cmake/installdata/windows/dlls.txt
new file mode 100644
index 0000000..72cca7d
--- /dev/null
+++ b/project/cmake/installdata/windows/dlls.txt
@@ -0,0 +1,6 @@
1system/*.dll
2system/airplay/*.dll
3system/cdrip/*.dll
4system/players/dvdplayer/*.dll
5system/players/paplayer/*.dll
6system/players/VideoPlayer/*.dll
diff --git a/project/cmake/installdata/windows/irss.txt b/project/cmake/installdata/windows/irss.txt
new file mode 100644
index 0000000..6fd8d48
--- /dev/null
+++ b/project/cmake/installdata/windows/irss.txt
@@ -0,0 +1,2 @@
1system/IRSSmap.xml
2system/X10-Lola-IRSSmap.xml
diff --git a/project/cmake/kodi-config.cmake.in b/project/cmake/kodi-config.cmake.in
index 118d723..84b2563 100644
--- a/project/cmake/kodi-config.cmake.in
+++ b/project/cmake/kodi-config.cmake.in
@@ -1,11 +1,29 @@
1SET(KODI_INCLUDE_DIR @prefix@/include)
2SET(APP_NAME @APP_NAME@) 1SET(APP_NAME @APP_NAME@)
2SET(APP_NAME_LC @APP_NAME_LC@)
3SET(APP_NAME_UC @APP_NAME_UC@)
3SET(APP_VERSION_MAJOR @APP_VERSION_MAJOR@) 4SET(APP_VERSION_MAJOR @APP_VERSION_MAJOR@)
4SET(APP_VERSION_MINOR @APP_VERSION_MINOR@) 5SET(APP_VERSION_MINOR @APP_VERSION_MINOR@)
6IF(NOT @APP_NAME_UC@_PREFIX)
7 SET(@APP_NAME_UC@_PREFIX @APP_PREFIX@)
8ENDIF()
9IF(NOT @APP_NAME_UC@_INCLUDE_DIR)
10 SET(@APP_NAME_UC@_INCLUDE_DIR @APP_INCLUDE_DIR@)
11ENDIF()
12IF(NOT @APP_NAME_UC@_LIB_DIR)
13 SET(@APP_NAME_UC@_LIB_DIR @APP_LIB_DIR@)
14ENDIF()
5IF(NOT WIN32) 15IF(NOT WIN32)
6 SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@") 16 SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} @CXX11_SWITCH@")
7ENDIF() 17ENDIF()
8LIST(APPEND CMAKE_MODULE_PATH @prefix@/lib/kodi) 18LIST(APPEND CMAKE_MODULE_PATH @APP_LIB_DIR@)
9ADD_DEFINITIONS(@ARCH_DEFINES@ -DBUILD_KODI_ADDON) 19ADD_DEFINITIONS(@ARCH_DEFINES@ -DBUILD_KODI_ADDON)
10 20
21if(NOT CORE_SYSTEM_NAME)
22 if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
23 set(CORE_SYSTEM_NAME "osx")
24 else()
25 string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME)
26 endif()
27endif()
28
11include(addon-helpers) 29include(addon-helpers)
diff --git a/project/cmake/modules/FindAML.cmake b/project/cmake/modules/FindAML.cmake
new file mode 100644
index 0000000..5b9a859
--- /dev/null
+++ b/project/cmake/modules/FindAML.cmake
@@ -0,0 +1,35 @@
1#.rst:
2# FindAML
3# -------
4# Finds the AML codec
5#
6# This will will define the following variables::
7#
8# AML_FOUND - system has AML
9# AML_INCLUDE_DIRS - the AML include directory
10# AML_DEFINITIONS - the AML definitions
11#
12# and the following imported targets::
13#
14# AML::AML - The AML codec
15
16find_path(AML_INCLUDE_DIR codec_error.h
17 PATH_SUFFIXES amcodec)
18
19include(FindPackageHandleStandardArgs)
20find_package_handle_standard_args(AML
21 REQUIRED_VARS AML_INCLUDE_DIR)
22
23if(AML_FOUND)
24 set(AML_INCLUDE_DIRS ${AML_INCLUDE_DIR})
25 set(AML_DEFINITIONS -DHAS_LIBAMCODEC=1)
26
27 if(NOT TARGET AML::AML)
28 add_library(AML::AML UNKNOWN IMPORTED)
29 set_target_properties(AML::AML PROPERTIES
30 INTERFACE_INCLUDE_DIRECTORIES "${AML_INCLUDE_DIR}"
31 INTERFACE_COMPILE_DEFINITIONS HAS_LIBAMCODEC=1)
32 endif()
33endif()
34
35mark_as_advanced(AMLCODEC_INCLUDE_DIR)
diff --git a/project/cmake/modules/FindASS.cmake b/project/cmake/modules/FindASS.cmake
new file mode 100644
index 0000000..5f4b0c7
--- /dev/null
+++ b/project/cmake/modules/FindASS.cmake
@@ -0,0 +1,18 @@
1# - Try to find ASS
2# Once done this will define
3#
4# ASS_FOUND - system has libass
5# ASS_INCLUDE_DIRS - the libass include directory
6# ASS_LIBRARIES - The libass libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (ASS libass)
10else()
11 find_path(ASS_INCLUDE_DIRS ass/ass.h)
12 find_library(ASS_LIBRARIES NAMES ass libass)
13endif()
14
15include(FindPackageHandleStandardArgs)
16find_package_handle_standard_args(ASS DEFAULT_MSG ASS_INCLUDE_DIRS ASS_LIBRARIES)
17
18mark_as_advanced(ASS_INCLUDE_DIRS ASS_LIBRARIES)
diff --git a/project/cmake/modules/FindAlsa.cmake b/project/cmake/modules/FindAlsa.cmake
new file mode 100644
index 0000000..b15a0cf
--- /dev/null
+++ b/project/cmake/modules/FindAlsa.cmake
@@ -0,0 +1,20 @@
1# - Try to find ALSA
2# Once done this will define
3#
4# ALSA_FOUND - system has libALSA
5# ALSA_INCLUDE_DIRS - the libALSA include directory
6# ALSA_LIBRARIES - The libALSA libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (ALSA alsa)
10else()
11 find_path(ALSA_INCLUDE_DIRS asoundlib.h PATH_SUFFIXES alsa)
12 find_library(ALSA_LIBRARIES asound)
13endif()
14
15include(FindPackageHandleStandardArgs)
16find_package_handle_standard_args(Alsa DEFAULT_MSG ALSA_INCLUDE_DIRS ALSA_LIBRARIES)
17
18set(ALSA_INCLUDE_DIRS "") # Dont want these added as 'timer.h' is a dangerous file
19mark_as_advanced(ALSA_INCLUDE_DIRS ALSA_LIBRARIES)
20list(APPEND ALSA_DEFINITIONS -DHAVE_ALSA=1 -DUSE_ALSA=1)
diff --git a/project/cmake/modules/FindAvahi.cmake b/project/cmake/modules/FindAvahi.cmake
new file mode 100644
index 0000000..24bf15c
--- /dev/null
+++ b/project/cmake/modules/FindAvahi.cmake
@@ -0,0 +1,26 @@
1# - Try to find avahi
2# Once done this will define
3#
4# AVAHI_FOUND - system has avahi
5# AVAHI_INCLUDE_DIRS - the avahi include directory
6# AVAHI_LIBRARIES - The avahi libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (AVAHI avahi-client)
10 list(APPEND AVAHI_INCLUDE_DIRS ${AVAHI_INCLUDEDIR})
11else()
12 find_path(AVAHI_CLIENT_INCLUDE_DIRS avahi-client/client.h)
13 find_path(AVAHI_COMMON_INCLUDE_DIRS avahi-common/defs.h)
14 find_library(AVAHI_COMMON_LIBRARIES avahi-common)
15 find_library(AVAHI_CLIENT_LIBRARIES avahi-common)
16 set(AVAHI_INCLUDE_DIRS ${AVAHI_CLIENT_INCLUDE_DIRS}
17 ${AVAHI_COMMON_INCLUDE_DIRS})
18 set(AVAHI_LIBRARIES ${AVAHI_CLIENT_LIBRARIES}
19 ${AVAHI_COMMON_LIBRARIES})
20endif()
21
22include(FindPackageHandleStandardArgs)
23find_package_handle_standard_args(Avahi DEFAULT_MSG AVAHI_INCLUDE_DIRS AVAHI_LIBRARIES)
24
25mark_as_advanced(AVAHI_INCLUDE_DIRS AVAHI_LIBRARIES)
26list(APPEND AVAHI_DEFINITIONS -DHAVE_LIBAVAHI_COMMON=1 -DHAVE_LIBAVAHI_CLIENT=1)
diff --git a/project/cmake/modules/FindBluray.cmake b/project/cmake/modules/FindBluray.cmake
new file mode 100644
index 0000000..2b0a449
--- /dev/null
+++ b/project/cmake/modules/FindBluray.cmake
@@ -0,0 +1,57 @@
1#.rst:
2# FindBluray
3# ----------
4# Finds the libbluray library
5#
6# This will will define the following variables::
7#
8# BLURAY_FOUND - system has libbluray
9# BLURAY_INCLUDE_DIRS - the libbluray include directory
10# BLURAY_LIBRARIES - the libbluray libraries
11# BLURAY_DEFINITIONS - the libbluray compile definitions
12#
13# and the following imported targets::
14#
15# Bluray::Bluray - The libblueray library
16
17if(PKG_CONFIG_FOUND)
18 pkg_check_modules(BLURAY libbluray>=0.7.0)
19 set(BLURAY_VERSION ${PC_BLURAY_VERSION})
20else()
21 find_path(BLURAY_INCLUDE_DIR libbluray/bluray.h
22 PATHS ${PC_BLURAY_INCLUDEDIR})
23
24 include(FindPackageHandleStandardArgs)
25 if(NOT WIN32)
26 find_library(BLURAY_LIBRARY NAMES bluray
27 PATHS ${PC_BLURAY_LIBDIR})
28
29 find_package_handle_standard_args(BLURAY
30 REQUIRED_VARS BLURAY_LIBRARY BLURAY_INCLUDE_DIR
31 VERSION_VAR BLURAY_VERSION)
32 else()
33 # Dynamically loaded DLL
34 find_package_handle_standard_args(BLURAY
35 REQUIRED_VARS BLURAY_INCLUDE_DIR
36 VERSION_VAR BLURAY_VERSION)
37 endif()
38endif()
39
40if(BLURAY_FOUND)
41 set(BLURAY_LIBRARIES ${BLURAY_LIBRARY})
42 set(BLURAY_INCLUDE_DIRS ${BLURAY_INCLUDE_DIR})
43 set(BLURAY_DEFINITIONS -DHAVE_LIBBLURAY=1)
44
45 if(NOT TARGET Bluray::Bluray)
46 add_library(Bluray::Bluray UNKNOWN IMPORTED)
47 if(BLURAY_LIBRARY)
48 set_target_properties(Bluray::Bluray PROPERTIES
49 IMPORTED_LOCATION "${BLURAY_LIBRARY}")
50 endif()
51 set_target_properties(Bluray::Bluray PROPERTIES
52 INTERFACE_INCLUDE_DIRECTORIES "${BLURAY_INCLUDE_DIR}"
53 INTERFACE_COMPILE_DEFINITIONS HAVE_LIBBLURAY=1)
54 endif()
55endif()
56
57mark_as_advanced(BLURAY_INCLUDE_DIR BLURAY_LIBRARY)
diff --git a/project/cmake/modules/FindCCache.cmake b/project/cmake/modules/FindCCache.cmake
new file mode 100644
index 0000000..4ad7d07
--- /dev/null
+++ b/project/cmake/modules/FindCCache.cmake
@@ -0,0 +1,6 @@
1find_program(CCACHE_FOUND ccache)
2if(CCACHE_FOUND)
3 set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
4 set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
5endif(CCACHE_FOUND)
6
diff --git a/project/cmake/modules/FindCEC.cmake b/project/cmake/modules/FindCEC.cmake
new file mode 100644
index 0000000..98e900d
--- /dev/null
+++ b/project/cmake/modules/FindCEC.cmake
@@ -0,0 +1,58 @@
1#.rst:
2# FindCEC
3# -------
4# Finds the libCEC library
5#
6# This will will define the following variables::
7#
8# CEC_FOUND - system has libCEC
9# CEC_INCLUDE_DIRS - the libCEC include directory
10# CEC_LIBRARIES - the libCEC libraries
11# CEC_DEFINITIONS - the libCEC compile definitions
12#
13# and the following imported targets::
14#
15# CEC::CEC - The libCEC library
16
17if(PKG_CONFIG_FOUND)
18 pkg_check_modules(PC_CEC libCEC>=3.0.0 QUIET)
19endif()
20
21find_path(CEC_INCLUDE_DIR libCEC/CEC.h
22 PATHS ${PC_CEC_INCLUDEDIR})
23
24set(CEC_VERSION ${PC_CEC_VERSION})
25
26include(FindPackageHandleStandardArgs)
27if(NOT WIN32)
28 find_library(CEC_LIBRARY NAMES cec
29 PATHS ${PC_CEC_LIBDIR})
30
31 find_package_handle_standard_args(CEC
32 REQUIRED_VARS CEC_LIBRARY CEC_INCLUDE_DIR
33 VERSION_VAR CEC_VERSION)
34else()
35 # Dynamically loaded DLL
36 find_package_handle_standard_args(CEC
37 REQUIRED_VARS CEC_INCLUDE_DIR
38 VERSION_VAR CEC_VERSION)
39endif()
40
41if(CEC_FOUND)
42 set(CEC_LIBRARIES ${CEC_LIBRARY})
43 set(CEC_INCLUDE_DIRS ${CEC_INCLUDE_DIR})
44 set(CEC_DEFINITIONS -DHAVE_LIBCEC=1)
45
46 if(NOT TARGET CEC::CEC)
47 add_library(CEC::CEC UNKNOWN IMPORTED)
48 if(CEC_LIBRARY)
49 set_target_properties(CEC::CEC PROPERTIES
50 IMPORTED_LOCATION "${CEC_LIBRARY}")
51 endif()
52 set_target_properties(CEC::CEC PROPERTIES
53 INTERFACE_INCLUDE_DIRECTORIES "${CEC_INCLUDE_DIR}"
54 INTERFACE_COMPILE_DEFINITIONS HAVE_LIBCEC=1)
55 endif()
56endif()
57
58mark_as_advanced(CEC_INCLUDE_DIR CEC_LIBRARY)
diff --git a/project/cmake/modules/FindCXX11.cmake b/project/cmake/modules/FindCXX11.cmake
new file mode 100644
index 0000000..f1b7346
--- /dev/null
+++ b/project/cmake/modules/FindCXX11.cmake
@@ -0,0 +1,18 @@
1include(TestCXXAcceptsFlag)
2
3# try to use compiler flag -std=c++11
4check_cxx_accepts_flag("-std=c++11" CXX_FLAG_CXX11)
5if(CXX_FLAG_CXX11)
6 add_options (CXX ALL_BUILDS "-std=c++11")
7 set(CXX_STD11_FLAGS "-std=c++11")
8else()
9 # try to use compiler flag -std=c++0x for older compilers
10 check_cxx_accepts_flag("-std=c++0x" CXX_FLAG_CXX0X)
11 if(CXX_FLAG_CXX0X)
12 add_options (CXX ALL_BUILDS "-std=c++0x")
13 set(CXX_STD11_FLAGS "-std=c++0x")
14 endif(CXX_FLAG_CXX0X)
15endif(CXX_FLAG_CXX11)
16
17include(FindPackageHandleStandardArgs)
18find_package_handle_standard_args(CXX11 DEFAULT_MSG CXX_STD11_FLAGS)
diff --git a/project/cmake/modules/FindCdio.cmake b/project/cmake/modules/FindCdio.cmake
new file mode 100644
index 0000000..1b6b8cd
--- /dev/null
+++ b/project/cmake/modules/FindCdio.cmake
@@ -0,0 +1,20 @@
1# - Try to find cdio
2# Once done this will define
3#
4# CDIO_FOUND - system has libcdio
5# CDIO_INCLUDE_DIRS - the libcdio include directory
6# CDIO_LIBRARIES - The libcdio libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (CDIO libcdio libiso9660)
10 list(APPEND CDIO_INCLUDE_DIRS ${CDIO_libcdio_INCLUDEDIR} ${CDIO_libiso9660_INCLUDEDIR})
11endif()
12if(NOT CDIO_FOUND)
13 find_path(CDIO_INCLUDE_DIRS cdio/cdio.h)
14 find_library(MODPLUG_LIBRARIES NAMES cdio)
15endif()
16
17include(FindPackageHandleStandardArgs)
18find_package_handle_standard_args(Cdio DEFAULT_MSG CDIO_INCLUDE_DIRS CDIO_LIBRARIES)
19
20mark_as_advanced(CDIO_INCLUDE_DIRS CDIO_LIBRARIES)
diff --git a/project/cmake/modules/FindCpluff.cmake b/project/cmake/modules/FindCpluff.cmake
new file mode 100644
index 0000000..b8fa22d
--- /dev/null
+++ b/project/cmake/modules/FindCpluff.cmake
@@ -0,0 +1,46 @@
1# - Builds Cpluff as external project
2# Once done this will define
3#
4# CPLUFF_FOUND - system has cpluff
5# CPLUFF_INCLUDE_DIRS - the cpluff include directories
6#
7# and link Kodi against the cpluff libraries.
8
9if(NOT WIN32)
10 string(REPLACE ";" " " defines "${CMAKE_C_FLAGS} ${SYSTEM_DEFINES} -I${EXPAT_INCLUDE_DIR}")
11 get_filename_component(expat_dir ${EXPAT_LIBRARY} PATH)
12 set(ldflags "-L${expat_dir}")
13 ExternalProject_Add(libcpluff SOURCE_DIR ${CORE_SOURCE_DIR}/lib/cpluff
14 PREFIX ${CORE_BUILD_DIR}/cpluff
15 PATCH_COMMAND rm -f config.status
16 UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif
17 CONFIGURE_COMMAND CC=${CMAKE_C_COMPILER} ${CORE_SOURCE_DIR}/lib/cpluff/configure
18 --disable-nls
19 --enable-static
20 --disable-shared
21 --with-pic
22 --prefix=<INSTALL_DIR>
23 --host=${ARCH}
24 CFLAGS=${defines}
25 LDFLAGS=${ldflags}
26 BUILD_COMMAND make V=1)
27 set(ldflags "${ldflags};-lexpat")
28 core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/lib/libcpluff.a
29 system/libcpluff libcpluff extras "${ldflags}")
30 set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE)
31else()
32 ExternalProject_Add(libcpluff SOURCE_DIR ${CORE_SOURCE_DIR}/lib/cpluff
33 PREFIX ${CORE_BUILD_DIR}/cpluff
34 CONFIGURE_COMMAND ""
35 # TODO: Building the project directly from lib/cpluff/libcpluff/win32/cpluff.vcxproj
36 # fails becaue it imports XBMC.defaults.props
37 BUILD_COMMAND devenv /build ${CORE_BUILD_CONFIG}
38 ${CORE_SOURCE_DIR}/project/VS2010Express/XBMC\ for\ Windows.sln
39 /project cpluff
40 INSTALL_COMMAND "")
41 # TODO: core_link_library
42endif()
43
44set(CPLUFF_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cpluff/include)
45set(CPLUFF_FOUND 1)
46mark_as_advanced(CPLUFF_INCLUDE_DIRS CPLUFF_FOUND)
diff --git a/project/cmake/modules/FindCrossGUID.cmake b/project/cmake/modules/FindCrossGUID.cmake
new file mode 100644
index 0000000..0d4a915
--- /dev/null
+++ b/project/cmake/modules/FindCrossGUID.cmake
@@ -0,0 +1,56 @@
1if(ENABLE_INTERNAL_CROSSGUID)
2 include(ExternalProject)
3 file(STRINGS ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/Makefile VER)
4 string(REGEX MATCH "VERSION=[^ ]*" CGUID_VER "${VER}")
5 list(GET CGUID_VER 0 CGUID_VER)
6 string(SUBSTRING "${CGUID_VER}" 8 -1 CGUID_VER)
7
8 externalproject_add(crossguid
9 URL http://mirrors.kodi.tv/build-deps/sources/crossguid-${CGUID_VER}.tar.gz
10 PREFIX ${CORE_BUILD_DIR}/crossguid
11 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}
12 -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
13 PATCH_COMMAND ${CMAKE_COMMAND} -E copy
14 ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/CMakeLists.txt
15 <SOURCE_DIR> &&
16 ${CMAKE_COMMAND} -E copy
17 ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/FindUUID.cmake
18 <SOURCE_DIR> &&
19 ${CMAKE_COMMAND} -E copy
20 ${CORE_SOURCE_DIR}/tools/depends/target/crossguid/FindCXX11.cmake
21 <SOURCE_DIR>)
22
23 set(CROSSGUID_FOUND 1)
24 set(CROSSGUID_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/libcrossguid.a)
25 set(CROSSGUID_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include)
26
27 include(FindPackageHandleStandardArgs)
28 find_package_handle_standard_args(CROSSGUID DEFAULT_MSG CROSSGUID_INCLUDE_DIRS CROSSGUID_LIBRARIES)
29 mark_as_advanced(CROSSGUID_INCLUDE_DIRS CROSSGUID_LIBRARIES CROSSGUID_DEFINITIONS CROSSGUID_FOUND)
30else()
31 find_path(CROSSGUID_INCLUDE_DIR guid.h)
32
33 find_library(CROSSGUID_LIBRARY_RELEASE NAMES crossguid
34 ${CONFIGURATION_LIBDIR_RELEASE})
35 find_library(CROSSGUID_LIBRARY_DEBUG NAMES crossguidd
36 ${CONFIGURATION_LIBDIR_DEBUG})
37
38 include(SelectLibraryConfigurations)
39 select_library_configurations(CROSSGUID)
40
41 include(FindPackageHandleStandardArgs)
42 find_package_handle_standard_args(CROSSGUID
43 REQUIRED_VARS CROSSGUID_LIBRARY CROSSGUID_INCLUDE_DIR)
44
45 if(CROSSGUID_FOUND)
46 set(CROSSGUID_LIBRARIES ${CROSSGUID_LIBRARY})
47 set(CROSSGUID_INCLUDE_DIRS ${CROSSGUID_INCLUDE_DIR})
48 endif()
49 mark_as_advanced(CROSSGUID_INCLUDE_DIR CROSSGUID_LIBRARY)
50endif()
51
52if(NOT WIN32 AND NOT APPLE)
53 find_package(UUID REQUIRED)
54 list(APPEND CROSSGUID_INCLUDE_DIRS ${UUID_INCLUDE_DIRS})
55 list(APPEND CROSSGUID_LIBRARIES ${UUID_LIBRARIES})
56endif()
diff --git a/project/cmake/modules/FindCurl.cmake b/project/cmake/modules/FindCurl.cmake
new file mode 100644
index 0000000..a2e8862
--- /dev/null
+++ b/project/cmake/modules/FindCurl.cmake
@@ -0,0 +1,37 @@
1# - Try to find CURL
2# Once done this will define
3#
4# CURL_FOUND - system has libcurl
5# CURL_INCLUDE_DIRS - the libcurl include directory
6# CURL_LIBRARIES - The libcurl libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (CURL libcurl)
10 list(APPEND CURL_INCLUDE_DIRS ${CURL_INCLUDEDIR})
11else()
12 find_path(CURL_INCLUDE_DIRS curl/curl.h)
13 find_library(CURL_LIBRARIES NAMES curl libcurl)
14endif()
15include(FindPackageHandleStandardArgs)
16find_package_handle_standard_args(Curl DEFAULT_MSG CURL_INCLUDE_DIRS CURL_LIBRARIES)
17
18mark_as_advanced(CURL_INCLUDE_DIRS CURL_LIBRARIES)
19
20if(CURL_FOUND)
21 if(NOT CURL_LIBRARY_DIRS AND CURL_LIBDIR)
22 set(CURL_LIBRARY_DIRS ${CURL_LIBDIR})
23 endif()
24
25 find_soname(CURL)
26
27 if(EXISTS "${CURL_LIBRARY_DIRS}/${CURL_SONAME}")
28 execute_process(COMMAND readelf -s ${CURL_LIBRARY_DIRS}/${CURL_SONAME} COMMAND grep CRYPTO_set_locking_call OUTPUT_VARIABLE HAS_CURL_STATIC)
29 else()
30 message(FATAL_ERROR "curl library not found")
31 endif()
32endif()
33
34if(HAS_CURL_STATIC)
35 mark_as_advanced(HAS_CURL_STATIC)
36 list(APPEND CURL_DEFINITIONS -DHAS_CURL_STATIC=1)
37endif()
diff --git a/project/cmake/modules/FindD3DX11Effects.cmake b/project/cmake/modules/FindD3DX11Effects.cmake
new file mode 100644
index 0000000..2b2de85
--- /dev/null
+++ b/project/cmake/modules/FindD3DX11Effects.cmake
@@ -0,0 +1,49 @@
1# - Builds D3DX11Effects as external project
2# Once done this will define
3#
4# D3DX11EFFECTS_FOUND - system has D3DX11Effects
5# D3DX11EFFECTS_INCLUDE_DIRS - the D3DX11Effects include directories
6# D3DCOMPILER_DLL - Path to the Direct3D Compiler
7
8include(ExternalProject)
9ExternalProject_Add(d3dx11effects
10 SOURCE_DIR ${CORE_SOURCE_DIR}/lib/win32/Effects11
11 PREFIX ${CORE_BUILD_DIR}/Effects11
12 CONFIGURE_COMMAND ""
13 BUILD_COMMAND devenv /build ${CORE_BUILD_CONFIG}
14 ${CORE_SOURCE_DIR}/lib/win32/Effects11/Effects11_2013.sln
15 INSTALL_COMMAND "")
16
17set(D3DX11EFFECTS_FOUND 1)
18set(D3DX11EFFECTS_INCLUDE_DIRS ${CORE_SOURCE_DIR}/lib/win32/Effects11/inc)
19
20set(D3DX11EFFECTS_LIBRARY_RELEASE ${CORE_SOURCE_DIR}/lib/win32/Effects11/libs/Effects11/Release/Effects11.lib)
21set(D3DX11EFFECTS_LIBRARY_DEBUG ${CORE_SOURCE_DIR}/lib/win32/Effects11/libs/Effects11/Debug/Effects11.lib)
22include(SelectLibraryConfigurations)
23select_library_configurations(D3DX11EFFECTS)
24
25mark_as_advanced(D3DX11EFFECTS_FOUND)
26
27find_file(D3DCOMPILER_DLL
28 NAMES d3dcompiler_47.dll d3dcompiler_46.dll
29 PATHS
30 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/Redist/D3D/x86"
31 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/Redist/D3D/x86"
32 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/Redist/D3D/x86"
33 "$ENV{WindowsSdkDir}Redist/d3d/x86"
34 NO_DEFAULT_PATH)
35if(NOT D3DCOMPILER_DLL)
36 message(WARNING "Could NOT find Direct3D Compiler")
37endif()
38mark_as_advanced(D3DCOMPILER_DLL)
39
40find_program(FXC fxc
41 PATHS
42 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v10.0;InstallationFolder]/bin/x86"
43 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.1;InstallationFolder]/bin/x86"
44 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v8.0;InstallationFolder]/bin/x86"
45 "$ENV{WindowsSdkDir}bin/x86")
46if(NOT FXC)
47 message(WARNING "Could NOT find DirectX Effects Compiler (FXC)")
48endif()
49mark_as_advanced(FXC)
diff --git a/project/cmake/modules/FindDbus.cmake b/project/cmake/modules/FindDbus.cmake
new file mode 100644
index 0000000..cdc3f52
--- /dev/null
+++ b/project/cmake/modules/FindDbus.cmake
@@ -0,0 +1,21 @@
1# - Try to find dbus
2# Once done this will define
3#
4# DBUS_FOUND - system has libdbus
5# DBUS_INCLUDE_DIRS - the libdbus include directory
6# DBUS_LIBRARIES - The libdbus libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (DBUS dbus-1)
10endif()
11
12if(DBUS_FOUND)
13 find_path(DBUS_INCLUDE_DIRS dbus/dbus.h PATH_SUFFIXES dbus-1.0)
14 find_library(DBUS_LIBRARIES dbus-1.0)
15endif()
16
17include(FindPackageHandleStandardArgs)
18find_package_handle_standard_args(Dbus DEFAULT_MSG DBUS_INCLUDE_DIRS DBUS_LIBRARIES)
19
20list(APPEND DBUS_DEFINITIONS -DHAVE_DBUS=1)
21mark_as_advanced(DBUS_INCLUDE_DIRS DBUS_LIBRARIES DBUS_DEFINITIONS)
diff --git a/project/cmake/modules/FindEGL.cmake b/project/cmake/modules/FindEGL.cmake
new file mode 100644
index 0000000..79bb176
--- /dev/null
+++ b/project/cmake/modules/FindEGL.cmake
@@ -0,0 +1,48 @@
1#.rst:
2# FindEGL
3# -------
4# Finds the EGL library
5#
6# This will will define the following variables::
7#
8# EGL_FOUND - system has EGL
9# EGL_INCLUDE_DIRS - the EGL include directory
10# EGL_LIBRARIES - the EGL libraries
11# EGL_DEFINITIONS - the EGL definitions
12#
13# and the following imported targets::
14#
15# EGL::EGL - The EGL library
16
17if(PKG_CONFIG_FOUND)
18 pkg_check_modules(PC_EGL egl QUIET)
19endif()
20
21find_path(EGL_INCLUDE_DIR EGL/egl.h
22 PATHS ${PC_EGL_INCLUDEDIR})
23
24find_library(EGL_LIBRARY NAMES EGL egl
25 PATHS ${PC_EGL_LIBDIR})
26
27set(EGL_VERSION ${PC_EGL_VERSION})
28
29include(FindPackageHandleStandardArgs)
30find_package_handle_standard_args(EGL
31 REQUIRED_VARS EGL_LIBRARY EGL_INCLUDE_DIR
32 VERSION_VAR EGL_VERSION)
33
34if(EGL_FOUND)
35 set(EGL_LIBRARIES ${EGL_LIBRARY})
36 set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR})
37 set(EGL_DEFINITIONS -DHAVE_LIBEGL=1)
38
39 if(NOT TARGET EGL::EGL)
40 add_library(EGL::EGL UNKNOWN IMPORTED)
41 set_target_properties(EGL::EGL PROPERTIES
42 IMPORTED_LOCATION "${EGL_LIBRARY}"
43 INTERFACE_INCLUDE_DIRECTORIES "${EGL_INCLUDE_DIR}"
44 INTERFACE_COMPILE_DEFINITIONS HAVE_LIBEGL=1)
45 endif()
46endif()
47
48mark_as_advanced(EGL_INCLUDE_DIR EGL_LIBRARY)
diff --git a/project/cmake/modules/FindEMBEDDED.cmake b/project/cmake/modules/FindEMBEDDED.cmake
new file mode 100644
index 0000000..bc1b456
--- /dev/null
+++ b/project/cmake/modules/FindEMBEDDED.cmake
@@ -0,0 +1,17 @@
1# - Try to find embedded platforms (RPI/IMX6)
2# Once done this will define
3#
4# EMBEDDED_FOUND - system is RPI / IMX6 and we most probably want to compile for GLES2 support
5# (don't configure for OpenGL)
6
7if(NOT CMAKE_SYSTEM_PROCESSOR)
8 set(CMAKE_SYSTEM_PROCESSOR ${CPU})
9endif()
10
11string(REGEX MATCH "^arm" TARGET_ARCH_ARM "${CMAKE_SYSTEM_PROCESSOR}")
12if(NOT CMAKE_CROSSCOMPILING AND NOT TARGET_ARCH_ARM)
13 return()
14endif(NOT CMAKE_CROSSCOMPILING AND NOT TARGET_ARCH_ARM)
15
16find_path(EMBEDDED_FOUND NAMES include/linux/imxfb.h include/bcm_host.h PATHS /opt/vc)
17
diff --git a/project/cmake/modules/FindFFMPEG.cmake b/project/cmake/modules/FindFFMPEG.cmake
new file mode 100644
index 0000000..711845a
--- /dev/null
+++ b/project/cmake/modules/FindFFMPEG.cmake
@@ -0,0 +1,99 @@
1include(ExternalProject)
2file(STRINGS ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/FFMPEG-VERSION VER)
3string(REGEX MATCH "VERSION=[^ ]*$.*" FFMPEG_VER "${VER}")
4list(GET FFMPEG_VER 0 FFMPEG_VER)
5string(SUBSTRING "${FFMPEG_VER}" 8 -1 FFMPEG_VER)
6string(REGEX MATCH "BASE_URL=([^ ]*)" FFMPEG_BASE_URL "${VER}")
7list(GET FFMPEG_BASE_URL 0 FFMPEG_BASE_URL)
8string(SUBSTRING "${FFMPEG_BASE_URL}" 9 -1 FFMPEG_BASE_URL)
9
10
11if(ENABLE_INTERNAL_FFMPEG)
12 if(FFMPEG_PATH)
13 message(WARNING "Internal FFmpeg enabled, but FFMPEG_PATH given, ignoring")
14 endif()
15 if(CMAKE_CROSSCOMPILING)
16 set(CROSS_ARGS -DDEPENDS_PATH=${DEPENDS_PATH}
17 -DPKG_CONFIG_EXECUTABLE=${PKG_CONFIG_EXECUTABLE}
18 -DCROSSCOMPILING=${CMAKE_CROSSCOMPILING}
19 -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
20 -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME}
21 -DCPU=${WITH_CPU}
22 -DOS=${OS}
23 -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
24 -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
25 -DCMAKE_AR=${CMAKE_AR}
26 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
27 -DCMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS})
28 endif()
29
30 externalproject_add(ffmpeg
31 URL ${FFMPEG_BASE_URL}/${FFMPEG_VER}.tar.gz
32 PREFIX ${CORE_BUILD_DIR}/ffmpeg
33 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}
34 -DCMAKE_BUILD_TYPE=${DCMAKE_BUILD_TYPE}
35 -DFFMPEG_VER=${FFMPEG_VER}
36 -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME}
37 ${CROSS_ARGS}
38 PATCH_COMMAND ${CMAKE_COMMAND} -E copy
39 ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/CMakeLists.txt
40 <SOURCE_DIR> &&
41 ${CMAKE_COMMAND} -E copy
42 ${CORE_SOURCE_DIR}/tools/depends/target/ffmpeg/FindGnuTls.cmake
43 <SOURCE_DIR>)
44
45 file(WRITE ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg/ffmpeg-link-wrapper
46"#!/bin/bash
47if [[ $@ == *${APP_NAME_LC}.bin* || $@ == *${APP_NAME_LC}-test* ]]
48then
49 avformat=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavcodec`
50 avcodec=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavformat`
51 avfilter=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavfilter`
52 avutil=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libavutil`
53 swscale=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswscale`
54 swresample=`PKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/pkgconfig ${PKG_CONFIG_EXECUTABLE} --libs --static libswresample`
55 gnutls=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors gnutls`
56 vorbisenc=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors vorbisenc`
57 dcadec=`PKG_CONFIG_PATH=${DEPENDS_PATH}/lib/pkgconfig/ ${PKG_CONFIG_EXECUTABLE} --libs-only-l --static --silence-errors dcadec`
58 $@ $avcodec $avformat $avcodec $avfilter $swscale $swresample -lpostproc $gnutls $vorbisenc $dcadec
59else
60 $@
61fi")
62 file(COPY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg/ffmpeg-link-wrapper
63 DESTINATION ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}
64 FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
65 set(FFMPEG_LINK_EXECUTABLE "${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/ffmpeg-link-wrapper <CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>" PARENT_SCOPE)
66 set(FFMPEG_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include)
67 list(APPEND FFMPEG_DEFINITIONS -DFFMPEG_VER_SHA=\"${FFMPEG_VER}\"
68 -DUSE_STATIC_FFMPEG=1)
69 set(FFMPEG_FOUND 1)
70else()
71 if(FFMPEG_PATH)
72 set(ENV{PKG_CONFIG_PATH} "${FFMPEG_PATH}/lib/pkgconfig")
73 endif()
74 set(FFMPEG_PKGS libavcodec>=56.26.100 libavfilter>=5.11.100 libavformat>=56.25.101
75 libavutil>=54.20.100 libswscale>=3.1.101 libswresample>=1.1.100 libpostproc>=53.3.100)
76 if(PKG_CONFIG_FOUND)
77 pkg_check_modules (FFMPEG ${FFMPEG_PKGS})
78 string(REGEX REPLACE "framework;" "framework " FFMPEG_LDFLAGS "${FFMPEG_LDFLAGS}")
79 set(FFMPEG_LIBRARIES ${FFMPEG_LDFLAGS})
80 else()
81 find_path(FFMPEG_INCLUDE_DIRS libavcodec/avcodec.h PATH_SUFFIXES ffmpeg)
82 find_library(FFMPEG_LIBAVCODEC NAMES avcodec libavcodec PATH_SUFFIXES ffmpeg/libavcodec)
83 find_library(FFMPEG_LIBAVFILTER NAMES avfilter libavfilter PATH_SUFFIXES ffmpeg/libavfilter)
84 find_library(FFMPEG_LIBAVFORMAT NAMES avformat libavformat PATH_SUFFIXES ffmpeg/libavformat)
85 find_library(FFMPEG_LIBAVUTIL NAMES avutil libavutil PATH_SUFFIXES ffmpeg/libavutil)
86 find_library(FFMPEG_LIBSWSCALE NAMES swscale libswscale PATH_SUFFIXES ffmpeg/libswscale)
87 find_library(FFMPEG_LIBPOSTPROC NAMES postproc libpostproc PATH_SUFFIXES ffmpeg/libpostproc)
88 set(FFMPEG_LIBRARIES ${FFMPEG_LIBAVCODEC} ${FFMPEG_LIBAVFILTER} ${FFMPEG_LIBAVFORMAT}
89 ${FFMPEG_LIBAVUTIL} ${FFMPEG_LIBSWSCALE} ${FFMPEG_LIBPOSTPROC})
90 add_custom_target(ffmpeg DEPENDS ${FFMPEG_LIBRARIES})
91 endif()
92
93 include(FindPackageHandleStandardArgs)
94 find_package_handle_standard_args(FFMPEG DEFAULT_MSG FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES)
95 set(FFMPEG_FOUND 1)
96 list(APPEND FFMPEG_DEFINITIONS -DFFMPEG_VER_SHA=\"${FFMPEG_VER}\")
97endif()
98
99mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_DEFINITIONS FFMPEG_FOUND)
diff --git a/project/cmake/modules/FindFreeType.cmake b/project/cmake/modules/FindFreeType.cmake
new file mode 100644
index 0000000..a1e69ab
--- /dev/null
+++ b/project/cmake/modules/FindFreeType.cmake
@@ -0,0 +1,18 @@
1# - Try to find freetype
2# Once done this will define
3#
4# FREETYPE_FOUND - system has freetype
5# FREETYPE_INCLUDE_DIRS - the freetype include directory
6# FREETYPE_LIBRARIES - The freetype libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (FREETYPE freetype2)
10else()
11 find_path(FREETYPE_INCLUDE_DIRS freetype/freetype.h)
12 find_library(FREETYPE_LIBRARIES NAMES freetype freetype246MT)
13endif()
14
15include(FindPackageHandleStandardArgs)
16find_package_handle_standard_args(FreeType DEFAULT_MSG FREETYPE_INCLUDE_DIRS FREETYPE_LIBRARIES)
17
18mark_as_advanced(FREETYPE_INCLUDE_DIRS FREETYPE_LIBRARIES)
diff --git a/project/cmake/modules/FindFribidi.cmake b/project/cmake/modules/FindFribidi.cmake
new file mode 100644
index 0000000..65a8d8b
--- /dev/null
+++ b/project/cmake/modules/FindFribidi.cmake
@@ -0,0 +1,18 @@
1# - Try to find Fribidi
2# Once done this will define
3#
4# FRIBIDI_FOUND - system has fribidi
5# FRIBIDI_INCLUDE_DIRS - the fribidi include directory
6# FRIBIDI_LIBRARIES - The fribidi libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (FRIBIDI fribidi)
10else()
11 find_path(FRIBIDI_INCLUDE_DIRS fribidi/fribidi.h)
12 find_library(FRIBIDI_LIBRARIES NAMES fribidi libfribidi)
13endif()
14
15include(FindPackageHandleStandardArgs)
16find_package_handle_standard_args(Fribidi DEFAULT_MSG FRIBIDI_INCLUDE_DIRS FRIBIDI_LIBRARIES)
17
18mark_as_advanced(FRIBIDI_INCLUDE_DIRS FRIBIDI_LIBRARIES)
diff --git a/project/cmake/modules/FindGIF.cmake b/project/cmake/modules/FindGIF.cmake
new file mode 100644
index 0000000..8649bd4
--- /dev/null
+++ b/project/cmake/modules/FindGIF.cmake
@@ -0,0 +1,46 @@
1#.rst:
2# FindGIF
3# -------
4# Finds the libgif library
5#
6# This will will define the following variables::
7#
8# GIF_FOUND - system has libgif
9# GIF_INCLUDE_DIRS - the libgif include directory
10# GIF_LIBRARIES - the libgif libraries
11#
12# and the following imported targets::
13#
14# GIF::GIF - The libgif library
15
16find_path(GIF_INCLUDE_DIR gif_lib.h)
17
18include(FindPackageHandleStandardArgs)
19if(NOT WIN32)
20 find_library(GIF_LIBRARY NAMES gif)
21 find_package_handle_standard_args(GIF
22 REQUIRED_VARS GIF_LIBRARY GIF_INCLUDE_DIR)
23else()
24 # Dynamically loaded DLL
25 find_package_handle_standard_args(GIF
26 REQUIRED_VARS GIF_INCLUDE_DIR)
27endif()
28
29if(GIF_FOUND)
30 set(GIF_LIBRARIES ${GIF_LIBRARY})
31 set(GIF_INCLUDE_DIRS ${GIF_INCLUDE_DIR})
32 set(GIF_DEFINITIONS -DHAVE_LIBGIF=1)
33
34 if(NOT TARGET GIF::GIF)
35 add_library(GIF::GIF UNKNOWN IMPORTED)
36 if(GIF_LIBRARY)
37 set_target_properties(GIF::GIF PROPERTIES
38 IMPORTED_LOCATION "${GIF_LIBRARY}")
39 endif()
40 set_target_properties(GIF::GIF PROPERTIES
41 INTERFACE_INCLUDE_DIRECTORIES "${GIF_INCLUDE_DIR}"
42 INTERFACE_COMPILE_DEFINITIONS HAVE_LIBGIF=1)
43 endif()
44endif()
45
46mark_as_advanced(GIF_INCLUDE_DIR GIF_LIBRARY)
diff --git a/project/cmake/modules/FindJsonSchemaBuilder.cmake b/project/cmake/modules/FindJsonSchemaBuilder.cmake
new file mode 100644
index 0000000..78e8d0a
--- /dev/null
+++ b/project/cmake/modules/FindJsonSchemaBuilder.cmake
@@ -0,0 +1,19 @@
1#.rst:
2# FindJsonSchemaBuilder
3# ---------------------
4# Finds the JsonSchemaBuilder
5#
6# This will define the following (imported) targets::
7#
8# JsonSchemaBuilder::JsonSchemaBuilder - The JsonSchemaBuilder executable
9
10if(NOT TARGET JsonSchemaBuilder::JsonSchemaBuilder)
11 if(CMAKE_CROSSCOMPILING)
12 add_executable(JsonSchemaBuilder::JsonSchemaBuilder IMPORTED GLOBAL)
13 set_target_properties(JsonSchemaBuilder::JsonSchemaBuilder PROPERTIES
14 IMPORTED_LOCATION "${NATIVEPREFIX}/bin/JsonSchemaBuilder")
15 else()
16 add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/JsonSchemaBuilder build/jsonschemabuilder)
17 add_executable(JsonSchemaBuilder::JsonSchemaBuilder ALIAS JsonSchemaBuilder)
18 endif()
19endif()
diff --git a/project/cmake/modules/FindLibDvd.cmake b/project/cmake/modules/FindLibDvd.cmake
new file mode 100644
index 0000000..f281773
--- /dev/null
+++ b/project/cmake/modules/FindLibDvd.cmake
@@ -0,0 +1,116 @@
1set(dvdlibs libdvdread libdvdnav)
2if(ENABLE_DVDCSS)
3 list(APPEND dvdlibs libdvdcss)
4endif()
5
6if(NOT WIN32)
7 foreach(dvdlib ${dvdlibs})
8 file(GLOB VERSION_FILE ${CORE_SOURCE_DIR}/tools/depends/target/${dvdlib}/DVD*-VERSION)
9 file(STRINGS ${VERSION_FILE} VER)
10 string(REGEX MATCH "VERSION=[^ ]*$.*" ${dvdlib}_VER "${VER}")
11 list(GET ${dvdlib}_VER 0 ${dvdlib}_VER)
12 string(SUBSTRING "${${dvdlib}_VER}" 8 -1 ${dvdlib}_VER)
13 string(REGEX MATCH "BASE_URL=([^ ]*)" ${dvdlib}_BASE_URL "${VER}")
14 list(GET ${dvdlib}_BASE_URL 0 ${dvdlib}_BASE_URL)
15 string(SUBSTRING "${${dvdlib}_BASE_URL}" 9 -1 ${dvdlib}_BASE_URL)
16 endforeach()
17
18 set(DVDREAD_CFLAGS "${DVDREAD_CFLAGS} -I${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include")
19 if(CMAKE_CROSSCOMPILING)
20 set(EXTRA_FLAGS "CC=${CMAKE_C_COMPILER}")
21 endif()
22
23 if(APPLE)
24 set(CMAKE_LD_FLAGS "-framework IOKit -framework CoreFoundation")
25 endif()
26
27 if(ENABLE_DVDCSS)
28 ExternalProject_ADD(dvdcss URL ${libdvdcss_BASE_URL}/archive/${libdvdcss_VER}.tar.gz
29 PREFIX ${CORE_BUILD_DIR}/libdvd
30 UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif
31 CONFIGURE_COMMAND ac_cv_path_GIT= <SOURCE_DIR>/configure
32 --target=${ARCH}
33 --host=${ARCH}
34 --disable-doc
35 --enable-static
36 --disable-shared
37 --with-pic
38 --prefix=<INSTALL_DIR>
39 "${EXTRA_FLAGS}"
40 "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}"
41 "LDFLAGS=${CMAKE_LD_FLAGS}")
42
43 core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdcss.a
44 system/players/VideoPlayer/libdvdcss dvdcss)
45 endif()
46
47 set(DVDREAD_CFLAGS "-D_XBMC")
48 if(ENABLE_DVDCSS)
49 set(DVDREAD_CFLAGS "${DVDREAD_CFLAGS} -DHAVE_DVDCSS_DVDCSS_H -I${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include")
50 endif(ENABLE_DVDCSS)
51
52 ExternalProject_ADD(dvdread URL ${libdvdread_BASE_URL}/archive/${libdvdread_VER}.tar.gz
53 PREFIX ${CORE_BUILD_DIR}/libdvd
54 UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif
55 CONFIGURE_COMMAND ac_cv_path_GIT= <SOURCE_DIR>/configure
56 --target=${ARCH}
57 --host=${ARCH}
58 --enable-static
59 --disable-shared
60 --with-pic
61 --prefix=<INSTALL_DIR>
62 "${EXTRA_FLAGS}"
63 "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}"
64 "LDFLAGS=${CMAKE_LD_FLAGS}")
65 if(ENABLE_DVDCSS)
66 add_dependencies(dvdread dvdcss)
67 endif()
68
69 core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.a
70 system/players/VideoPlayer/libdvdread dvdread)
71
72 if(ENABLE_DVDCSS)
73 set(DVDNAV_LIBS -ldvdcss)
74 endif(ENABLE_DVDCSS)
75
76 ExternalProject_ADD(dvdnav URL ${libdvdnav_BASE_URL}/archive/${libdvdnav_VER}.tar.gz
77 PREFIX ${CORE_BUILD_DIR}/libdvd
78 UPDATE_COMMAND PATH=${NATIVEPREFIX}/bin:$ENV{PATH} autoreconf -vif
79 CONFIGURE_COMMAND ac_cv_path_GIT= <SOURCE_DIR>/configure
80 --target=${ARCH}
81 --host=${ARCH}
82 --enable-static
83 --disable-shared
84 --with-pic
85 --prefix=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd
86 "${EXTRA_FLAGS}"
87 "LDFLAGS=${CMAKE_LD_FLAGS} -L${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib"
88 "CFLAGS=${CMAKE_C_FLAGS} ${DVDREAD_CFLAGS}"
89 "DVDREAD_CFLAGS=${DVDREAD_CFLAGS}"
90 "DVDREAD_LIBS=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.la"
91 "LIBS=${DVDNAV_LIBS}")
92 add_dependencies(dvdnav dvdread)
93 core_link_library(${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdnav.a
94 system/players/VideoPlayer/libdvdnav dvdnav)
95
96 set(LIBDVD_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/include)
97 set(LIBDVD_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdnav.a
98 ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdread.a)
99 if(ENABLE_DVDCSS)
100 list(APPEND LIBDVD_LIBRARIES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/libdvd/lib/libdvdcss.a)
101 endif()
102 set(LIBDVD_LIBRARIES ${LIBDVD_LIBRARIES} CACHE STRING "libdvd libraries" FORCE)
103 set(LIBDVD_FOUND 1 CACHE BOOL "libdvd found" FORCE)
104else()
105 # Dynamically loaded on Windows
106 find_path(LIBDVD_INCLUDE_DIR dvdcss/dvdcss.h PATHS ${CORE_SOURCE_DIR}/lib/libdvd/include)
107
108 include(FindPackageHandleStandardArgs)
109 find_package_handle_standard_args(LIBDVD REQUIRED_VARS LIBDVD_INCLUDE_DIR)
110
111 if(LIBDVD_FOUND)
112 set(LIBDVD_INCLUDE_DIRS ${LIBDVD_INCLUDE_DIR})
113 endif()
114
115 mark_as_advanced(LIBDVD_INCLUDE_DIR)
116endif()
diff --git a/project/cmake/modules/FindLibSmbClient.cmake b/project/cmake/modules/FindLibSmbClient.cmake
new file mode 100644
index 0000000..897fa7b
--- /dev/null
+++ b/project/cmake/modules/FindLibSmbClient.cmake
@@ -0,0 +1,65 @@
1# - Try to find Libsmbclient
2
3if(PKGCONFIG_FOUND)
4 pkg_check_modules(LIBSMBCLIENT smbclient)
5 set(LIBSMBCLIENT_DEFINITIONS -DHAVE_LIBSMBCLIENT=1)
6endif()
7
8if (LIBSMBCLIENT_LIBRARIES AND LIBSMBCLIENT_INCLUDE_DIRS)
9 # in cache already
10 set(LIBSMBCLIENT_FOUND TRUE)
11else (LIBSMBCLIENT_LIBRARIES AND LIBSMBCLIENT_INCLUDE_DIRS)
12 find_path(LIBSMBCLIENT_INCLUDE_DIR
13 NAMES
14 libsmbclient.h
15 PATHS
16 /usr/include
17 /usr/local/include
18 /opt/local/include
19 /sw/include
20 )
21
22 find_library(SMBCLIENT_LIBRARY
23 NAMES
24 smbclient
25 PATHS
26 /usr/lib
27 /usr/local/lib
28 /opt/local/lib
29 /sw/lib
30 )
31
32 if (SMBCLIENT_LIBRARY)
33 set(SMBCLIENT_FOUND TRUE)
34 endif (SMBCLIENT_LIBRARY)
35
36 set(LIBSMBCLIENT_INCLUDE_DIRS
37 ${LIBSMBCLIENT_INCLUDE_DIR}
38 )
39
40 if (SMBCLIENT_FOUND)
41 set(LIBSMBCLIENT_LIBRARIES
42 ${LIBSMBCLIENT_LIBRARIES}
43 ${SMBCLIENT_LIBRARY}
44 )
45 endif (SMBCLIENT_FOUND)
46
47 if (LIBSMBCLIENT_INCLUDE_DIRS AND LIBSMBCLIENT_LIBRARIES)
48 set(LIBSMBCLIENT_FOUND TRUE)
49 endif (LIBSMBCLIENT_INCLUDE_DIRS AND LIBSMBCLIENT_LIBRARIES)
50
51 if (LIBSMBCLIENT_FOUND)
52 if (NOT Libsmbclient_FIND_QUIETLY)
53 message(STATUS "Found Libsmbclient: ${LIBSMBCLIENT_LIBRARIES}")
54 endif (NOT Libsmbclient_FIND_QUIETLY)
55 else (LIBSMBCLIENT_FOUND)
56 if (Libsmbclient_FIND_REQUIRED)
57 message(FATAL_ERROR "Could not find Libsmbclient")
58 endif (Libsmbclient_FIND_REQUIRED)
59 endif (LIBSMBCLIENT_FOUND)
60 set(LIBSMBCLIENT_DEFINITIONS -DHAVE_LIBSMBCLIENT=1)
61
62 # show the LIBSMBCLIENT_INCLUDE_DIRS and LIBSMBCLIENT_LIBRARIES variables only in the advanced view
63 mark_as_advanced(LIBSMBCLIENT_INCLUDE_DIRS LIBSMBCLIENT_LIBRARIES LIBSMBCLIENT_DEFINITIONS)
64
65endif (LIBSMBCLIENT_LIBRARIES AND LIBSMBCLIENT_INCLUDE_DIRS)
diff --git a/project/cmake/modules/FindLibUSB.cmake b/project/cmake/modules/FindLibUSB.cmake
new file mode 100644
index 0000000..e976bf4
--- /dev/null
+++ b/project/cmake/modules/FindLibUSB.cmake
@@ -0,0 +1,45 @@
1#.rst:
2# FindLibUSB
3# ----------
4# Finds the USB library
5#
6# This will will define the following variables::
7#
8# LIBUSB_FOUND - system has LibUSB
9# LIBUSB_INCLUDE_DIRS - the USB include directory
10# LIBUSB_LIBRARIES - the USB libraries
11#
12# and the following imported targets::
13#
14# LibUSB::LibUSB - The USB library
15
16if(PKG_CONFIG_FOUND)
17 pkg_check_modules(PC_LIBUSB libusb QUIET)
18endif()
19
20find_path(LIBUSB_INCLUDE_DIR usb.h
21 PATHS ${PC_LIBUSB_INCLUDEDIR})
22find_library(LIBUSB_LIBRARY NAMES usb
23 PATHS ${PC_LIBUSB_INCLUDEDIR})
24set(LIBUSB_VERSION ${PC_LIBUSB_VERSION})
25
26include(FindPackageHandleStandardArgs)
27find_package_handle_standard_args(LIBUSB
28 REQUIRED_VARS LIBUSB_LIBRARY LIBUSB_INCLUDE_DIR
29 VERSION_VAR LIBUSB_VERSION)
30
31if(LIBUSB_FOUND)
32 set(LIBUSB_INCLUDE_DIRS ${LIBUSB_INCLUDE_DIR})
33 set(LIBUSB_LIBRARIES ${LIBUSB_LIBRARY})
34 set(LIBUSB_DEFINITIONS -DUSE_LIBUSB=1)
35
36 if(NOT TARGET LibUSB::LibUSB)
37 add_library(LibUSB::LibUSB UNKNOWN IMPORTED)
38 set_target_properties(LibUSB::LibUSB PROPERTIES
39 IMPORTED_LOCATION "${LIBUSB_LIBRARY}"
40 INTERFACE_INCLUDE_DIRECTORIES "${LIBUSB_INCLUDE_DIR}"
41 INTERFACE_COMPILE_DEFINITIONS USE_LIBUSB=1)
42 endif()
43endif()
44
45mark_as_advanced(USB_INCLUDE_DIR USB_LIBRARY)
diff --git a/project/cmake/modules/FindLzo2.cmake b/project/cmake/modules/FindLzo2.cmake
new file mode 100644
index 0000000..33eee10
--- /dev/null
+++ b/project/cmake/modules/FindLzo2.cmake
@@ -0,0 +1,22 @@
1# - Try to find Lzo2
2# Once done this will define
3#
4# Lzo2_FOUND - system has Lzo2
5# Lzo2_INCLUDE_DIR - the Lzo2 include directory
6# Lzo2_LIBRARIES - Link these to use Lzo2
7# Lzo2_NEED_PREFIX - this is set if the functions are prefixed with BZ2_
8
9# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
10#
11# Redistribution and use is allowed according to the terms of the BSD license.
12# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
13
14
15FIND_PATH(LZO2_INCLUDE_DIRS lzo1x.h PATH_SUFFIXES lzo)
16
17FIND_LIBRARY(LZO2_LIBRARIES NAMES lzo2 liblzo2)
18
19include(FindPackageHandleStandardArgs)
20find_package_handle_standard_args(Lzo2 DEFAULT_MSG LZO2_INCLUDE_DIRS LZO2_LIBRARIES)
21
22MARK_AS_ADVANCED(LZO2_INCLUDE_DIRS LZO2_LIBRARIES)
diff --git a/project/cmake/modules/FindMMAL.cmake b/project/cmake/modules/FindMMAL.cmake
new file mode 100644
index 0000000..8843983
--- /dev/null
+++ b/project/cmake/modules/FindMMAL.cmake
@@ -0,0 +1,36 @@
1# - Try to find MMAL
2# Once done this will define
3#
4# MMAL_FOUND - system has MMAL
5# MMAL_INCLUDE_DIRS - the MMAL include directory
6# MMAL_LIBRARIES - The MMAL libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules(MMAL mmal QUIET)
10endif()
11
12if(NOT MMAL_FOUND)
13 find_path(MMAL_INCLUDE_DIRS interface/mmal/mmal.h)
14 find_library(MMAL_LIBRARY mmal)
15 find_library(MMALCORE_LIBRARY mmal_core)
16 find_library(MMALUTIL_LIBRARY mmal_util)
17 find_library(MMALCLIENT_LIBRARY mmal_vc_client)
18 find_library(MMALCOMPONENT_LIBRARY mmal_components)
19 find_library(BCM_LIBRARY bcm_host)
20 find_library(VCHIQ_LIBRARY vchiq_arm)
21 find_library(VCOS_LIBRARY vcos)
22 find_library(VCSM_LIBRARY vcsm)
23 find_library(CONTAINER_LIBRARY containers)
24
25 set(MMAL_LIBRARIES ${MMAL_LIBRARY} ${MMALCORE_LIBRARY} ${MMALUTIL_LIBRARY}
26 ${MMALCLIENT_LIBRARY} ${MMALCOMPONENT_LIBRARY}
27 ${BCM_LIBRARY} ${VCHIQ_LIBRARY} ${VCOS_LIBRARY} ${VCSM_LIBRARY} ${CONTAINER_LIBRARY}
28 CACHE STRING "mmal libraries" FORCE)
29endif()
30
31include(FindPackageHandleStandardArgs)
32find_package_handle_standard_args(MMAL DEFAULT_MSG MMAL_LIBRARIES MMAL_INCLUDE_DIRS)
33
34list(APPEND MMAL_DEFINITIONS -DHAVE_MMAL=1 -DHAS_MMAL=1)
35
36mark_as_advanced(MMAL_INCLUDE_DIRS MMAL_LIBRARIES MMAL_DEFINITIONS)
diff --git a/project/cmake/modules/FindMicroHttpd.cmake b/project/cmake/modules/FindMicroHttpd.cmake
new file mode 100644
index 0000000..f73dc77
--- /dev/null
+++ b/project/cmake/modules/FindMicroHttpd.cmake
@@ -0,0 +1,106 @@
1IF (NOT WIN32)
2 include(FindPkgConfig)
3 if ( PKG_CONFIG_FOUND )
4
5 pkg_check_modules (MICROHTTPD libmicrohttpd>=0.4)
6
7 set(MICROHTTPD_DEFINITIONS ${MICROHTTPD_CFLAGS_OTHER})
8 endif(PKG_CONFIG_FOUND)
9endif (NOT WIN32)
10
11#
12# set defaults
13if(NOT MICROHTTPD_FOUND)
14 SET(_microhttpd_HOME "/usr/local")
15 SET(_microhttpd_INCLUDE_SEARCH_DIRS
16 ${CMAKE_INCLUDE_PATH}
17 /usr/local/include
18 /usr/include
19 )
20
21 SET(_microhttpd_LIBRARIES_SEARCH_DIRS
22 ${CMAKE_LIBRARY_PATH}
23 /usr/local/lib
24 /usr/lib
25 )
26
27 ##
28 if( "${MICROHTTPD_HOME}" STREQUAL "")
29 if("" MATCHES "$ENV{MICROHTTPD_HOME}")
30 message(STATUS "MICROHTTPD_HOME env is not set, setting it to /usr/local")
31 set (MICROHTTPD_HOME ${_microhttpd_HOME})
32 else("" MATCHES "$ENV{MICROHTTPD_HOME}")
33 set (MICROHTTPD_HOME "$ENV{MICROHTTPD_HOME}")
34 endif("" MATCHES "$ENV{MICROHTTPD_HOME}")
35 else( "${MICROHTTPD_HOME}" STREQUAL "")
36 message(STATUS "MICROHTTPD_HOME is not empty: \"${MICROHTTPD_HOME}\"")
37 endif( "${MICROHTTPD_HOME}" STREQUAL "")
38 ##
39
40 message(STATUS "Looking for microhttpd in ${MICROHTTPD_HOME}")
41
42 IF( NOT ${MICROHTTPD_HOME} STREQUAL "" )
43 SET(_microhttpd_INCLUDE_SEARCH_DIRS ${MICROHTTPD_HOME}/include ${_microhttpd_INCLUDE_SEARCH_DIRS})
44 SET(_microhttpd_LIBRARIES_SEARCH_DIRS ${MICROHTTPD_HOME}/lib ${_microhttpd_LIBRARIES_SEARCH_DIRS})
45 SET(_microhttpd_HOME ${MICROHTTPD_HOME})
46 ENDIF( NOT ${MICROHTTPD_HOME} STREQUAL "" )
47
48 IF( NOT $ENV{MICROHTTPD_INCLUDEDIR} STREQUAL "" )
49 SET(_microhttpd_INCLUDE_SEARCH_DIRS $ENV{MICROHTTPD_INCLUDEDIR} ${_microhttpd_INCLUDE_SEARCH_DIRS})
50 ENDIF( NOT $ENV{MICROHTTPD_INCLUDEDIR} STREQUAL "" )
51
52 IF( NOT $ENV{MICROHTTPD_LIBRARYDIR} STREQUAL "" )
53 SET(_microhttpd_LIBRARIES_SEARCH_DIRS $ENV{MICROHTTPD_LIBRARYDIR} ${_microhttpd_LIBRARIES_SEARCH_DIRS})
54 ENDIF( NOT $ENV{MICROHTTPD_LIBRARYDIR} STREQUAL "" )
55
56 IF( MICROHTTPD_HOME )
57 SET(_microhttpd_INCLUDE_SEARCH_DIRS ${MICROHTTPD_HOME}/include ${_microhttpd_INCLUDE_SEARCH_DIRS})
58 SET(_microhttpd_LIBRARIES_SEARCH_DIRS ${MICROHTTPD_HOME}/lib ${_microhttpd_LIBRARIES_SEARCH_DIRS})
59 SET(_microhttpd_HOME ${MICROHTTPD_HOME})
60 ENDIF( MICROHTTPD_HOME )
61
62 # find the include files
63 FIND_PATH(MICROHTTPD_INCLUDE_DIRS microhttpd.h
64 HINTS
65 ${_microhttpd_INCLUDE_SEARCH_DIRS}
66 ${PC_MICROHTTPD_INCLUDEDIR}
67 ${PC_MICROHTTPD_INCLUDE_DIRS}
68 ${CMAKE_INCLUDE_PATH}
69 )
70
71 # locate the library
72 IF(WIN32)
73 SET(MICROHTTPD_LIBRARY_NAMES ${MICROHTTPD_LIBRARY_NAMES} libmicrohttpd.lib)
74 ELSE(WIN32)
75 SET(MICROHTTPD_LIBRARY_NAMES ${MICROHTTPD_LIBRARY_NAMES} libmicrohttpd.a)
76 ENDIF(WIN32)
77 FIND_LIBRARY(MICROHTTPD_LIBRARIES NAMES ${MICROHTTPD_LIBRARY_NAMES}
78 HINTS
79 ${_microhttpd_LIBRARIES_SEARCH_DIRS}
80 ${PC_MICROHTTPD_LIBDIR}
81 ${PC_MICROHTTPD_LIBRARY_DIRS}
82 )
83
84 # if the include and the program are found then we have it
85 IF(MICROHTTPD_INCLUDE_DIRS AND MICROHTTPD_LIBRARIES)
86 SET(MICROHTTPD_FOUND "YES")
87 ENDIF(MICROHTTPD_INCLUDE_DIRS AND MICROHTTPD_LIBRARIES)
88
89 if( NOT WIN32)
90 find_library(GCRYPT_LIBRARY gcrypt)
91 find_library(GPGERROR_LIBRARY gpg-error)
92 list(APPEND MICROHTTPD_LIBRARIES ${GCRYPT_LIBRARY} ${GPGERROR_LIBRARY})
93 if(NOT APPLE AND NOT CORE_SYSTEM_NAME STREQUAL android)
94 list(APPEND MICROHTTPD_LIBRARIES "-lrt")
95 endif()
96 endif( NOT WIN32)
97endif()
98
99list(APPEND MICROHTTPD_DEFINITIONS -DHAVE_LIBMICROHTTPD=1)
100
101MARK_AS_ADVANCED(
102 MICROHTTPD_FOUND
103 MICROHTTPD_LIBRARIES
104 MICROHTTPD_DEFINITIONS
105 MICROHTTPD_INCLUDE_DIRS
106)
diff --git a/project/cmake/modules/FindMySqlClient.cmake b/project/cmake/modules/FindMySqlClient.cmake
new file mode 100644
index 0000000..12fee5c
--- /dev/null
+++ b/project/cmake/modules/FindMySqlClient.cmake
@@ -0,0 +1,53 @@
1#.rst:
2# FindMySqlClient
3# ---------------
4# Finds the MySqlClient library
5#
6# This will will define the following variables::
7#
8# MYSQLCLIENT_FOUND - system has MySqlClient
9# MYSQLCLIENT_INCLUDE_DIRS - the MySqlClient include directory
10# MYSQLCLIENT_LIBRARIES - the MySqlClient libraries
11# MYSQLCLIENT_DEFINITIONS - the MySqlClient compile definitions
12#
13# and the following imported targets::
14#
15# MySqlClient::MySqlClient - The MySqlClient library
16
17find_path(MYSQLCLIENT_INCLUDE_DIR mysql/mysql_time.h)
18find_library(MYSQLCLIENT_LIBRARY_RELEASE NAMES mysqlclient mysqlclient_r
19 PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE} mysql)
20find_library(MYSQLCLIENT_LIBRARY_DEBUG NAMES mysqlclient
21 PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG} mysql)
22
23include(SelectLibraryConfigurations)
24select_library_configurations(MYSQLCLIENT)
25
26include(FindPackageHandleStandardArgs)
27find_package_handle_standard_args(MYSQLCLIENT
28 REQUIRED_VARS MYSQLCLIENT_LIBRARY MYSQLCLIENT_INCLUDE_DIR)
29
30if(MYSQLCLIENT_FOUND)
31 set(MYSQLCLIENT_LIBRARIES ${MYSQLCLIENT_LIBRARY})
32 set(MYSQLCLIENT_INCLUDE_DIRS ${MYSQLCLIENT_INCLUDE_DIR})
33 set(MYSQLCLIENT_DEFINITIONS -DHAVE_MYSQL=1)
34
35 if(NOT TARGET MySqlClient::MySqlClient)
36 add_library(MySqlClient::MySqlClient UNKNOWN IMPORTED)
37 if(MYSQLCLIENT_LIBRARY_RELEASE)
38 set_target_properties(MySqlClient::MySqlClient PROPERTIES
39 IMPORTED_CONFIGURATIONS RELEASE
40 IMPORTED_LOCATION "${MYSQLCLIENT_LIBRARY_RELEASE}")
41 endif()
42 if(MYSQLCLIENT_LIBRARY_DEBUG)
43 set_target_properties(MySqlClient::MySqlClient PROPERTIES
44 IMPORTED_CONFIGURATIONS DEBUG
45 IMPORTED_LOCATION "${MYSQLCLIENT_LIBRARY_DEBUG}")
46 endif()
47 set_target_properties(MySqlClient::MySqlClient PROPERTIES
48 INTERFACE_INCLUDE_DIRECTORIES "${MYSQLCLIENT_INCLUDE_DIR}"
49 INTERFACE_COMPILE_DEFINITIONS HAVE_MYSQL=1)
50 endif()
51endif()
52
53mark_as_advanced(MYSQLCLIENT_INCLUDE_DIR MYSQLCLIENT_LIBRARY)
diff --git a/project/cmake/modules/FindNFS.cmake b/project/cmake/modules/FindNFS.cmake
new file mode 100644
index 0000000..3fd9d61
--- /dev/null
+++ b/project/cmake/modules/FindNFS.cmake
@@ -0,0 +1,58 @@
1#.rst:
2# FindNFS
3# -------
4# Finds the libnfs library
5#
6# This will will define the following variables::
7#
8# NFS_FOUND - system has libnfs
9# NFS_INCLUDE_DIRS - the libnfs include directory
10# NFS_LIBRARIES - the libnfs libraries
11# NFS_DEFINITIONS - the libnfs compile definitions
12#
13# and the following imported targets::
14#
15# NFS::NFS - The libnfs library
16
17if(PKG_CONFIG_FOUND)
18 pkg_check_modules(NFS libnfs QUIET)
19endif()
20
21find_path(NFS_INCLUDE_DIR nfsc/libnfs.h
22 PATHS ${PC_NFS_INCLUDEDIR})
23
24set(NFS_VERSION ${PC_NFS_VERSION})
25
26include(FindPackageHandleStandardArgs)
27if(NOT WIN32)
28 find_library(NFS_LIBRARY NAMES nfs
29 PATHS ${PC_NFS_LIBDIR})
30
31 find_package_handle_standard_args(NFS
32 REQUIRED_VARS NFS_LIBRARY NFS_INCLUDE_DIR
33 VERSION_VAR NFS_VERSION)
34else()
35 # Dynamically loaded DLL
36 find_package_handle_standard_args(NFS
37 REQUIRED_VARS NFS_INCLUDE_DIR
38 VERSION_VAR NFS_VERSION)
39endif()
40
41if(NFS_FOUND)
42 set(NFS_LIBRARIES ${NFS_LIBRARY})
43 set(NFS_INCLUDE_DIRS ${NFS_INCLUDE_DIR})
44 set(NFS_DEFINITIONS -DHAVE_LIBNFS=1)
45
46 if(NOT TARGET NFS::NFS)
47 add_library(NFS::NFS UNKNOWN IMPORTED)
48 if(NFS_LIBRARY)
49 set_target_properties(NFS::NFS PROPERTIES
50 IMPORTED_LOCATION "${NFS_LIBRARY_RELEASE}")
51 endif()
52 set_target_properties(NFS::NFS PROPERTIES
53 INTERFACE_INCLUDE_DIRECTORIES "${NFS_INCLUDE_DIR}"
54 INTERFACE_COMPILE_DEFINITIONS HAVE_LIBNFS=1)
55 endif()
56endif()
57
58mark_as_advanced(NFS_INCLUDE_DIR NFS_LIBRARY)
diff --git a/project/cmake/modules/FindOpenGLES.cmake b/project/cmake/modules/FindOpenGLES.cmake
new file mode 100644
index 0000000..5d71dd4
--- /dev/null
+++ b/project/cmake/modules/FindOpenGLES.cmake
@@ -0,0 +1,48 @@
1#.rst:
2# FindOpenGLES
3# ------------
4# Finds the OpenGLES2 library
5#
6# This will will define the following variables::
7#
8# OPENGLES_FOUND - system has OpenGLES
9# OPENGLES_INCLUDE_DIRS - the OpenGLES include directory
10# OPENGLES_LIBRARIES - the OpenGLES libraries
11# OPENGLES_DEFINITIONS - the OpenGLES definitions
12
13find_package(EMBEDDED)
14
15if(PKG_CONFIG_FOUND AND NOT PLATFORM STREQUAL "raspberry-pi")
16 pkg_check_modules(PC_OPENGLES glesv2)
17 if(NOT OPENGLES_FOUND AND EMBEDDED_FOUND)
18 set(CMAKE_PREFIX_PATH ${EMBEDDED_FOUND} ${CMAKE_PREFIX_PATH})
19 endif()
20endif()
21
22if(NOT CORE_SYSTEM_NAME STREQUAL ios)
23 find_path(OPENGLES_INCLUDE_DIR GLES2/gl2.h
24 PATHS ${PC_OPENGLES_INCLUDEDIR})
25 find_library(OPENGLES_gl_LIBRARY NAMES GLESv2
26 PATHS ${PC_OPENGLES_LIBDIR})
27 find_library(OPENGLES_egl_LIBRARY NAMES EGL
28 PATHS ${PC_OPENGLES_LIBDIR})
29else()
30 find_library(OPENGLES_gl_LIBRARY NAMES OpenGLES
31 PATHS ${CMAKE_OSX_SYSROOT}/System/Library
32 PATH_SUFFIXES Frameworks
33 NO_DEFAULT_PATH)
34 set(OPENGLES_INCLUDE_DIR ${OPENGLES_gl_LIBRARY}/Headers)
35 set(OPENGLES_egl_LIBRARY ${OPENGLES_gl_LIBRARY})
36endif()
37
38include(FindPackageHandleStandardArgs)
39find_package_handle_standard_args(OpenGLES
40 REQUIRED_VARS OPENGLES_gl_LIBRARY OPENGLES_egl_LIBRARY OPENGLES_INCLUDE_DIR)
41
42if(OPENGLES_FOUND)
43 set(OPENGLES_INCLUDE_DIRS ${OPENGLES_INCLUDE_DIR})
44 set(OPENGLES_LIBRARIES ${OPENGLES_gl_LIBRARY} ${OPENGLES_egl_LIBRARY})
45 set(OPENGLES_DEFINITIONS -DHAVE_LIBGLESV2 -DHAVE_LIBEGL=1)
46endif()
47
48mark_as_advanced(OPENGLES_INCLUDE_DIR OPENGLES_gl_LIBRARY OPENGLES_egl_LIBRARY)
diff --git a/project/cmake/modules/FindOpenGl.cmake b/project/cmake/modules/FindOpenGl.cmake
new file mode 100644
index 0000000..9d6ec01
--- /dev/null
+++ b/project/cmake/modules/FindOpenGl.cmake
@@ -0,0 +1,43 @@
1#.rst:
2# FindOpenGl
3# ----------
4# Finds the FindOpenGl library
5#
6# This will will define the following variables::
7#
8# OPENGL_FOUND - system has OpenGl
9# OPENGL_INCLUDE_DIRS - the OpenGl include directory
10# OPENGL_LIBRARIES - the OpenGl libraries
11# OPENGL_DEFINITIONS - the OpenGl definitions
12
13if(PKG_CONFIG_FOUND)
14 pkg_check_modules(PC_OPENGL gl glu)
15endif()
16
17if(NOT CORE_SYSTEM_NAME STREQUAL darwin)
18 find_path(OPENGL_INCLUDE_DIR GL/gl.h
19 PATHS ${PC_OPENGL_gl_INCLUDEDIR})
20 find_library(OPENGL_gl_LIBRARY NAMES GL
21 PATHS ${PC_OPENGL_gl_LIBDIR})
22 find_library(OPENGL_glu_LIBRARY NAMES GLU
23 PATHS ${PC_OPENGL_glu_LIBDIR})
24else()
25 find_library(OPENGL_gl_LIBRARY NAMES OpenGL
26 PATHS ${CMAKE_OSX_SYSROOT}/System/Library
27 PATH_SUFFIXES Frameworks
28 NO_DEFAULT_PATH)
29 set(OPENGL_INCLUDE_DIR ${OPENGL_gl_LIBRARY}/Headers)
30 set(OPENGL_glu_LIBRARY ${OPENGL_gl_LIBRARY})
31endif()
32
33include(FindPackageHandleStandardArgs)
34find_package_handle_standard_args(OpenGl
35 REQUIRED_VARS OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY OPENGL_INCLUDE_DIR)
36
37if(OPENGL_FOUND)
38 set(OPENGL_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
39 set(OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
40 set(OPENGL_DEFINITIONS -DHAVE_LIBGL=1)
41endif()
42
43mark_as_advanced(OPENGL_INCLUDE_DIR OPENGL_gl_LIBRARY OPENGL_glu_LIBRARY)
diff --git a/project/cmake/modules/FindPCRE.cmake b/project/cmake/modules/FindPCRE.cmake
new file mode 100644
index 0000000..54c4ab4
--- /dev/null
+++ b/project/cmake/modules/FindPCRE.cmake
@@ -0,0 +1,91 @@
1#.rst:
2# FindPCRE
3# --------
4# Finds the PCRECPP library
5#
6# This will will define the following variables::
7#
8# PCRE_FOUND - system has libpcrecpp
9# PCRE_INCLUDE_DIRS - the libpcrecpp include directory
10# PCRE_LIBRARIES - the libpcrecpp libraries
11# PCRE_DEFINITIONS - the libpcrecpp definitions
12#
13# and the following imported targets::
14#
15# PCRE::PCRECPP - The PCRECPP library
16# PCRE::PCRE - The PCRE library
17
18if(PKG_CONFIG_FOUND)
19 pkg_check_modules(PC_PCRE libpcrecpp QUIET)
20endif()
21
22find_path(PCRE_INCLUDE_DIR pcrecpp.h
23 PATHS ${PC_PCRE_INCLUDEDIR})
24find_library(PCRECPP_LIBRARY_RELEASE NAMES pcrecpp
25 PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE}
26 PATHS ${PC_PCRE_LIBDIR})
27find_library(PCRE_LIBRARY_RELEASE NAMES pcre
28 PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE}
29 PATHS ${PC_PCRE_LIBDIR})
30find_library(PCRECPP_LIBRARY_DEBUG NAMES pcrecppd
31 PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG}
32 PATHS ${PC_PCRE_LIBDIR})
33find_library(PCRE_LIBRARY_DEBUG NAMES pcred
34 PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG}
35 PATHS ${PC_PCRE_LIBDIR})
36set(PCRE_VERSION ${PC_PCRE_VERSION})
37
38include(SelectLibraryConfigurations)
39select_library_configurations(PCRECPP)
40select_library_configurations(PCRE)
41
42include(FindPackageHandleStandardArgs)
43find_package_handle_standard_args(PCRE
44 REQUIRED_VARS PCRECPP_LIBRARY PCRE_LIBRARY PCRE_INCLUDE_DIR
45 VERSION_VAR PCRE_VERSION)
46
47if(PCRE_FOUND)
48 set(PCRE_LIBRARIES ${PCRECPP_LIBRARY} ${PCRE_LIBRARY})
49 set(PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR})
50 if(WIN32)
51 set(PCRE_DEFINITIONS -DPCRE_STATIC=1)
52 endif()
53
54 if(NOT TARGET PCRE::PCRE)
55 add_library(PCRE::PCRE UNKNOWN IMPORTED)
56 if(PCRE_LIBRARY_RELEASE)
57 set_target_properties(PCRE::PCRE PROPERTIES
58 IMPORTED_CONFIGURATIONS RELEASE
59 IMPORTED_LOCATION "${PCRE_LIBRARY_RELEASE}")
60 endif()
61 if(PCRE_LIBRARY_DEBUG)
62 set_target_properties(PCRE::PCRE PROPERTIES
63 IMPORTED_CONFIGURATIONS DEBUG
64 IMPORTED_LOCATION "${PCRE_LIBRARY_DEBUG}")
65 endif()
66 set_target_properties(PCRE::PCRE PROPERTIES
67 INTERFACE_INCLUDE_DIRECTORIES "${PCRE_INCLUDE_DIR}")
68 if(WIN32)
69 set_target_properties(PCRE::PCRE PROPERTIES
70 INTERFACE_COMPILE_DEFINITIONS PCRE_STATIC=1)
71 endif()
72
73 endif()
74 if(NOT TARGET PCRE::PCRECPP)
75 add_library(PCRE::PCRECPP UNKNOWN IMPORTED)
76 if(PCRE_LIBRARY_RELEASE)
77 set_target_properties(PCRE::PCRECPP PROPERTIES
78 IMPORTED_CONFIGURATIONS RELEASE
79 IMPORTED_LOCATION "${PCRECPP_LIBRARY_RELEASE}")
80 endif()
81 if(PCRE_LIBRARY_DEBUG)
82 set_target_properties(PCRE::PCRECPP PROPERTIES
83 IMPORTED_CONFIGURATIONS DEBUG
84 IMPORTED_LOCATION "${PCRECPP_LIBRARY_DEBUG}")
85 endif()
86 set_target_properties(PCRE::PCRECPP PROPERTIES
87 INTERFACE_LINK_LIBRARIES PCRE::PCRE)
88 endif()
89endif()
90
91mark_as_advanced(PCRE_INCLUDE_DIR PCRECPP_LIBRARY PCRE_LIBRARY)
diff --git a/project/cmake/modules/FindPlist.cmake b/project/cmake/modules/FindPlist.cmake
new file mode 100644
index 0000000..d7a6c48
--- /dev/null
+++ b/project/cmake/modules/FindPlist.cmake
@@ -0,0 +1,58 @@
1#.rst:
2# FindPlist
3# ---------
4# Finds the Plist library
5#
6# This will will define the following variables::
7#
8# PLIST_FOUND - system has Plist library
9# PLIST_INCLUDE_DIRS - the Plist library include directory
10# PLIST_LIBRARIES - the Plist libraries
11# PLIST_DEFINITIONS - the Plist compile definitions
12#
13# and the following imported targets::
14#
15# Plist::Plist - The Plist library
16
17if(PKG_CONFIG_FOUND)
18 pkg_check_modules(PC_PLIST libplist QUIET)
19endif()
20
21find_path(PLIST_INCLUDE_DIR plist/plist.h
22 PATHS ${PC_PLIST_INCLUDEDIR})
23
24set(PLIST_VERSION ${PC_PLIST_VERSION})
25
26include(FindPackageHandleStandardArgs)
27if(NOT WIN32)
28 find_library(PLIST_LIBRARY NAMES plist
29 PATHS ${PC_PLIST_LIBDIR})
30
31 find_package_handle_standard_args(PLIST
32 REQUIRED_VARS PLIST_LIBRARY PLIST_INCLUDE_DIR
33 VERSION_VAR PLIST_VERSION)
34else()
35 # Dynamically loaded DLL
36 find_package_handle_standard_args(PLIST
37 REQUIRED_VARS PLIST_INCLUDE_DIR
38 VERSION_VAR PLIST_VERSION)
39endif()
40
41if(PLIST_FOUND)
42 set(PLIST_LIBRARIES ${PLIST_LIBRARY})
43 set(PLIST_INCLUDE_DIRS ${PLIST_INCLUDE_DIR})
44 set(PLIST_DEFINITIONS -DHAVE_LIBPLIST=1)
45
46 if(NOT TARGET Plist::Plist)
47 add_library(Plist::Plist UNKNOWN IMPORTED)
48 if(PLIST_LIBRARY)
49 set_target_properties(Plist::Plist PROPERTIES
50 IMPORTED_LOCATION "${PLIST_LIBRARY}")
51 endif()
52 set_target_properties(Plist::Plist PROPERTIES
53 INTERFACE_INCLUDE_DIRECTORIES "${PLIST_INCLUDE_DIR}"
54 INTERFACE_COMPILE_DEFINITIONS HAVE_LIBPLIST=1)
55 endif()
56endif()
57
58mark_as_advanced(PLIST_INCLUDE_DIR PLIST_LIBRARY)
diff --git a/project/cmake/modules/FindPulseAudio.cmake b/project/cmake/modules/FindPulseAudio.cmake
new file mode 100644
index 0000000..5b57364
--- /dev/null
+++ b/project/cmake/modules/FindPulseAudio.cmake
@@ -0,0 +1,72 @@
1# Try to find the PulseAudio library
2#
3# Once done this will define:
4#
5# PULSEAUDIO_FOUND - system has the PulseAudio library
6# PULSEAUDIO_INCLUDE_DIR - the PulseAudio include directory
7# PULSEAUDIO_LIBRARY - the libraries needed to use PulseAudio
8# PULSEAUDIO_MAINLOOP_LIBRARY - the libraries needed to use PulsAudio Mailoop
9#
10# Copyright (c) 2008, Matthias Kretz, <kretz@kde.org>
11# Copyright (c) 2009, Marcus Hufgard, <Marcus.Hufgard@hufgard.de>
12#
13# Redistribution and use is allowed according to the terms of the BSD license.
14# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
15
16if (NOT PULSEAUDIO_MINIMUM_VERSION)
17 set(PULSEAUDIO_MINIMUM_VERSION "1.0.0")
18endif (NOT PULSEAUDIO_MINIMUM_VERSION)
19
20if (PULSEAUDIO_INCLUDE_DIRS AND PULSEAUDIO_LIBRARY AND PULSEAUDIO_MAINLOOP_LIBRARY)
21 # Already in cache, be silent
22 set(PULSEAUDIO_FIND_QUIETLY TRUE)
23endif (PULSEAUDIO_INCLUDE_DIRS AND PULSEAUDIO_LIBRARY AND PULSEAUDIO_MAINLOOP_LIBRARY)
24
25if (NOT WIN32)
26 include(FindPkgConfig)
27 pkg_check_modules(PC_PULSEAUDIO libpulse>=${PULSEAUDIO_MINIMUM_VERSION})
28 pkg_check_modules(PC_PULSEAUDIO_MAINLOOP libpulse-mainloop-glib)
29endif (NOT WIN32)
30
31FIND_PATH(PULSEAUDIO_INCLUDE_DIRS pulse/pulseaudio.h
32 HINTS
33 ${PC_PULSEAUDIO_INCLUDEDIR}
34 ${PC_PULSEAUDIO_INCLUDE_DIRS}
35 )
36
37FIND_LIBRARY(PULSEAUDIO_LIBRARY NAMES pulse libpulse
38 HINTS
39 ${PC_PULSEAUDIO_LIBDIR}
40 ${PC_PULSEAUDIO_LIBRARY_DIRS}
41 )
42
43FIND_LIBRARY(PULSEAUDIO_MAINLOOP_LIBRARY NAMES pulse-mainloop pulse-mainloop-glib libpulse-mainloop-glib
44 HINTS
45 ${PC_PULSEAUDIO_LIBDIR}
46 ${PC_PULSEAUDIO_LIBRARY_DIRS}
47 )
48
49if (NOT PULSEAUDIO_INCLUDE_DIRS OR NOT PULSEAUDIO_LIBRARY)
50 set(PULSEAUDIO_FOUND FALSE)
51else()
52 set(PULSEAUDIO_FOUND TRUE)
53endif()
54
55if (PULSEAUDIO_FOUND)
56 if (NOT PULSEAUDIO_FIND_QUIETLY)
57 message(STATUS "Found PulseAudio: ${PULSEAUDIO_LIBRARY}")
58 if (PULSEAUDIO_MAINLOOP_LIBRARY)
59 message(STATUS "Found PulseAudio Mainloop: ${PULSEAUDIO_MAINLOOP_LIBRARY}")
60 else (PULSAUDIO_MAINLOOP_LIBRARY)
61 message(STATUS "Could NOT find PulseAudio Mainloop Library")
62 endif (PULSEAUDIO_MAINLOOP_LIBRARY)
63 endif (NOT PULSEAUDIO_FIND_QUIETLY)
64else (PULSEAUDIO_FOUND)
65 message(STATUS "Could NOT find PulseAudio")
66endif (PULSEAUDIO_FOUND)
67
68set(PULSEAUDIO_LIBRARIES ${PULSEAUDIO_LIBRARY})
69
70list(APPEND PULSEAUDIO_DEFINITIONS -DHAVE_LIBPULSE=1)
71
72mark_as_advanced(PULSEAUDIO_INCLUDE_DIRS PULSEAUDIO_LIBRARIES PULSEAUDIO_LIBRARY PULSEAUDIO_MAINLOOP_LIBRARY)
diff --git a/project/cmake/modules/FindPython.cmake b/project/cmake/modules/FindPython.cmake
new file mode 100644
index 0000000..6f9f236
--- /dev/null
+++ b/project/cmake/modules/FindPython.cmake
@@ -0,0 +1,43 @@
1# - Try to find python
2# Once done this will define
3#
4# PYTHON_FOUND - system has PYTHON
5# PYTHON_INCLUDE_DIRS - the python include directory
6# PYTHON_LIBRARIES - The python libraries
7
8if(PKG_CONFIG_FOUND AND NOT CMAKE_CROSSCOMPILING)
9 pkg_check_modules (PYTHON python)
10endif()
11
12if(NOT PYTHON_FOUND)
13 if(CMAKE_CROSSCOMPILING)
14 find_program(PYTHON_EXECUTABLE python ONLY_CMAKE_FIND_ROOT_PATH)
15 find_library(PYTHON_LIBRARY NAMES python2.6 python2.7)
16 find_path(PYTHON_INCLUDE_DIRS NAMES Python.h PATHS ${DEPENDS_PATH}/include/python2.6 ${DEPENDS_PATH}/include/python2.7)
17 set(PYTHON_INCLUDE_DIR ${PYTHON_INCLUDE_DIRS} CACHE PATH "python include dir" FORCE)
18
19 find_library(FFI_LIBRARY ffi)
20 find_library(EXPAT_LIBRARY expat)
21 find_library(INTL_LIBRARY intl)
22
23 if(NOT CORE_SYSTEM_NAME STREQUAL android)
24 set(PYTHON_DEP_LIBRARIES -lpthread -ldl -lutil)
25 endif()
26
27 set(PYTHON_LIBRARIES ${PYTHON_LIBRARY} ${FFI_LIBRARY} ${EXPAT_LIBRARY} ${INTL_LIBRARY} ${PYTHON_DEP_LIBRARIES}
28 CACHE INTERNAL "python libraries" FORCE)
29 else()
30 find_package(PythonLibs)
31 endif()
32endif()
33
34include(FindPackageHandleStandardArgs)
35find_package_handle_standard_args(Python DEFAULT_MSG PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES)
36
37if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
38 find_library(FFI_LIBRARY ffi REQUIRED)
39 find_library(INTL_LIBRARY intl)
40 list(APPEND PYTHON_LIBRARIES ${FFI_LIBRARY} ${INTL_LIBRARY})
41endif()
42
43mark_as_advanced(PYTHON_INCLUDE_DIRS PYTHON_LIBRARIES PYTHON_LDFLAGS)
diff --git a/project/cmake/modules/FindRTMP.cmake b/project/cmake/modules/FindRTMP.cmake
new file mode 100644
index 0000000..432b77d
--- /dev/null
+++ b/project/cmake/modules/FindRTMP.cmake
@@ -0,0 +1,21 @@
1# - Try to find rtmp
2# Once done this will define
3#
4# RTMP_FOUND - system has librtmp
5# RTMP_INCLUDE_DIRS - the librtmp include directory
6# RTMP_LIBRARIES - The librtmp libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (RTMP librtmp)
10 list(APPEND RTMP_INCLUDE_DIRS ${RTMP_INCLUDEDIR})
11else()
12 find_path(RTMP_INCLUDE_DIRS librtmp/rtmp.h)
13 find_library(RTMP_LIBRARIES rtmp)
14endif()
15
16include(FindPackageHandleStandardArgs)
17find_package_handle_standard_args(RTMP DEFAULT_MSG RTMP_INCLUDE_DIRS RTMP_LIBRARIES)
18
19list(APPEND RTMP_DEFINITIONS -DHAS_LIBRTMP=1)
20
21mark_as_advanced(RTMP_INCLUDE_DIRS RTMP_LIBRARIES RTMP_DEFINITIONS)
diff --git a/project/cmake/modules/FindSSE.cmake b/project/cmake/modules/FindSSE.cmake
new file mode 100644
index 0000000..c76b811
--- /dev/null
+++ b/project/cmake/modules/FindSSE.cmake
@@ -0,0 +1,105 @@
1# Check if SSE instructions are available on the machine where
2# the project is compiled.
3
4IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
5 EXEC_PROGRAM(cat ARGS "/proc/cpuinfo" OUTPUT_VARIABLE CPUINFO)
6
7 STRING(REGEX REPLACE "^.*(sse2).*$" "\\1" SSE_THERE ${CPUINFO})
8 STRING(COMPARE EQUAL "sse2" "${SSE_THERE}" SSE2_TRUE)
9 IF (SSE2_TRUE)
10 set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
11 ELSE (SSE2_TRUE)
12 set(SSE2_FOUND false CACHE BOOL "SSE2 available on host")
13 ENDIF (SSE2_TRUE)
14
15 # /proc/cpuinfo apparently omits sse3 :(
16 STRING(REGEX REPLACE "^.*[^s](sse3).*$" "\\1" SSE_THERE ${CPUINFO})
17 STRING(COMPARE EQUAL "sse3" "${SSE_THERE}" SSE3_TRUE)
18 IF (NOT SSE3_TRUE)
19 STRING(REGEX REPLACE "^.*(T2300).*$" "\\1" SSE_THERE ${CPUINFO})
20 STRING(COMPARE EQUAL "T2300" "${SSE_THERE}" SSE3_TRUE)
21 ENDIF (NOT SSE3_TRUE)
22
23 STRING(REGEX REPLACE "^.*(ssse3).*$" "\\1" SSE_THERE ${CPUINFO})
24 STRING(COMPARE EQUAL "ssse3" "${SSE_THERE}" SSSE3_TRUE)
25 IF (SSE3_TRUE OR SSSE3_TRUE)
26 set(SSE3_FOUND true CACHE BOOL "SSE3 available on host")
27 ELSE (SSE3_TRUE OR SSSE3_TRUE)
28 set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
29 ENDIF (SSE3_TRUE OR SSSE3_TRUE)
30 IF (SSSE3_TRUE)
31 set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host")
32 ELSE (SSSE3_TRUE)
33 set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
34 ENDIF (SSSE3_TRUE)
35
36 STRING(REGEX REPLACE "^.*(sse4_1).*$" "\\1" SSE_THERE ${CPUINFO})
37 STRING(COMPARE EQUAL "sse4_1" "${SSE_THERE}" SSE41_TRUE)
38 IF (SSE41_TRUE)
39 set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host")
40 ELSE (SSE41_TRUE)
41 set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
42 ENDIF (SSE41_TRUE)
43ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
44 EXEC_PROGRAM("/usr/sbin/sysctl -n machdep.cpu.features" OUTPUT_VARIABLE
45 CPUINFO)
46
47 STRING(REGEX REPLACE "^.*[^S](SSE2).*$" "\\1" SSE_THERE ${CPUINFO})
48 STRING(COMPARE EQUAL "SSE2" "${SSE_THERE}" SSE2_TRUE)
49 IF (SSE2_TRUE)
50 set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
51 ELSE (SSE2_TRUE)
52 set(SSE2_FOUND false CACHE BOOL "SSE2 available on host")
53 ENDIF (SSE2_TRUE)
54
55 STRING(REGEX REPLACE "^.*[^S](SSE3).*$" "\\1" SSE_THERE ${CPUINFO})
56 STRING(COMPARE EQUAL "SSE3" "${SSE_THERE}" SSE3_TRUE)
57 IF (SSE3_TRUE)
58 set(SSE3_FOUND true CACHE BOOL "SSE3 available on host")
59 ELSE (SSE3_TRUE)
60 set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
61 ENDIF (SSE3_TRUE)
62
63 STRING(REGEX REPLACE "^.*(SSSE3).*$" "\\1" SSE_THERE ${CPUINFO})
64 STRING(COMPARE EQUAL "SSSE3" "${SSE_THERE}" SSSE3_TRUE)
65 IF (SSSE3_TRUE)
66 set(SSSE3_FOUND true CACHE BOOL "SSSE3 available on host")
67 ELSE (SSSE3_TRUE)
68 set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
69 ENDIF (SSSE3_TRUE)
70
71 STRING(REGEX REPLACE "^.*(SSE4.1).*$" "\\1" SSE_THERE ${CPUINFO})
72 STRING(COMPARE EQUAL "SSE4.1" "${SSE_THERE}" SSE41_TRUE)
73 IF (SSE41_TRUE)
74 set(SSE4_1_FOUND true CACHE BOOL "SSE4.1 available on host")
75 ELSE (SSE41_TRUE)
76 set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
77 ENDIF (SSE41_TRUE)
78ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Windows")
79 # TODO
80 set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
81 set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
82 set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
83 set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
84ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux")
85 set(SSE2_FOUND true CACHE BOOL "SSE2 available on host")
86 set(SSE3_FOUND false CACHE BOOL "SSE3 available on host")
87 set(SSSE3_FOUND false CACHE BOOL "SSSE3 available on host")
88 set(SSE4_1_FOUND false CACHE BOOL "SSE4.1 available on host")
89ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
90
91if(NOT SSE2_FOUND)
92 MESSAGE(STATUS "Could not find hardware support for SSE2 on this machine.")
93endif(NOT SSE2_FOUND)
94if(NOT SSE3_FOUND)
95 MESSAGE(STATUS "Could not find hardware support for SSE3 on this machine.")
96endif(NOT SSE3_FOUND)
97if(NOT SSSE3_FOUND)
98 MESSAGE(STATUS "Could not find hardware support for SSSE3 on this machine.")
99endif(NOT SSSE3_FOUND)
100if(NOT SSE4_1_FOUND)
101 MESSAGE(STATUS "Could not find hardware support for SSE4.1 on this machine.")
102endif(NOT SSE4_1_FOUND)
103
104mark_as_advanced(SSE2_FOUND SSE3_FOUND SSSE3_FOUND SSE4_1_FOUND)
105
diff --git a/project/cmake/modules/FindSSH.cmake b/project/cmake/modules/FindSSH.cmake
new file mode 100644
index 0000000..60c3537
--- /dev/null
+++ b/project/cmake/modules/FindSSH.cmake
@@ -0,0 +1,21 @@
1# - Try to find libssh
2# Once done this will define
3#
4# SSH_FOUND - system has libssh
5# SSH_INCLUDE_DIRS - the libssh include directory
6# SSH_LIBRARIES - The libssh libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (SSH libssh)
10 list(APPEND SSH_INCLUDE_DIRS /usr/include)
11else()
12 find_path(SSH_INCLUDE_DIRS libssh/libssh.h)
13 find_library(SSH_LIBRARIES ssh)
14endif()
15
16include(FindPackageHandleStandardArgs)
17find_package_handle_standard_args(SSH DEFAULT_MSG SSH_INCLUDE_DIRS SSH_LIBRARIES)
18
19list(APPEND SSH_DEFINITIONS -DHAVE_LIBSSH=1)
20
21mark_as_advanced(SSH_INCLUDE_DIRS SSH_LIBRARIES SSH_DEFINITIONS)
diff --git a/project/cmake/modules/FindSWIG.cmake b/project/cmake/modules/FindSWIG.cmake
new file mode 100644
index 0000000..84c7a51
--- /dev/null
+++ b/project/cmake/modules/FindSWIG.cmake
@@ -0,0 +1,14 @@
1if(NOT SWIG_EXECUTABLE)
2 find_program(SWIG_EXECUTABLE NAMES swig2.0 swig PATH_SUFFIXES swig)
3endif()
4if(SWIG_EXECUTABLE)
5 execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib
6 OUTPUT_VARIABLE SWIG_DIR
7 ERROR_VARIABLE SWIG_swiglib_error
8 RESULT_VARIABLE SWIG_swiglib_result)
9endif()
10
11
12include(FindPackageHandleStandardArgs)
13FIND_PACKAGE_HANDLE_STANDARD_ARGS(SWIG REQUIRED_VARS SWIG_EXECUTABLE SWIG_DIR
14 VERSION_VAR SWIG_VERSION )
diff --git a/project/cmake/modules/FindSdl.cmake b/project/cmake/modules/FindSdl.cmake
new file mode 100644
index 0000000..91bcac5
--- /dev/null
+++ b/project/cmake/modules/FindSdl.cmake
@@ -0,0 +1,46 @@
1#.rst:
2# FindSDL
3# -------
4# Finds the SDL library
5#
6# This will will define the following variables::
7#
8# SDL_FOUND - system has SDL
9# SDL_INCLUDE_DIRS - the SDL include directory
10# SDL_LIBRARIES - the SDL libraries
11# SDL_DEFINITIONS - the SDL compile definitions
12
13if(PKG_CONFIG_FOUND)
14 pkg_check_modules(PC_SDL2 sdl2 QUIET)
15 if(PC_SDL2_FOUND)
16 set(SDL_VERSION ${PC_SDL2_VERSION})
17 else()
18 pkg_check_modules(PC_SDL1 sdl QUIET)
19 if(PC_SDL1_FOUND)
20 set(SDL_VERSION ${PC_SDL1_VERSION})
21 endif()
22 endif()
23endif()
24
25find_path(SDL_INCLUDE_DIR SDL/SDL.h
26 PATHS ${PC_SDL2_INCLUDE_DIR} ${PC_SDL1_INCLUDE_DIR})
27find_library(SDL_LIBRARY NAMES SDL2 SDL
28 PATHS ${PC_SDL2_LIBDIR} ${PC_SDL1_LIBDIR})
29
30include(FindPackageHandleStandardArgs)
31find_package_handle_standard_args(Sdl REQUIRED_VARS SDL_LIBRARY SDL_INCLUDE_DIR
32 VERSION_VAR SDL_VERSION)
33
34if(SDL_FOUND)
35 set(SDL_LIBRARIES ${SDL_LIBRARY})
36 set(SDL_INCLUDE_DIRS ${SDL_INCLUDE_DIR})
37 set(SDL_DEFINITIONS -DHAVE_SDL=1)
38
39 if(SDL_VERSION VERSION_GREATER 2)
40 list(APPEND SDL_DEFINITIONS -DHAVE_SDL_VERSION=2)
41 elseif(SDL_VERSION VERSION_GREATER 1)
42 list(APPEND SDL_DEFINITIONS -DHAVE_SDL_VERSION=1)
43 endif()
44endif()
45
46mark_as_advanced(SDL_LIBRARY SDL_INCLUDE_DIR)
diff --git a/project/cmake/modules/FindShairplay.cmake b/project/cmake/modules/FindShairplay.cmake
new file mode 100644
index 0000000..4804686
--- /dev/null
+++ b/project/cmake/modules/FindShairplay.cmake
@@ -0,0 +1,63 @@
1#.rst:
2# FindShairplay
3# -------------
4# Finds the Shairplay library
5#
6# This will will define the following variables::
7#
8# SHAIRPLAY_FOUND - system has Shairplay
9# SHAIRPLAY_INCLUDE_DIRS - the Shairplay include directory
10# SHAIRPLAY_LIBRARIES - the Shairplay libraries
11# SHAIRPLAY_DEFINITIONS - the Shairplay compile definitions
12#
13# and the following imported targets::
14#
15# Shairplay::Shairplay - The Shairplay library
16
17find_path(SHAIRPLAY_INCLUDE_DIR shairplay/raop.h)
18
19include(FindPackageHandleStandardArgs)
20if(NOT WIN32)
21 find_library(SHAIRPLAY_LIBRARY NAMES shairplay)
22
23 if(SHAIRPLAY_INCLUDE_DIR AND SHAIRPLAY_LIBRARY)
24 include(CheckCSourceCompiles)
25 set(CMAKE_REQUIRED_INCLUDES ${SHAIRPLAY_INCLUDE_DIRS})
26 set(CMAKE_REQUIRED_LIBRARIES ${SHAIRPLAY_LIBRARIES})
27 check_c_source_compiles("#include <shairplay/raop.h>
28
29 int main()
30 {
31 struct raop_callbacks_s foo;
32 foo.cls;
33 return 0;
34 }
35 " HAVE_SHAIRPLAY_CALLBACK_CLS)
36 endif()
37
38 find_package_handle_standard_args(SHAIRPLAY
39 REQUIRED_VARS SHAIRPLAY_LIBRARY SHAIRPLAY_INCLUDE_DIR HAVE_SHAIRPLAY_CALLBACK_CLS)
40else()
41 # Dynamically loaded DLL
42 find_package_handle_standard_args(SHAIRPLAY
43 REQUIRED_VARS SHAIRPLAY_INCLUDE_DIR)
44endif()
45
46if(SHAIRPLAY_FOUND)
47 set(SHAIRPLAY_LIBRARIES ${SHAIRPLAY_LIBRARY})
48 set(SHAIRPLAY_INCLUDE_DIRS ${SHAIRPLAY_INCLUDE_DIR})
49 set(SHAIRPLAY_DEFINITIONS -DHAVE_LIBSHAIRPLAY=1)
50
51 if(NOT TARGET Shairplay::Shairplay)
52 add_library(Shairplay::Shairplay UNKNOWN IMPORTED)
53 if(SHAIRPLAY_LIBRARY)
54 set_target_properties(Shairplay::Shairplay PROPERTIES
55 IMPORTED_LOCATION "${SHAIRPLAY_LIBRARY}")
56 endif()
57 set_target_properties(Shairplay::Shairplay PROPERTIES
58 INTERFACE_INCLUDE_DIRECTORIES "${SHAIRPLAY_INCLUDE_DIR}"
59 INTERFACE_COMPILE_DEFINITIONS HAVE_LIBSHAIRPLAY=1)
60 endif()
61endif()
62
63mark_as_advanced(SHAIRPLAY_INCLUDE_DIR SHAIRPLAY_LIBRARY)
diff --git a/project/cmake/modules/FindSqlite3.cmake b/project/cmake/modules/FindSqlite3.cmake
new file mode 100644
index 0000000..a47944e
--- /dev/null
+++ b/project/cmake/modules/FindSqlite3.cmake
@@ -0,0 +1,19 @@
1# - Try to find SQLITE3
2# Once done this will define
3#
4# SQLITE3_FOUND - system has sqlite3
5# SQLITE3_INCLUDE_DIRS - the sqlite3 include directory
6# SQLITE3_LIBRARIES - The sqlite3 libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (SQLITE3 sqlite3)
10 list(APPEND SQLITE3_INCLUDE_DIRS ${SQLITE3_INCLUDEDIR})
11else()
12 find_path(SQLITE3_INCLUDE_DIRS sqlite3.h)
13 find_library(SQLITE3_LIBRARIES sqlite3)
14endif()
15
16include(FindPackageHandleStandardArgs)
17find_package_handle_standard_args(Sqlite3 DEFAULT_MSG SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES)
18
19mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES)
diff --git a/project/cmake/modules/FindTagLib.cmake b/project/cmake/modules/FindTagLib.cmake
new file mode 100644
index 0000000..b515e81
--- /dev/null
+++ b/project/cmake/modules/FindTagLib.cmake
@@ -0,0 +1,62 @@
1#.rst:
2# FindTagLib
3# ----------
4# Finds the TagLib library
5#
6# This will will define the following variables::
7#
8# TAGLIB_FOUND - system has TagLib
9# TAGLIB_INCLUDE_DIRS - the TagLib include directory
10# TAGLIB_LIBRARIES - the TagLib libraries
11#
12# and the following imported targets::
13#
14# TagLib::TagLib - The TagLib library
15
16if(PKG_CONFIG_FOUND)
17 pkg_check_modules(PC_TAGLIB taglib>=1.8.0 QUIET)
18endif()
19
20find_path(TAGLIB_INCLUDE_DIR taglib/tag.h
21 PATHS ${PC_TAGLIB_INCLUDEDIR})
22find_library(TAGLIB_LIBRARY_RELEASE NAMES tag
23 PATH_SUFFIXES ${CONFIGURATION_LIBDIR_RELEASE}
24 PATHS ${PC_TAGLIB_LIBDIR})
25find_library(TAGLIB_LIBRARY_DEBUG NAMES tag
26 PATH_SUFFIXES ${CONFIGURATION_LIBDIR_DEBUG}
27 PATHS ${PC_TAGLIB_LIBDIR})
28set(TAGLIB_VERSION ${PC_TAGLIB_VERSION})
29
30include(SelectLibraryConfigurations)
31select_library_configurations(TAGLIB)
32
33include(FindPackageHandleStandardArgs)
34find_package_handle_standard_args(TAGLIB
35 REQUIRED_VARS TAGLIB_LIBRARY TAGLIB_INCLUDE_DIR
36 VERSION_VAR TAGLIB_VERSION)
37
38if(TAGLIB_FOUND)
39 set(TAGLIB_LIBRARIES ${TAGLIB_LIBRARY})
40
41 # Workaround broken .pc file
42 list(APPEND TAGLIB_LIBRARIES ${PC_TAGLIB_ZLIB_LIBRARIES})
43
44 set(TAGLIB_INCLUDE_DIRS ${TAGLIB_INCLUDE_DIR})
45 if(NOT TARGET TagLib::TagLib)
46 add_library(TagLib::TagLib UNKNOWN IMPORTED)
47 if(TAGLIB_LIBRARY_RELEASE)
48 set_target_properties(TagLib::TagLib PROPERTIES
49 IMPORTED_CONFIGURATIONS RELEASE
50 IMPORTED_LOCATION "${TAGLIB_LIBRARY_RELEASE}")
51 endif()
52 if(TAGLIB_LIBRARY_DEBUG)
53 set_target_properties(TagLib::TagLib PROPERTIES
54 IMPORTED_CONFIGURATIONS DEBUG
55 IMPORTED_LOCATION "${TAGLIB_LIBRARY_DEBUG}")
56 endif()
57 set_target_properties(TagLib::TagLib PROPERTIES
58 INTERFACE_INCLUDE_DIRECTORIES "${TAGLIB_INCLUDE_DIR}")
59 endif()
60endif()
61
62mark_as_advanced(TAGLIB_INCLUDE_DIR TAGLIB_LIBRARY)
diff --git a/project/cmake/modules/FindTexturePacker.cmake b/project/cmake/modules/FindTexturePacker.cmake
new file mode 100644
index 0000000..2229ff7
--- /dev/null
+++ b/project/cmake/modules/FindTexturePacker.cmake
@@ -0,0 +1,23 @@
1#.rst:
2# FindTexturePacker
3# -----------------
4# Finds the TexturePacker
5#
6# This will define the following (imported) targets::
7#
8# TexturePacker::TexturePacker - The TexturePacker executable
9
10if(NOT TARGET TexturePacker::TexturePacker)
11 if(CMAKE_CROSSCOMPILING)
12 add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL)
13 set_target_properties(TexturePacker::TexturePacker PROPERTIES
14 IMPORTED_LOCATION "${NATIVEPREFIX}/bin/TexturePacker")
15 elseif(WIN32)
16 add_executable(TexturePacker::TexturePacker IMPORTED GLOBAL)
17 set_target_properties(TexturePacker::TexturePacker PROPERTIES
18 IMPORTED_LOCATION "${CORE_SOURCE_DIR}/tools/TexturePacker/TexturePacker.exe")
19 else()
20 add_subdirectory(${CORE_SOURCE_DIR}/tools/depends/native/TexturePacker build/texturepacker)
21 add_executable(TexturePacker::TexturePacker ALIAS TexturePacker)
22 endif()
23endif()
diff --git a/project/cmake/modules/FindTinyXML.cmake b/project/cmake/modules/FindTinyXML.cmake
new file mode 100644
index 0000000..0168f40
--- /dev/null
+++ b/project/cmake/modules/FindTinyXML.cmake
@@ -0,0 +1,68 @@
1#.rst:
2# FindTinyXML
3# -----------
4# Finds the TinyXML library
5#
6# This will will define the following variables::
7#
8# TINYXML_FOUND - system has TinyXML
9# TINYXML_INCLUDE_DIRS - the TinyXML include directory
10# TINYXML_LIBRARIES - the TinyXML libraries
11# TINYXML_DEFINITIONS - the TinyXML definitions
12#
13# and the following imported targets::
14#
15# TinyXML::TinyXML - The TinyXML library
16
17if(PKG_CONFIG_FOUND)
18 pkg_check_modules(PC_TINYXML tinyxml QUIET)
19endif()
20
21find_path(TINYXML_INCLUDE_DIR tinyxml.h
22 PATH_SUFFIXES tinyxml
23 PATHS ${PC_TINYXML_INCLUDEDIR})
24find_library(TINYXML_LIBRARY_RELEASE NAMES tinyxml tinyxmlSTL
25 PATH_SUFFIXES tinyxml ${CONFIGURATION_LIBDIR_RELEASE}
26 PATHS ${PC_TINYXML_LIBDIR})
27find_library(TINYXML_LIBRARY_DEBUG NAMES tinyxml tinyxmlSTL
28 PATH_SUFFIXES tinyxml ${CONFIGURATION_LIBDIR_DEBUG}
29 PATHS ${PC_TINYXML_LIBDIR})
30set(TINYXML_VERSION ${PC_TINYXML_VERSION})
31
32include(SelectLibraryConfigurations)
33select_library_configurations(TINYXML)
34
35include(FindPackageHandleStandardArgs)
36find_package_handle_standard_args(TINYXML
37 REQUIRED_VARS TINYXML_LIBRARY TINYXML_INCLUDE_DIR
38 VERSION_VAR TINYXML_VERSION)
39
40if(TINYXML_FOUND)
41 set(TINYXML_LIBRARIES ${TINYXML_LIBRARY})
42 set(TINYXML_INCLUDE_DIRS ${TINYXML_INCLUDE_DIR})
43 if(WIN32)
44 set(TINYXML_DEFINITIONS -DTIXML_USE_STL=1)
45 endif()
46
47 if(NOT TARGET TinyXML::TinyXML)
48 add_library(TinyXML::TinyXML UNKNOWN IMPORTED)
49 if(TINYXML_LIBRARY_RELEASE)
50 set_target_properties(TinyXML::TinyXML PROPERTIES
51 IMPORTED_CONFIGURATIONS RELEASE
52 IMPORTED_LOCATION "${TINYXML_LIBRARY_RELEASE}")
53 endif()
54 if(TINYXML_LIBRARY_DEBUG)
55 set_target_properties(TinyXML::TinyXML PROPERTIES
56 IMPORTED_CONFIGURATIONS DEBUG
57 IMPORTED_LOCATION "${TINYXML_LIBRARY_DEBUG}")
58 endif()
59 set_target_properties(TinyXML::TinyXML PROPERTIES
60 INTERFACE_INCLUDE_DIRECTORIES "${TINYXML_INCLUDE_DIR}")
61 if(WIN32)
62 set_target_properties(TinyXML::TinyXML PROPERTIES
63 INTERFACE_COMPILE_DEFINITIONS TIXML_USE_STL=1)
64 endif()
65 endif()
66endif()
67
68mark_as_advanced(TINYXML_INCLUDE_DIR TINYXML_LIBRARY)
diff --git a/project/cmake/modules/FindUDev.cmake b/project/cmake/modules/FindUDev.cmake
new file mode 100644
index 0000000..97fa956
--- /dev/null
+++ b/project/cmake/modules/FindUDev.cmake
@@ -0,0 +1,22 @@
1# - Try to find udev
2# Once done this will define
3#
4# UDEV_FOUND - system has libudev
5# UDEV_INCLUDE_DIRS - the libudev include directory
6# UDEV_LIBRARIES - The libudev libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (UDEV libudev)
10 list(APPEND UDEV_INCLUDE_DIRS ${UDEV_INCLUDEDIR})
11endif()
12
13if(NOT UDEV_FOUND)
14 find_path(UDEV_INCLUDE_DIRS libudev.h)
15 find_library(UDEV_LIBRARIES udev)
16endif()
17
18include(FindPackageHandleStandardArgs)
19find_package_handle_standard_args(UDev DEFAULT_MSG UDEV_INCLUDE_DIRS UDEV_LIBRARIES)
20
21mark_as_advanced(UDEV_INCLUDE_DIRS UDEV_LIBRARIES)
22list(APPEND UDEV_DEFINITIONS -DHAVE_LIBUDEV=1)
diff --git a/project/cmake/modules/FindUUID.cmake b/project/cmake/modules/FindUUID.cmake
new file mode 100644
index 0000000..173fac2
--- /dev/null
+++ b/project/cmake/modules/FindUUID.cmake
@@ -0,0 +1,43 @@
1#.rst:
2# FindUUID
3# --------
4# Finds the libuuid library
5#
6# This will will define the following variables::
7#
8# UUID_FOUND - system has libuuid
9# UUID_INCLUDE_DIRS - the libuuid include directory
10# UUID_LIBRARIES - the libuuid libraries
11#
12# and the following imported targets::
13#
14# UUID::UUID - The libuuid library
15
16if(PKG_CONFIG_FOUND)
17 pkg_check_modules(PC_UUID uuid QUIET)
18endif()
19
20find_path(UUID_INCLUDE_DIR uuid/uuid.h
21 PATHS ${PC_UUID_INCLUDEDIR})
22find_library(UUID_LIBRARY uuid
23 PATHS ${PC_UUID_LIBRARY})
24set(UUID_VERSION ${PC_UUID_VERSION})
25
26include(FindPackageHandleStandardArgs)
27find_package_handle_standard_args(UUID
28 REQUIRED_VARS UUID_LIBRARY UUID_INCLUDE_DIR
29 VERSION_VAR UUID_VERSION)
30
31if(UUID_FOUND)
32 set(UUID_LIBRARIES ${UUID_LIBRARY})
33 set(UUID_INCLUDE_DIRS ${UUID_INCLUDE_DIR})
34
35 if(NOT TARGET UUID::UUID)
36 add_library(UUID::UUID UNKNOWN IMPORTED)
37 set_target_properties(UUID::UUID PROPERTIES
38 IMPORTED_LOCATION "${UUID_LIBRARY}"
39 INTERFACE_INCLUDE_DIRECTORIES "${UUID_INCLUDE_DIR}")
40 endif()
41endif()
42
43mark_as_advanced(UUID_INCLUDE_DIR UUID_LIBRARY)
diff --git a/project/cmake/modules/FindVAAPI.cmake b/project/cmake/modules/FindVAAPI.cmake
new file mode 100644
index 0000000..08e821f
--- /dev/null
+++ b/project/cmake/modules/FindVAAPI.cmake
@@ -0,0 +1,47 @@
1#.rst:
2# FindVAAPI
3# ---------
4# Finds the VAAPI library
5#
6# This will will define the following variables::
7#
8# VAAPI_FOUND - system has VAAPI
9# VAAPI_INCLUDE_DIRS - the VAAPI include directory
10# VAAPI_LIBRARIES - the VAAPI libraries
11# VAAPI_DEFINITIONS - the VAAPI definitions
12
13if(PKG_CONFIG_FOUND)
14 pkg_check_modules(PC_VAAPI libva libva-x11 QUIET)
15endif()
16
17find_path(VAAPI_INCLUDE_DIR va/va.h
18 PATHS ${PC_VAAPI_libva_INCLUDEDIR})
19find_library(VAAPI_libva_LIBRARY NAMES va
20 PATHS ${PC_VAAPI_libva_LIBDIR})
21find_library(VAAPI_libva-x11_LIBRARY NAMES va-x11
22 PATHS ${PC_VAAPI_libva_LIBDIR})
23
24if(PC_VAAPI_libva_VERSION)
25 set(VAAPI_VERSION_STRING ${PC_VAAPI_libva_VERSION})
26elseif(VAAPI_INCLUDE_DIR AND EXISTS "${VAAPI_INCLUDE_DIR}/va/va_version.h")
27 file(STRINGS "${VAAPI_INCLUDE_DIR}/va/va_version.h" vaapi_version_str REGEX "^#define[\t ]+VA_VERSION_S[\t ]+\".*\".*")
28 string(REGEX REPLACE "^#define[\t ]+VA_VERSION_S[\t ]+\"([^\"]+)\".*" "\\1" VAAPI_VERSION_STRING "${vaapi_version_str}")
29 unset(vaapi_version_str)
30endif()
31
32if(NOT VAAPI_FIND_VERSION)
33 set(VAAPI_FIND_VERSION 0.38.0)
34endif()
35
36include(FindPackageHandleStandardArgs)
37find_package_handle_standard_args(VAAPI
38 REQUIRED_VARS VAAPI_libva_LIBRARY VAAPI_libva-x11_LIBRARY VAAPI_INCLUDE_DIR
39 VERSION_VAR VAAPI_VERSION_STRING)
40
41if(VAAPI_FOUND)
42 set(VAAPI_INCLUDE_DIRS ${VAAPI_INCLUDE_DIR})
43 set(VAAPI_LIBRARIES ${VAAPI_libva_LIBRARY} ${VAAPI_libva-x11_LIBRARY})
44 set(VAAPI_DEFINITIONS -DHAVE_LIBVA=1)
45endif()
46
47mark_as_advanced(VAAPI_INCLUDE_DIR VAAPI_libva_LIBRARY VAAPI_libva-x11_LIBRARY)
diff --git a/project/cmake/modules/FindVDPAU.cmake b/project/cmake/modules/FindVDPAU.cmake
new file mode 100644
index 0000000..680b45f
--- /dev/null
+++ b/project/cmake/modules/FindVDPAU.cmake
@@ -0,0 +1,32 @@
1#.rst:
2# FindVDPAU
3# ---------
4# Finds the VDPAU library
5#
6# This will will define the following variables::
7#
8# VDPAU_FOUND - system has VDPAU
9# VDPAU_INCLUDE_DIRS - the VDPAU include directory
10# VDPAU_LIBRARIES - the VDPAU libraries
11# VDPAU_DEFINITIONS - the VDPAU definitions
12
13if(PKG_CONFIG_FOUND)
14 pkg_check_modules(PC_VDPAU vdpau QUIET)
15endif()
16
17find_path(VDPAU_INCLUDE_DIR NAMES vdpau/vdpau.h vdpau/vdpau_x11.h
18 PATHS ${PC_VDPAU_INCLUDEDIR})
19find_library(VDPAU_LIBRARY NAMES vdpau
20 PATHS ${PC_VDPAU_LIBDIR})
21
22include(FindPackageHandleStandardArgs)
23find_package_handle_standard_args(VDPAU
24 REQUIRED_VARS VDPAU_LIBRARY VDPAU_INCLUDE_DIR)
25
26if(VDPAU_FOUND)
27 set(VDPAU_INCLUDE_DIRS ${VDPAU_INCLUDE_DIR})
28 set(VDPAU_LIBRARIES ${VDPAU_LIBRARY})
29 set(VDPAU_DEFINITIONS -DHAVE_LIBVDPAU=1)
30endif()
31
32mark_as_advanced(VDPAU_INCLUDE_DIR VDPAU_LIBRARY)
diff --git a/project/cmake/modules/FindX.cmake b/project/cmake/modules/FindX.cmake
new file mode 100644
index 0000000..d9ab5bc
--- /dev/null
+++ b/project/cmake/modules/FindX.cmake
@@ -0,0 +1,21 @@
1# - Try to find X11
2# Once done this will define
3#
4# X11_FOUND - system has X11
5# X11_INCLUDE_DIRS - the X11 include directory
6# X11_LIBRARIES - The X11 libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (X x11 xext libdrm egl)
10 list(APPEND X_INCLUDE_DIRS /usr/include)
11else()
12 find_path(X_INCLUDE_DIRS X11/Xlib.h)
13 find_library(X_LIBRARIES X11)
14endif()
15
16include(FindPackageHandleStandardArgs)
17find_package_handle_standard_args(X DEFAULT_MSG X_INCLUDE_DIRS X_LIBRARIES)
18
19list(APPEND X_DEFINITIONS -DHAVE_X11=1)
20
21mark_as_advanced(X_INCLUDE_DIRS X_LIBRARIES X_DEFINITIONS)
diff --git a/project/cmake/modules/FindXRandR.cmake b/project/cmake/modules/FindXRandR.cmake
new file mode 100644
index 0000000..57ff750
--- /dev/null
+++ b/project/cmake/modules/FindXRandR.cmake
@@ -0,0 +1,22 @@
1# - Try to find xrandr
2# Once done this will define
3#
4# XRANDR_FOUND - system has lixrandr
5# XRANDR_INCLUDE_DIRS - the libxrandr include directory
6# XRANDR_LIBRARIES - The libxrandr libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (XRANDR xrandr)
10 list(APPEND XRANDR_INCLUDE_DIRS ${XRANDR_INCLUDEDIR})
11else()
12 find_library(XRANDR_LIBRARIES Xrandr)
13endif()
14
15if(XRANDR_FOUND)
16include(FindPackageHandleStandardArgs)
17 find_package_handle_standard_args(XRandR DEFAULT_MSG XRANDR_INCLUDE_DIRS XRANDR_LIBRARIES)
18
19 list(APPEND XRANDR_DEFINITIONS -DHAVE_LIBXRANDR=1)
20
21 mark_as_advanced(XRANDR_INCLUDE_DIRS XRANDR_LIBRARIES XRANDR_DEFINITIONS)
22endif()
diff --git a/project/cmake/modules/FindXslt.cmake b/project/cmake/modules/FindXslt.cmake
new file mode 100644
index 0000000..442ba43
--- /dev/null
+++ b/project/cmake/modules/FindXslt.cmake
@@ -0,0 +1,18 @@
1# - Try to find XSLT
2# Once done this will define
3#
4# XSLT_FOUND - system has libxslt
5# XSLT_INCLUDE_DIRS - the libxslt include directory
6# XSLT_LIBRARIES - The libxslt libraries
7
8if(PKG_CONFIG_FOUND)
9 pkg_check_modules (XSLT libxslt)
10else()
11 find_path(XSLT_INCLUDE_DIRS libxslt/xslt.h)
12 find_library(XSLT_LIBRARIES NAMES xslt libxslt)
13endif()
14
15include(FindPackageHandleStandardArgs)
16find_package_handle_standard_args(Xslt DEFAULT_MSG XSLT_INCLUDE_DIRS XSLT_LIBRARIES)
17
18mark_as_advanced(XSLT_INCLUDE_DIRS XSLT_LIBRARIES)
diff --git a/project/cmake/modules/FindYajl.cmake b/project/cmake/modules/FindYajl.cmake
new file mode 100644
index 0000000..c27b03a
--- /dev/null
+++ b/project/cmake/modules/FindYajl.cmake
@@ -0,0 +1,27 @@
1# Base Io build system
2# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
3#
4# Find libyajl
5pkg_check_modules(YAJL yajl>=2.0)
6if(YAJL_FOUND)
7 list(APPEND YAJL_DEFINITIONS -DYAJL_MAJOR=2)
8endif()
9
10if(NOT YAJL_FOUND)
11 find_path(YAJL_INCLUDE_DIRS yajl/yajl_common.h)
12 find_library(YAJL_LIBRARIES NAMES yajl)
13
14 file(STRINGS ${YAJL_INCLUDE_DIRS}/yajl/yajl_version.h version_header)
15 string(REGEX MATCH "YAJL_MAJOR ([0-9]+)" YAJL_VERSION_MAJOR ${version_header})
16 string(REGEX REPLACE "YAJL_MAJOR ([0-9]+)" "\\1" YAJL_VERSION_MAJOR "${YAJL_VERSION_MAJOR}")
17 if (YAJL_VERSION_MINOR LESS 2)
18 set(YAJL_INCLUDE_DIRS)
19 set(YALJ_LIBRARIES)
20 endif()
21 list(APPEND YAJL_DEFINITIONS -DYAJL_MAJOR=${YAJL_VERSION_MAJOR})
22endif()
23
24include(FindPackageHandleStandardArgs)
25find_package_handle_standard_args(Yajl DEFAULT_MSG YAJL_INCLUDE_DIRS YAJL_LIBRARIES)
26
27mark_as_advanced(YAJL_INCLUDE_DIRS YAJL_LIBRARIES YAJL_DEFINITIONS)
diff --git a/project/cmake/modules/FindZip.cmake b/project/cmake/modules/FindZip.cmake
new file mode 100644
index 0000000..e0a38c1
--- /dev/null
+++ b/project/cmake/modules/FindZip.cmake
@@ -0,0 +1,46 @@
1#.rst:
2# FindZip
3# -----------
4# Finds the Zip library
5#
6# This will will define the following variables::
7#
8# ZIP_FOUND - system has Zip
9# ZIP_INCLUDE_DIRS - the Zip include directory
10# ZIP_LIBRARIES - the Zip libraries
11# ZIP_DEFINITIONS - the Zip libraries
12#
13# and the following imported targets::
14#
15# ZIP::ZIP - The Zip library
16
17if(PKG_CONFIG_FOUND)
18 pkg_check_modules(PC_ZIP libzip QUIET)
19endif()
20
21find_path(ZIP_INCLUDE_DIR zip.h
22 PATHS ${PC_ZIP_INCLUDEDIR})
23find_library(ZIP_LIBRARY NAMES zip
24 PATHS ${PC_ZIP_LIBDIR})
25set(ZIP_VERSION ${PC_ZIP_VERSION})
26
27include(FindPackageHandleStandardArgs)
28find_package_handle_standard_args(ZIP
29 REQUIRED_VARS ZIP_LIBRARY ZIP_INCLUDE_DIR
30 VERSION_VAR ZIP_VERSION)
31
32if(ZIP_FOUND)
33 set(ZIP_LIBRARIES ${ZIP_LIBRARY})
34 set(ZIP_INCLUDE_DIRS ${ZIP_INCLUDE_DIR})
35 set(ZIP_DEFINITIONS "${PC_ZIP_CFLAGS}")
36
37 if(NOT TARGET ZIP::ZIP)
38 add_library(ZIP::ZIP UNKNOWN IMPORTED)
39 set_target_properties(ZIP::ZIP PROPERTIES
40 IMPORTED_LOCATION "${ZIP_LIBRARY}"
41 INTERFACE_INCLUDE_DIRECTORIES "${ZIP_INCLUDE_DIR}"
42 INTERFACE_COMPILE_DEFINITIONS "${PC_ZIP_CFLAGS}")
43 endif()
44endif()
45
46mark_as_advanced(ZIP_INCLUDE_DIR ZIP_LIBRARY)
diff --git a/project/cmake/platform/darwin/defines.txt b/project/cmake/platform/osx/defines.txt
index 33b009e..33b009e 100644
--- a/project/cmake/platform/darwin/defines.txt
+++ b/project/cmake/platform/osx/defines.txt
diff --git a/project/cmake/scripts/android/archsetup.cmake b/project/cmake/scripts/android/archsetup.cmake
new file mode 100644
index 0000000..86c0f6a
--- /dev/null
+++ b/project/cmake/scripts/android/archsetup.cmake
@@ -0,0 +1,30 @@
1if(NOT CMAKE_TOOLCHAIN_FILE)
2 message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for android. See ${PROJECT_SOURCE_DIR}/README.md")
3endif()
4
5set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -DTARGET_ANDROID)
6set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED
7 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
8set(PLATFORM_DIR linux)
9if(WITH_ARCH)
10 set(ARCH ${WITH_ARCH})
11else()
12 if(CPU STREQUAL armeabi-v7a)
13 set(ARCH arm-linux-androideabi)
14 elseif(CPU STREQUAL i686)
15 set(ARCH i686-linux-android)
16 else()
17 message(SEND_ERROR "Unknown CPU: ${CPU}")
18 endif()
19endif()
20
21set(FFMPEG_OPTS --enable-cross-compile --cpu=cortex-a9 --arch=arm --target-os=linux --enable-neon
22 --disable-vdpau --cc=${CMAKE_C_COMPILER} --host-cc=${CMAKE_C_COMPILER}
23 --strip=${CMAKE_STRIP})
24set(ENABLE_SDL OFF)
25set(ENABLE_X11 OFF)
26set(ENABLE_EGL ON)
27set(ENABLE_AML ON)
28set(ENABLE_OPTICAL OFF)
29
30list(APPEND DEPLIBS android log jnigraphics)
diff --git a/project/cmake/scripts/android/install.cmake b/project/cmake/scripts/android/install.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/cmake/scripts/android/install.cmake
diff --git a/project/cmake/scripts/android/macros.cmake b/project/cmake/scripts/android/macros.cmake
new file mode 120000
index 0000000..28c77ca
--- /dev/null
+++ b/project/cmake/scripts/android/macros.cmake
@@ -0,0 +1 @@
../linux/macros.cmake \ No newline at end of file
diff --git a/project/cmake/scripts/android/pathsetup.cmake b/project/cmake/scripts/android/pathsetup.cmake
new file mode 120000
index 0000000..26d7f17
--- /dev/null
+++ b/project/cmake/scripts/android/pathsetup.cmake
@@ -0,0 +1 @@
../linux/pathsetup.cmake \ No newline at end of file
diff --git a/project/cmake/scripts/common/addon-helpers.cmake b/project/cmake/scripts/common/addon-helpers.cmake
index b94df2a..9541df4 100644
--- a/project/cmake/scripts/common/addon-helpers.cmake
+++ b/project/cmake/scripts/common/addon-helpers.cmake
@@ -10,13 +10,23 @@ add_custom_target(addon-package
10 COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target package) 10 COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target package)
11 11
12macro(add_cpack_workaround target version ext) 12macro(add_cpack_workaround target version ext)
13 if(NOT PACKAGE_DIR)
14 set(PACKAGE_DIR "${CMAKE_INSTALL_PREFIX}/zips")
15 endif()
16
13 add_custom_command(TARGET addon-package PRE_BUILD 17 add_custom_command(TARGET addon-package PRE_BUILD
14 COMMAND ${CMAKE_COMMAND} -E rename addon-${target}-${version}.${ext} ${target}-${version}.${ext}) 18 COMMAND ${CMAKE_COMMAND} -E make_directory ${PACKAGE_DIR}
19 COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_PACKAGE_DIRECTORY}/addon-${target}-${version}.${ext} ${PACKAGE_DIR}/${target}-${version}.${ext})
15endmacro() 20endmacro()
16 21
17# Grab the version from a given add-on's addon.xml 22# Grab the version from a given add-on's addon.xml
18macro (addon_version dir prefix) 23macro (addon_version dir prefix)
19 FILE(READ ${dir}/addon.xml ADDONXML) 24 IF(EXISTS ${PROJECT_SOURCE_DIR}/${dir}/addon.xml.in)
25 FILE(READ ${PROJECT_SOURCE_DIR}/${dir}/addon.xml.in ADDONXML)
26 ELSE()
27 FILE(READ ${dir}/addon.xml ADDONXML)
28 ENDIF()
29
20 STRING(REGEX MATCH "<addon[^>]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML}) 30 STRING(REGEX MATCH "<addon[^>]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML})
21 STRING(REGEX REPLACE ".*version=.([0-9\\.]+).*" "\\1" ${prefix}_VERSION ${VERSION_STRING}) 31 STRING(REGEX REPLACE ".*version=.([0-9\\.]+).*" "\\1" ${prefix}_VERSION ${VERSION_STRING})
22 message(STATUS ${prefix}_VERSION=${${prefix}_VERSION}) 32 message(STATUS ${prefix}_VERSION=${${prefix}_VERSION})
@@ -34,6 +44,25 @@ macro (build_addon target prefix libs)
34 SET_TARGET_PROPERTIES(${target} PROPERTIES PREFIX "lib") 44 SET_TARGET_PROPERTIES(${target} PROPERTIES PREFIX "lib")
35 ENDIF(OS STREQUAL "android") 45 ENDIF(OS STREQUAL "android")
36 46
47 # get the library's location
48 SET(LIBRARY_LOCATION $<TARGET_FILE:${target}>)
49 # get the library's filename
50 if("${CORE_SYSTEM_NAME}" STREQUAL "android")
51 # for android we need the filename without any version numbers
52 set(LIBRARY_FILENAME $<TARGET_LINKER_FILE_NAME:${target}>)
53 else()
54 SET(LIBRARY_FILENAME $<TARGET_FILE_NAME:${target}>)
55 endif()
56
57 # if there's an addon.xml.in we need to generate the addon.xml
58 IF(EXISTS ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in)
59 SET(PLATFORM ${CORE_SYSTEM_NAME})
60
61 FILE(READ ${PROJECT_SOURCE_DIR}/${target}/addon.xml.in addon_file)
62 STRING(CONFIGURE "${addon_file}" addon_file_conf @ONLY)
63 FILE(GENERATE OUTPUT ${PROJECT_SOURCE_DIR}/${target}/addon.xml CONTENT "${addon_file_conf}")
64 ENDIF()
65
37 # set zip as default if addon-package is called without PACKAGE_XXX 66 # set zip as default if addon-package is called without PACKAGE_XXX
38 SET(CPACK_GENERATOR "ZIP") 67 SET(CPACK_GENERATOR "ZIP")
39 SET(ext "zip") 68 SET(ext "zip")
@@ -51,33 +80,62 @@ macro (build_addon target prefix libs)
51 set(CPACK_COMPONENTS_IGNORE_GROUPS 1) 80 set(CPACK_COMPONENTS_IGNORE_GROUPS 1)
52 list(APPEND CPACK_COMPONENTS_ALL ${target}-${${prefix}_VERSION}) 81 list(APPEND CPACK_COMPONENTS_ALL ${target}-${${prefix}_VERSION})
53 # Pack files together to create an archive 82 # Pack files together to create an archive
54 INSTALL(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION}) 83 INSTALL(DIRECTORY ${target} DESTINATION ./ COMPONENT ${target}-${${prefix}_VERSION} PATTERN "addon.xml.in" EXCLUDE)
55 IF(WIN32) 84 IF(WIN32)
56 # get the installation location for the addon's target 85 if(NOT CPACK_PACKAGE_DIRECTORY)
57 get_property(dll_location TARGET ${target} PROPERTY LOCATION) 86 # determine the temporary path
87 file(TO_CMAKE_PATH "$ENV{TEMP}" WIN32_TEMP_PATH)
88 string(LENGTH "${WIN32_TEMP_PATH}" WIN32_TEMP_PATH_LENGTH)
89 string(LENGTH "${PROJECT_BINARY_DIR}" PROJECT_BINARY_DIR_LENGTH)
90
91 # check if the temporary path is shorter than the default packaging directory path
92 if(WIN32_TEMP_PATH_LENGTH GREATER 0 AND WIN32_TEMP_PATH_LENGTH LESS PROJECT_BINARY_DIR_LENGTH)
93 # set the directory used by CPack for packaging to the temp directory
94 set(CPACK_PACKAGE_DIRECTORY ${WIN32_TEMP_PATH})
95 endif()
96 endif()
97
58 # in case of a VC++ project the installation location contains a $(Configuration) VS variable 98 # in case of a VC++ project the installation location contains a $(Configuration) VS variable
59 # we replace it with ${CMAKE_BUILD_TYPE} (which doesn't cover the case when the build configuration 99 # we replace it with ${CMAKE_BUILD_TYPE} (which doesn't cover the case when the build configuration
60 # is changed within Visual Studio) 100 # is changed within Visual Studio)
61 string(REPLACE "$(Configuration)" "${CMAKE_BUILD_TYPE}" dll_location "${dll_location}") 101 string(REPLACE "$(Configuration)" "${CMAKE_BUILD_TYPE}" LIBRARY_LOCATION "${LIBRARY_LOCATION}")
62 102
63 # install the generated DLL file 103 # install the generated DLL file
64 INSTALL(PROGRAMS ${dll_location} DESTINATION ${target} 104 INSTALL(PROGRAMS ${LIBRARY_LOCATION} DESTINATION ${target}
65 COMPONENT ${target}-${${prefix}_VERSION}) 105 COMPONENT ${target}-${${prefix}_VERSION})
66 106
67 IF(CMAKE_BUILD_TYPE MATCHES Debug) 107 IF(CMAKE_BUILD_TYPE MATCHES Debug)
68 # for debug builds also install the PDB file 108 # for debug builds also install the PDB file
69 get_filename_component(dll_directory ${dll_location} DIRECTORY) 109 get_filename_component(LIBRARY_DIR ${LIBRARY_LOCATION} DIRECTORY)
70 INSTALL(FILES ${dll_directory}/${target}.pdb DESTINATION ${target} 110 INSTALL(FILES ${LIBRARY_DIR}/${target}.pdb DESTINATION ${target}
71 COMPONENT ${target}-${${prefix}_VERSION}) 111 COMPONENT ${target}-${${prefix}_VERSION})
72 ENDIF() 112 ENDIF()
73 ELSE(WIN32) 113 ELSE(WIN32)
114 if(NOT CPACK_PACKAGE_DIRECTORY)
115 set(CPACK_PACKAGE_DIRECTORY ${CMAKE_BINARY_DIR})
116 endif()
74 INSTALL(TARGETS ${target} DESTINATION ${target} 117 INSTALL(TARGETS ${target} DESTINATION ${target}
75 COMPONENT ${target}-${${prefix}_VERSION}) 118 COMPONENT ${target}-${${prefix}_VERSION})
76 ENDIF(WIN32) 119 ENDIF(WIN32)
77 add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext}) 120 add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext})
78 ELSE(PACKAGE_ZIP OR PACKAGE_TGZ) 121 ELSE(PACKAGE_ZIP OR PACKAGE_TGZ)
79 INSTALL(TARGETS ${target} DESTINATION lib/kodi/addons/${target}) 122 if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
80 INSTALL(DIRECTORY ${target} DESTINATION share/kodi/addons) 123 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT OR NOT CMAKE_INSTALL_PREFIX)
124 message(STATUS "setting install paths to match ${APP_NAME}: CMAKE_INSTALL_PREFIX: ${${APP_NAME_UC}_PREFIX}")
125 set(CMAKE_INSTALL_PREFIX "${${APP_NAME_UC}_PREFIX}" CACHE PATH "${APP_NAME} install prefix" FORCE)
126 set(CMAKE_INSTALL_LIBDIR "${${APP_NAME_UC}_LIB_DIR}" CACHE PATH "${APP_NAME} install libdir" FORCE)
127 elseif(NOT CMAKE_INSTALL_PREFIX STREQUAL "${${APP_NAME_UC}_PREFIX}" AND NOT OVERRIDE_PATHS)
128 message(FATAL_ERROR "CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} differs from ${APP_NAME} prefix ${${APP_NAME_UC}_PREFIX}. Please pass -DOVERRIDE_PATHS=1 to skip this check")
129 else()
130 if(NOT CMAKE_INSTALL_LIBDIR)
131 set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/lib/${APP_NAME_LC}")
132 endif()
133 endif()
134 else()
135 set(CMAKE_INSTALL_LIBDIR "lib/${APP_NAME_LC}")
136 endif()
137 INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target})
138 INSTALL(DIRECTORY ${target} DESTINATION share/${APP_NAME_LC}/addons PATTERN "addon.xml.in" EXCLUDE)
81 ENDIF(PACKAGE_ZIP OR PACKAGE_TGZ) 139 ENDIF(PACKAGE_ZIP OR PACKAGE_TGZ)
82endmacro() 140endmacro()
83 141
diff --git a/project/cmake/scripts/common/archsetup.cmake b/project/cmake/scripts/common/archsetup.cmake
new file mode 100644
index 0000000..dff5558
--- /dev/null
+++ b/project/cmake/scripts/common/archsetup.cmake
@@ -0,0 +1,99 @@
1# This script configures the build for a given architecture.
2# Flags and stringified arch is set up.
3# General compiler tests belongs here.
4#
5# On return, the following variables are set:
6# CMAKE_SYSTEM_NAME - a lowercased system name
7# CPU - the CPU on the target
8# ARCH - the system architecture
9# ARCH_DEFINES - list of compiler definitions for this architecture
10# SYSTEM_DEFINES - list of compiler definitions for this system
11# DEP_DEFINES - compiler definitions for system dependencies (e.g. LIRC)
12# + the results of compiler tests etc.
13
14include(CheckCXXSourceCompiles)
15include(CheckSymbolExists)
16include(CheckFunctionExists)
17
18# Macro to check if a given type exists in a given header
19# Arguments:
20# header the header to check
21# type the type to check for existence
22# var the compiler definition to set if type exists
23# On return:
24# If type was found, the definition is added to SYSTEM_DEFINES
25macro(check_type header type var)
26 check_cxx_source_compiles("#include <${header}>
27 int main()
28 {
29 ${type} s;
30 }" ${var})
31 if(${var})
32 list(APPEND SYSTEM_DEFINES -D${var}=1)
33 endif()
34endmacro()
35
36# Macro to check if a given builtin function exists
37# Arguments:
38# func the function to check
39# var the compiler definition to set if type exists
40# On return:
41# If type was found, the definition is added to SYSTEM_DEFINES
42macro(check_builtin func var)
43 check_cxx_source_compiles("
44 int main()
45 {
46 ${func};
47 }" ${var})
48 if(${var})
49 list(APPEND SYSTEM_DEFINES -D${var}=1)
50 endif()
51endmacro()
52
53
54# -------- Main script ---------
55message(STATUS "System type: ${CMAKE_SYSTEM_NAME}")
56if(NOT CORE_SYSTEM_NAME)
57 string(TOLOWER ${CMAKE_SYSTEM_NAME} CORE_SYSTEM_NAME)
58endif()
59
60if(WITH_CPU)
61 set(CPU ${WITH_CPU})
62elseif(NOT CMAKE_TOOLCHAIN_FILE)
63 set(CPU ${CMAKE_SYSTEM_PROCESSOR})
64endif()
65
66if(CMAKE_TOOLCHAIN_FILE)
67 if(NOT EXISTS "${CMAKE_TOOLCHAIN_FILE}")
68 message(FATAL_ERROR "Toolchain file ${CMAKE_TOOLCHAIN_FILE} does not exist.")
69 elseif(NOT DEPENDS_PATH OR NOT NATIVEPREFIX)
70 message(FATAL_ERROR "Toolchain did not define DEPENDS_PATH or NATIVEPREFIX. Possibly outdated depends.")
71 endif()
72endif()
73
74# Main cpp
75set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/posix/main.cpp)
76
77# system specific arch setup
78include(${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/archsetup.cmake)
79
80message(STATUS "Core system type: ${CORE_SYSTEM_NAME}")
81message(STATUS "Platform: ${PLATFORM}")
82message(STATUS "CPU: ${CPU}, ARCH: ${ARCH}")
83
84check_type(string std::u16string HAVE_STD__U16_STRING)
85check_type(string std::u32string HAVE_STD__U32_STRING)
86check_type(string char16_t HAVE_CHAR16_T)
87check_type(string char32_t HAVE_CHAR32_T)
88check_type(stdint.h uint_least16_t HAVE_STDINT_H)
89check_symbol_exists(posix_fadvise fcntl.h HAVE_POSIX_FADVISE)
90check_builtin("long* temp=0; long ret=__sync_add_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_ADD_AND_FETCH)
91check_builtin("long* temp=0; long ret=__sync_sub_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_SUB_AND_FETCH)
92check_builtin("long* temp=0; long ret=__sync_val_compare_and_swap(temp, 1, 1)" HAS_BUILTIN_SYNC_VAL_COMPARE_AND_SWAP)
93if(HAVE_POSIX_FADVISE)
94 list(APPEND SYSTEM_DEFINES -DHAVE_POSIX_FADVISE=1)
95endif()
96check_function_exists(localtime_r HAVE_LOCALTIME_R)
97if(HAVE_LOCALTIME_R)
98 list(APPEND SYSTEM_DEFINES -DHAVE_LOCALTIME_R=1)
99endif()
diff --git a/project/cmake/scripts/common/checkcommits.cmake b/project/cmake/scripts/common/checkcommits.cmake
new file mode 100644
index 0000000..304e623
--- /dev/null
+++ b/project/cmake/scripts/common/checkcommits.cmake
@@ -0,0 +1,75 @@
1find_package(Git REQUIRED)
2
3macro(sanity_check message)
4 if(status_code)
5 message(FATAL_ERROR "${message}")
6 endif()
7endmacro()
8
9# Check that there are no changes in working-tree
10execute_process(COMMAND ${GIT_EXECUTABLE} diff --quiet
11 RESULT_VARIABLE status_code)
12sanity_check("Cannot run with working tree changes. Commit, stash or drop them.")
13
14# Setup base of tests
15set(check_base $ENV{CHECK_BASE})
16if(NOT check_base)
17 set(check_base origin/master)
18endif()
19
20# Setup end of tests
21set(check_head $ENV{CHECK_HEAD})
22if(NOT check_head)
23 set(check_head HEAD)
24endif()
25
26# Setup target to build
27set(check_target $ENV{CHECK_TARGET})
28if(NOT check_target)
29 set(check_target check)
30endif()
31
32# Build threads
33set(build_threads $ENV{CHECK_THREADS})
34if(NOT build_threads)
35 if(UNIX)
36 execute_process(COMMAND nproc
37 OUTPUT_VARIABLE build_threads)
38 string(REGEX REPLACE "(\r?\n)+$" "" build_threads "${build_threads}")
39 endif()
40endif()
41
42# Record current HEAD
43execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
44 OUTPUT_VARIABLE current_branch)
45
46string(REGEX REPLACE "(\r?\n)+$" "" current_branch "${current_branch}")
47
48# Grab revision list
49execute_process(COMMAND ${GIT_EXECUTABLE} rev-list ${check_base}..${check_head} --reverse
50 OUTPUT_VARIABLE rev_list)
51
52string(REPLACE "\n" ";" rev_list ${rev_list})
53foreach(rev ${rev_list})
54 # Checkout
55 message("Testing revision ${rev}")
56 execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${rev}
57 RESULT_VARIABLE status_code)
58 sanity_check("Failed to checkout ${rev}")
59
60 # Build
61 if(build_threads GREATER 2)
62 execute_process(COMMAND ${CMAKE_COMMAND} "--build" "${CMAKE_BINARY_DIR}" "--target" "${check_target}" "--use-stderr" "--" "-j${build_threads}"
63 RESULT_VARIABLE status_code)
64 else()
65 execute_process(COMMAND ${CMAKE_COMMAND} "--build" "${CMAKE_BINARY_DIR}" "--target" "${check_target}" "--use-stderr"
66 RESULT_VARIABLE status_code)
67 endif()
68 if(status_code)
69 execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${current_branch})
70 endif()
71 sanity_check("Failed to build target for revision ${rev}")
72endforeach()
73
74message("Everything checks out fine")
75execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${current_branch})
diff --git a/project/cmake/scripts/common/generateversionedfiles.cmake b/project/cmake/scripts/common/generateversionedfiles.cmake
new file mode 100644
index 0000000..9a4080a
--- /dev/null
+++ b/project/cmake/scripts/common/generateversionedfiles.cmake
@@ -0,0 +1,13 @@
1include(${CORE_SOURCE_DIR}/project/cmake/scripts/common/macros.cmake)
2
3core_find_versions()
4file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/addons/xbmc.addon)
5file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/addons/kodi.guilib)
6configure_file(${CORE_SOURCE_DIR}/addons/xbmc.addon/addon.xml.in
7 ${CMAKE_BINARY_DIR}/addons/xbmc.addon/addon.xml @ONLY)
8configure_file(${CORE_SOURCE_DIR}/addons/kodi.guilib/addon.xml.in
9 ${CMAKE_BINARY_DIR}/addons/kodi.guilib/addon.xml @ONLY)
10configure_file(${CORE_SOURCE_DIR}/xbmc/CompileInfo.cpp.in
11 ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp @ONLY)
12set(prefix ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR})
13set(APP_LIBDIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/kodi)
diff --git a/project/cmake/scripts/common/generatorsetup.cmake b/project/cmake/scripts/common/generatorsetup.cmake
new file mode 100644
index 0000000..75083ca
--- /dev/null
+++ b/project/cmake/scripts/common/generatorsetup.cmake
@@ -0,0 +1,24 @@
1# Configure single-/multiconfiguration generators and variables
2#
3# CORE_BUILD_CONFIG that is set to
4# - CMAKE_BUILD_TYPE for single configuration generators such as make, nmake
5# - a variable that expands on build time to the current configuration for
6# multi configuration generators such as VS or Xcode
7if(CMAKE_CONFIGURATION_TYPES)
8 if(CMAKE_BUILD_TYPE)
9 message(FATAL_ERROR "CMAKE_BUILD_TYPE must not be defined for multi-configuration generators")
10 endif()
11 set(CORE_BUILD_CONFIG ${CMAKE_CFG_INTDIR})
12 message(STATUS "Generator: Multi-configuration (${CMAKE_GENERATOR})")
13else()
14 if(CMAKE_BUILD_TYPE)
15 set(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}
16 CACHE STRING "Choose build type (${CMAKE_BUILD_TYPES})" FORCE)
17 else()
18 # Set default
19 set(CMAKE_BUILD_TYPE Release
20 CACHE STRING "Choose build type (${CMAKE_BUILD_TYPES})" FORCE)
21 endif()
22 set(CORE_BUILD_CONFIG ${CMAKE_BUILD_TYPE})
23 message(STATUS "Generator: Single-configuration: ${CMAKE_BUILD_TYPE} (${CMAKE_GENERATOR})")
24endif()
diff --git a/project/cmake/scripts/common/macros.cmake b/project/cmake/scripts/common/macros.cmake
new file mode 100644
index 0000000..dd2233b
--- /dev/null
+++ b/project/cmake/scripts/common/macros.cmake
@@ -0,0 +1,373 @@
1# This script holds the main functions used to construct the build system
2
3# include system specific macros
4include(${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/macros.cmake)
5
6# Add a library, optionally as a dependency of the main application
7# Arguments:
8# name name of the library to add
9# Optional Arguments:
10# NO_MAIN_DEPENDS if specified, the library is not added to main depends
11# Implicit arguments:
12# SOURCES the sources of the library
13# HEADERS the headers of the library (only for IDE support)
14# OTHERS other library related files (only for IDE support)
15# On return:
16# Library will be built, optionally added to ${core_DEPENDS}
17function(core_add_library name)
18 cmake_parse_arguments(arg "NO_MAIN_DEPENDS" "" "" ${ARGN})
19 add_library(${name} STATIC ${SOURCES} ${HEADERS} ${OTHERS})
20 set_target_properties(${name} PROPERTIES PREFIX "")
21 if(NOT arg_NO_MAIN_DEPENDS)
22 set(core_DEPENDS ${name} ${core_DEPENDS} CACHE STRING "" FORCE)
23 endif()
24
25 # Add precompiled headers to Kodi main libraries
26 if(WIN32 AND "${CMAKE_CURRENT_LIST_DIR}" MATCHES "^${CORE_SOURCE_DIR}/xbmc")
27 add_precompiled_header(${name} pch.h ${CORE_SOURCE_DIR}/xbmc/win32/pch.cpp
28 PCH_TARGET kodi)
29 endif()
30
31 # IDE support
32 if(CMAKE_GENERATOR MATCHES "Xcode")
33 file(RELATIVE_PATH parentfolder ${CORE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..)
34 set_target_properties(${name} PROPERTIES FOLDER "${parentfolder}")
35 elseif(CMAKE_GENERATOR MATCHES "Visual Studio")
36 file(RELATIVE_PATH foldername ${CORE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
37 set_target_properties(${name} PROPERTIES FOLDER "${foldername}")
38 source_group(" " REGULAR_EXPRESSION ".*")
39 endif()
40endfunction()
41
42# Add a test library, and add sources to list for gtest integration macros
43function(core_add_test_library name)
44 core_add_library(${name} NO_MAIN_DEPENDS)
45 set_target_properties(${name} PROPERTIES EXCLUDE_FROM_ALL 1)
46 foreach(src ${SOURCES})
47 set(test_sources ${CMAKE_CURRENT_SOURCE_DIR}/${src} ${test_sources} CACHE STRING "" FORCE)
48 endforeach()
49 set(test_archives ${test_archives} ${name} CACHE STRING "" FORCE)
50endfunction()
51
52# Add a data file to installation list with a mirror in build tree
53# Arguments:
54# file full path to file to mirror
55# relative the relative base of file path in the build/install tree
56# give another parameter to exclude from install target
57# Implicit arguments:
58# CORE_SOURCE_DIR - root of source tree
59# On return:
60# file is added to ${install_data} and mirrored in build tree
61function(copy_file_to_buildtree file relative)
62 if(NOT WIN32)
63 string(REPLACE "\(" "\\(" file ${file})
64 string(REPLACE "\)" "\\)" file ${file})
65 endif()
66 string(REPLACE "${relative}/" "" outfile ${file})
67
68 if(NOT TARGET export-files)
69 add_custom_target(export-files ALL COMMENT "Copying files into build tree")
70 endif()
71 if(NOT ${CORE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR})
72 if(VERBOSE)
73 message(STATUS "copy_file_to_buildtree - copying file: ${file} -> ${CMAKE_CURRENT_BINARY_DIR}/${outfile}")
74 endif()
75 add_custom_command(TARGET export-files COMMAND ${CMAKE_COMMAND} -E copy_if_different "${file}" "${CMAKE_CURRENT_BINARY_DIR}/${outfile}")
76 endif()
77 if(NOT ARGN)
78 list(APPEND install_data ${outfile})
79 set(install_data ${install_data} PARENT_SCOPE)
80 endif()
81endfunction()
82
83# add data files to installation list with a mirror in build tree.
84# reads list of files to install from a given list of text files.
85# Arguments:
86# pattern globbing pattern for text files to read
87# give another parameter to exclude from installation target
88# Implicit arguments:
89# CORE_SOURCE_DIR - root of source tree
90# On return:
91# files are added to ${install_data} and mirrored in build tree
92function(copy_files_from_filelist_to_buildtree pattern)
93 foreach(arg ${ARGN})
94 list(APPEND pattern ${arg})
95 endforeach()
96 # copies files listed in text files to the buildtree
97 # Input: [glob pattern: filepattern]
98 list(SORT pattern)
99 if(VERBOSE)
100 message(STATUS "copy_files_from_filelist_to_buildtree - got pattern: ${pattern}")
101 endif()
102 foreach(pat ${pattern})
103 file(GLOB filenames ${pat})
104 foreach(filename ${filenames})
105 string(STRIP ${filename} filename)
106 core_file_read_filtered(fstrings ${filename})
107 foreach(dir ${fstrings})
108 file(GLOB_RECURSE files RELATIVE ${CORE_SOURCE_DIR} ${CORE_SOURCE_DIR}/${dir})
109 foreach(file ${files})
110 if(ARGN)
111 copy_file_to_buildtree(${CORE_SOURCE_DIR}/${file} ${CORE_SOURCE_DIR} 1)
112 else()
113 copy_file_to_buildtree(${CORE_SOURCE_DIR}/${file} ${CORE_SOURCE_DIR})
114 endif()
115 endforeach()
116 endforeach()
117 endforeach()
118 endforeach()
119 set(install_data ${install_data} PARENT_SCOPE)
120endfunction()
121
122# helper macro to set modified variables in parent scope
123macro(export_dep)
124 set(SYSTEM_INCLUDES ${SYSTEM_INCLUDES} PARENT_SCOPE)
125 set(DEPLIBS ${DEPLIBS} PARENT_SCOPE)
126 set(DEP_DEFINES ${DEP_DEFINES} PARENT_SCOPE)
127 set(${depup}_FOUND ${${depup}_FOUND} PARENT_SCOPE)
128 mark_as_advanced(${depup}_LIBRARIES)
129endmacro()
130
131# add a required dependency of main application
132# Arguments:
133# dep name of find rule for dependency, used uppercased for variable prefix
134# On return:
135# dependency added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES}
136function(core_require_dep dep)
137 find_package(${dep} REQUIRED)
138 string(TOUPPER ${dep} depup)
139 list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS})
140 list(APPEND DEPLIBS ${${depup}_LIBRARIES})
141 list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS})
142 export_dep()
143endfunction()
144
145# add a required dyloaded dependency of main application
146# Arguments:
147# dep name of find rule for dependency, used uppercased for variable prefix
148# On return:
149# dependency added to ${SYSTEM_INCLUDES}, ${dep}_SONAME is set up
150function(core_require_dyload_dep dep)
151 find_package(${dep} REQUIRED)
152 string(TOUPPER ${dep} depup)
153 list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS})
154 list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS})
155 find_soname(${depup} REQUIRED)
156 export_dep()
157 set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE)
158endfunction()
159
160# helper macro for optional deps
161macro(setup_enable_switch)
162 string(TOUPPER ${dep} depup)
163 if (ARGV1)
164 set(enable_switch ${ARGV1})
165 else()
166 set(enable_switch ENABLE_${depup})
167 endif()
168endmacro()
169
170# add an optional dependency of main application
171# Arguments:
172# dep name of find rule for dependency, used uppercased for variable prefix
173# On return:
174# dependency optionally added to ${SYSTEM_INCLUDES}, ${DEPLIBS} and ${DEP_DEFINES}
175function(core_optional_dep dep)
176 setup_enable_switch()
177 if(${enable_switch})
178 find_package(${dep})
179 if(${depup}_FOUND)
180 list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS})
181 list(APPEND DEPLIBS ${${depup}_LIBRARIES})
182 list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS})
183 set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE)
184 export_dep()
185 else()
186 set(final_message ${final_message} "${depup} enabled: No" PARENT_SCOPE)
187 endif()
188 endif()
189endfunction()
190
191# add an optional dyloaded dependency of main application
192# Arguments:
193# dep name of find rule for dependency, used uppercased for variable prefix
194# On return:
195# dependency optionally added to ${SYSTEM_INCLUDES}, ${DEP_DEFINES}, ${dep}_SONAME is set up
196function(core_optional_dyload_dep dep)
197 setup_enable_switch()
198 if(${enable_switch})
199 find_package(${dep})
200 if(${depup}_FOUND)
201 list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS})
202 find_soname(${depup} REQUIRED)
203 list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS})
204 set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE)
205 export_dep()
206 set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE)
207 endif()
208 endif()
209endfunction()
210
211function(core_file_read_filtered result filepattern)
212 # Reads STRINGS from text files
213 # with comments filtered out
214 # Result: [list: result]
215 # Input: [glob pattern: filepattern]
216 file(GLOB filenames ${filepattern})
217 list(SORT filenames)
218 foreach(filename ${filenames})
219 if(VERBOSE)
220 message(STATUS "core_file_read_filtered - filename: ${filename}")
221 endif()
222 file(STRINGS ${filename} fstrings REGEX "^[^#//]")
223 foreach(fstring ${fstrings})
224 string(REGEX REPLACE "^(.*)#(.*)" "\\1" fstring ${fstring})
225 string(REGEX REPLACE "//.*" "" fstring ${fstring})
226 string(STRIP ${fstring} fstring)
227 list(APPEND filename_strings ${fstring})
228 endforeach()
229 endforeach()
230 set(${result} ${filename_strings} PARENT_SCOPE)
231endfunction()
232
233function(core_add_subdirs_from_filelist files)
234 # Adds subdirectories from a sorted list of files
235 # Input: [list: filenames] [bool: sort]
236 foreach(arg ${ARGN})
237 list(APPEND files ${arg})
238 endforeach()
239 list(SORT files)
240 if(VERBOSE)
241 message(STATUS "core_add_subdirs_from_filelist - got pattern: ${files}")
242 endif()
243 foreach(filename ${files})
244 string(STRIP ${filename} filename)
245 core_file_read_filtered(fstrings ${filename})
246 foreach(subdir ${fstrings})
247 STRING_SPLIT(subdir " " ${subdir})
248 list(GET subdir 0 subdir_src)
249 list(GET subdir -1 subdir_dest)
250 if(VERBOSE)
251 message(STATUS " core_add_subdirs_from_filelist - adding subdir: ${CORE_SOURCE_DIR}${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}")
252 endif()
253 add_subdirectory(${CORE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest})
254 endforeach()
255 endforeach()
256endfunction()
257
258macro(core_add_optional_subdirs_from_filelist pattern)
259 # Adds subdirectories from text files
260 # if the option(s) in the 3rd field are enabled
261 # Input: [glob pattern: filepattern]
262 foreach(arg ${ARGN})
263 list(APPEND pattern ${arg})
264 endforeach()
265 foreach(elem ${pattern})
266 string(STRIP ${elem} elem)
267 list(APPEND filepattern ${elem})
268 endforeach()
269
270 file(GLOB filenames ${filepattern})
271 list(SORT filenames)
272 if(VERBOSE)
273 message(STATUS "core_add_optional_subdirs_from_filelist - got pattern: ${filenames}")
274 endif()
275
276 foreach(filename ${filenames})
277 if(VERBOSE)
278 message(STATUS "core_add_optional_subdirs_from_filelist - reading file: ${filename}")
279 endif()
280 file(STRINGS ${filename} fstrings REGEX "^[^#//]")
281 foreach(line ${fstrings})
282 string(REPLACE " " ";" line "${line}")
283 list(GET line 0 subdir_src)
284 list(GET line 1 subdir_dest)
285 list(GET line 3 opts)
286 foreach(opt ${opts})
287 if(ENABLE_${opt})
288 if(VERBOSE)
289 message(STATUS " core_add_optional_subdirs_from_filelist - adding subdir: ${CORE_SOURCE_DIR}${subdir_src} -> ${CORE_BUILD_DIR}/${subdir_dest}")
290 endif()
291 add_subdirectory(${CORE_SOURCE_DIR}/${subdir_src} ${CORE_BUILD_DIR}/${subdir_dest})
292 else()
293 if(VERBOSE)
294 message(STATUS " core_add_optional_subdirs_from_filelist: OPTION ${opt} not enabled for ${subdir_src}, skipping subdir")
295 endif()
296 endif()
297 endforeach()
298 endforeach()
299 endforeach()
300endmacro()
301
302macro(today RESULT)
303 if (WIN32)
304 execute_process(COMMAND "cmd" " /C date /T" OUTPUT_VARIABLE ${RESULT})
305 string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}})
306 elseif(UNIX)
307 execute_process(COMMAND date -u +%F
308 OUTPUT_VARIABLE ${RESULT})
309 string(REGEX REPLACE "(..)/(..)/..(..).*" "\\1/\\2/\\3" ${RESULT} ${${RESULT}})
310 else()
311 message(SEND_ERROR "date not implemented")
312 set(${RESULT} 000000)
313 endif()
314 string(REGEX REPLACE "(\r?\n)+$" "" ${RESULT} "${${RESULT}}")
315endmacro()
316
317function(core_find_git_rev)
318 if(EXISTS ${CORE_SOURCE_DIR}/VERSION)
319 file(STRINGS ${CORE_SOURCE_DIR}/VERSION VERSION_FILE)
320 string(SUBSTRING "${VERSION_FILE}" 1 16 GIT_REV)
321 else()
322 find_package(Git)
323 if(GIT_FOUND AND EXISTS ${CORE_SOURCE_DIR}/.git)
324 execute_process(COMMAND ${GIT_EXECUTABLE} diff-files --ignore-submodules --quiet --
325 RESULT_VARIABLE status_code
326 WORKING_DIRECTORY ${CORE_SOURCE_DIR})
327 if (NOT status_code)
328 execute_process(COMMAND ${GIT_EXECUTABLE} diff-index --cached --ignore-submodules --quiet HEAD --
329 RESULT_VARIABLE status_code
330 WORKING_DIRECTORY ${CORE_SOURCE_DIR})
331 endif()
332 today(DATE)
333 execute_process(COMMAND ${GIT_EXECUTABLE} --no-pager log --abbrev=7 -n 1
334 --pretty=format:"%h-dirty" HEAD
335 OUTPUT_VARIABLE LOG_UNFORMATTED
336 WORKING_DIRECTORY ${CORE_SOURCE_DIR})
337 string(SUBSTRING ${LOG_UNFORMATTED} 1 7 HASH)
338 else()
339 execute_process(COMMAND ${GIT_EXECUTABLE} --no-pager log --abbrev=7 -n 1
340 --pretty=format:"%h %cd" HEAD
341 OUTPUT_VARIABLE LOG_UNFORMATTED
342 WORKING_DIRECTORY ${CORE_SOURCE_DIR})
343 string(SUBSTRING ${LOG_UNFORMATTED} 1 7 HASH)
344 string(SUBSTRING ${LOG_UNFORMATTED} 9 10 DATE)
345 string(REPLACE "-" "" DATE ${DATE})
346 endif()
347 set(GIT_REV "${DATE}-${HASH}")
348 endif()
349 if(GIT_REV)
350 set(APP_SCMID ${GIT_REV} PARENT_SCOPE)
351 endif()
352endfunction()
353
354macro(core_find_versions)
355 include(CMakeParseArguments)
356 core_file_read_filtered(version_list ${CORE_SOURCE_DIR}/version.txt)
357 string(REPLACE " " ";" version_list "${version_list}")
358 cmake_parse_arguments(APP "" "VERSION_MAJOR;VERSION_MINOR;VERSION_TAG;VERSION_CODE;ADDON_API;APP_NAME;COMPANY_NAME" "" ${version_list})
359
360 set(APP_NAME ${APP_APP_NAME}) # inconsistency in upstream
361 string(TOLOWER ${APP_APP_NAME} APP_NAME_LC)
362 set(COMPANY_NAME ${APP_COMPANY_NAME})
363 set(APP_VERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR})
364 if(APP_VERSION_TAG)
365 set(APP_VERSION ${APP_VERSION}-${APP_VERSION_TAG})
366 endif()
367 string(REPLACE "." "," FILE_VERSION ${APP_ADDON_API}.0)
368 string(TOLOWER ${APP_VERSION_TAG} APP_VERSION_TAG_LC)
369 file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version REGEX "^.*GUILIB_API_VERSION (.*)$")
370 string(REGEX REPLACE ".*\"(.*)\"" "\\1" guilib_version ${guilib_version})
371 file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version_min REGEX "^.*GUILIB_MIN_API_VERSION (.*)$")
372 string(REGEX REPLACE ".*\"(.*)\"" "\\1" guilib_version_min ${guilib_version_min})
373endmacro()
diff --git a/project/cmake/scripts/common/managestring.cmake b/project/cmake/scripts/common/managestring.cmake
new file mode 100644
index 0000000..7321f4c
--- /dev/null
+++ b/project/cmake/scripts/common/managestring.cmake
@@ -0,0 +1,235 @@
1# - Collection of String utility macros.
2# Defines the following macros:
3# STRING_TRIM(var str [NOUNQUOTE])
4# - Trim a string by removing the leading and trailing spaces,
5# just like STRING(STRIP ...) in CMake 2.6 and later.
6# This macro is needed as CMake 2.4 does not support STRING(STRIP ..)
7# This macro also remove quote and double quote marks around the string,
8# unless NOUNQUOTE is defined.
9# * Parameters:
10# + var: A variable that stores the result.
11# + str: A string.
12# + NOUNQUOTE: (Optional) do not remove the double quote mark around the string.
13#
14# STRING_UNQUOTE(var str)
15# - Remove double quote marks and quote marks around a string.
16# If the string is not quoted, then it returns an empty string.
17# * Parameters:
18# + var: A variable that stores the result.
19# + str: A string.
20#
21# STRING_JOIN(var delimiter str_list [str...])
22# - Concatenate strings, with delimiter inserted between strings.
23# * Parameters:
24# + var: A variable that stores the result.
25# + str_list: A list of string.
26# + str: (Optional) more string to be join.
27#
28# STRING_SPLIT(var delimiter str [NOESCAPE_SEMICOLON])
29# - Split a string into a list using a delimiter, which can be in 1 or more
30# characters long.
31# * Parameters:
32# + var: A variable that stores the result.
33# + delimiter: To separate a string.
34# + str: A string.
35# + NOESCAPE_SEMICOLON: (Optional) Do not escape semicolons.
36#
37
38IF(NOT DEFINED _MANAGE_STRING_CMAKE_)
39 SET(_MANAGE_STRING_CMAKE_ "DEFINED")
40
41 MACRO(STRING_TRIM var str)
42 SET(${var} "")
43 IF (NOT "${ARGN}" STREQUAL "NOUNQUOTE")
44 # Need not trim a quoted string.
45 STRING_UNQUOTE(_var "${str}")
46 IF(NOT _var STREQUAL "")
47 # String is quoted
48 SET(${var} "${_var}")
49 ENDIF(NOT _var STREQUAL "")
50 ENDIF(NOT "${ARGN}" STREQUAL "NOUNQUOTE")
51
52 IF(${var} STREQUAL "")
53 SET(_var_1 "${str}")
54 STRING(REGEX REPLACE "^[ \t\r\n]+" "" _var_2 "${str}" )
55 STRING(REGEX REPLACE "[ \t\r\n]+$" "" _var_3 "${_var_2}" )
56 SET(${var} "${_var_3}")
57 ENDIF(${var} STREQUAL "")
58 ENDMACRO(STRING_TRIM var str)
59
60 # Internal macro
61 # Variable cannot be escaped here, as variable is already substituted
62 # at the time it passes to this macro.
63 MACRO(STRING_ESCAPE var str)
64 # ';' and '\' are tricky, need to be encoded.
65 # '#' => '#H'
66 # '\' => '#B'
67 # ';' => '#S'
68 SET(_NOESCAPE_SEMICOLON "")
69 SET(_NOESCAPE_HASH "")
70
71 FOREACH(_arg ${ARGN})
72 IF(${_arg} STREQUAL "NOESCAPE_SEMICOLON")
73 SET(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON")
74 ELSEIF(${_arg} STREQUAL "NOESCAPE_HASH")
75 SET(_NOESCAPE_HASH "NOESCAPE_HASH")
76 ENDIF(${_arg} STREQUAL "NOESCAPE_SEMICOLON")
77 ENDFOREACH(_arg)
78
79 IF(_NOESCAPE_HASH STREQUAL "")
80 STRING(REGEX REPLACE "#" "#H" _ret "${str}")
81 ELSE(_NOESCAPE_HASH STREQUAL "")
82 SET(_ret "${str}")
83 ENDIF(_NOESCAPE_HASH STREQUAL "")
84
85 STRING(REGEX REPLACE "\\\\" "#B" _ret "${_ret}")
86 IF(_NOESCAPE_SEMICOLON STREQUAL "")
87 STRING(REGEX REPLACE ";" "#S" _ret "${_ret}")
88 ENDIF(_NOESCAPE_SEMICOLON STREQUAL "")
89 SET(${var} "${_ret}")
90 ENDMACRO(STRING_ESCAPE var str)
91
92 MACRO(STRING_UNESCAPE var str)
93 # '#B' => '\'
94 # '#H' => '#'
95 # '#D' => '$'
96 # '#S' => ';'
97 SET(_ESCAPE_VARIABLE "")
98 SET(_NOESCAPE_SEMICOLON "")
99 SET(_ret "${str}")
100 FOREACH(_arg ${ARGN})
101 IF(${_arg} STREQUAL "NOESCAPE_SEMICOLON")
102 SET(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON")
103 ELSEIF(${_arg} STREQUAL "ESCAPE_VARIABLE")
104 SET(_ESCAPE_VARIABLE "ESCAPE_VARIABLE")
105 STRING(REGEX REPLACE "#D" "$" _ret "${_ret}")
106 ENDIF(${_arg} STREQUAL "NOESCAPE_SEMICOLON")
107 ENDFOREACH(_arg)
108
109 STRING(REGEX REPLACE "#B" "\\\\" _ret "${_ret}")
110 IF(_NOESCAPE_SEMICOLON STREQUAL "")
111 # ';' => '#S'
112 STRING(REGEX REPLACE "#S" "\\\\;" _ret "${_ret}")
113 ELSE(_NOESCAPE_SEMICOLON STREQUAL "")
114 STRING(REGEX REPLACE "#S" ";" _ret "${_ret}")
115 ENDIF(_NOESCAPE_SEMICOLON STREQUAL "")
116
117 IF(NOT _ESCAPE_VARIABLE STREQUAL "")
118 # '#D' => '$'
119 STRING(REGEX REPLACE "#D" "$" _ret "${_ret}")
120 ENDIF(NOT _ESCAPE_VARIABLE STREQUAL "")
121 STRING(REGEX REPLACE "#H" "#" _ret "${_ret}")
122 SET(${var} "${_ret}")
123 ENDMACRO(STRING_UNESCAPE var str)
124
125
126 MACRO(STRING_UNQUOTE var str)
127 STRING_ESCAPE(_ret "${str}" ${ARGN})
128 IF(_ret MATCHES "^[ \t\r\n]+")
129 STRING(REGEX REPLACE "^[ \t\r\n]+" "" _ret "${_ret}")
130 ENDIF(_ret MATCHES "^[ \t\r\n]+")
131 IF(_ret MATCHES "^\"")
132 # Double quote
133 STRING(REGEX REPLACE "\"\(.*\)\"[ \t\r\n]*$" "\\1" _ret "${_ret}")
134 ELSEIF(_ret MATCHES "^'")
135 # Single quote
136 STRING(REGEX REPLACE "'\(.*\)'[ \t\r\n]*$" "\\1" _ret "${_ret}")
137 ELSE(_ret MATCHES "^\"")
138 SET(_ret "")
139 ENDIF(_ret MATCHES "^\"")
140
141 # Unencoding
142 STRING_UNESCAPE(${var} "${_ret}" ${ARGN})
143 ENDMACRO(STRING_UNQUOTE var str)
144
145 MACRO(STRING_JOIN var delimiter str_list)
146 SET(_ret "")
147 FOREACH(_str ${str_list})
148 IF(_ret STREQUAL "")
149 SET(_ret "${_str}")
150 ELSE(_ret STREQUAL "")
151 SET(_ret "${_ret}${delimiter}${_str}")
152 ENDIF(_ret STREQUAL "")
153 ENDFOREACH(_str ${str_list})
154
155 FOREACH(_str ${ARGN})
156 IF(_ret STREQUAL "")
157 SET(_ret "${_str}")
158 ELSE(_ret STREQUAL "")
159 SET(_ret "${_ret}${delimiter}${_str}")
160 ENDIF(_ret STREQUAL "")
161 ENDFOREACH(_str ${str_list})
162 SET(${var} "${_ret}")
163 ENDMACRO(STRING_JOIN var delimiter str_list)
164
165 MACRO(STRING_SPLIT var delimiter str)
166 SET(_max_tokens "")
167 SET(_NOESCAPE_SEMICOLON "")
168 SET(_ESCAPE_VARIABLE "")
169 FOREACH(_arg ${ARGN})
170 IF(${_arg} STREQUAL "NOESCAPE_SEMICOLON")
171 SET(_NOESCAPE_SEMICOLON "NOESCAPE_SEMICOLON")
172 ELSEIF(${_arg} STREQUAL "ESCAPE_VARIABLE")
173 SET(_ESCAPE_VARIABLE "ESCAPE_VARIABLE")
174 ELSE(${_arg} STREQUAL "NOESCAPE_SEMICOLON")
175 SET(_max_tokens ${_arg})
176 ENDIF(${_arg} STREQUAL "NOESCAPE_SEMICOLON")
177 ENDFOREACH(_arg)
178
179 IF(NOT _max_tokens)
180 SET(_max_tokens -1)
181 ENDIF(NOT _max_tokens)
182
183 STRING_ESCAPE(_str "${str}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE})
184 STRING_ESCAPE(_delimiter "${delimiter}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE})
185
186 SET(_str_list "")
187 SET(_token_count 0)
188 STRING(LENGTH "${_delimiter}" _de_len)
189
190 WHILE(NOT _token_count EQUAL _max_tokens)
191 MATH(EXPR _token_count ${_token_count}+1)
192 IF(_token_count EQUAL _max_tokens)
193 # Last token, no need splitting
194 SET(_str_list ${_str_list} "${_str}")
195 ELSE(_token_count EQUAL _max_tokens)
196 # in case encoded characters are delimiters
197 STRING(LENGTH "${_str}" _str_len)
198 SET(_index 0)
199 SET(_token "")
200 SET(_str_remain "")
201 MATH(EXPR _str_end ${_str_len}-${_de_len}+1)
202 SET(_bound "k")
203 WHILE(_index LESS _str_end)
204 STRING(SUBSTRING "${_str}" ${_index} ${_de_len} _str_cursor)
205 IF(_str_cursor STREQUAL _delimiter)
206 # Get the token
207 STRING(SUBSTRING "${_str}" 0 ${_index} _token)
208 # Get the rest
209 MATH(EXPR _rest_index ${_index}+${_de_len})
210 MATH(EXPR _rest_len ${_str_len}-${_index}-${_de_len})
211 STRING(SUBSTRING "${_str}" ${_rest_index} ${_rest_len} _str_remain)
212 SET(_index ${_str_end})
213 ELSE(_str_cursor STREQUAL _delimiter)
214 MATH(EXPR _index ${_index}+1)
215 ENDIF(_str_cursor STREQUAL _delimiter)
216 ENDWHILE(_index LESS _str_end)
217
218 IF(_str_remain STREQUAL "")
219 # Meaning: end of string
220 LIST(APPEND _str_list "${_str}")
221 SET(_max_tokens ${_token_count})
222 ELSE(_str_remain STREQUAL "")
223 LIST(APPEND _str_list "${_token}")
224 SET(_str "${_str_remain}")
225 ENDIF(_str_remain STREQUAL "")
226 ENDIF(_token_count EQUAL _max_tokens)
227 ENDWHILE(NOT _token_count EQUAL _max_tokens)
228
229
230 # Unencoding
231 STRING_UNESCAPE(${var} "${_str_list}" ${_NOESCAPE_SEMICOLON} ${_ESCAPE_VARIABLE})
232 ENDMACRO(STRING_SPLIT var delimiter str)
233
234ENDIF(NOT DEFINED _MANAGE_STRING_CMAKE_)
235
diff --git a/project/cmake/scripts/common/pathsetup.cmake b/project/cmake/scripts/common/pathsetup.cmake
new file mode 100644
index 0000000..54b352d
--- /dev/null
+++ b/project/cmake/scripts/common/pathsetup.cmake
@@ -0,0 +1,3 @@
1# This script configures installation paths
2
3include(${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/pathsetup.cmake)
diff --git a/project/cmake/scripts/common/prepare-env.cmake b/project/cmake/scripts/common/prepare-env.cmake
index 3413c45..b9a39e7 100644
--- a/project/cmake/scripts/common/prepare-env.cmake
+++ b/project/cmake/scripts/common/prepare-env.cmake
@@ -12,6 +12,8 @@ if(EXISTS "${APP_ROOT}/version.txt")
12 set(${name} "${value}") 12 set(${name} "${value}")
13 endif() 13 endif()
14 endforeach() 14 endforeach()
15 string(TOLOWER ${APP_NAME} APP_NAME_LC)
16 string(TOUPPER ${APP_NAME} APP_NAME_UC)
15endif() 17endif()
16 18
17# bail if we can't parse versions 19# bail if we can't parse versions
@@ -19,16 +21,21 @@ if(NOT DEFINED APP_VERSION_MAJOR OR NOT DEFINED APP_VERSION_MINOR)
19 message(FATAL_ERROR "Could not determine app version! make sure that ${APP_ROOT}/version.txt exists") 21 message(FATAL_ERROR "Could not determine app version! make sure that ${APP_ROOT}/version.txt exists")
20endif() 22endif()
21 23
24# in case we need to download something, set KODI_MIRROR to the default if not alread set
25if(NOT DEFINED KODI_MIRROR)
26 set(KODI_MIRROR "http://mirrors.kodi.tv")
27endif()
28
22### copy all the addon binding header files to include/kodi 29### copy all the addon binding header files to include/kodi
23# make sure include/kodi exists and is empty 30# make sure include/kodi exists and is empty
24set(KODI_LIB_DIR ${DEPENDS_PATH}/lib/kodi) 31set(APP_LIB_DIR ${DEPENDS_PATH}/lib/${APP_NAME_LC})
25if(NOT EXISTS "${KODI_LIB_DIR}/") 32if(NOT EXISTS "${APP_LIB_DIR}/")
26 file(MAKE_DIRECTORY ${KODI_LIB_DIR}) 33 file(MAKE_DIRECTORY ${APP_LIB_DIR})
27endif() 34endif()
28 35
29set(KODI_INCLUDE_DIR ${DEPENDS_PATH}/include/kodi) 36set(APP_INCLUDE_DIR ${DEPENDS_PATH}/include/${APP_NAME_LC})
30if(NOT EXISTS "${KODI_INCLUDE_DIR}/") 37if(NOT EXISTS "${APP_INCLUDE_DIR}/")
31 file(MAKE_DIRECTORY ${KODI_INCLUDE_DIR}) 38 file(MAKE_DIRECTORY ${APP_INCLUDE_DIR})
32endif() 39endif()
33 40
34# we still need XBMC_INCLUDE_DIR and XBMC_LIB_DIR for backwards compatibility to xbmc 41# we still need XBMC_INCLUDE_DIR and XBMC_LIB_DIR for backwards compatibility to xbmc
@@ -49,13 +56,13 @@ if(NOT WIN32)
49 endif() 56 endif()
50endif() 57endif()
51 58
52# kodi-config.cmake.in (further down) expects a "prefix" variable
53get_filename_component(prefix "${DEPENDS_PATH}" ABSOLUTE)
54
55# generate the proper kodi-config.cmake file 59# generate the proper kodi-config.cmake file
56configure_file(${APP_ROOT}/project/cmake/kodi-config.cmake.in ${KODI_LIB_DIR}/kodi-config.cmake @ONLY) 60configure_file(${APP_ROOT}/project/cmake/kodi-config.cmake.in ${APP_LIB_DIR}/kodi-config.cmake @ONLY)
61
57# copy cmake helpers to lib/kodi 62# copy cmake helpers to lib/kodi
58file(COPY ${APP_ROOT}/project/cmake/scripts/common/addon-helpers.cmake ${APP_ROOT}/project/cmake/scripts/common/addoptions.cmake DESTINATION ${KODI_LIB_DIR}) 63file(COPY ${APP_ROOT}/project/cmake/scripts/common/addon-helpers.cmake
64 ${APP_ROOT}/project/cmake/scripts/common/addoptions.cmake
65 DESTINATION ${APP_LIB_DIR})
59 66
60# generate xbmc-config.cmake for backwards compatibility to xbmc 67# generate xbmc-config.cmake for backwards compatibility to xbmc
61configure_file(${APP_ROOT}/project/cmake/xbmc-config.cmake.in ${XBMC_LIB_DIR}/xbmc-config.cmake @ONLY) 68configure_file(${APP_ROOT}/project/cmake/xbmc-config.cmake.in ${XBMC_LIB_DIR}/xbmc-config.cmake @ONLY)
@@ -69,7 +76,7 @@ foreach(binding ${bindings})
69 string(REPLACE "+=" ";" binding "${binding}") 76 string(REPLACE "+=" ";" binding "${binding}")
70 list(GET binding 1 header) 77 list(GET binding 1 header)
71 # copy the header file to include/kodi 78 # copy the header file to include/kodi
72 file(COPY ${APP_ROOT}/${header} DESTINATION ${KODI_INCLUDE_DIR}) 79 file(COPY ${APP_ROOT}/${header} DESTINATION ${APP_INCLUDE_DIR})
73 80
74 # auto-generate header files for backwards compatibility to xbmc with deprecation warning 81 # auto-generate header files for backwards compatibility to xbmc with deprecation warning
75 # but only do it if the file doesn't already exist 82 # but only do it if the file doesn't already exist
@@ -95,7 +102,7 @@ if(WIN32)
95 else() 102 else()
96 set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-1") 103 set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-1")
97 set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip") 104 set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip")
98 set(PATCH_URL "http://mirrors.xbmc.org/build-deps/win32/${PATCH_ARCHIVE}") 105 set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}")
99 set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE}) 106 set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE})
100 107
101 # download the archive containing patch.exe 108 # download the archive containing patch.exe
diff --git a/project/cmake/scripts/common/projectmacros.cmake b/project/cmake/scripts/common/projectmacros.cmake
new file mode 100644
index 0000000..d0739c4
--- /dev/null
+++ b/project/cmake/scripts/common/projectmacros.cmake
@@ -0,0 +1,84 @@
1# This script holds macros which are project specific
2
3# Pack a skin xbt file
4# Arguments:
5# input input directory to pack
6# output ouput xbt file
7# On return:
8# xbt is added to ${XBT_FILES}
9function(pack_xbt input output)
10 file(GLOB_RECURSE MEDIA_FILES ${input}/*)
11 get_filename_component(dir ${output} PATH)
12 add_custom_command(OUTPUT ${output}
13 COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}
14 COMMAND TexturePacker::TexturePacker
15 ARGS -input ${input}
16 -output ${output}
17 -dupecheck
18 DEPENDS ${MEDIA_FILES})
19 list(APPEND XBT_FILES ${output})
20 set(XBT_FILES ${XBT_FILES} PARENT_SCOPE)
21endfunction()
22
23# Add a skin to installation list, mirroring it in build tree, packing textures
24# Arguments:
25# skin skin directory
26# relative relative base path in build tree
27# On return:
28# xbt is added to ${XBT_FILES}, data added to ${install_data}, mirror in build tree
29function(copy_skin_to_buildtree skin relative)
30 file(GLOB_RECURSE FILES ${skin}/*)
31 file(GLOB_RECURSE MEDIA_FILES ${skin}/media/*)
32 list(REMOVE_ITEM FILES ${MEDIA_FILES})
33 foreach(file ${FILES})
34 copy_file_to_buildtree(${file} ${relative})
35 endforeach()
36 file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${dest}/media)
37 string(REPLACE "${relative}/" "" dest ${skin})
38 pack_xbt(${skin}/media
39 ${CMAKE_BINARY_DIR}/${dest}/media/Textures.xbt
40 ${CMAKE_BINARY_DIR})
41
42 set(XBT_FILES ${XBT_FILES} PARENT_SCOPE)
43 set(install_data ${install_data} PARENT_SCOPE)
44endfunction()
45
46# Get GTest tests as CMake tests.
47# Copied from FindGTest.cmake
48# Thanks to Daniel Blezek <blezek@gmail.com> for the GTEST_ADD_TESTS code
49function(GTEST_ADD_TESTS executable extra_args)
50 if(NOT ARGN)
51 message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS")
52 endif()
53 foreach(source ${ARGN})
54 file(READ "${source}" contents)
55 string(REGEX MATCHALL "TEST_?[F]?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})
56 foreach(hit ${found_tests})
57 string(REGEX REPLACE ".*\\( *([A-Za-z_0-9]+), *([A-Za-z_0-9]+) *\\).*" "\\1.\\2" test_name ${hit})
58 add_test(${test_name} ${executable} --gtest_filter=${test_name} ${extra_args})
59 endforeach()
60 # Groups parametrized tests under a single ctest entry
61 string(REGEX MATCHALL "INSTANTIATE_TEST_CASE_P\\(([^,]+), *([^,]+)" found_tests2 ${contents})
62 foreach(hit ${found_tests2})
63 string(SUBSTRING ${hit} 24 -1 test_name)
64 string(REPLACE "," ";" test_name "${test_name}")
65 list(GET test_name 0 filter_name)
66 list(GET test_name 1 test_prefix)
67 string(STRIP ${test_prefix} test_prefix)
68 add_test(${test_prefix}.${filter_name} ${executable} --gtest_filter=${filter_name}* ${extra_args})
69 endforeach()
70 endforeach()
71endfunction()
72
73function(whole_archive output)
74 if(CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
75 set(${output} -Wl,--whole-archive ${ARGN} -Wl,--no-whole-archive PARENT_SCOPE)
76 elseif(CMAKE_CXX_COMPILER_ID STREQUAL AppleClang)
77 foreach(library ${ARGN})
78 list(APPEND ${output} -Wl,-force_load ${library})
79 set(${output} ${${output}} PARENT_SCOPE)
80 endforeach()
81 else()
82 set(${output} ${ARGN} PARENT_SCOPE)
83 endif()
84endfunction()
diff --git a/project/cmake/scripts/darwin/archsetup.cmake b/project/cmake/scripts/darwin/archsetup.cmake
new file mode 100644
index 0000000..accb8ab
--- /dev/null
+++ b/project/cmake/scripts/darwin/archsetup.cmake
@@ -0,0 +1,34 @@
1if(NOT CMAKE_TOOLCHAIN_FILE)
2 message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for darwin. See ${PROJECT_SOURCE_DIR}/README.md")
3endif()
4
5set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/posix/main.cpp
6 ${CORE_SOURCE_DIR}/xbmc/platform/darwin/osx/SDLMain.mm
7 ${CORE_SOURCE_DIR}/xbmc/platform/darwin/osx/SDLMain.h)
8
9set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_OSX)
10set(SYSTEM_DEFINES -D_REENTRANT -D_FILE_DEFINED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
11 -D__STDC_CONSTANT_MACROS)
12set(PLATFORM_DIR linux)
13set(CMAKE_SYSTEM_NAME Darwin)
14if(WITH_ARCH)
15 set(ARCH ${WITH_ARCH})
16else()
17 if(CPU STREQUAL x86_64)
18 set(ARCH x86_64-apple-darwin)
19 elseif(CPU STREQUAL i386)
20 set(ARCH i386-apple-darwin)
21 else()
22 message(SEND_ERROR "Unknown CPU: ${CPU}")
23 endif()
24endif()
25
26find_package(CXX11 REQUIRED)
27
28list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${NATIVEPREFIX})
29
30list(APPEND DEPLIBS "-framework DiskArbitration" "-framework IOKit"
31 "-framework IOSurface" "-framework SystemConfiguration"
32 "-framework ApplicationServices" "-framework AppKit"
33 "-framework CoreAudio" "-framework AudioToolbox"
34 "-framework CoreGraphics")
diff --git a/project/cmake/scripts/darwin/install.cmake b/project/cmake/scripts/darwin/install.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/cmake/scripts/darwin/install.cmake
diff --git a/project/cmake/scripts/darwin/macros.cmake b/project/cmake/scripts/darwin/macros.cmake
new file mode 100644
index 0000000..4ee17c2
--- /dev/null
+++ b/project/cmake/scripts/darwin/macros.cmake
@@ -0,0 +1,108 @@
1function(core_link_library lib wraplib)
2 if(CMAKE_GENERATOR MATCHES "Unix Makefiles")
3 set(wrapper_obj cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o)
4 elseif(CMAKE_GENERATOR MATCHES "Xcode")
5 set(wrapper_obj cores/dll-loader/exports/kodi.build/$(CONFIGURATION)/wrapper.build/Objects-$(CURRENT_VARIANT)/$(CURRENT_ARCH)/wrapper.o)
6 else()
7 message(FATAL_ERROR "Unsupported generator in core_link_library")
8 endif()
9
10 set(export -bundle -undefined dynamic_lookup -read_only_relocs suppress
11 -Wl,-alias_list,${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def
12 ${CORE_BUILD_DIR}/${wrapper_obj})
13 set(check_arg "")
14 if(TARGET ${lib})
15 set(target ${lib})
16 set(link_lib $<TARGET_FILE:${lib}>)
17 set(check_arg ${ARGV2})
18 set(data_arg ${ARGV3})
19 else()
20 set(target ${ARGV2})
21 set(link_lib ${lib})
22 set(check_arg ${ARGV3})
23 set(data_arg ${ARGV4})
24 endif()
25 if(check_arg STREQUAL export)
26 set(export ${export}
27 -Wl,--version-script=${ARGV3})
28 elseif(check_arg STREQUAL nowrap)
29 set(export ${data_arg})
30 elseif(check_arg STREQUAL extras)
31 foreach(arg ${data_arg})
32 list(APPEND export ${arg})
33 endforeach()
34 endif()
35 get_filename_component(dir ${wraplib} PATH)
36
37 # We can't simply pass the linker flags to the args section of the custom command
38 # because cmake will add quotes around it (and the linker will fail due to those).
39 # We need to do this handstand first ...
40 separate_arguments(CUSTOM_COMMAND_ARGS_LDFLAGS UNIX_COMMAND "${CMAKE_SHARED_LINKER_FLAGS}")
41
42 add_custom_command(OUTPUT ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}
43 COMMAND ${CMAKE_COMMAND} -E make_directory ${dir}
44 COMMAND ${CMAKE_C_COMPILER}
45 ARGS ${CUSTOM_COMMAND_ARGS_LDFLAGS} ${export} -Wl,-force_load ${link_lib}
46 -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}
47 DEPENDS ${target} wrapper.def wrapper
48 VERBATIM)
49
50 # Uncomment to create wrap_<lib> targets for debugging
51 #get_filename_component(libname ${wraplib} NAME_WE)
52 #add_custom_target(wrap_${libname} ALL DEPENDS ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX})
53
54 list(APPEND WRAP_FILES ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX})
55 set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE)
56endfunction()
57
58function(find_soname lib)
59 cmake_parse_arguments(arg "REQUIRED" "" "" ${ARGN})
60
61 string(TOLOWER ${lib} liblow)
62 if(${lib}_LDFLAGS)
63 set(link_lib "${${lib}_LDFLAGS}")
64 else()
65 set(link_lib "${${lib}_LIBRARIES}")
66 endif()
67
68 execute_process(COMMAND ${CMAKE_C_COMPILER} -print-search-dirs
69 COMMAND fgrep libraries:
70 COMMAND sed "s/[^=]*=\\(.*\\)/\\1/"
71 COMMAND sed "s/:/ /g"
72 ERROR_QUIET
73 OUTPUT_VARIABLE cc_lib_path
74 OUTPUT_STRIP_TRAILING_WHITESPACE)
75 execute_process(COMMAND echo ${link_lib}
76 COMMAND sed "s/-L[ ]*//g"
77 COMMAND sed "s/-l[^ ]*//g"
78 ERROR_QUIET
79 OUTPUT_VARIABLE env_lib_path
80 OUTPUT_STRIP_TRAILING_WHITESPACE)
81
82 foreach(path ${cc_lib_path} ${env_lib_path})
83 if(IS_DIRECTORY ${path})
84 execute_process(COMMAND ls -- ${path}/lib${liblow}.dylib
85 ERROR_QUIET
86 OUTPUT_VARIABLE lib_file
87 OUTPUT_STRIP_TRAILING_WHITESPACE)
88 else()
89 set(lib_file ${path})
90 endif()
91 if(lib_file)
92 # we want the path/name that is embedded in the dylib
93 execute_process(COMMAND otool -L ${lib_file}
94 COMMAND grep -v lib${liblow}.dylib
95 COMMAND grep ${liblow}
96 COMMAND awk "{V=1; print $V}"
97 ERROR_QUIET
98 OUTPUT_VARIABLE filename
99 OUTPUT_STRIP_TRAILING_WHITESPACE)
100 get_filename_component(${lib}_SONAME "${filename}" NAME)
101 message(STATUS "${lib} soname: ${${lib}_SONAME}")
102 endif()
103 endforeach()
104 if(arg_REQUIRED AND NOT ${lib}_SONAME)
105 message(FATAL_ERROR "Could not find dynamically loadable library ${lib}")
106 endif()
107 set(${lib}_SONAME ${${lib}_SONAME} PARENT_SCOPE)
108endfunction()
diff --git a/project/cmake/scripts/darwin/pathsetup.cmake b/project/cmake/scripts/darwin/pathsetup.cmake
new file mode 100644
index 0000000..e31f66e
--- /dev/null
+++ b/project/cmake/scripts/darwin/pathsetup.cmake
@@ -0,0 +1,32 @@
1if(NOT prefix)
2 set(prefix ${DEPENDS_PATH})
3endif()
4if(NOT exec_prefix)
5 set(exec_prefix \${prefix})
6endif()
7if(NOT libdir)
8 set(libdir ${prefix}/lib)
9endif()
10if(NOT bindir)
11 set(bindir ${prefix}/bin)
12endif()
13if(NOT includedir)
14 set(includedir ${prefix}/include)
15endif()
16if(NOT datarootdir)
17 set(datarootdir ${prefix}/share)
18endif()
19if(NOT datadir)
20 set(datadir \${datarootdir})
21endif()
22
23list(APPEND final_message "-- PATH config --")
24list(APPEND final_message "Prefix: ${prefix}")
25list(APPEND final_message "Libdir: ${libdir}")
26list(APPEND final_message "Bindir: ${bindir}")
27list(APPEND final_message "Includedir: ${includedir}")
28list(APPEND final_message "Datarootdir: ${datarootdir}")
29list(APPEND final_message "Datadir: ${datadir}")
30
31set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/xbmc\"
32 -DINSTALL_PATH=\"${datarootdir}/xbmc\")
diff --git a/project/cmake/scripts/freebsd/archsetup.cmake b/project/cmake/scripts/freebsd/archsetup.cmake
new file mode 100644
index 0000000..edc77f1
--- /dev/null
+++ b/project/cmake/scripts/freebsd/archsetup.cmake
@@ -0,0 +1,19 @@
1set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_FREEBSD)
2set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED
3 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
4set(PLATFORM_DIR linux)
5set(SYSTEM_LDFLAGS -L/usr/local/lib)
6if(WITH_ARCH)
7 set(ARCH ${WITH_ARCH})
8else()
9 if(CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
10 set(ARCH x86_64-freebsd)
11 elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i.86")
12 set(ARCH x86-freebsd)
13 else()
14 message(WARNING "unknown CPU: ${CPU}")
15 endif()
16endif()
17
18set(LIRC_DEVICE "\"/dev/lircd\"" CACHE STRING "LIRC device to use")
19set(DEP_DEFINES -DLIRC_DEVICE=${LIRC_DEVICE})
diff --git a/project/cmake/scripts/freebsd/install.cmake b/project/cmake/scripts/freebsd/install.cmake
new file mode 100644
index 0000000..0c8939e
--- /dev/null
+++ b/project/cmake/scripts/freebsd/install.cmake
@@ -0,0 +1,58 @@
1set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
2set(bindir ${CMAKE_INSTALL_PREFIX}/bin)
3
4configure_file(${CORE_SOURCE_DIR}/tools/Linux/xbmc.sh.in
5 ${CORE_BUILD_DIR}/scripts/xbmc @ONLY)
6configure_file(${CORE_SOURCE_DIR}/tools/Linux/xbmc-standalone.sh.in
7 ${CORE_BUILD_DIR}/scripts/xbmc-standalone @ONLY)
8
9install(TARGETS xbmc-xrandr DESTINATION lib/xbmc)
10install(FILES ${addon_bindings} DESTINATION include/xbmc)
11install(FILES ${cmake_files} ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/modules/xbmc-config.cmake
12 DESTINATION lib/xbmc)
13install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/xbmc
14 ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/xbmc-standalone
15 DESTINATION bin)
16install(FILES ${CORE_SOURCE_DIR}/tools/Linux/FEH.py
17 DESTINATION share/xbmc)
18
19install(FILES ${CORE_SOURCE_DIR}/tools/Linux/xbmc-xsession.desktop
20 RENAME XBMC.desktop
21 DESTINATION share/xsessions)
22
23install(FILES ${CORE_SOURCE_DIR}/LICENSE.GPL
24 ${CORE_SOURCE_DIR}/docs/README.freebsd
25 DESTINATION share/doc/xbmc)
26
27foreach(texture ${XBT_FILES})
28 string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${texture})
29 get_filename_component(dir ${dir} PATH)
30 install(FILES ${texture}
31 DESTINATION share/xbmc/${dir})
32endforeach()
33
34foreach(wraplib ${WRAP_FILES})
35 get_filename_component(dir ${wraplib} PATH)
36 install(PROGRAMS ${CMAKE_BINARY_DIR}/${wraplib}
37 DESTINATION lib/xbmc/${dir})
38endforeach()
39
40foreach(file ${install_data})
41 get_filename_component(dir ${file} PATH)
42 install(FILES ${CMAKE_BINARY_DIR}/${file}
43 DESTINATION share/xbmc/${dir})
44endforeach()
45
46install(CODE "file(STRINGS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs dirs)
47 foreach(dir \${dirs})
48 file(GLOB_RECURSE FILES RELATIVE ${CMAKE_BINARY_DIR} \${dir}/*)
49 foreach(file \${FILES})
50 get_filename_component(dir \${file} PATH)
51 file(INSTALL \${file} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/xbmc/\${dir})
52 endforeach()
53 endforeach()")
54foreach(subdir ${build_dirs})
55 string(REPLACE " " ";" subdir ${subdir})
56 list(GET subdir 0 id)
57 install(CODE "execute_process(COMMAND make -C ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${id}/src/${id}-build install)")
58endforeach()
diff --git a/project/cmake/scripts/freebsd/macros.cmake b/project/cmake/scripts/freebsd/macros.cmake
new file mode 100644
index 0000000..f0bf7ba
--- /dev/null
+++ b/project/cmake/scripts/freebsd/macros.cmake
@@ -0,0 +1 @@
include(../linux/macros.cmake)
diff --git a/project/cmake/scripts/freebsd/pathsetup.cmake b/project/cmake/scripts/freebsd/pathsetup.cmake
new file mode 100644
index 0000000..1fb45b6
--- /dev/null
+++ b/project/cmake/scripts/freebsd/pathsetup.cmake
@@ -0,0 +1 @@
include(${PROJECT_SOURCE_DIR}/scripts/linux/pathsetup.cmake)
diff --git a/project/cmake/scripts/ios/archsetup.cmake b/project/cmake/scripts/ios/archsetup.cmake
new file mode 100644
index 0000000..e6639f7
--- /dev/null
+++ b/project/cmake/scripts/ios/archsetup.cmake
@@ -0,0 +1,38 @@
1if(NOT CMAKE_TOOLCHAIN_FILE)
2 message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for ios. See ${PROJECT_SOURCE_DIR}/README.md")
3endif()
4
5set(CORE_MAIN_SOURCE ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/XBMCApplication.m)
6
7set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_DARWIN -DTARGET_DARWIN_IOS)
8set(SYSTEM_DEFINES -D_REENTRANT -D_FILE_DEFINED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
9 -D__STDC_CONSTANT_MACROS)
10set(PLATFORM_DIR linux)
11set(CMAKE_SYSTEM_NAME Darwin)
12if(WITH_ARCH)
13 set(ARCH ${WITH_ARCH})
14else()
15 if(CPU STREQUAL armv7)
16 set(ARCH arm-apple-darwin)
17 elseif(CPU STREQUAL arm64)
18 set(ARCH arm-apple-darwin)
19 else()
20 message(SEND_ERROR "Unknown CPU: ${CPU}")
21 endif()
22endif()
23
24find_package(CXX11 REQUIRED)
25
26list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${NATIVEPREFIX})
27
28list(APPEND DEPLIBS "-framework CoreFoundation" "-framework CoreVideo"
29 "-framework CoreAudio" "-framework AudioToolbox"
30 "-framework QuartzCore" "-framework MediaPlayer"
31 "-framework CFNetwork" "-framework CoreGraphics"
32 "-framework Foundation" "-framework UIKit"
33 "-framework CoreMedia" "-framework AVFoundation")
34
35set(ENABLE_DVDCSS OFF)
36set(ENABLE_OPTICAL OFF)
37set(ENABLE_VTB ON)
38set(VTB_FOUND 1 CACHE INTERNAL "VTB")
diff --git a/project/cmake/scripts/ios/install.cmake b/project/cmake/scripts/ios/install.cmake
new file mode 120000
index 0000000..0ea6586
--- /dev/null
+++ b/project/cmake/scripts/ios/install.cmake
@@ -0,0 +1 @@
../darwin/install.cmake \ No newline at end of file
diff --git a/project/cmake/scripts/ios/macros.cmake b/project/cmake/scripts/ios/macros.cmake
new file mode 120000
index 0000000..45c7ad1
--- /dev/null
+++ b/project/cmake/scripts/ios/macros.cmake
@@ -0,0 +1 @@
../darwin/macros.cmake \ No newline at end of file
diff --git a/project/cmake/scripts/ios/pathsetup.cmake b/project/cmake/scripts/ios/pathsetup.cmake
new file mode 120000
index 0000000..f8e1248
--- /dev/null
+++ b/project/cmake/scripts/ios/pathsetup.cmake
@@ -0,0 +1 @@
../darwin/pathsetup.cmake \ No newline at end of file
diff --git a/project/cmake/scripts/linux/archsetup.cmake b/project/cmake/scripts/linux/archsetup.cmake
new file mode 100644
index 0000000..d0e149e
--- /dev/null
+++ b/project/cmake/scripts/linux/archsetup.cmake
@@ -0,0 +1,21 @@
1set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_LINUX)
2set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED
3 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
4set(PLATFORM_DIR linux)
5set(CMAKE_SYSTEM_NAME Linux)
6if(WITH_ARCH)
7 set(ARCH ${WITH_ARCH})
8else()
9 if(CPU STREQUAL x86_64)
10 set(ARCH x86_64-linux)
11 elseif(CPU MATCHES "i.86")
12 set(ARCH i486-linux)
13 else()
14 message(SEND_ERROR "Unknown CPU: ${CPU}")
15 endif()
16endif()
17
18find_package(CXX11 REQUIRED)
19
20set(LIRC_DEVICE "\"/dev/lircd\"" CACHE STRING "LIRC device to use")
21set(DEP_DEFINES -DLIRC_DEVICE=${LIRC_DEVICE})
diff --git a/project/cmake/scripts/linux/install.cmake b/project/cmake/scripts/linux/install.cmake
new file mode 100644
index 0000000..b887610
--- /dev/null
+++ b/project/cmake/scripts/linux/install.cmake
@@ -0,0 +1,93 @@
1if(X_FOUND)
2 set(USE_X11 1)
3else()
4 set(USE_X11 0)
5endif()
6if(OPENGL_FOUND)
7 set(USE_OPENGL 1)
8else()
9 set(USE_OPENGL 0)
10endif()
11if(OPENGLES_FOUND)
12 set(USE_OPENGLES 1)
13else()
14 set(USE_OPENGLES 0)
15endif()
16
17configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi.sh.in
18 ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC} @ONLY)
19configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.in
20 ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone @ONLY)
21
22install(TARGETS ${APP_NAME_LC} DESTINATION ${libdir}/kodi)
23if(ENABLE_X11 AND XRANDR_FOUND)
24 install(TARGETS ${APP_NAME_LC}-xrandr DESTINATION ${libdir}/${APP_NAME_LC})
25endif()
26install(FILES ${addon_bindings} DESTINATION ${includedir}/kodi)
27install(FILES ${cmake-files}
28 DESTINATION ${libdir}/kodi)
29install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}
30 ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone
31 DESTINATION ${bindir})
32
33configure_file(${CORE_SOURCE_DIR}/tools/Linux/kodi-xsession.desktop.in
34 ${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop)
35install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop
36 DESTINATION ${datarootdir}/xsessions)
37
38install(FILES ${CORE_SOURCE_DIR}/LICENSE.GPL
39 ${CORE_SOURCE_DIR}/docs/README.linux
40 DESTINATION ${datarootdir}/doc/kodi)
41
42install(FILES ${CORE_SOURCE_DIR}/tools/Linux/kodi.desktop
43 DESTINATION ${datarootdir}/applications)
44
45foreach(texture ${XBT_FILES})
46 string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${texture})
47 get_filename_component(dir ${dir} PATH)
48 install(FILES ${texture}
49 DESTINATION ${datarootdir}/kodi/${dir})
50endforeach()
51
52foreach(wraplib ${WRAP_FILES})
53 get_filename_component(dir ${wraplib} PATH)
54 install(PROGRAMS ${CMAKE_BINARY_DIR}/${wraplib}
55 DESTINATION ${libdir}/kodi/${dir})
56endforeach()
57
58foreach(file ${install_data})
59 get_filename_component(dir ${file} PATH)
60 install(FILES ${CMAKE_BINARY_DIR}/${file}
61 DESTINATION ${datarootdir}/kodi/${dir})
62endforeach()
63
64if(EXISTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs)
65 install(CODE "file(STRINGS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs dirs)
66 foreach(dir \${dirs})
67 file(GLOB_RECURSE FILES RELATIVE ${CMAKE_BINARY_DIR} \${dir}/*)
68 foreach(file \${FILES})
69 get_filename_component(dir \${file} PATH)
70 file(INSTALL \${file} DESTINATION ${datarootdir}/kodi/\${dir})
71 endforeach()
72 endforeach()")
73endif()
74
75if(NOT "$ENV{DESTDIR}" STREQUAL "")
76 set(DESTDIR ${CMAKE_BINARY_DIR}/$ENV{DESTDIR})
77endif()
78foreach(subdir ${build_dirs})
79 if(NOT subdir MATCHES kodi-platform)
80 string(REPLACE " " ";" subdir ${subdir})
81 list(GET subdir 0 id)
82 install(CODE "execute_process(COMMAND make -C ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${id}/src/${id}-build install DESTDIR=${DESTDIR})")
83 endif()
84endforeach()
85
86install(FILES ${CORE_SOURCE_DIR}/media/icon48x48.png
87 RENAME ${APP_NAME_LC}.png
88 DESTINATION ${datarootdir}/icons/hicolor/48x48/apps)
89install(FILES ${CORE_SOURCE_DIR}/media/icon256x256.png
90 RENAME ${APP_NAME_LC}.png
91 DESTINATION ${datarootdir}/icons/hicolor/256x256/apps)
92
93install(CODE "execute_process(COMMAND gtk-update-icon-cache -f -q -t $ENV{DESTDIR}${datarootdir}/icons/hicolor ERROR_QUIET)")
diff --git a/project/cmake/scripts/linux/macros.cmake b/project/cmake/scripts/linux/macros.cmake
new file mode 100644
index 0000000..7453a1c
--- /dev/null
+++ b/project/cmake/scripts/linux/macros.cmake
@@ -0,0 +1,79 @@
1function(core_link_library lib wraplib)
2 set(export -Wl,--unresolved-symbols=ignore-all
3 `cat ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def`
4 ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o)
5 set(check_arg "")
6 if(TARGET ${lib})
7 set(target ${lib})
8 set(link_lib ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${lib}/${lib}.a)
9 set(check_arg ${ARGV2})
10 set(data_arg ${ARGV3})
11 else()
12 set(target ${ARGV2})
13 set(link_lib ${lib})
14 set(check_arg ${ARGV3})
15 set(data_arg ${ARGV4})
16 endif()
17 if(check_arg STREQUAL export)
18 set(export ${export}
19 -Wl,--version-script=${ARGV3})
20 elseif(check_arg STREQUAL nowrap)
21 set(export ${data_arg})
22 elseif(check_arg STREQUAL extras)
23 foreach(arg ${data_arg})
24 list(APPEND export ${arg})
25 endforeach()
26 endif()
27 get_filename_component(dir ${wraplib} PATH)
28 add_custom_command(OUTPUT ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}
29 COMMAND cmake -E make_directory ${dir}
30 COMMAND ${CMAKE_C_COMPILER}
31 ARGS -Wl,--whole-archive
32 ${link_lib}
33 -Wl,--no-whole-archive -lm
34 -shared -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}
35 ${export}
36 DEPENDS ${target} wrapper.def wrapper)
37 list(APPEND WRAP_FILES ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX})
38 set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE)
39endfunction()
40
41function(find_soname lib)
42 cmake_parse_arguments(arg "REQUIRED" "" "" ${ARGN})
43
44 string(TOLOWER ${lib} liblow)
45 if(${lib}_LDFLAGS)
46 set(link_lib "${${lib}_LDFLAGS}")
47 else()
48 if(IS_ABSOLUTE "${${lib}_LIBRARIES}")
49 set(link_lib "${${lib}_LIBRARIES}")
50 else()
51 set(link_lib -l${${lib}_LIBRARIES})
52 endif()
53 endif()
54 execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-M ${link_lib}
55 COMMAND grep LOAD.*${liblow}
56 ERROR_QUIET
57 OUTPUT_VARIABLE ${lib}_FILENAME)
58 string(REPLACE "LOAD " "" ${lib}_FILENAME "${${lib}_FILENAME}")
59 string(STRIP "${${lib}_FILENAME}" ${lib}_FILENAME)
60 if(NOT ${lib}_FILENAME)
61 execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-t ${link_lib}
62 OUTPUT_QUIET
63 ERROR_VARIABLE _TMP_FILENAME)
64 string(REGEX MATCH ".*lib${liblow}.so" ${lib}_FILENAME ${_TMP_FILENAME})
65 endif()
66 if(${lib}_FILENAME)
67 execute_process(COMMAND objdump -p ${${lib}_FILENAME}
68 COMMAND grep SONAME.*${liblow}
69 ERROR_QUIET
70 OUTPUT_VARIABLE ${lib}_SONAME)
71 string(REPLACE "SONAME " "" ${lib}_SONAME ${${lib}_SONAME})
72 string(STRIP ${${lib}_SONAME} ${lib}_SONAME)
73 message(STATUS "${lib} soname: ${${lib}_SONAME}")
74 set(${lib}_SONAME ${${lib}_SONAME} PARENT_SCOPE)
75 endif()
76 if(arg_REQUIRED AND NOT ${lib}_SONAME)
77 message(FATAL_ERROR "Could not find dynamically loadable library ${lib}")
78 endif()
79endfunction()
diff --git a/project/cmake/scripts/linux/pathsetup.cmake b/project/cmake/scripts/linux/pathsetup.cmake
new file mode 100644
index 0000000..940fb62
--- /dev/null
+++ b/project/cmake/scripts/linux/pathsetup.cmake
@@ -0,0 +1,34 @@
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}/xbmc\"
34 -DINSTALL_PATH=\"${datarootdir}/xbmc\")
diff --git a/project/cmake/scripts/rbpi/archsetup.cmake b/project/cmake/scripts/rbpi/archsetup.cmake
new file mode 100644
index 0000000..84f1dad
--- /dev/null
+++ b/project/cmake/scripts/rbpi/archsetup.cmake
@@ -0,0 +1,32 @@
1if(NOT CMAKE_TOOLCHAIN_FILE)
2 message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE required for rbpi. See ${PROJECT_SOURCE_DIR}/README.md")
3endif()
4
5set(ARCH_DEFINES -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -D_ARMEL -DTARGET_RASPBERRY_PI
6 -DHAS_OMXPLAYER -DHAVE_OMXLIB)
7set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_FILE_DEFINED
8 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)
9set(PLATFORM_DIR linux)
10
11string(REGEX REPLACE "[ ]+" ";" SYSTEM_LDFLAGS $ENV{LDFLAGS})
12set(CMAKE_SYSTEM_NAME Linux)
13
14if(WITH_ARCH)
15 set(ARCH ${WITH_ARCH})
16else()
17 if(CPU STREQUAL arm1176jzf-s)
18 set(ARCH arm-linux-gnueabihf)
19 elseif(CPU MATCHES "cortex-a7")
20 set(ARCH arm-linux-gnueabihf)
21 else()
22 message(SEND_ERROR "Unknown CPU: ${CPU}")
23 endif()
24endif()
25
26find_package(CXX11 REQUIRED)
27
28set(LIRC_DEVICE "\"/dev/lircd\"" CACHE STRING "LIRC device to use")
29set(DEP_DEFINES -DLIRC_DEVICE=${LIRC_DEVICE})
30set(MMAL_FOUND 1 CACHE INTERNAL "MMAL")
31set(OMX_FOUND 1 CACHE INTERNAL "OMX")
32set(OMXLIB_FOUND 1 CACHE INTERNAL "OMX")
diff --git a/project/cmake/scripts/rbpi/install.cmake b/project/cmake/scripts/rbpi/install.cmake
new file mode 120000
index 0000000..0409981
--- /dev/null
+++ b/project/cmake/scripts/rbpi/install.cmake
@@ -0,0 +1 @@
../linux/install.cmake \ No newline at end of file
diff --git a/project/cmake/scripts/rbpi/macros.cmake b/project/cmake/scripts/rbpi/macros.cmake
new file mode 120000
index 0000000..28c77ca
--- /dev/null
+++ b/project/cmake/scripts/rbpi/macros.cmake
@@ -0,0 +1 @@
../linux/macros.cmake \ No newline at end of file
diff --git a/project/cmake/scripts/rbpi/pathsetup.cmake b/project/cmake/scripts/rbpi/pathsetup.cmake
new file mode 120000
index 0000000..26d7f17
--- /dev/null
+++ b/project/cmake/scripts/rbpi/pathsetup.cmake
@@ -0,0 +1 @@
../linux/pathsetup.cmake \ No newline at end of file
diff --git a/project/cmake/scripts/windows/archsetup.cmake b/project/cmake/scripts/windows/archsetup.cmake
new file mode 100644
index 0000000..baa3624
--- /dev/null
+++ b/project/cmake/scripts/windows/archsetup.cmake
@@ -0,0 +1,91 @@
1# -------- Architecture settings ---------
2
3set(ARCH win32)
4
5
6# -------- Paths (mainly for find_package) ---------
7
8set(PLATFORM_DIR 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)
18set(CONFIGURATION_LIBDIR lib/${CORE_BUILD_CONFIG}-vc120)
19set(CONFIGURATION_LIBDIR_RELEASE lib/Release-vc120)
20set(CONFIGURATION_LIBDIR_DEBUG lib/Debug-vc120)
21
22set(JPEG_NAMES ${JPEG_NAMES} jpeg-static)
23set(PYTHON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/../BuildDependencies/include/python)
24
25
26# -------- Compiler options ---------
27
28add_options(CXX ALL_BUILDS "/wd\"4996\"")
29set(ARCH_DEFINES -D_WINDOWS -DTARGET_WINDOWS)
30set(SYSTEM_DEFINES -DNOMINMAX -D_USE_32BIT_TIME_T -DHAS_DX -D__STDC_CONSTANT_MACROS
31 -DTAGLIB_STATIC -DNPT_CONFIG_ENABLE_LOGGING
32 -DPLT_HTTP_DEFAULT_USER_AGENT="UPnP/1.0 DLNADOC/1.50 Kodi"
33 -DPLT_HTTP_DEFAULT_SERVER="UPnP/1.0 DLNADOC/1.50 Kodi"
34 -DBUILDING_WITH_CMAKE
35 $<$<CONFIG:Debug>:-DD3D_DEBUG_INFO -D_SECURE_SCL=0 -D_HAS_ITERATOR_DEBUGGING=0>)
36
37# Compile with /MT (to be compatible with the dependent libraries)
38foreach(CompilerFlag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
39 CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
40 string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
41endforeach()
42
43# Make sure /FS is set for Visual Studio in order to prevent simultanious access to pdb files.
44if(CMAKE_GENERATOR MATCHES "Visual Studio")
45 set(CMAKE_CXX_FLAGS "/MP /FS ${CMAKE_CXX_FLAGS}")
46endif()
47
48
49# -------- Linker options ---------
50
51set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
52
53# For #pragma comment(lib X)
54# TODO: It would certainly be better to handle these libraries via CMake modules.
55link_directories(${PROJECT_SOURCE_DIR}/../../lib/win32/ffmpeg/bin
56 ${PROJECT_SOURCE_DIR}/../BuildDependencies/lib
57 ${PROJECT_SOURCE_DIR}/../BuildDependencies/${CONFIGURATION_LIBDIR})
58
59# Additional libraries
60list(APPEND DEPLIBS d3d11.lib DInput8.lib DSound.lib winmm.lib Mpr.lib Iphlpapi.lib
61 PowrProf.lib setupapi.lib dwmapi.lib yajl.lib dxguid.lib DelayImp.lib)
62
63# NODEFAULTLIB option
64set(_nodefaultlibs_RELEASE libc msvcrt libci msvcprt)
65set(_nodefaultlibs_DEBUG libcpmt libc msvcrt libcmt msvcrtd msvcprtd)
66foreach(_lib ${_nodefaultlibs_RELEASE})
67 set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:\"${_lib}\"")
68endforeach()
69foreach(_lib ${_nodefaultlibs_DEBUG})
70 set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:\"${_lib}\"")
71endforeach()
72
73# DELAYLOAD option
74set(_delayloadlibs libxslt.dll dnssd.dll dwmapi.dll ssh.dll sqlite3.dll
75 avcodec-56.dll avfilter-5.dll avformat-56.dll avutil-54.dll
76 postproc-53.dll swresample-1.dll swscale-3.dll d3dcompiler_47.dll)
77foreach(_lib ${_delayloadlibs})
78 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DELAYLOAD:\"${_lib}\"")
79endforeach()
80
81# Make the Release version create a PDB
82set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
83# Minimize the size or the resulting DLLs
84set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG /OPT:REF")
85
86
87# -------- Visual Studio options ---------
88
89if(CMAKE_GENERATOR MATCHES "Visual Studio")
90 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
91endif()
diff --git a/project/cmake/scripts/windows/install.cmake b/project/cmake/scripts/windows/install.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/cmake/scripts/windows/install.cmake
diff --git a/project/cmake/scripts/windows/macros.cmake b/project/cmake/scripts/windows/macros.cmake
new file mode 100644
index 0000000..6aabf7d
--- /dev/null
+++ b/project/cmake/scripts/windows/macros.cmake
@@ -0,0 +1,143 @@
1function(core_link_library lib wraplib)
2# set(export -Wl,--unresolved-symbols=ignore-all
3# `cat ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/wrapper.def`
4# ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/cores/dll-loader/exports/CMakeFiles/wrapper.dir/wrapper.c.o)
5# set(check_arg "")
6# if(TARGET ${lib})
7# set(target ${lib})
8# set(link_lib ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${lib}/${lib}.a)
9# set(check_arg ${ARGV2})
10# set(data_arg ${ARGV3})
11# else()
12# set(target ${ARGV2})
13# set(link_lib ${lib})
14# set(check_arg ${ARGV3})
15# set(data_arg ${ARGV4})
16# endif()
17# if(check_arg STREQUAL "export")
18# set(export ${export}
19# -Wl,--version-script=${ARGV3})
20# elseif(check_arg STREQUAL "nowrap")
21# set(export ${data_arg})
22# elseif(check_arg STREQUAL "extras")
23# foreach(arg ${data_arg})
24# list(APPEND export ${arg})
25# endforeach()
26# endif()
27# get_filename_component(dir ${wraplib} PATH)
28# add_custom_command(OUTPUT ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}
29# COMMAND cmake -E make_directory ${dir}
30# COMMAND ${CMAKE_C_COMPILER}
31# ARGS -Wl,--whole-archive
32# ${link_lib}
33# -Wl,--no-whole-archive -lm
34# -shared -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}
35# ${export}
36# DEPENDS ${target} wrapper.def wrapper)
37# list(APPEND WRAP_FILES ${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX})
38# set(WRAP_FILES ${WRAP_FILES} PARENT_SCOPE)
39endfunction()
40
41function(find_soname lib)
42 # Windows uses hardcoded dlls in xbmc/DllPaths_win32.h.
43 # Therefore the output of this function is unused.
44endfunction()
45
46# Add precompiled header to target
47# Arguments:
48# target existing target that will be set up to compile with a precompiled header
49# pch_header the precompiled header file
50# pch_source the precompiled header source file
51# Optional Arguments:
52# PCH_TARGET build precompiled header as separate target with the given name
53# so that the same precompiled header can be used for multiple libraries
54# EXCLUDE_SOURCES if not all target sources shall use the precompiled header,
55# the relevant files can be listed here
56# On return:
57# Compiles the pch_source into a precompiled header and adds the header to
58# the given target
59function(add_precompiled_header target pch_header pch_source)
60 cmake_parse_arguments(PCH "" "PCH_TARGET" "EXCLUDE_SOURCES" ${ARGN})
61
62 if(PCH_PCH_TARGET)
63 set(pch_binary ${PRECOMPILEDHEADER_DIR}/${PCH_PCH_TARGET}.pch)
64 else()
65 set(pch_binary ${PRECOMPILEDHEADER_DIR}/${target}.pch)
66 endif()
67
68 # Set compile options and dependency for sources
69 get_target_property(sources ${target} SOURCES)
70 list(REMOVE_ITEM sources ${pch_source})
71 foreach(exclude_source IN LISTS PCH_EXCLUDE_SOURCES)
72 list(REMOVE_ITEM sources ${exclude_source})
73 endforeach()
74 set_source_files_properties(${sources}
75 PROPERTIES COMPILE_FLAGS "/Yu\"${pch_header}\" /Fp\"${pch_binary}\" /FI\"${pch_header}\""
76 OBJECT_DEPENDS "${pch_binary}")
77
78 # Set compile options for precompiled header
79 if(NOT PCH_PCH_TARGET OR NOT TARGET ${PCH_PCH_TARGET}_pch)
80 set_source_files_properties(${pch_source}
81 PROPERTIES COMPILE_FLAGS "/Yc\"${pch_header}\" /Fp\"${pch_binary}\""
82 OBJECT_OUTPUTS "${pch_binary}")
83 endif()
84
85 # Compile precompiled header
86 if(PCH_PCH_TARGET)
87 # As own target for usage in multiple libraries
88 if(NOT TARGET ${PCH_PCH_TARGET}_pch)
89 add_library(${PCH_PCH_TARGET}_pch STATIC ${pch_source})
90 set_target_properties(${PCH_PCH_TARGET}_pch PROPERTIES COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR})
91 endif()
92 # From VS2012 onwards, precompiled headers have to be linked against (LNK2011).
93 target_link_libraries(${target} PUBLIC ${PCH_PCH_TARGET}_pch)
94 set_target_properties(${target} PROPERTIES COMPILE_PDB_OUTPUT_DIRECTORY ${PRECOMPILEDHEADER_DIR})
95 else()
96 # As part of the target
97 target_sources(${target} PRIVATE ${pch_source})
98 endif()
99endfunction()
100
101# Adds an FX-compiled shader to a target
102# Creates a custom command that FX-compiles the given shader and adds the
103# generated header file to the given target.
104# Arguments:
105# target Target to add the FX-compiled shader to
106# hlsl HLSL shader input file
107# profile HLSL profile that specifies the shader model
108# entrypoint Shader entry point
109# On return:
110# FXC_FILE is set to the name of the generated header file.
111function(add_shader_dx target hlsl profile entrypoint)
112 get_filename_component(file ${hlsl} NAME_WE)
113 add_custom_command(OUTPUT ${file}.h
114 COMMAND ${FXC} /Fh ${file}.h
115 /E ${entrypoint}
116 /T ${profile}
117 /Vn ${file}
118 /Qstrip_reflect
119 ${hlsl}
120 DEPENDS ${hlsl}
121 COMMENT "FX compile ${hlsl}"
122 VERBATIM)
123 target_sources(${target} PRIVATE ${file}.h)
124 target_include_directories(${target} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
125endfunction()
126
127# Copies the main dlls to the root of the buildtree
128# On return:
129# files added to ${install_data}, mirror in build tree
130function(copy_main_dlls_to_buildtree)
131 set(dir ${PROJECT_SOURCE_DIR}/../Win32BuildSetup/dependencies)
132 file(GLOB_RECURSE files ${dir}/*)
133 foreach(file ${files})
134 copy_file_to_buildtree(${file} ${dir})
135 endforeach()
136
137 if(D3DCOMPILER_DLL)
138 get_filename_component(d3dcompiler_dir ${D3DCOMPILER_DLL} DIRECTORY)
139 copy_file_to_buildtree(${D3DCOMPILER_DLL} ${d3dcompiler_dir})
140 endif()
141
142 set(install_data ${install_data} PARENT_SCOPE)
143endfunction()
diff --git a/project/cmake/scripts/windows/pathsetup.cmake b/project/cmake/scripts/windows/pathsetup.cmake
new file mode 100644
index 0000000..940fb62
--- /dev/null
+++ b/project/cmake/scripts/windows/pathsetup.cmake
@@ -0,0 +1,34 @@
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}/xbmc\"
34 -DINSTALL_PATH=\"${datarootdir}/xbmc\")
diff --git a/project/cmake/treedata/android/subdirs.txt b/project/cmake/treedata/android/subdirs.txt
new file mode 100644
index 0000000..1c75fa6
--- /dev/null
+++ b/project/cmake/treedata/android/subdirs.txt
@@ -0,0 +1,16 @@
1xbmc/linux linuxsupport
2xbmc/input/touch input/touch
3xbmc/input/touch/generic input/touch/generic
4xbmc/network/linux network/linux
5xbmc/peripherals/bus/linux peripherals/bus/linux
6xbmc/powermanagement/android powermanagement/android
7xbmc/storage/android storage/android
8xbmc/filesystem/posix filesystem/posix
9xbmc/utils/posix utils_posix
10xbmc/windowing/android windowing/android
11xbmc/windowing/egl windowing/egl
12xbmc/platform/posix posix
13xbmc/platform/android/activity android_activity
14xbmc/platform/android/bionic_supplement android_bionicsupplement
15xbmc/platform/android/jni android_jni
16xbmc/platform/android/loader android_loader
diff --git a/project/cmake/treedata/common/addons.txt b/project/cmake/treedata/common/addons.txt
new file mode 100644
index 0000000..29b7990
--- /dev/null
+++ b/project/cmake/treedata/common/addons.txt
@@ -0,0 +1,7 @@
1lib/addons/library.kodi.adsp KODI_adsp
2lib/addons/library.kodi.audioengine KODI_audioengine
3lib/addons/library.kodi.guilib KODI_guilib
4lib/addons/library.kodi.inputstream KODI_inputstream
5lib/addons/library.xbmc.addon XBMC_addon
6lib/addons/library.xbmc.codec XBMC_codec
7lib/addons/library.xbmc.pvr XBMC_pvr
diff --git a/project/cmake/treedata/common/cores.txt b/project/cmake/treedata/common/cores.txt
new file mode 100644
index 0000000..d23939d
--- /dev/null
+++ b/project/cmake/treedata/common/cores.txt
@@ -0,0 +1,8 @@
1xbmc/cores cores
2xbmc/cores/AudioEngine cores/audioengine
3xbmc/cores/DllLoader cores/dll-loader
4xbmc/cores/DllLoader/exports cores/dll-loader/exports
5xbmc/cores/DllLoader/exports/util cores/dll-loader/exports/util
6xbmc/cores/ExternalPlayer cores/externalplayer
7xbmc/cores/paplayer cores/paplayer
8xbmc/cores/playercorefactory cores/playercorefactory
diff --git a/project/cmake/treedata/common/events.txt b/project/cmake/treedata/common/events.txt
new file mode 100644
index 0000000..0adeb08
--- /dev/null
+++ b/project/cmake/treedata/common/events.txt
@@ -0,0 +1,2 @@
1xbmc/events events
2xbmc/events/windows events/windows
diff --git a/project/cmake/treedata/common/externals.txt b/project/cmake/treedata/common/externals.txt
new file mode 100644
index 0000000..632b354
--- /dev/null
+++ b/project/cmake/treedata/common/externals.txt
@@ -0,0 +1,3 @@
1xbmc/contrib/kissfft kissfft
2lib/libUPnP upnp
3lib/libexif exif
diff --git a/project/cmake/treedata/common/filesystem.txt b/project/cmake/treedata/common/filesystem.txt
new file mode 100644
index 0000000..1c49a74
--- /dev/null
+++ b/project/cmake/treedata/common/filesystem.txt
@@ -0,0 +1,3 @@
1xbmc/filesystem filesystem
2xbmc/filesystem/VideoDatabaseDirectory filesystem/videodatabase
3xbmc/filesystem/MusicDatabaseDirectory filesystem/musicdatabase
diff --git a/project/cmake/treedata/common/interfaces.txt b/project/cmake/treedata/common/interfaces.txt
new file mode 100644
index 0000000..ffd3570
--- /dev/null
+++ b/project/cmake/treedata/common/interfaces.txt
@@ -0,0 +1,9 @@
1xbmc/interfaces interfaces
2xbmc/interfaces/builtins interfaces/builtins
3xbmc/interfaces/generic interfaces/generic
4xbmc/interfaces/info interfaces/info
5xbmc/interfaces/json-rpc interfaces/json-rpc
6xbmc/interfaces/json-rpc/schema interfaces/json-rpc/schema
7xbmc/interfaces/legacy interfaces/legacy
8xbmc/interfaces/legacy/wsgi interfaces/legacy/wsgi
9xbmc/interfaces/python interfaces/python
diff --git a/project/cmake/treedata/common/music.txt b/project/cmake/treedata/common/music.txt
new file mode 100644
index 0000000..71f30e1
--- /dev/null
+++ b/project/cmake/treedata/common/music.txt
@@ -0,0 +1,5 @@
1xbmc/music music
2xbmc/music/dialogs music/dialogs
3xbmc/music/infoscanner music/infoscanner
4xbmc/music/tags music/tags
5xbmc/music/windows music/windows
diff --git a/project/cmake/treedata/common/network.txt b/project/cmake/treedata/common/network.txt
new file mode 100644
index 0000000..c0ec4a3
--- /dev/null
+++ b/project/cmake/treedata/common/network.txt
@@ -0,0 +1,6 @@
1xbmc/network network
2xbmc/network/dacp network/dacp
3xbmc/network/httprequesthandler network/httprequesthandler
4xbmc/network/httprequesthandler/python network/httprequesthandler/python
5xbmc/network/upnp network/upnp
6xbmc/network/websocket network/websocket
diff --git a/project/cmake/treedata/common/peripherals.txt b/project/cmake/treedata/common/peripherals.txt
new file mode 100644
index 0000000..e6d9283
--- /dev/null
+++ b/project/cmake/treedata/common/peripherals.txt
@@ -0,0 +1,4 @@
1xbmc/peripherals peripherals
2xbmc/peripherals/bus peripherals/bus
3xbmc/peripherals/devices peripherals/devices
4xbmc/peripherals/dialogs peripherals/dialogs
diff --git a/project/cmake/treedata/common/profiles.txt b/project/cmake/treedata/common/profiles.txt
new file mode 100644
index 0000000..fae570b
--- /dev/null
+++ b/project/cmake/treedata/common/profiles.txt
@@ -0,0 +1,3 @@
1xbmc/profiles profiles
2xbmc/profiles/dialogs profiles/dialogs
3xbmc/profiles/windows profiles/windows
diff --git a/project/cmake/treedata/common/pvr.txt b/project/cmake/treedata/common/pvr.txt
new file mode 100644
index 0000000..6797677
--- /dev/null
+++ b/project/cmake/treedata/common/pvr.txt
@@ -0,0 +1,7 @@
1xbmc/pvr pvr
2xbmc/pvr/addons pvr/addons
3xbmc/pvr/channels pvr/channels
4xbmc/pvr/dialogs pvr/dialogs
5xbmc/pvr/recordings pvr/recordings
6xbmc/pvr/timers pvr/timers
7xbmc/pvr/windows pvr/windows
diff --git a/project/cmake/treedata/common/settings.txt b/project/cmake/treedata/common/settings.txt
new file mode 100644
index 0000000..c5aa2ae
--- /dev/null
+++ b/project/cmake/treedata/common/settings.txt
@@ -0,0 +1,4 @@
1xbmc/settings settings
2xbmc/settings/dialogs settings/dialogs
3xbmc/settings/lib settings/lib
4xbmc/settings/windows settings/windows
diff --git a/project/cmake/treedata/common/subdirs.txt b/project/cmake/treedata/common/subdirs.txt
new file mode 100644
index 0000000..762547e
--- /dev/null
+++ b/project/cmake/treedata/common/subdirs.txt
@@ -0,0 +1,25 @@
1xbmc xbmc
2xbmc/addons addons
3xbmc/commons commons
4xbmc/cdrip cdrip
5xbmc/dbwrappers dbwrappers
6xbmc/dialogs dialogs
7xbmc/epg epg
8xbmc/guilib guilib
9xbmc/input input
10xbmc/listproviders listproviders
11xbmc/media media
12xbmc/messaging messaging
13xbmc/messaging/helpers messagingHelpers
14xbmc/pictures pictures
15xbmc/platform platform
16xbmc/playlists playlists
17xbmc/powermanagement powermanagement
18xbmc/programs programs
19xbmc/rendering rendering
20xbmc/storage storage
21xbmc/threads threads
22xbmc/utils utils
23xbmc/view view
24xbmc/windowing windowing
25xbmc/windows windows
diff --git a/project/cmake/treedata/common/tests.txt b/project/cmake/treedata/common/tests.txt
new file mode 100644
index 0000000..358bc4d
--- /dev/null
+++ b/project/cmake/treedata/common/tests.txt
@@ -0,0 +1,10 @@
1xbmc/test test
2xbmc/addons/test test/addons
3xbmc/filesystem/test test/filesystem
4xbmc/interfaces/python/test test/python
5xbmc/music/tags/test test/music_tags
6xbmc/network/test test/network
7xbmc/threads/test test/threads
8xbmc/utils/test test/utils
9xbmc/video/test test/video
10xbmc/cores/AudioEngine/Sinks/test test/audioengine_sinks
diff --git a/project/cmake/treedata/common/video.txt b/project/cmake/treedata/common/video.txt
new file mode 100644
index 0000000..e7855a0
--- /dev/null
+++ b/project/cmake/treedata/common/video.txt
@@ -0,0 +1,5 @@
1xbmc/video video
2xbmc/video/dialogs video/dialogs
3xbmc/video/jobs video/jobs
4xbmc/video/videosync video/sync
5xbmc/video/windows video/windows
diff --git a/project/cmake/treedata/common/videoplayer.txt b/project/cmake/treedata/common/videoplayer.txt
new file mode 100644
index 0000000..8c8d45d
--- /dev/null
+++ b/project/cmake/treedata/common/videoplayer.txt
@@ -0,0 +1,12 @@
1xbmc/cores/VideoPlayer cores/VideoPlayer
2xbmc/cores/VideoPlayer/DVDCodecs cores/VideoPlayer/codecs
3xbmc/cores/VideoPlayer/DVDCodecs/Audio cores/VideoPlayer/codecs/audio
4xbmc/cores/VideoPlayer/DVDCodecs/Overlay cores/VideoPlayer/codecs/overlay
5xbmc/cores/VideoPlayer/DVDCodecs/Video cores/VideoPlayer/codecs/video
6xbmc/cores/VideoPlayer/DVDDemuxers cores/VideoPlayer/demuxers
7xbmc/cores/VideoPlayer/DVDInputStreams cores/VideoPlayer/inputstreams
8xbmc/cores/VideoPlayer/DVDSubtitles cores/VideoPlayer/subtitles
9xbmc/cores/VideoPlayer/Process cores/VideoPlayer/process
10xbmc/cores/VideoPlayer/VideoRenderers cores/VideoPlayer/videorenderers
11xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders cores/VideoPlayer/videorenderers/shaders
12xbmc/cores/VideoPlayer/VideoRenderers/HwDecRender cores/VideoPlayer/videorenderers/hwdec
diff --git a/project/cmake/treedata/darwin/subdirs.txt b/project/cmake/treedata/darwin/subdirs.txt
new file mode 100644
index 0000000..f0fc5c5
--- /dev/null
+++ b/project/cmake/treedata/darwin/subdirs.txt
@@ -0,0 +1,12 @@
1xbmc/linux linuxsupport
2xbmc/network/linux network/linux
3xbmc/network/osx network/osx
4xbmc/peripherals/bus/osx peripherals/bus/osx
5xbmc/powermanagement/osx powermanagement/osx
6xbmc/storage/osx storage/osx
7xbmc/platform/posix posix
8xbmc/platform/darwin platform_darwin
9xbmc/platform/darwin/osx platform_osx
10xbmc/filesystem/posix filesystem/posix
11xbmc/utils/posix utils_posix
12xbmc/windowing/osx windowing/osx
diff --git a/project/cmake/treedata/freebsd/subdirs.txt b/project/cmake/treedata/freebsd/subdirs.txt
new file mode 100644
index 0000000..faff03c
--- /dev/null
+++ b/project/cmake/treedata/freebsd/subdirs.txt
@@ -0,0 +1,4 @@
1xbmc/linux linuxsupport
2xbmc/input/linux input/linux
3xbmc/network/linux network/linux
4xbmc/freebsd freebsdsupport
diff --git a/project/cmake/treedata/ios/subdirs.txt b/project/cmake/treedata/ios/subdirs.txt
new file mode 100644
index 0000000..b681ed5
--- /dev/null
+++ b/project/cmake/treedata/ios/subdirs.txt
@@ -0,0 +1,15 @@
1xbmc/linux linuxsupport
2xbmc/input/touch input/touch
3xbmc/input/touch/generic input/touch/generic
4xbmc/network/linux network/linux
5xbmc/network/osx network/osx
6xbmc/peripherals/bus/osx peripherals/bus/osx
7xbmc/powermanagement/osx powermanagement/osx
8xbmc/storage/osx storage/osx
9xbmc/platform/posix posix
10xbmc/platform/darwin platform_darwin
11xbmc/platform/darwin/ios platform_ios
12xbmc/platform/darwin/ios-common platform_ios-common
13xbmc/filesystem/posix filesystem/posix
14xbmc/utils/posix utils_posix
15xbmc/windowing/osx windowing/osx
diff --git a/project/cmake/treedata/linux/subdirs.txt b/project/cmake/treedata/linux/subdirs.txt
new file mode 100644
index 0000000..81a48e3
--- /dev/null
+++ b/project/cmake/treedata/linux/subdirs.txt
@@ -0,0 +1,12 @@
1xbmc/linux linuxsupport
2xbmc/linux/sse4 sse4
3xbmc/input/linux input/linux
4xbmc/input/touch input/touch
5xbmc/input/touch/generic input/touch/generic
6xbmc/network/linux network/linux
7xbmc/peripherals/bus/linux peripherals/bus/linux
8xbmc/powermanagement/linux powermanagement/linux
9xbmc/storage/linux storage/linux
10xbmc/filesystem/posix filesystem/posix
11xbmc/utils/posix utils_posix
12xbmc/platform/posix posix
diff --git a/project/cmake/treedata/optional/common/X11.txt b/project/cmake/treedata/optional/common/X11.txt
new file mode 100644
index 0000000..f4afa57
--- /dev/null
+++ b/project/cmake/treedata/optional/common/X11.txt
@@ -0,0 +1 @@
xbmc/windowing/X11 windowing/X11 # X11
diff --git a/project/cmake/treedata/optional/common/cec.txt b/project/cmake/treedata/optional/common/cec.txt
new file mode 100644
index 0000000..19cd7f7
--- /dev/null
+++ b/project/cmake/treedata/optional/common/cec.txt
@@ -0,0 +1 @@
xbmc/peripherals/bus/virtual peripherals/bus/virtual # CEC
diff --git a/project/cmake/treedata/optional/common/nonfree.txt b/project/cmake/treedata/optional/common/nonfree.txt
new file mode 100644
index 0000000..470ed59
--- /dev/null
+++ b/project/cmake/treedata/optional/common/nonfree.txt
@@ -0,0 +1 @@
lib/UnrarXLib unrarxlib # NONFREE
diff --git a/project/cmake/treedata/optional/common/opengl.txt b/project/cmake/treedata/optional/common/opengl.txt
new file mode 100644
index 0000000..b88ad7a
--- /dev/null
+++ b/project/cmake/treedata/optional/common/opengl.txt
@@ -0,0 +1 @@
xbmc/rendering/gl rendering/gl # OPENGL
diff --git a/project/cmake/treedata/optional/common/opengles.txt b/project/cmake/treedata/optional/common/opengles.txt
new file mode 100644
index 0000000..6a223a1
--- /dev/null
+++ b/project/cmake/treedata/optional/common/opengles.txt
@@ -0,0 +1 @@
xbmc/rendering/gles rendering/gles # OPENGLES
diff --git a/project/cmake/treedata/rbpi/omxplayer.txt b/project/cmake/treedata/rbpi/omxplayer.txt
new file mode 100644
index 0000000..d56f1df
--- /dev/null
+++ b/project/cmake/treedata/rbpi/omxplayer.txt
@@ -0,0 +1 @@
xbmc/cores/omxplayer cores/omxplayer
diff --git a/project/cmake/treedata/rbpi/subdirs.txt b/project/cmake/treedata/rbpi/subdirs.txt
new file mode 100644
index 0000000..866ec00
--- /dev/null
+++ b/project/cmake/treedata/rbpi/subdirs.txt
@@ -0,0 +1,12 @@
1xbmc/linux linuxsupport
2xbmc/input/linux input/linux
3xbmc/input/touch input/touch
4xbmc/input/touch/generic input/touch/generic
5xbmc/network/linux network/linux
6xbmc/peripherals/bus/linux peripherals/bus/linux
7xbmc/powermanagement/linux powermanagement/linux
8xbmc/storage/linux storage/linux
9xbmc/filesystem/posix filesystem/posix
10xbmc/utils/posix utils_posix
11xbmc/platform/posix posix
12xbmc/windowing/egl windowing/egl # EGL
diff --git a/project/cmake/treedata/windows/subdirs.txt b/project/cmake/treedata/windows/subdirs.txt
new file mode 100644
index 0000000..60c0095
--- /dev/null
+++ b/project/cmake/treedata/windows/subdirs.txt
@@ -0,0 +1,15 @@
1xbmc/win32 win32support
2xbmc/input/windows input/windows
3xbmc/input/touch input/touch
4xbmc/input/touch/generic input/touch/generic
5xbmc/network/windows network/windows
6xbmc/network/mdns network/mdns
7xbmc/peripherals/bus/win32 peripherals/bus/win32
8xbmc/powermanagement/windows powermanagement/windows
9xbmc/storage/windows storage/windows
10xbmc/filesystem/win32 filesystem/win32
11xbmc/utils/win32 utils_win32
12xbmc/platform/win32 platform_win32
13xbmc/rendering/dx rendering_dx
14xbmc/threads/platform/win threads_win
15xbmc/windowing/windows windowing/windows