diff options
| author | manuel <manuel@mausz.at> | 2017-06-04 16:57:49 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2017-06-04 16:57:49 +0200 |
| commit | f44ecaa4f27e7538ddcad66d40e543bffa2d2d86 (patch) | |
| tree | d8de60fc7e17edeb6f0921726c038ee54b281445 /cmake/scripts/linux | |
| parent | ae08c8b7221bc965ac40d70e53fc8fcddb050c46 (diff) | |
| download | kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.tar.gz kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.tar.bz2 kodi-pvr-build-f44ecaa4f27e7538ddcad66d40e543bffa2d2d86.zip | |
sync with upstream
Diffstat (limited to 'cmake/scripts/linux')
| -rw-r--r-- | cmake/scripts/linux/ArchSetup.cmake | 46 | ||||
| -rw-r--r-- | cmake/scripts/linux/CodeCoverage.cmake | 97 | ||||
| -rw-r--r-- | cmake/scripts/linux/ExtraTargets.cmake | 15 | ||||
| -rw-r--r-- | cmake/scripts/linux/Install.cmake | 312 | ||||
| -rw-r--r-- | cmake/scripts/linux/Macros.cmake | 95 | ||||
| -rw-r--r-- | cmake/scripts/linux/PathSetup.cmake | 40 |
6 files changed, 605 insertions, 0 deletions
diff --git a/cmake/scripts/linux/ArchSetup.cmake b/cmake/scripts/linux/ArchSetup.cmake new file mode 100644 index 0000000..c31becd --- /dev/null +++ b/cmake/scripts/linux/ArchSetup.cmake | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | set(ARCH_DEFINES -D_LINUX -DTARGET_POSIX -DTARGET_LINUX) | ||
| 2 | set(SYSTEM_DEFINES -D__STDC_CONSTANT_MACROS -D_LARGEFILE64_SOURCE | ||
| 3 | -D_FILE_OFFSET_BITS=64) | ||
| 4 | set(PLATFORM_DIR linux) | ||
| 5 | set(CMAKE_SYSTEM_NAME Linux) | ||
| 6 | if(WITH_ARCH) | ||
| 7 | set(ARCH ${WITH_ARCH}) | ||
| 8 | else() | ||
| 9 | if(CPU STREQUAL x86_64) | ||
| 10 | set(ARCH x86_64-linux) | ||
| 11 | set(NEON False) | ||
| 12 | elseif(CPU MATCHES "i.86") | ||
| 13 | set(ARCH i486-linux) | ||
| 14 | set(NEON False) | ||
| 15 | add_options(CXX ALL_BUILDS "-msse") | ||
| 16 | elseif(CPU MATCHES arm) | ||
| 17 | set(ARCH arm) | ||
| 18 | set(NEON True) | ||
| 19 | set(NEON_FLAGS "-mfpu=neon -mvectorize-with-neon-quad") | ||
| 20 | elseif(CPU MATCHES aarch64 OR CPU MATCHES arm64) | ||
| 21 | set(ARCH aarch64) | ||
| 22 | set(NEON True) | ||
| 23 | else() | ||
| 24 | message(SEND_ERROR "Unknown CPU: ${CPU}") | ||
| 25 | endif() | ||
| 26 | endif() | ||
| 27 | |||
| 28 | # Make sure we strip binaries in Release build | ||
| 29 | if(CMAKE_BUILD_TYPE STREQUAL Release AND CMAKE_COMPILER_IS_GNUCXX) | ||
| 30 | set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s") | ||
| 31 | endif() | ||
| 32 | |||
| 33 | find_package(CXX11 REQUIRED) | ||
| 34 | include(LDGOLD) | ||
| 35 | |||
| 36 | # Code Coverage | ||
| 37 | if(CMAKE_BUILD_TYPE STREQUAL Coverage) | ||
| 38 | set(COVERAGE_TEST_BINARY ${APP_NAME_LC}-test) | ||
| 39 | set(COVERAGE_SOURCE_DIR ${CMAKE_SOURCE_DIR}) | ||
| 40 | set(COVERAGE_DEPENDS "\${APP_NAME_LC}" "\${APP_NAME_LC}-test") | ||
| 41 | set(COVERAGE_EXCLUDES */test/* lib/* */lib/*) | ||
| 42 | endif() | ||
| 43 | |||
| 44 | if(ENABLE_MIR) | ||
| 45 | set(ENABLE_VDPAU OFF CACHE BOOL "Disabling VDPAU since no Mir support" FORCE) | ||
| 46 | endif() | ||
diff --git a/cmake/scripts/linux/CodeCoverage.cmake b/cmake/scripts/linux/CodeCoverage.cmake new file mode 100644 index 0000000..f0a36fc --- /dev/null +++ b/cmake/scripts/linux/CodeCoverage.cmake | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | # - CodeCoverage | ||
| 2 | # Generate code coverage reports with LCOV and GCovr. | ||
| 3 | # | ||
| 4 | # Configuration: | ||
| 5 | # COVERAGE_SOURCE_DIR - Source root directory (default ${CMAKE_SOURCE_DIR}). | ||
| 6 | # COVERAGE_BINARY_DIR - Directory where the coverage reports (and intermediate files) | ||
| 7 | # are generated to. | ||
| 8 | # COVERAGE_EXCLUDES - List of exclude patterns (for example '*/tests/*'). | ||
| 9 | # | ||
| 10 | # The following targets will be generated: | ||
| 11 | # coverage - Builds an html report. Requires LCOV. | ||
| 12 | # coverage_xml - Builds an xml report (in Cobertura format for Jenkins). | ||
| 13 | # Requires Gcovr. | ||
| 14 | # | ||
| 15 | # Inspired by https://github.com/bilke/cmake-modules/blob/master/CodeCoverage.cmake | ||
| 16 | |||
| 17 | # Compiler and linker setup | ||
| 18 | set(CMAKE_C_FLAGS_COVERAGE "-g -O0 --coverage" CACHE STRING | ||
| 19 | "Flags used by the C compiler during coverage builds." FORCE) | ||
| 20 | set(CMAKE_CXX_FLAGS_COVERAGE "-g -O0 --coverage" CACHE STRING | ||
| 21 | "Flags used by the C++ compiler during coverage builds." FORCE) | ||
| 22 | set(CMAKE_EXE_LINKER_FLAGS_COVERAGE "--coverage" CACHE STRING | ||
| 23 | "Flags used for linking binaries during coverage builds." FORCE) | ||
| 24 | set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "--coverage" CACHE STRING | ||
| 25 | "Flags used by the shared libraries linker during coverage builds." FORCE) | ||
| 26 | mark_as_advanced( | ||
| 27 | CMAKE_C_FLAGS_COVERAGE CMAKE_CXX_FLAGS_COVERAGE CMAKE_EXE_LINKER_FLAGS_COVERAGE | ||
| 28 | CMAKE_SHARED_LINKER_FLAGS_COVERAGE CMAKE_STATIC_LINKER_FLAGS_COVERAGE | ||
| 29 | ) | ||
| 30 | |||
| 31 | find_program(LCOV_EXECUTABLE lcov) | ||
| 32 | find_program(GENINFO_EXECUTABLE geninfo) | ||
| 33 | find_program(GENHTML_EXECUTABLE genhtml) | ||
| 34 | find_program(GCOVR_EXECUTABLE gcovr) | ||
| 35 | mark_as_advanced(LCOV_EXECUTABLE GENINFO_EXECUTABLE GENHTML_EXECUTABLE GCOVR_EXECUTABLE) | ||
| 36 | |||
| 37 | # Default options | ||
| 38 | if(NOT COVERAGE_SOURCE_DIR) | ||
| 39 | set(COVERAGE_SOURCE_DIR ${CMAKE_SOURCE_DIR}) | ||
| 40 | endif() | ||
| 41 | if(NOT COVERAGE_BINARY_DIR) | ||
| 42 | set(COVERAGE_BINARY_DIR ${CMAKE_BINARY_DIR}/coverage) | ||
| 43 | endif() | ||
| 44 | if(NOT COVERAGE_EXCLUDES) | ||
| 45 | set(COVERAGE_EXCLUDES) | ||
| 46 | endif() | ||
| 47 | |||
| 48 | # Allow variables in COVERAGE_DEPENDS that are not evaluated before this file is included. | ||
| 49 | string(CONFIGURE "${COVERAGE_DEPENDS}" COVERAGE_DEPENDS) | ||
| 50 | |||
| 51 | # Add coverage target that generates an HTML report using LCOV | ||
| 52 | if(LCOV_EXECUTABLE AND GENINFO_EXECUTABLE AND GENHTML_EXECUTABLE) | ||
| 53 | file(MAKE_DIRECTORY ${COVERAGE_BINARY_DIR}) | ||
| 54 | add_custom_target(coverage | ||
| 55 | COMMAND ${CMAKE_COMMAND} -E make_directory ${COVERAGE_BINARY_DIR} | ||
| 56 | COMMAND ${LCOV_EXECUTABLE} -z -q -d ${CMAKE_BINARY_DIR} | ||
| 57 | COMMAND ${LCOV_EXECUTABLE} -c -q -i -d ${CMAKE_BINARY_DIR} -b ${COVERAGE_SOURCE_DIR} | ||
| 58 | -o ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage_base.info | ||
| 59 | COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target test || true | ||
| 60 | COMMAND ${LCOV_EXECUTABLE} -c -q -d ${CMAKE_BINARY_DIR} -b ${COVERAGE_SOURCE_DIR} | ||
| 61 | -o ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage_test.info | ||
| 62 | COMMAND ${LCOV_EXECUTABLE} -a ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage_base.info | ||
| 63 | -a ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage_test.info | ||
| 64 | -o ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage.info -q | ||
| 65 | COMMAND ${LCOV_EXECUTABLE} -q -r ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage.info | ||
| 66 | /usr/include/* ${CMAKE_BINARY_DIR}/* ${COVERAGE_EXCLUDES} | ||
| 67 | -o ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage.info | ||
| 68 | COMMAND ${GENHTML_EXECUTABLE} ${COVERAGE_BINARY_DIR}/${PROJECT_NAME}.coverage.info | ||
| 69 | -o ${COVERAGE_BINARY_DIR}/html -s --legend --highlight --demangle-cpp | ||
| 70 | COMMAND ${CMAKE_COMMAND} -E echo "Coverage report: file://${COVERAGE_BINARY_DIR}/html/index.html" | ||
| 71 | WORKING_DIRECTORY ${COVERAGE_BINARY_DIR} | ||
| 72 | VERBATIM | ||
| 73 | DEPENDS ${COVERAGE_DEPENDS} | ||
| 74 | COMMENT "Generate code coverage html report" | ||
| 75 | ) | ||
| 76 | else() | ||
| 77 | message(WARNING "Target coverage not available (lcov, geninfo and genhtml needed).") | ||
| 78 | endif() | ||
| 79 | |||
| 80 | # Add coverage target that generates an XML report using Gcovr | ||
| 81 | if(GCOVR_EXECUTABLE) | ||
| 82 | file(MAKE_DIRECTORY ${COVERAGE_BINARY_DIR}) | ||
| 83 | string(REGEX REPLACE "([^;]+)" "--exclude=\"\\1\"" _gcovr_excludes "${COVERAGE_EXCLUDES}") | ||
| 84 | string(REPLACE "*" ".*" _gcovr_excludes "${_gcovr_excludes}") | ||
| 85 | add_custom_target(coverage_xml | ||
| 86 | COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target test || true | ||
| 87 | COMMAND ${GCOVR_EXECUTABLE} -x -r ${COVERAGE_SOURCE_DIR} -o ${COVERAGE_BINARY_DIR}/coverage.xml | ||
| 88 | --object-directory ${CMAKE_BINARY_DIR} ${_gcovr_excludes} ${CMAKE_BINARY_DIR} | ||
| 89 | COMMAND ${CMAKE_COMMAND} -E echo "Coverage report: file://${COVERAGE_BINARY_DIR}/coverage.xml" | ||
| 90 | WORKING_DIRECTORY ${COVERAGE_BINARY_DIR} | ||
| 91 | DEPENDS ${COVERAGE_DEPENDS} | ||
| 92 | COMMENT "Generate code coverage xml report" | ||
| 93 | ) | ||
| 94 | unset(_gcovr_excludes) | ||
| 95 | else() | ||
| 96 | message(WARNING "Target coverage_xml not available (gcovr needed).") | ||
| 97 | endif() | ||
diff --git a/cmake/scripts/linux/ExtraTargets.cmake b/cmake/scripts/linux/ExtraTargets.cmake new file mode 100644 index 0000000..e89aab6 --- /dev/null +++ b/cmake/scripts/linux/ExtraTargets.cmake | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | # xrandr | ||
| 2 | if(X_FOUND AND XRANDR_FOUND) | ||
| 3 | find_package(X QUIET) | ||
| 4 | find_package(XRandR QUIET) | ||
| 5 | add_executable(${APP_NAME_LC}-xrandr ${CMAKE_SOURCE_DIR}/xbmc-xrandr.c) | ||
| 6 | target_link_libraries(${APP_NAME_LC}-xrandr ${SYSTEM_LDFLAGS} ${X_LIBRARIES} m ${XRANDR_LIBRARIES}) | ||
| 7 | endif() | ||
| 8 | |||
| 9 | # WiiRemote | ||
| 10 | if(ENABLE_EVENTCLIENTS AND BLUETOOTH_FOUND) | ||
| 11 | find_package(CWiid QUIET) | ||
| 12 | if(CWIID_FOUND) | ||
| 13 | add_subdirectory(${CMAKE_SOURCE_DIR}/tools/EventClients/Clients/WiiRemote build/WiiRemote) | ||
| 14 | endif() | ||
| 15 | endif() | ||
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 @@ | |||
| 1 | if(X_FOUND) | ||
| 2 | set(USE_X11 1) | ||
| 3 | else() | ||
| 4 | set(USE_X11 0) | ||
| 5 | endif() | ||
| 6 | if(OPENGL_FOUND) | ||
| 7 | set(USE_OPENGL 1) | ||
| 8 | else() | ||
| 9 | set(USE_OPENGL 0) | ||
| 10 | endif() | ||
| 11 | if(OPENGLES_FOUND) | ||
| 12 | set(USE_OPENGLES 1) | ||
| 13 | else() | ||
| 14 | set(USE_OPENGLES 0) | ||
| 15 | endif() | ||
| 16 | |||
| 17 | # CMake config | ||
| 18 | set(APP_PREFIX ${prefix}) | ||
| 19 | set(APP_LIB_DIR ${libdir}/${APP_NAME_LC}) | ||
| 20 | set(APP_DATA_DIR ${datarootdir}/${APP_NAME_LC}) | ||
| 21 | set(APP_INCLUDE_DIR ${includedir}/${APP_NAME_LC}) | ||
| 22 | set(CXX11_SWITCH "-std=c++11") | ||
| 23 | |||
| 24 | # Set XBMC_STANDALONE_SH_PULSE so we can insert PulseAudio block into kodi-standalone | ||
| 25 | if(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() | ||
| 30 | endif() | ||
| 31 | |||
| 32 | # Configure startup scripts | ||
| 33 | configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi.sh.in | ||
| 34 | ${CORE_BUILD_DIR}/scripts/${APP_NAME_LC} @ONLY) | ||
| 35 | configure_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 | ||
| 39 | configure_file(${CMAKE_SOURCE_DIR}/cmake/KodiConfig.cmake.in | ||
| 40 | ${CORE_BUILD_DIR}/scripts/${APP_NAME}Config.cmake @ONLY) | ||
| 41 | |||
| 42 | # Configure xsession entry | ||
| 43 | configure_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 | ||
| 47 | configure_file(${CMAKE_SOURCE_DIR}/tools/Linux/kodi.desktop.in | ||
| 48 | ${CORE_BUILD_DIR}/${APP_NAME_LC}.desktop @ONLY) | ||
| 49 | |||
| 50 | # Install app | ||
| 51 | install(TARGETS ${APP_NAME_LC} | ||
| 52 | DESTINATION ${libdir}/${APP_NAME_LC} | ||
| 53 | COMPONENT kodi-bin) | ||
| 54 | if(X_FOUND AND XRANDR_FOUND) | ||
| 55 | install(TARGETS ${APP_NAME_LC}-xrandr | ||
| 56 | DESTINATION ${libdir}/${APP_NAME_LC} | ||
| 57 | COMPONENT kodi-bin) | ||
| 58 | endif() | ||
| 59 | |||
| 60 | # Install scripts | ||
| 61 | install(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 | ||
| 67 | foreach(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) | ||
| 73 | endforeach() | ||
| 74 | |||
| 75 | # Install add-ons, fonts, icons, keyboard maps, keymaps, etc | ||
| 76 | # (addons, media, system, userdata folders in share/kodi/) | ||
| 77 | foreach(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) | ||
| 82 | endforeach() | ||
| 83 | |||
| 84 | # Install xsession entry | ||
| 85 | install(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 | ||
| 91 | install(FILES ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${APP_NAME_LC}.desktop | ||
| 92 | DESTINATION ${datarootdir}/applications | ||
| 93 | COMPONENT kodi) | ||
| 94 | |||
| 95 | # Install icons | ||
| 96 | install(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) | ||
| 100 | install(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) | ||
| 104 | install(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) | ||
| 108 | install(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) | ||
| 112 | install(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) | ||
| 116 | install(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) | ||
| 120 | install(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) | ||
| 124 | install(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 | ||
| 130 | install(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 | |||
| 137 | install(FILES ${CMAKE_SOURCE_DIR}/privacy-policy.txt | ||
| 138 | DESTINATION ${datarootdir}/${APP_NAME_LC} | ||
| 139 | COMPONENT kodi) | ||
| 140 | |||
| 141 | # Install kodi-tools-texturepacker | ||
| 142 | if(NOT WITH_TEXTUREPACKER) | ||
| 143 | install(PROGRAMS $<TARGET_FILE:TexturePacker::TexturePacker> | ||
| 144 | DESTINATION ${bindir} | ||
| 145 | COMPONENT kodi-tools-texturepacker) | ||
| 146 | endif() | ||
| 147 | |||
| 148 | # Install kodi-addon-dev headers | ||
| 149 | install(DIRECTORY ${CMAKE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/ | ||
| 150 | DESTINATION ${includedir}/${APP_NAME_LC} | ||
| 151 | COMPONENT kodi-addon-dev) | ||
| 152 | |||
| 153 | install(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 | ||
| 163 | install(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 | |||
| 179 | if(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) | ||
| 268 | endif() | ||
| 269 | |||
| 270 | # Install XBT skin files | ||
| 271 | foreach(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) | ||
| 277 | endforeach() | ||
| 278 | |||
| 279 | # Install extra stuff if it exists | ||
| 280 | if(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()") | ||
| 289 | endif() | ||
| 290 | |||
| 291 | if(NOT "$ENV{DESTDIR}" STREQUAL "") | ||
| 292 | set(DESTDIR ${CMAKE_BINARY_DIR}/$ENV{DESTDIR}) | ||
| 293 | endif() | ||
| 294 | foreach(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() | ||
| 300 | endforeach() | ||
| 301 | |||
| 302 | # generate packages? yes please, if everything checks out | ||
| 303 | if(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() | ||
| 312 | endif() | ||
diff --git a/cmake/scripts/linux/Macros.cmake b/cmake/scripts/linux/Macros.cmake new file mode 100644 index 0000000..9e8ebe6 --- /dev/null +++ b/cmake/scripts/linux/Macros.cmake | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | function(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 $<TARGET_FILE:${lib}>) | ||
| 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 | |||
| 18 | # wrapper has to be adapted in order to support coverage. | ||
| 19 | if(CMAKE_BUILD_TYPE STREQUAL Coverage) | ||
| 20 | set(export "") | ||
| 21 | endif() | ||
| 22 | |||
| 23 | if(check_arg STREQUAL export) | ||
| 24 | set(export ${export} | ||
| 25 | -Wl,--version-script=${ARGV3}) | ||
| 26 | elseif(check_arg STREQUAL extras) | ||
| 27 | foreach(arg ${data_arg}) | ||
| 28 | list(APPEND export ${arg}) | ||
| 29 | endforeach() | ||
| 30 | elseif(check_arg STREQUAL archives) | ||
| 31 | set(extra_libs ${data_arg}) | ||
| 32 | endif() | ||
| 33 | |||
| 34 | string(REGEX REPLACE "[ ]+" ";" _flags "${CMAKE_SHARED_LINKER_FLAGS}") | ||
| 35 | get_filename_component(dir ${wraplib} DIRECTORY) | ||
| 36 | add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} | ||
| 37 | COMMAND ${CMAKE_COMMAND} -E make_directory ${dir} | ||
| 38 | COMMAND ${CMAKE_C_COMPILER} | ||
| 39 | ARGS ${_flags} -Wl,--whole-archive | ||
| 40 | "${link_lib}" ${extra_libs} | ||
| 41 | -Wl,--no-whole-archive -lm | ||
| 42 | -Wl,-soname,${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} | ||
| 43 | -shared -o ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} | ||
| 44 | ${export} | ||
| 45 | DEPENDS ${target} wrapper.def wrapper) | ||
| 46 | |||
| 47 | get_filename_component(libname ${wraplib} NAME_WE) | ||
| 48 | add_custom_target(wrap_${libname} ALL DEPENDS ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX}) | ||
| 49 | set_target_properties(wrap_${libname} PROPERTIES FOLDER lib/wrapped) | ||
| 50 | add_dependencies(${APP_NAME_LC}-libraries wrap_${libname}) | ||
| 51 | |||
| 52 | set(LIBRARY_FILES ${LIBRARY_FILES} ${CMAKE_BINARY_DIR}/${wraplib}-${ARCH}${CMAKE_SHARED_MODULE_SUFFIX} CACHE STRING "" FORCE) | ||
| 53 | endfunction() | ||
| 54 | |||
| 55 | function(find_soname lib) | ||
| 56 | cmake_parse_arguments(arg "REQUIRED" "" "" ${ARGN}) | ||
| 57 | |||
| 58 | string(TOLOWER ${lib} liblow) | ||
| 59 | if(${lib}_LDFLAGS) | ||
| 60 | set(link_lib "${${lib}_LDFLAGS}") | ||
| 61 | else() | ||
| 62 | if(IS_ABSOLUTE "${${lib}_LIBRARIES}") | ||
| 63 | set(link_lib "${${lib}_LIBRARIES}") | ||
| 64 | else() | ||
| 65 | set(link_lib -l${${lib}_LIBRARIES}) | ||
| 66 | endif() | ||
| 67 | endif() | ||
| 68 | execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-M ${link_lib} | ||
| 69 | COMMAND grep LOAD.*${liblow} | ||
| 70 | ERROR_QUIET | ||
| 71 | OUTPUT_VARIABLE ${lib}_FILENAME) | ||
| 72 | string(REPLACE "LOAD " "" ${lib}_FILENAME "${${lib}_FILENAME}") | ||
| 73 | string(STRIP "${${lib}_FILENAME}" ${lib}_FILENAME) | ||
| 74 | if(NOT ${lib}_FILENAME) | ||
| 75 | execute_process(COMMAND ${CMAKE_C_COMPILER} -nostdlib -o /dev/null -Wl,-t ${link_lib} | ||
| 76 | OUTPUT_QUIET | ||
| 77 | ERROR_VARIABLE _TMP_FILENAME) | ||
| 78 | string(REGEX MATCH ".*lib${liblow}.so" ${lib}_FILENAME ${_TMP_FILENAME}) | ||
| 79 | endif() | ||
| 80 | if(${lib}_FILENAME) | ||
| 81 | execute_process(COMMAND ${CMAKE_OBJDUMP} -p ${${lib}_FILENAME} | ||
| 82 | COMMAND grep SONAME.*${liblow} | ||
| 83 | ERROR_QUIET | ||
| 84 | OUTPUT_VARIABLE ${lib}_SONAME) | ||
| 85 | string(REPLACE "SONAME " "" ${lib}_SONAME ${${lib}_SONAME}) | ||
| 86 | string(STRIP ${${lib}_SONAME} ${lib}_SONAME) | ||
| 87 | if(VERBOSE) | ||
| 88 | message(STATUS "${lib} soname: ${${lib}_SONAME}") | ||
| 89 | endif() | ||
| 90 | set(${lib}_SONAME ${${lib}_SONAME} PARENT_SCOPE) | ||
| 91 | endif() | ||
| 92 | if(arg_REQUIRED AND NOT ${lib}_SONAME) | ||
| 93 | message(FATAL_ERROR "Could not find dynamically loadable library ${lib}") | ||
| 94 | endif() | ||
| 95 | endfunction() | ||
diff --git a/cmake/scripts/linux/PathSetup.cmake b/cmake/scripts/linux/PathSetup.cmake new file mode 100644 index 0000000..f9f78ba --- /dev/null +++ b/cmake/scripts/linux/PathSetup.cmake | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | include(GNUInstallDirs) | ||
| 2 | |||
| 3 | if(NOT prefix) | ||
| 4 | set(prefix ${CMAKE_INSTALL_PREFIX}) | ||
| 5 | else() | ||
| 6 | set(CMAKE_INSTALL_PREFIX ${prefix}) | ||
| 7 | endif() | ||
| 8 | if(NOT exec_prefix) | ||
| 9 | set(exec_prefix ${prefix}) | ||
| 10 | endif() | ||
| 11 | if(NOT libdir) | ||
| 12 | set(libdir ${CMAKE_INSTALL_FULL_LIBDIR}) | ||
| 13 | endif() | ||
| 14 | if(NOT bindir) | ||
| 15 | set(bindir ${CMAKE_INSTALL_FULL_BINDIR}) | ||
| 16 | endif() | ||
| 17 | if(NOT includedir) | ||
| 18 | set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR}) | ||
| 19 | endif() | ||
| 20 | if(NOT datarootdir) | ||
| 21 | set(datarootdir ${CMAKE_INSTALL_FULL_DATAROOTDIR}) | ||
| 22 | endif() | ||
| 23 | if(NOT datadir) | ||
| 24 | set(datadir ${CMAKE_INSTALL_FULL_DATADIR}) | ||
| 25 | endif() | ||
| 26 | if(NOT docdir) | ||
| 27 | set(docdir ${CMAKE_INSTALL_FULL_DOCDIR}) | ||
| 28 | endif() | ||
| 29 | |||
| 30 | list(APPEND final_message "-- PATH config --") | ||
| 31 | list(APPEND final_message "Prefix: ${prefix}") | ||
| 32 | list(APPEND final_message "Libdir: ${libdir}") | ||
| 33 | list(APPEND final_message "Bindir: ${bindir}") | ||
| 34 | list(APPEND final_message "Includedir: ${includedir}") | ||
| 35 | list(APPEND final_message "Datarootdir: ${datarootdir}") | ||
| 36 | list(APPEND final_message "Datadir: ${datadir}") | ||
| 37 | list(APPEND final_message "Docdir: ${docdir}") | ||
| 38 | |||
| 39 | set(PATH_DEFINES -DBIN_INSTALL_PATH=\"${libdir}/${APP_NAME_LC}\" | ||
| 40 | -DINSTALL_PATH=\"${datarootdir}/${APP_NAME_LC}\") | ||
