summaryrefslogtreecommitdiffstats
path: root/cmake/scripts/linux/Install.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/scripts/linux/Install.cmake')
-rw-r--r--cmake/scripts/linux/Install.cmake312
1 files changed, 312 insertions, 0 deletions
diff --git a/cmake/scripts/linux/Install.cmake b/cmake/scripts/linux/Install.cmake
new file mode 100644
index 0000000..613a989
--- /dev/null
+++ b/cmake/scripts/linux/Install.cmake
@@ -0,0 +1,312 @@
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
17# CMake config
18set(APP_PREFIX ${prefix})
19set(APP_LIB_DIR ${libdir}/${APP_NAME_LC})
20set(APP_DATA_DIR ${datarootdir}/${APP_NAME_LC})
21set(APP_INCLUDE_DIR ${includedir}/${APP_NAME_LC})
22set(CXX11_SWITCH "-std=c++11")
23
24# Set XBMC_STANDALONE_SH_PULSE so we can insert PulseAudio block into kodi-standalone
25if(EXISTS ${CMAKE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.pulse)
26 if(ENABLE_PULSEAUDIO AND PULSEAUDIO_FOUND)
27 file(READ "${CMAKE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.pulse" pulse_content)
28 set(XBMC_STANDALONE_SH_PULSE ${pulse_content})
29 endif()
30endif()
31
32# Configure startup scripts
33configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi.sh.in
34 ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC} @ONLY)
35configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.in
36 ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone @ONLY)
37
38# Configure cmake files
39configure_file(${CMAKE_SOURCE_DIR}/cmake/KodiConfig.cmake.in
40 ${CORE_BUILD_DIR}/scripts/${APP_NAME}Config.cmake @ONLY)
41
42# Configure xsession entry
43configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi-xsession.desktop.in
44 ${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop @ONLY)
45
46# Configure desktop entry
47configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi.desktop.in
48 ${CORE_BUILD_DIR}/${APP_NAME_LC}.desktop @ONLY)
49
50# Install app
51install(TARGETS ${APP_NAME_LC}
52 DESTINATION ${libdir}/${APP_NAME_LC}
53 COMPONENT kodi-bin)
54if(X_FOUND AND XRANDR_FOUND)
55 install(TARGETS ${APP_NAME_LC}-xrandr
56 DESTINATION ${libdir}/${APP_NAME_LC}
57 COMPONENT kodi-bin)
58endif()
59
60# Install scripts
61install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}
62 ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone
63 DESTINATION ${bindir}
64 COMPONENT kodi-bin)
65
66# Install libraries
67foreach(library ${LIBRARY_FILES})
68 get_filename_component(dir ${library} DIRECTORY)
69 string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${dir})
70 install(PROGRAMS ${library}
71 DESTINATION ${libdir}/${APP_NAME_LC}/${dir}
72 COMPONENT kodi-bin)
73endforeach()
74
75# Install add-ons, fonts, icons, keyboard maps, keymaps, etc
76# (addons, media, system, userdata folders in share/kodi/)
77foreach(file ${install_data})
78 get_filename_component(dir ${file} DIRECTORY)
79 install(FILES ${CMAKE_BINARY_DIR}/${file}
80 DESTINATION ${datarootdir}/${APP_NAME_LC}/${dir}
81 COMPONENT kodi)
82endforeach()
83
84# Install xsession entry
85install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop
86 RENAME ${APP_NAME_LC}.desktop
87 DESTINATION ${datarootdir}/xsessions
88 COMPONENT kodi)
89
90# Install desktop entry
91install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}.desktop
92 DESTINATION ${datarootdir}/applications
93 COMPONENT kodi)
94
95# Install icons
96install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon16x16.png
97 RENAME ${APP_NAME_LC}.png
98 DESTINATION ${datarootdir}/icons/hicolor/16x16/apps
99 COMPONENT kodi)
100install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon22x22.png
101 RENAME ${APP_NAME_LC}.png
102 DESTINATION ${datarootdir}/icons/hicolor/22x22/apps
103 COMPONENT kodi)
104install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon24x24.png
105 RENAME ${APP_NAME_LC}.png
106 DESTINATION ${datarootdir}/icons/hicolor/24x24/apps
107 COMPONENT kodi)
108install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon32x32.png
109 RENAME ${APP_NAME_LC}.png
110 DESTINATION ${datarootdir}/icons/hicolor/32x32/apps
111 COMPONENT kodi)
112install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon48x48.png
113 RENAME ${APP_NAME_LC}.png
114 DESTINATION ${datarootdir}/icons/hicolor/48x48/apps
115 COMPONENT kodi)
116install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon64x64.png
117 RENAME ${APP_NAME_LC}.png
118 DESTINATION ${datarootdir}/icons/hicolor/64x64/apps
119 COMPONENT kodi)
120install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon128x128.png
121 RENAME ${APP_NAME_LC}.png
122 DESTINATION ${datarootdir}/icons/hicolor/128x128/apps
123 COMPONENT kodi)
124install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon256x256.png
125 RENAME ${APP_NAME_LC}.png
126 DESTINATION ${datarootdir}/icons/hicolor/256x256/apps
127 COMPONENT kodi)
128
129# Install docs
130install(FILES ${CMAKE_SOURCE_DIR}/copying.txt
131 ${CMAKE_SOURCE_DIR}/LICENSE.GPL
132 ${CMAKE_SOURCE_DIR}/version.txt
133 ${CMAKE_SOURCE_DIR}/docs/README.linux
134 DESTINATION ${docdir}
135 COMPONENT kodi)
136
137install(FILES ${CMAKE_SOURCE_DIR}/privacy-policy.txt
138 DESTINATION ${datarootdir}/${APP_NAME_LC}
139 COMPONENT kodi)
140
141# Install kodi-tools-texturepacker
142if(NOT WITH_TEXTUREPACKER)
143 install(PROGRAMS $<TARGET_FILE:TexturePacker::TexturePacker>
144 DESTINATION ${bindir}
145 COMPONENT kodi-tools-texturepacker)
146endif()
147
148# Install kodi-addon-dev headers
149install(DIRECTORY ${CMAKE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/
150 DESTINATION ${includedir}/${APP_NAME_LC}
151 COMPONENT kodi-addon-dev)
152
153install(FILES ${CMAKE_SOURCE_DIR}/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxPacket.h
154 ${CMAKE_SOURCE_DIR}/xbmc/cores/VideoPlayer/DVDDemuxers/DemuxCrypto.h
155 ${CMAKE_SOURCE_DIR}/xbmc/cores/AudioEngine/Utils/AEChannelData.h
156 ${CMAKE_SOURCE_DIR}/xbmc/filesystem/IFileTypes.h
157 ${CMAKE_SOURCE_DIR}/xbmc/input/ActionIDs.h
158 ${CMAKE_SOURCE_DIR}/xbmc/input/XBMC_vkeys.h
159 DESTINATION ${includedir}/${APP_NAME_LC}
160 COMPONENT kodi-addon-dev)
161
162# Install kodi-addon-dev add-on bindings
163install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME}Config.cmake
164 ${CMAKE_SOURCE_DIR}/cmake/scripts/common/AddonHelpers.cmake
165 ${CMAKE_SOURCE_DIR}/cmake/scripts/common/AddOptions.cmake
166 ${CMAKE_SOURCE_DIR}/cmake/scripts/common/ArchSetup.cmake
167 ${CMAKE_SOURCE_DIR}/cmake/scripts/common/CheckCommits.cmake
168 ${CMAKE_SOURCE_DIR}/cmake/scripts/common/CheckTargetPlatform.cmake
169 ${CMAKE_SOURCE_DIR}/cmake/scripts/common/GenerateVersionedFiles.cmake
170 ${CMAKE_SOURCE_DIR}/cmake/scripts/common/GeneratorSetup.cmake
171 ${CMAKE_SOURCE_DIR}/cmake/scripts/common/HandleDepends.cmake
172 ${CMAKE_SOURCE_DIR}/cmake/scripts/common/Macros.cmake
173 ${CMAKE_SOURCE_DIR}/cmake/scripts/common/PrepareEnv.cmake
174 ${CMAKE_SOURCE_DIR}/cmake/scripts/common/ProjectMacros.cmake
175 ${CMAKE_SOURCE_DIR}/cmake/scripts/linux/PathSetup.cmake
176 DESTINATION ${datarootdir}/${APP_NAME_LC}/cmake
177 COMPONENT kodi-addon-dev)
178
179if(ENABLE_EVENTCLIENTS)
180 execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(prefix='')"
181 OUTPUT_VARIABLE PYTHON_LIB_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
182 # Install kodi-eventclients-common BT python files
183 install(PROGRAMS ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/bt/__init__.py
184 ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/bt/bt.py
185 ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/bt/hid.py
186 DESTINATION ${PYTHON_LIB_PATH}/${APP_NAME_LC}/bt
187 COMPONENT kodi-eventclients-common)
188
189 # Install kodi-eventclients-common PS3 python files
190 install(PROGRAMS ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/__init__.py
191 ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/keymaps.py
192 ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixaxis.py
193 ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixpair.py
194 ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixwatch.py
195 DESTINATION ${PYTHON_LIB_PATH}/${APP_NAME_LC}/ps3
196 COMPONENT kodi-eventclients-common)
197
198 # Install kodi-eventclients-common python files
199 file(WRITE ${CMAKE_BINARY_DIR}/packages/deb/defs.py ICON_PATH="usr/share/pixmaps/${APP_NAME_LC}/")
200 install(PROGRAMS ${CMAKE_BINARY_DIR}/packages/deb/defs.py
201 ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/__init__.py
202 "${CMAKE_SOURCE_DIR}/tools/EventClients/Clients/PS3 BD Remote/ps3_remote.py"
203 ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/xbmcclient.py
204 ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/zeroconf.py
205 DESTINATION ${PYTHON_LIB_PATH}/${APP_NAME_LC}
206 COMPONENT kodi-eventclients-common)
207
208 # Install kodi-eventclients-common icons
209 install(FILES ${CMAKE_SOURCE_DIR}/tools/EventClients/icons/bluetooth.png
210 ${CMAKE_SOURCE_DIR}/tools/EventClients/icons/phone.png
211 ${CMAKE_SOURCE_DIR}/tools/EventClients/icons/mail.png
212 ${CMAKE_SOURCE_DIR}/tools/EventClients/icons/mouse.png
213 DESTINATION ${datarootdir}/pixmaps/${APP_NAME_LC}
214 COMPONENT kodi-eventclients-common)
215
216 # Install kodi-eventclients-dev headers
217 install(FILES ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/c++/xbmcclient.h
218 DESTINATION ${includedir}/${APP_NAME_LC}
219 COMPONENT kodi-eventclients-dev)
220
221 # Install kodi-eventclients-dev C# examples
222 install(FILES "${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c#/XBMCDemoClient1.cs"
223 DESTINATION "${docdir}/${APP_NAME_LC}-eventclients-dev/examples/C#"
224 COMPONENT kodi-eventclients-dev)
225
226 # Install kodi-eventclients-dev C++ examples
227 install(FILES ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_notification.cpp
228 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_log.cpp
229 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_button1.cpp
230 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_mouse.cpp
231 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_button2.cpp
232 DESTINATION ${docdir}/${APP_NAME_LC}-eventclients-dev/examples/C++
233 COMPONENT kodi-eventclients-dev)
234
235 # Install kodi-eventclients-dev java examples
236 install(FILES ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/java/XBMCDemoClient1.java
237 DESTINATION ${docdir}/${APP_NAME_LC}-eventclients-dev/examples/java
238 COMPONENT kodi-eventclients-dev)
239
240 # Install kodi-eventclients-dev python examples
241 install(PROGRAMS ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_mouse.py
242 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_button1.py
243 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_notification.py
244 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_action.py
245 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_button2.py
246 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_simple.py
247 DESTINATION ${docdir}/${APP_NAME_LC}-eventclients-dev/examples/python
248 COMPONENT kodi-eventclients-dev)
249
250 # Install kodi-eventclients-ps3
251 install(PROGRAMS "${CMAKE_SOURCE_DIR}/tools/EventClients/Clients/PS3 BD Remote/ps3_remote.py"
252 RENAME ${APP_NAME_LC}-ps3remote
253 DESTINATION ${bindir}
254 COMPONENT kodi-eventclients-ps3)
255
256 if(BLUETOOTH_FOUND AND CWIID_FOUND)
257 # Install kodi-eventclients-wiiremote
258 install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/WiiRemote/${APP_NAME_LC}-wiiremote
259 DESTINATION ${bindir}
260 COMPONENT kodi-eventclients-wiiremote)
261 endif()
262
263 # Install kodi-eventclients-xbmc-send
264 install(PROGRAMS "${CMAKE_SOURCE_DIR}/tools/EventClients/Clients/Kodi Send/kodi-send.py"
265 RENAME ${APP_NAME_LC}-send
266 DESTINATION ${bindir}
267 COMPONENT kodi-eventclients-xbmc-send)
268endif()
269
270# Install XBT skin files
271foreach(texture ${XBT_FILES})
272 string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${texture})
273 get_filename_component(dir ${dir} DIRECTORY)
274 install(FILES ${texture}
275 DESTINATION ${datarootdir}/${APP_NAME_LC}/${dir}
276 COMPONENT kodi)
277endforeach()
278
279# Install extra stuff if it exists
280if(EXISTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs)
281 install(CODE "file(STRINGS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs dirs)
282 foreach(dir \${dirs})
283 file(GLOB_RECURSE FILES RELATIVE ${CMAKE_BINARY_DIR} \${dir}/*)
284 foreach(file \${FILES})
285 get_filename_component(dir \${file} DIRECTORY)
286 file(INSTALL \${file} DESTINATION ${datarootdir}/${APP_NAME_LC}/\${dir})
287 endforeach()
288 endforeach()")
289endif()
290
291if(NOT "$ENV{DESTDIR}" STREQUAL "")
292 set(DESTDIR ${CMAKE_BINARY_DIR}/$ENV{DESTDIR})
293endif()
294foreach(subdir ${build_dirs})
295 if(NOT subdir MATCHES kodi-platform)
296 string(REPLACE " " ";" subdir ${subdir})
297 list(GET subdir 0 id)
298 install(CODE "execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${id}/src/${id}-build install DESTDIR=${DESTDIR})")
299 endif()
300endforeach()
301
302# generate packages? yes please, if everything checks out
303if(CPACK_GENERATOR)
304 if(CPACK_GENERATOR STREQUAL DEB AND ( CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL rbpi ) )
305 if(CMAKE_BUILD_TYPE STREQUAL Debug)
306 message(STATUS "DEB Generator: Build type is set to 'Debug'. Packaged binaries will be unstripped.")
307 endif()
308 include(${CMAKE_SOURCE_DIR}/cmake/cpack/CPackConfigDEB.cmake)
309 else()
310 message(FATAL_ERROR "DEB Generator: Can't configure CPack to generate Debian packages on non-linux systems.")
311 endif()
312endif()