[video] Fix bookmark thumbnails of rotated videos
[xbmc.git] / cmake / scripts / linux / Install.cmake
blobfd73bea9ed006e685f95e41950474b63a2cf6d36
1 if(X_FOUND)
2   set(USE_X11 1)
3 else()
4   set(USE_X11 0)
5 endif()
7 # CMake config
8 set(APP_BINARY ${APP_NAME_LC}${APP_BINARY_SUFFIX})
9 set(APP_PREFIX ${prefix})
10 set(APP_LIB_DIR ${libdir}/${APP_NAME_LC})
11 set(APP_DATA_DIR ${datarootdir}/${APP_NAME_LC})
12 set(APP_INCLUDE_DIR ${includedir}/${APP_NAME_LC})
14 # Set XBMC_STANDALONE_SH_PULSE so we can insert PulseAudio block into kodi-standalone
15 if(EXISTS ${CMAKE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.pulse)
16   if(ENABLE_PULSEAUDIO AND TARGET PulseAudio::PulseAudio)
17     file(READ "${CMAKE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.pulse" pulse_content)
18     set(XBMC_STANDALONE_SH_PULSE ${pulse_content})
19   endif()
20 endif()
22 # Configure startup scripts
23 configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi.sh.in
24                ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC} @ONLY)
25 configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi-standalone.sh.in
26                ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone @ONLY)
28 # Configure cmake files
29 configure_file(${CMAKE_SOURCE_DIR}/cmake/KodiConfig.cmake.in
30                ${CORE_BUILD_DIR}/scripts/${APP_NAME}Config.cmake @ONLY)
32 # Configure gbm session entry
33 configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi-gbm-session.desktop.in
34                ${CORE_BUILD_DIR}/${APP_NAME_LC}-gbm-session.desktop @ONLY)
36 # Configure xsession entry
37 configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi-xsession.desktop.in
38                ${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop @ONLY)
40 # Configure desktop entry
41 configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi.desktop.in
42                ${CORE_BUILD_DIR}/${APP_NAME_LC}.desktop @ONLY)
44 # Configure metainfo
45 configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi.metainfo.xml.in
46                ${CORE_BUILD_DIR}/${APP_PACKAGE}.metainfo.xml @ONLY)
48 # Install app
49 install(TARGETS ${APP_NAME_LC}
50         DESTINATION ${libdir}/${APP_NAME_LC}
51         COMPONENT kodi-bin)
52 if(TARGET X::X AND TARGET XRandR::XRandR)
53   install(TARGETS ${APP_NAME_LC}-xrandr
54           DESTINATION ${libdir}/${APP_NAME_LC}
55           COMPONENT kodi-bin)
56 endif()
58 # Install scripts
59 install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}
60                  ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME_LC}-standalone
61         DESTINATION ${bindir}
62         COMPONENT kodi-bin)
64 # Install libraries
65 foreach(library ${LIBRARY_FILES})
66   get_filename_component(dir ${library} DIRECTORY)
67   string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${dir})
68   install(PROGRAMS ${library}
69           DESTINATION ${libdir}/${APP_NAME_LC}/${dir}
70           COMPONENT kodi-bin)
71 endforeach()
73 # Install add-ons, fonts, icons, keyboard maps, keymaps, etc
74 # (addons, media, system, userdata folders in share/kodi/)
75 foreach(file ${install_data})
76   get_filename_component(dir ${file} DIRECTORY)
77   install(FILES ${CMAKE_BINARY_DIR}/${file}
78           DESTINATION ${datarootdir}/${APP_NAME_LC}/${dir}
79           COMPONENT kodi)
80 endforeach()
82 # Install gbm session entry
83 install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}-gbm-session.desktop
84         RENAME ${APP_NAME_LC}-gbm.desktop
85         DESTINATION ${datarootdir}/wayland-sessions
86         COMPONENT kodi)
88 # Install xsession entry
89 install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}-xsession.desktop
90         RENAME ${APP_NAME_LC}.desktop
91         DESTINATION ${datarootdir}/xsessions
92         COMPONENT kodi)
94 # Install desktop entry
95 install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}.desktop
96         DESTINATION ${datarootdir}/applications
97         COMPONENT kodi)
99 # Install metainfo
100 install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_PACKAGE}.metainfo.xml
101         DESTINATION ${datarootdir}/metainfo
102         COMPONENT kodi)
104 # Install icons
105 install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon16x16.png
106         RENAME ${APP_NAME_LC}.png
107         DESTINATION ${datarootdir}/icons/hicolor/16x16/apps
108         COMPONENT kodi)
109 install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon22x22.png
110         RENAME ${APP_NAME_LC}.png
111         DESTINATION ${datarootdir}/icons/hicolor/22x22/apps
112         COMPONENT kodi)
113 install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon24x24.png
114         RENAME ${APP_NAME_LC}.png
115         DESTINATION ${datarootdir}/icons/hicolor/24x24/apps
116         COMPONENT kodi)
117 install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon32x32.png
118         RENAME ${APP_NAME_LC}.png
119         DESTINATION ${datarootdir}/icons/hicolor/32x32/apps
120         COMPONENT kodi)
121 install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon48x48.png
122         RENAME ${APP_NAME_LC}.png
123         DESTINATION ${datarootdir}/icons/hicolor/48x48/apps
124         COMPONENT kodi)
125 install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon64x64.png
126         RENAME ${APP_NAME_LC}.png
127         DESTINATION ${datarootdir}/icons/hicolor/64x64/apps
128         COMPONENT kodi)
129 install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon128x128.png
130         RENAME ${APP_NAME_LC}.png
131         DESTINATION ${datarootdir}/icons/hicolor/128x128/apps
132         COMPONENT kodi)
133 install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/packaging/media/icon256x256.png
134         RENAME ${APP_NAME_LC}.png
135         DESTINATION ${datarootdir}/icons/hicolor/256x256/apps
136         COMPONENT kodi)
138 # Install firewalld service definitions
139 install(FILES ${CMAKE_SOURCE_DIR}/tools/Linux/firewalld-services/kodi-eventserver.xml
140               ${CMAKE_SOURCE_DIR}/tools/Linux/firewalld-services/kodi-http.xml
141               ${CMAKE_SOURCE_DIR}/tools/Linux/firewalld-services/kodi-jsonrpc.xml
142         DESTINATION ${prefix}/lib/firewalld/services
143         COMPONENT kodi)
145 # Install docs
146 install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.md
147               ${CMAKE_SOURCE_DIR}/version.txt
148               ${CMAKE_SOURCE_DIR}/docs/README.Linux.md
149         DESTINATION ${docdir}
150         COMPONENT kodi)
152 install(FILES ${CMAKE_SOURCE_DIR}/privacy-policy.txt
153         DESTINATION ${datarootdir}/${APP_NAME_LC}
154         COMPONENT kodi)
156 # Install kodi-tools-texturepacker
157 if(INTERNAL_TEXTUREPACKER_INSTALLABLE)
158   install(PROGRAMS $<TARGET_FILE:TexturePacker::TexturePacker::Installable>
159           DESTINATION ${bindir}
160           RENAME "${APP_NAME_LC}-TexturePacker"
161           COMPONENT kodi-tools-texturepacker)
162 endif()
164 # Install kodi-addon-dev headers
165 include(${CMAKE_SOURCE_DIR}/xbmc/addons/AddonBindings.cmake)
166 install(DIRECTORY ${CORE_ADDON_BINDINGS_DIRS}/
167         DESTINATION ${includedir}/${APP_NAME_LC}
168         COMPONENT kodi-addon-dev
169         REGEX ".txt" EXCLUDE)
171 install(FILES ${CORE_ADDON_BINDINGS_FILES}
172         DESTINATION ${includedir}/${APP_NAME_LC}
173         COMPONENT kodi-addon-dev)
175 # Install kodi-addon-dev add-on bindings
176 install(FILES ${CMAKE_SOURCE_DIR}/cmake/scripts/common/AddonHelpers.cmake
177               ${CMAKE_SOURCE_DIR}/cmake/scripts/common/AddOptions.cmake
178               ${CMAKE_SOURCE_DIR}/cmake/scripts/common/ArchSetup.cmake
179               ${CMAKE_SOURCE_DIR}/cmake/scripts/common/CheckCommits.cmake
180               ${CMAKE_SOURCE_DIR}/cmake/scripts/common/CheckTargetPlatform.cmake
181               ${CMAKE_SOURCE_DIR}/cmake/scripts/common/GenerateCompileInfo.cmake
182               ${CMAKE_SOURCE_DIR}/cmake/scripts/common/GeneratorSetup.cmake
183               ${CMAKE_SOURCE_DIR}/cmake/scripts/common/HandleDepends.cmake
184               ${CMAKE_SOURCE_DIR}/cmake/scripts/common/Macros.cmake
185               ${CMAKE_SOURCE_DIR}/cmake/scripts/common/PrepareEnv.cmake
186               ${CMAKE_SOURCE_DIR}/cmake/scripts/common/ProjectMacros.cmake
187               ${CMAKE_SOURCE_DIR}/cmake/scripts/linux/PathSetup.cmake
188         DESTINATION ${datarootdir}/${APP_NAME_LC}/cmake
189         COMPONENT kodi-addon-dev)
190 # ${APP_NAME}Config.cmake contains architecture-specific paths so it
191 # should be installed in ${libdir}/${APP_NAME_LC}/${dir}
192 install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/scripts/${APP_NAME}Config.cmake
193         DESTINATION ${libdir}/${APP_NAME_LC}/cmake
194         COMPONENT kodi-addon-dev)
196 if(ENABLE_EVENTCLIENTS)
197   find_package(PythonInterpreter REQUIRED)
198   execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(prefix=''))"
199                   OUTPUT_VARIABLE PYTHON_LIB_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
200   # Install kodi-eventclients-common BT python files
201   install(PROGRAMS ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/bt/__init__.py
202                    ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/bt/bt.py
203                    ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/bt/hid.py
204           DESTINATION ${PYTHON_LIB_PATH}/${APP_NAME_LC}/bt
205           COMPONENT kodi-eventclients-common)
207   # Install kodi-eventclients-common PS3 python files
208   install(PROGRAMS ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/__init__.py
209                    ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/keymaps.py
210                    ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixaxis.py
211                    ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixpair.py
212                    ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/ps3/sixwatch.py
213           DESTINATION ${PYTHON_LIB_PATH}/${APP_NAME_LC}/ps3
214           COMPONENT kodi-eventclients-common)
216   # Install kodi-eventclients-common python files
217   file(WRITE ${CMAKE_BINARY_DIR}/packages/deb/defs.py ICON_PATH="/usr/share/pixmaps/${APP_NAME_LC}/")
218   install(PROGRAMS ${CMAKE_BINARY_DIR}/packages/deb/defs.py
219                    ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/__init__.py
220                    ${CMAKE_SOURCE_DIR}/tools/EventClients/Clients/PS3BDRemote/ps3_remote.py
221                    ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/xbmcclient.py
222                    ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/python/zeroconf.py
223           DESTINATION ${PYTHON_LIB_PATH}/${APP_NAME_LC}
224           COMPONENT kodi-eventclients-common)
226   # Install kodi-eventclients-common icons
227   install(FILES ${CMAKE_SOURCE_DIR}/tools/EventClients/icons/bluetooth.png
228                 ${CMAKE_SOURCE_DIR}/tools/EventClients/icons/phone.png
229                 ${CMAKE_SOURCE_DIR}/tools/EventClients/icons/mail.png
230                 ${CMAKE_SOURCE_DIR}/tools/EventClients/icons/mouse.png
231           DESTINATION ${datarootdir}/pixmaps/${APP_NAME_LC}
232           COMPONENT kodi-eventclients-common)
234   # Install kodi-eventclients-dev headers
235   install(FILES ${CMAKE_SOURCE_DIR}/tools/EventClients/lib/c++/xbmcclient.h
236           DESTINATION ${includedir}/${APP_NAME_LC}
237           COMPONENT kodi-eventclients-dev)
239   # Install kodi-eventclients-dev C# examples
240   install(FILES "${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c#/XBMCDemoClient1.cs"
241           DESTINATION "${docdir}/${APP_NAME_LC}-eventclients-dev/examples/C#"
242           COMPONENT kodi-eventclients-dev)
244   # Install kodi-eventclients-dev C++ examples
245   install(FILES ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_notification.cpp
246                 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_log.cpp
247                 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_button1.cpp
248                 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_mouse.cpp
249                 ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/c++/example_button2.cpp
250           DESTINATION ${docdir}/${APP_NAME_LC}-eventclients-dev/examples/C++
251           COMPONENT kodi-eventclients-dev)
253   # Install kodi-eventclients-dev java examples
254   install(FILES ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/java/XBMCDemoClient1.java
255           DESTINATION ${docdir}/${APP_NAME_LC}-eventclients-dev/examples/java
256           COMPONENT kodi-eventclients-dev)
258   # Install kodi-eventclients-dev python examples
259   install(PROGRAMS ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_mouse.py
260                    ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_button1.py
261                    ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_notification.py
262                    ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_action.py
263                    ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_button2.py
264                    ${CMAKE_SOURCE_DIR}/tools/EventClients/examples/python/example_simple.py
265           DESTINATION ${docdir}/${APP_NAME_LC}-eventclients-dev/examples/python
266           COMPONENT kodi-eventclients-dev)
268   # Install kodi-eventclients-ps3
269   install(PROGRAMS ${CMAKE_SOURCE_DIR}/tools/EventClients/Clients/PS3BDRemote/ps3_remote.py
270           RENAME ${APP_NAME_LC}-ps3remote
271           DESTINATION ${bindir}
272           COMPONENT kodi-eventclients-ps3)
274   if(TARGET Bluetooth::Bluetooth AND CWIID_FOUND AND GLU_FOUND)
275     # Install kodi-eventclients-wiiremote
276     install(PROGRAMS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/WiiRemote/${APP_NAME_LC}-wiiremote
277             DESTINATION ${bindir}
278             COMPONENT kodi-eventclients-wiiremote)
279   endif()
281   # Install kodi-eventclients-kodi-send
282   install(PROGRAMS ${CMAKE_SOURCE_DIR}/tools/EventClients/Clients/KodiSend/kodi-send.py
283           RENAME ${APP_NAME_LC}-send
284           DESTINATION ${bindir}
285           COMPONENT kodi-eventclients-kodi-send)
286 endif()
288 # Install XBT skin files
289 foreach(texture ${XBT_FILES})
290   string(REPLACE "${CMAKE_BINARY_DIR}/" "" dir ${texture})
291   get_filename_component(dir ${dir} DIRECTORY)
292   install(FILES ${texture}
293           DESTINATION ${datarootdir}/${APP_NAME_LC}/${dir}
294           COMPONENT kodi)
295 endforeach()
297 # Install extra stuff if it exists
298 if(EXISTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs)
299   install(CODE "file(STRINGS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/extra-installs dirs)
300               foreach(dir \${dirs})
301                 file(GLOB_RECURSE FILES RELATIVE ${CMAKE_BINARY_DIR} \${dir}/*)
302                 foreach(file \${FILES})
303                   get_filename_component(dir \${file} DIRECTORY)
304                   file(INSTALL \${file} DESTINATION ${datarootdir}/${APP_NAME_LC}/\${dir})
305                 endforeach()
306               endforeach()")
307 endif()
309 if(NOT "$ENV{DESTDIR}" STREQUAL "")
310   set(DESTDIR ${CMAKE_BINARY_DIR}/$ENV{DESTDIR})
311 endif()
312 foreach(subdir ${build_dirs})
313   if(NOT subdir MATCHES kodi-platform)
314     string(REPLACE " " ";" subdir ${subdir})
315     list(GET subdir 0 id)
316     install(CODE "execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} -C ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${id}/src/${id}-build install DESTDIR=${DESTDIR})")
317   endif()
318 endforeach()
320 # generate packages? yes please, if everything checks out
321 if(CPACK_GENERATOR)
322   if(CPACK_GENERATOR STREQUAL DEB AND CORE_SYSTEM_NAME STREQUAL linux)
323     if(CMAKE_BUILD_TYPE STREQUAL Debug)
324       message(STATUS "DEB Generator: Build type is set to 'Debug'. Packaged binaries will be unstripped.")
325     endif()
326     include(${CMAKE_SOURCE_DIR}/cmake/cpack/CPackConfigDEB.cmake)
327   else()
328     message(FATAL_ERROR "DEB Generator: Can't configure CPack to generate Debian packages on non-linux systems.")
329   endif()
330 endif()
332 if("webos" IN_LIST CORE_PLATFORM_NAME_LC)
333   include(${CMAKE_SOURCE_DIR}/cmake/scripts/webos/Install.cmake)
334 endif()