diff options
| author | manuel <manuel@mausz.at> | 2016-11-24 21:27:41 +0100 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2016-11-24 21:27:41 +0100 |
| commit | 8cdf8dec703d882b46ca50a769fabb95ffc48e2c (patch) | |
| tree | f7fe8233508f79d3dc94f8f445ce6342e7dfbdbb /project/cmake/CMakeLists.txt | |
| parent | 5823b05feb29a59510c32a9c28ca18b50b9b6399 (diff) | |
| download | kodi-pvr-build-8cdf8dec703d882b46ca50a769fabb95ffc48e2c.tar.gz kodi-pvr-build-8cdf8dec703d882b46ca50a769fabb95ffc48e2c.tar.bz2 kodi-pvr-build-8cdf8dec703d882b46ca50a769fabb95ffc48e2c.zip | |
sync with upstream
Diffstat (limited to 'project/cmake/CMakeLists.txt')
| -rw-r--r-- | project/cmake/CMakeLists.txt | 335 |
1 files changed, 215 insertions, 120 deletions
diff --git a/project/cmake/CMakeLists.txt b/project/cmake/CMakeLists.txt index de0ea20..fa1156d 100644 --- a/project/cmake/CMakeLists.txt +++ b/project/cmake/CMakeLists.txt | |||
| @@ -1,51 +1,62 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.1) | 1 | cmake_minimum_required(VERSION 3.1) |
| 2 | project(kodi) | 2 | project(kodi LANGUAGES CXX C ASM) |
| 3 | 3 | ||
| 4 | list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/modules) | 4 | list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/modules) |
| 5 | if(DEPENDS_DIR) | 5 | if(DEPENDS_DIR) |
| 6 | list(APPEND CMAKE_PREFIX_PATH ${DEPENDS_DIR}) | 6 | list(APPEND CMAKE_PREFIX_PATH ${DEPENDS_DIR}) |
| 7 | endif() | 7 | endif() |
| 8 | 8 | ||
| 9 | # Set CORE_SOURCE_DIR and CORE_BUILD_DIR | ||
| 10 | get_filename_component(CORE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../.. ABSOLUTE) | ||
| 11 | set(CORE_BUILD_DIR build) | ||
| 12 | |||
| 13 | message(STATUS "Source directory: ${CORE_SOURCE_DIR}") | ||
| 14 | message(STATUS "Build directory: ${CMAKE_BINARY_DIR}") | ||
| 15 | if(CMAKE_BINARY_DIR STREQUAL CORE_SOURCE_DIR) | ||
| 16 | message(WARNING "In-source build detected. It is recommended to build out-of-source.") | ||
| 17 | endif() | ||
| 18 | |||
| 19 | # Hide messages from Check*.cmake (e.g. CheckCSourceCompiles) | ||
| 20 | if(NOT VERBOSE) | ||
| 21 | set(CMAKE_REQUIRED_QUIET ON) | ||
| 22 | endif() | ||
| 23 | |||
| 24 | # Includes | ||
| 25 | include(modules/extra/ECMEnableSanitizers.cmake) | ||
| 26 | include(scripts/common/GeneratorSetup.cmake) | ||
| 27 | include(scripts/common/AddOptions.cmake) | ||
| 28 | include(scripts/common/ArchSetup.cmake) | ||
| 29 | include(scripts/common/Macros.cmake) | ||
| 30 | include(scripts/common/ProjectMacros.cmake) | ||
| 31 | include(scripts/${CORE_SYSTEM_NAME}/PathSetup.cmake) | ||
| 32 | include(ExternalProject) | ||
| 33 | |||
| 34 | # Languages and global compiler settings | ||
| 9 | set(CMAKE_CXX_STANDARD 11) | 35 | set(CMAKE_CXX_STANDARD 11) |
| 10 | set(CMAKE_CXX_STANDARD_REQUIRED ON) | 36 | set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 11 | set(CMAKE_CXX_EXTENSIONS OFF) | 37 | set(CMAKE_CXX_EXTENSIONS OFF) |
| 38 | set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp") | ||
| 12 | 39 | ||
| 13 | # general | 40 | # general |
| 14 | option(VERBOSE "Enable verbose output?" OFF) | 41 | option(VERBOSE "Enable verbose output?" OFF) |
| 15 | option(ENABLE_DVDCSS "Enable libdvdcss support?" ON) | 42 | option(ENABLE_DVDCSS "Enable libdvdcss support?" ON) |
| 16 | option(ENABLE_UPNP "Enable UPnP support?" ON) | 43 | option(ENABLE_UPNP "Enable UPnP support?" ON) |
| 17 | option(ENABLE_NONFREE "Enable non-free components?" ON) | 44 | option(ENABLE_NONFREE "Enable non-free components?" ON) |
| 18 | option(ENABLE_MICROHTTPD "Enable MicroHttpd webserver?" ON) | ||
| 19 | option(ENABLE_MYSQLCLIENT "Enable MySql support?" ON) | ||
| 20 | option(ENABLE_AVAHI "Enable Avahi support?" ON) | ||
| 21 | option(ENABLE_RTMP "Enable RTMP support?" ON) | ||
| 22 | option(ENABLE_BLURAY "Enable BluRay support?" ON) | ||
| 23 | option(ENABLE_PLIST "Enable AirPlay support?" ON) | ||
| 24 | option(ENABLE_NFS "Enable NFS support?" ON) | ||
| 25 | option(ENABLE_AIRTUNES "Enable AirTunes support?" ON) | 45 | option(ENABLE_AIRTUNES "Enable AirTunes support?" ON) |
| 26 | option(ENABLE_CEC "Enable CEC support?" ON) | 46 | option(ENABLE_CEC "Enable CEC support?" ON) |
| 47 | option(ENABLE_OPTICAL "Enable optical support?" ON) | ||
| 27 | if(UNIX) | 48 | if(UNIX) |
| 28 | if(NOT APPLE) | 49 | if(NOT APPLE) |
| 29 | option(ENABLE_INTERNAL_FFMPEG "Enable internal ffmpeg?" ON) | 50 | option(ENABLE_INTERNAL_FFMPEG "Enable internal ffmpeg?" ON) |
| 30 | else() | ||
| 31 | option(ENABLE_VTB "Enable VTB support?" OFF) | ||
| 32 | endif() | 51 | endif() |
| 33 | option(FFMPEG_PATH "Path to external ffmpeg?" "") | 52 | option(FFMPEG_PATH "Path to external ffmpeg?" "") |
| 34 | option(ENABLE_INTERNAL_CROSSGUID "Enable internal crossguid?" ON) | 53 | 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) | 54 | option(ENABLE_OPENSSL "Enable OpenSSL?" ON) |
| 43 | option(ENABLE_SDL "Enable SDL?" OFF) | 55 | option(ENABLE_SDL "Enable SDL?" OFF) |
| 44 | option(ENABLE_X11 "Enable X11 support?" ON) | 56 | if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd) |
| 45 | option(ENABLE_EGL "Enable EGL?" OFF) | 57 | option(ENABLE_X11 "Enable X11 support?" ON) |
| 46 | option(ENABLE_VAAPI "Enable VAAPI support?" ON) | 58 | option(ENABLE_AML "Enable AML?" OFF) |
| 47 | option(ENABLE_VDPAU "Enable VDPAU support?" ON) | 59 | endif() |
| 48 | option(ENABLE_OPTICAL "Enable optical support?" ON) | ||
| 49 | endif() | 60 | endif() |
| 50 | # System options | 61 | # System options |
| 51 | if(NOT WIN32) | 62 | if(NOT WIN32) |
| @@ -53,25 +64,26 @@ if(NOT WIN32) | |||
| 53 | option(WITH_CPU "build with given cpu" OFF) | 64 | option(WITH_CPU "build with given cpu" OFF) |
| 54 | option(ENABLE_CCACHE "Enable Ccache support" ON) | 65 | option(ENABLE_CCACHE "Enable Ccache support" ON) |
| 55 | endif() | 66 | endif() |
| 67 | if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL rbpi) | ||
| 68 | option(ENABLE_LIRC "Enable LIRC support?" ON) | ||
| 69 | option(ENABLE_EVENTCLIENTS "Enable event clients support?" OFF) | ||
| 70 | endif() | ||
| 56 | 71 | ||
| 57 | get_filename_component(CORE_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../.. ABSOLUTE) | 72 | # Build static libraries per directory |
| 58 | set(CORE_BUILD_DIR build) | 73 | if(NOT CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT CMAKE_GENERATOR STREQUAL Xcode) |
| 59 | 74 | set(ENABLE_STATIC_LIBS TRUE) | |
| 60 | message(STATUS "Source directory: ${CORE_SOURCE_DIR}") | 75 | else() |
| 61 | message(STATUS "Build directory: ${CMAKE_BINARY_DIR}") | 76 | set(ENABLE_STATIC_LIBS FALSE) |
| 62 | 77 | endif() | |
| 63 | include(scripts/common/generatorsetup.cmake) | ||
| 64 | include(scripts/common/addoptions.cmake) | ||
| 65 | include(scripts/common/archsetup.cmake) | ||
| 66 | include(scripts/common/macros.cmake) | ||
| 67 | include(scripts/common/managestring.cmake) | ||
| 68 | include(scripts/common/projectmacros.cmake) | ||
| 69 | include(scripts/common/pathsetup.cmake) | ||
| 70 | include(ExternalProject) | ||
| 71 | 78 | ||
| 72 | core_find_git_rev() | 79 | core_find_git_rev(APP_SCMID FULL) |
| 73 | core_find_versions() | 80 | core_find_versions() |
| 74 | 81 | ||
| 82 | # Dynamically loaded libraries built with the project | ||
| 83 | add_custom_target(${APP_NAME_LC}-libraries) | ||
| 84 | set(LIBRARY_FILES "" CACHE STRING "" FORCE) | ||
| 85 | mark_as_advanced(LIBRARY_FILES) | ||
| 86 | |||
| 75 | set(INCLUDES ${CORE_SOURCE_DIR} | 87 | set(INCLUDES ${CORE_SOURCE_DIR} |
| 76 | ${CORE_SOURCE_DIR}/addons/library.xbmc.addon | 88 | ${CORE_SOURCE_DIR}/addons/library.xbmc.addon |
| 77 | ${CORE_SOURCE_DIR}/lib | 89 | ${CORE_SOURCE_DIR}/lib |
| @@ -84,20 +96,19 @@ set(INCLUDES ${CORE_SOURCE_DIR} | |||
| 84 | find_package(PkgConfig) | 96 | find_package(PkgConfig) |
| 85 | if(CMAKE_CROSSCOMPILING) | 97 | if(CMAKE_CROSSCOMPILING) |
| 86 | if(PKG_CONFIG_EXECUTABLE) | 98 | if(PKG_CONFIG_EXECUTABLE) |
| 87 | message(STATUS "CMAKE_CROSSCOMPILING: ${CMAKE_CROSSCOMPILING}") | ||
| 88 | set(PKG_CONFIG_FOUND TRUE) | 99 | set(PKG_CONFIG_FOUND TRUE) |
| 89 | endif() | 100 | endif() |
| 90 | endif() | 101 | endif() |
| 91 | 102 | ||
| 92 | find_package(Threads REQUIRED) | 103 | find_package(Threads REQUIRED QUIET) |
| 93 | list(APPEND DEPLIBS ${CMAKE_THREAD_LIBS_INIT}) | 104 | list(APPEND DEPLIBS ${CMAKE_THREAD_LIBS_INIT}) |
| 94 | 105 | ||
| 95 | # Required dependencies | 106 | # Required dependencies |
| 96 | set(required_deps Sqlite3 FreeType PCRE Cpluff LibDvd | 107 | set(required_deps Sqlite3 FreeType PCRE Cpluff LibDvd |
| 97 | TinyXML Python Yajl Xslt | 108 | TinyXML Python Yajl |
| 98 | JPEG Lzo2 Fribidi TagLib FFMPEG CrossGUID) | 109 | Lzo2 Fribidi TagLib FFMPEG CrossGUID) |
| 99 | if(NOT WIN32) | 110 | if(NOT WIN32) |
| 100 | list(APPEND required_deps LibSmbClient ZLIB) | 111 | list(APPEND required_deps ZLIB) |
| 101 | else() | 112 | else() |
| 102 | list(APPEND required_deps D3DX11Effects) | 113 | list(APPEND required_deps D3DX11Effects) |
| 103 | endif() | 114 | endif() |
| @@ -106,18 +117,18 @@ if(CORE_SYSTEM_NAME STREQUAL android) | |||
| 106 | endif() | 117 | endif() |
| 107 | 118 | ||
| 108 | # Optional dependencies | 119 | # Optional dependencies |
| 109 | set(optional_deps MicroHttpd MySqlClient SSH | 120 | set(optional_deps MicroHttpd MySqlClient SSH XSLT |
| 110 | Alsa UDev Dbus Avahi | 121 | Alsa UDEV DBus Avahi SmbClient |
| 111 | PulseAudio VDPAU VAAPI) | 122 | PulseAudio VDPAU VAAPI) |
| 112 | 123 | ||
| 113 | # Required, dyloaded deps | 124 | # Required, dyloaded deps |
| 114 | set(required_dyload Curl ASS) | 125 | set(required_dyload Curl ASS) |
| 115 | 126 | ||
| 116 | # Optional, dyloaded deps | 127 | # Optional, dyloaded deps |
| 117 | set(dyload_optional RTMP CEC Bluray Plist NFS) | 128 | set(dyload_optional CEC Bluray Plist NFS) |
| 118 | 129 | ||
| 119 | # Required by shared objects we link | 130 | # Required by shared objects we link |
| 120 | set(required_dep_libs PNG EXPAT) | 131 | set(required_dep_libs EXPAT) |
| 121 | 132 | ||
| 122 | # Required tools | 133 | # Required tools |
| 123 | find_package(TexturePacker REQUIRED) | 134 | find_package(TexturePacker REQUIRED) |
| @@ -165,6 +176,11 @@ if(ENABLE_OPTICAL) | |||
| 165 | core_require_dep(Cdio) | 176 | core_require_dep(Cdio) |
| 166 | endif() | 177 | endif() |
| 167 | 178 | ||
| 179 | if(ENABLE_LIRC) | ||
| 180 | set(LIRC_DEVICE /dev/lircd CACHE STRING "LIRC device to use") | ||
| 181 | list(APPEND DEP_DEFINES -DLIRC_DEVICE="${LIRC_DEVICE}" -DHAVE_LIRC=1) | ||
| 182 | endif() | ||
| 183 | |||
| 168 | if(ENABLE_AIRTUNES) | 184 | if(ENABLE_AIRTUNES) |
| 169 | find_package(Shairplay) | 185 | find_package(Shairplay) |
| 170 | if(SHAIRPLAY_FOUND) | 186 | if(SHAIRPLAY_FOUND) |
| @@ -172,36 +188,36 @@ if(ENABLE_AIRTUNES) | |||
| 172 | endif() | 188 | endif() |
| 173 | endif() | 189 | endif() |
| 174 | 190 | ||
| 175 | if(ENABLE_VTB) | 191 | if(CORE_SYSTEM_NAME STREQUAL osx) |
| 176 | list(APPEND DEP_DEFINES -DHAVE_VIDEOTOOLBOXDECODER=1) | 192 | core_require_dep(Sdl) |
| 193 | else() | ||
| 194 | core_optional_dep(Sdl) | ||
| 177 | endif() | 195 | endif() |
| 178 | 196 | ||
| 179 | if(NOT WIN32) | 197 | if(NOT WIN32) |
| 180 | core_optional_dep(OpenGl) | 198 | core_optional_dep(OpenGl) |
| 181 | if(OPENGL_FOUND) | 199 | if(OPENGL_FOUND) |
| 182 | if(NOT APPLE) | ||
| 183 | core_optional_dep(Sdl) | ||
| 184 | else() | ||
| 185 | core_require_dep(Sdl) | ||
| 186 | endif() | ||
| 187 | core_optional_dep(X ENABLE_X11) | 200 | core_optional_dep(X ENABLE_X11) |
| 201 | core_optional_dep(LibDRM ENABLE_X11) | ||
| 188 | core_optional_dep(XRandR ENABLE_X11) | 202 | core_optional_dep(XRandR ENABLE_X11) |
| 189 | else() | 203 | else() |
| 190 | core_optional_dep(OpenGLES ENABLE_OPENGLES) | 204 | core_optional_dep(OpenGLES) |
| 191 | if(OPENGLES_FOUND) | 205 | if(OPENGLES_FOUND) |
| 192 | core_optional_dep(EGL ENABLE_EGL) | ||
| 193 | core_optional_dep(OMX ENABLE_OMX) | ||
| 194 | core_optional_dep(AML ENABLE_AML) | ||
| 195 | core_optional_dep(X ENABLE_X11) | 206 | core_optional_dep(X ENABLE_X11) |
| 196 | core_optional_dep(Sdl) | 207 | core_optional_dep(LibDRM ENABLE_X11) |
| 197 | endif() | 208 | endif() |
| 198 | endif() | 209 | endif() |
| 199 | 210 | if(NOT APPLE) | |
| 200 | if(CORE_SYSTEM_NAME STREQUAL rbpi) | 211 | core_require_dep(EGL) |
| 201 | core_require_dep(MMAL) | ||
| 202 | endif() | 212 | endif() |
| 203 | endif() | 213 | endif() |
| 204 | 214 | ||
| 215 | if(CORE_SYSTEM_NAME STREQUAL android OR CORE_SYSTEM_NAME STREQUAL linux) | ||
| 216 | core_optional_dep(AML) | ||
| 217 | elseif(CORE_SYSTEM_NAME STREQUAL rbpi) | ||
| 218 | core_require_dep(MMAL) | ||
| 219 | endif() | ||
| 220 | |||
| 205 | if(ENABLE_CCACHE) | 221 | if(ENABLE_CCACHE) |
| 206 | core_optional_dep(CCache) | 222 | core_optional_dep(CCache) |
| 207 | endif() | 223 | endif() |
| @@ -217,7 +233,7 @@ add_custom_command(OUTPUT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp | |||
| 217 | -DARCH_DEFINES="${ARCH_DEFINES}" | 233 | -DARCH_DEFINES="${ARCH_DEFINES}" |
| 218 | -DAPP_SCMID=${APP_SCMID} | 234 | -DAPP_SCMID=${APP_SCMID} |
| 219 | -Dprefix=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} | 235 | -Dprefix=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} |
| 220 | -P ${PROJECT_SOURCE_DIR}/scripts/common/generateversionedfiles.cmake | 236 | -P ${PROJECT_SOURCE_DIR}/scripts/common/GenerateVersionedFiles.cmake |
| 221 | DEPENDS ${CORE_SOURCE_DIR}/version.txt | 237 | DEPENDS ${CORE_SOURCE_DIR}/version.txt |
| 222 | ${CORE_SOURCE_DIR}/addons/xbmc.addon/addon.xml.in | 238 | ${CORE_SOURCE_DIR}/addons/xbmc.addon/addon.xml.in |
| 223 | ${CORE_SOURCE_DIR}/addons/kodi.guilib/addon.xml.in | 239 | ${CORE_SOURCE_DIR}/addons/kodi.guilib/addon.xml.in |
| @@ -226,13 +242,15 @@ list(APPEND install_data addons/xbmc.addon/addon.xml) | |||
| 226 | list(APPEND install_data addons/xbmc.json/addon.xml) | 242 | list(APPEND install_data addons/xbmc.json/addon.xml) |
| 227 | list(APPEND install_data addons/kodi.guilib/addon.xml) | 243 | list(APPEND install_data addons/kodi.guilib/addon.xml) |
| 228 | add_library(compileinfo OBJECT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp) | 244 | add_library(compileinfo OBJECT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp) |
| 245 | set_target_properties(compileinfo PROPERTIES FOLDER "Build Utilities") | ||
| 229 | target_compile_options(compileinfo PRIVATE "${SYSTEM_DEFINES}") | 246 | target_compile_options(compileinfo PRIVATE "${SYSTEM_DEFINES}") |
| 230 | 247 | ||
| 231 | # RC File | 248 | # RC File |
| 232 | if(WIN32) | 249 | if(WIN32) |
| 233 | configure_file(${CORE_SOURCE_DIR}/xbmc/win32/XBMC_PC.rc.in | 250 | configure_file(${CORE_SOURCE_DIR}/xbmc/platform/win32/XBMC_PC.rc.in |
| 234 | ${CORE_BUILD_DIR}/xbmc/win32/XBMC_PC.rc @ONLY) | 251 | ${CORE_BUILD_DIR}/xbmc/platform/win32/XBMC_PC.rc @ONLY) |
| 235 | add_library(resources OBJECT ${CORE_BUILD_DIR}/xbmc/win32/XBMC_PC.rc) | 252 | add_library(resources OBJECT ${CORE_BUILD_DIR}/xbmc/platform/win32/XBMC_PC.rc) |
| 253 | set_target_properties(resources PROPERTIES FOLDER "Build Utilities") | ||
| 236 | target_include_directories(resources PRIVATE ${CORE_SOURCE_DIR}/tools/windows/packaging/media) | 254 | target_include_directories(resources PRIVATE ${CORE_SOURCE_DIR}/tools/windows/packaging/media) |
| 237 | set(RESOURCES $<TARGET_OBJECTS:resources>) | 255 | set(RESOURCES $<TARGET_OBJECTS:resources>) |
| 238 | endif() | 256 | endif() |
| @@ -247,23 +265,8 @@ mark_as_advanced(core_DEPENDS) | |||
| 247 | mark_as_advanced(test_archives) | 265 | mark_as_advanced(test_archives) |
| 248 | mark_as_advanced(test_sources) | 266 | mark_as_advanced(test_sources) |
| 249 | 267 | ||
| 250 | file(STRINGS ${PROJECT_SOURCE_DIR}/installdata/addon-bindings.txt bindings) | ||
| 251 | foreach(binding ${bindings}) | ||
| 252 | list(APPEND addon_bindings ${CORE_SOURCE_DIR}/${binding}) | ||
| 253 | endforeach() | ||
| 254 | |||
| 255 | file(STRINGS ${PROJECT_SOURCE_DIR}/installdata/cmake-files.txt cmakefiles) | ||
| 256 | foreach(cmakefile ${cmakefiles}) | ||
| 257 | list(APPEND cmake_files ${CORE_SOURCE_DIR}/${cmakefile}) | ||
| 258 | endforeach() | ||
| 259 | |||
| 260 | add_subdirectory(${CORE_SOURCE_DIR}/lib/gtest ${CORE_BUILD_DIR}/gtest EXCLUDE_FROM_ALL) | 268 | add_subdirectory(${CORE_SOURCE_DIR}/lib/gtest ${CORE_BUILD_DIR}/gtest EXCLUDE_FROM_ALL) |
| 261 | 269 | set_target_properties(gtest PROPERTIES FOLDER "External Projects") | |
| 262 | # Subdirs | ||
| 263 | core_add_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/common/*.txt | ||
| 264 | ${PROJECT_SOURCE_DIR}/treedata/${CORE_SYSTEM_NAME}/*.txt) | ||
| 265 | core_add_optional_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/optional/common/*.txt | ||
| 266 | ${PROJECT_SOURCE_DIR}/treedata/optional/${CORE_SYSTEM_NAME}/*.txt) | ||
| 267 | 270 | ||
| 268 | # copy files to build tree | 271 | # copy files to build tree |
| 269 | copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/common/*.txt | 272 | copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/common/*.txt |
| @@ -281,23 +284,9 @@ endforeach() | |||
| 281 | 284 | ||
| 282 | add_custom_target(pack-skins ALL | 285 | add_custom_target(pack-skins ALL |
| 283 | DEPENDS TexturePacker::TexturePacker export-files ${XBT_FILES}) | 286 | DEPENDS TexturePacker::TexturePacker export-files ${XBT_FILES}) |
| 284 | 287 | set_target_properties(pack-skins PROPERTIES FOLDER "Build Utilities") | |
| 285 | core_link_library(exif system/libexif) | ||
| 286 | if(CORE_SYSTEM_NAME STREQUAL linux) | ||
| 287 | core_link_library(sse4 system/libsse4) | ||
| 288 | endif() | ||
| 289 | |||
| 290 | core_link_library(XBMC_addon addons/library.xbmc.addon/libXBMC_addon) | ||
| 291 | core_link_library(XBMC_codec addons/library.xbmc.codec/libXBMC_codec) | ||
| 292 | core_link_library(XBMC_pvr addons/library.xbmc.pvr/libXBMC_pvr) | ||
| 293 | core_link_library(KODI_adsp addons/library.kodi.adsp/libKODI_adsp) | ||
| 294 | core_link_library(KODI_audioengine addons/library.kodi.audioengine/libKODI_audioengine) | ||
| 295 | core_link_library(KODI_guilib addons/library.kodi.guilib/libKODI_guilib) | ||
| 296 | core_link_library(KODI_inputstream addons/library.kodi.inputstream/libKODI_inputstream) | ||
| 297 | core_link_library(KODI_peripheral addons/library.kodi.peripheral/libKODI_peripheral) | ||
| 298 | 288 | ||
| 299 | file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/system/players/VideoPlayer) | 289 | file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/system/players/VideoPlayer) |
| 300 | add_custom_target(wrap-libraries ALL DEPENDS ${WRAP_FILES}) | ||
| 301 | 290 | ||
| 302 | set(LIBCEC_SONAME "${CEC_SONAME}") | 291 | set(LIBCEC_SONAME "${CEC_SONAME}") |
| 303 | if(NOT CORE_SYSTEM_NAME STREQUAL windows AND NOT CORE_SYSTEM_NAME STREQUAL android) | 292 | if(NOT CORE_SYSTEM_NAME STREQUAL windows AND NOT CORE_SYSTEM_NAME STREQUAL android) |
| @@ -308,62 +297,166 @@ elseif(CORE_SYSTEM_NAME STREQUAL android) | |||
| 308 | ${CORE_BUILD_DIR}/DllPaths_generated_android.h @ONLY) | 297 | ${CORE_BUILD_DIR}/DllPaths_generated_android.h @ONLY) |
| 309 | endif() | 298 | endif() |
| 310 | 299 | ||
| 300 | # main library (used for main binary and tests) | ||
| 301 | add_library(lib${APP_NAME_LC} STATIC $<TARGET_OBJECTS:compileinfo>) | ||
| 302 | set_target_properties(lib${APP_NAME_LC} PROPERTIES PREFIX "") | ||
| 303 | add_dependencies(lib${APP_NAME_LC} libcpluff ffmpeg dvdnav crossguid) | ||
| 304 | |||
| 311 | # Codegen | 305 | # Codegen |
| 312 | add_subdirectory(${CORE_SOURCE_DIR}/xbmc/interfaces/swig build/swig) | 306 | add_subdirectory(${CORE_SOURCE_DIR}/xbmc/interfaces/swig build/swig) |
| 313 | 307 | ||
| 314 | # Other files (IDE) | 308 | # Other files (IDE) |
| 315 | set(OTHER_FILES README.md) | 309 | set(OTHER_FILES README.md) |
| 316 | 310 | ||
| 311 | # Subdirs | ||
| 312 | core_add_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/common/*.txt | ||
| 313 | ${PROJECT_SOURCE_DIR}/treedata/${CORE_SYSTEM_NAME}/*.txt) | ||
| 314 | core_add_optional_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/optional/common/*.txt | ||
| 315 | ${PROJECT_SOURCE_DIR}/treedata/optional/${CORE_SYSTEM_NAME}/*.txt) | ||
| 316 | |||
| 317 | target_link_libraries(lib${APP_NAME_LC} PUBLIC ${core_DEPENDS} ${SYSTEM_LDFLAGS} ${DEPLIBS} ${CMAKE_DL_LIBS}) | ||
| 318 | set_target_properties(lib${APP_NAME_LC} PROPERTIES PROJECT_LABEL "xbmc") | ||
| 319 | source_group_by_folder(lib${APP_NAME_LC} RELATIVE ${CORE_SOURCE_DIR}/xbmc) | ||
| 320 | if(WIN32) | ||
| 321 | add_precompiled_header(lib${APP_NAME_LC} pch.h ${CORE_SOURCE_DIR}/xbmc/platform/win32/pch.cpp PCH_TARGET kodi) | ||
| 322 | set_language_cxx(lib${APP_NAME_LC}) | ||
| 323 | endif() | ||
| 324 | |||
| 317 | # main binary | 325 | # main binary |
| 318 | add_executable(${APP_NAME_LC} ${CORE_MAIN_SOURCE} $<TARGET_OBJECTS:compileinfo> "${RESOURCES}" ${OTHER_FILES}) | 326 | if(NOT CORE_SYSTEM_NAME STREQUAL android) |
| 327 | add_executable(${APP_NAME_LC} ${CORE_MAIN_SOURCE} "${RESOURCES}" ${OTHER_FILES}) | ||
| 328 | else() | ||
| 329 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") | ||
| 330 | add_library(${APP_NAME_LC} SHARED ${CORE_MAIN_SOURCE} "${RESOURCES}" ${OTHER_FILES}) | ||
| 331 | endif() | ||
| 332 | add_dependencies(${APP_NAME_LC} ${APP_NAME_LC}-libraries export-files pack-skins) | ||
| 319 | whole_archive(_MAIN_LIBRARIES ${core_DEPENDS}) | 333 | whole_archive(_MAIN_LIBRARIES ${core_DEPENDS}) |
| 320 | target_link_libraries(${APP_NAME_LC} ${SYSTEM_LDFLAGS} ${_MAIN_LIBRARIES} ${DEPLIBS} ${CMAKE_DL_LIBS}) | 334 | target_link_libraries(${APP_NAME_LC} ${_MAIN_LIBRARIES} lib${APP_NAME_LC} ${DEPLIBS}) |
| 321 | unset(_MAIN_LIBRARIES) | 335 | unset(_MAIN_LIBRARIES) |
| 322 | add_dependencies(${APP_NAME_LC} export-files) | 336 | |
| 323 | if(NOT WIN32) | 337 | if(WIN32) |
| 324 | set_target_properties(${APP_NAME_LC} PROPERTIES SUFFIX ".bin") | ||
| 325 | else() | ||
| 326 | set_target_properties(${APP_NAME_LC} PROPERTIES WIN32_EXECUTABLE ON) | 338 | set_target_properties(${APP_NAME_LC} PROPERTIES WIN32_EXECUTABLE ON) |
| 327 | copy_main_dlls_to_buildtree() | 339 | set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${APP_NAME_LC}) |
| 340 | target_sources(kodi PRIVATE ${CORE_SOURCE_DIR}/xbmc/platform/win32/app.manifest) | ||
| 341 | elseif(CORE_SYSTEM_NAME STREQUAL android) | ||
| 342 | # Nothing | ||
| 343 | else() | ||
| 344 | set_target_properties(${APP_NAME_LC} PROPERTIES SUFFIX ".bin") | ||
| 328 | endif() | 345 | endif() |
| 329 | 346 | ||
| 330 | # testing | 347 | # testing |
| 331 | copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/test-reference-data.txt NO_INSTALL) | 348 | copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/test-reference-data.txt NO_INSTALL) |
| 332 | add_executable(${APP_NAME_LC}-test EXCLUDE_FROM_ALL ${CORE_SOURCE_DIR}/xbmc/test/xbmc-test.cpp $<TARGET_OBJECTS:compileinfo>) | 349 | add_executable(${APP_NAME_LC}-test EXCLUDE_FROM_ALL ${CORE_SOURCE_DIR}/xbmc/test/xbmc-test.cpp ${test_sources}) |
| 333 | whole_archive(_TEST_LIBRARIES ${core_DEPENDS} gtest ${test_archives}) | 350 | whole_archive(_TEST_LIBRARIES ${core_DEPENDS} gtest) |
| 334 | target_link_libraries(${APP_NAME_LC}-test ${SYSTEM_LDFLAGS} ${_TEST_LIBRARIES} ${DEPLIBS} ${CMAKE_DL_LIBS}) | 351 | target_link_libraries(${APP_NAME_LC}-test PRIVATE ${SYSTEM_LDFLAGS} ${_TEST_LIBRARIES} lib${APP_NAME_LC} ${DEPLIBS} ${CMAKE_DL_LIBS}) |
| 335 | unset(_TEST_LIBRARIES) | 352 | unset(_TEST_LIBRARIES) |
| 336 | add_dependencies(${APP_NAME_LC}-test export-files) | 353 | add_dependencies(${APP_NAME_LC}-test ${APP_NAME_LC}-libraries export-files) |
| 354 | if(WIN32) | ||
| 355 | add_precompiled_header(${APP_NAME_LC}-test pch.h ${CORE_SOURCE_DIR}/xbmc/platform/win32/pch.cpp PCH_TARGET kodi) | ||
| 356 | endif() | ||
| 337 | 357 | ||
| 338 | # make test and make check (cannot be executed when cross compiling) | 358 | # Enable unit-test related targets |
| 339 | if(NOT CMAKE_CROSSCOMPILING) | 359 | if(CORE_HOST_IS_TARGET) |
| 340 | enable_testing() | 360 | enable_testing() |
| 341 | gtest_add_tests(${APP_NAME_LC}-test "" ${test_sources}) | 361 | gtest_add_tests(${APP_NAME_LC}-test "" ${test_sources}) |
| 342 | add_custom_target(check ${CMAKE_CTEST_COMMAND} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) | 362 | add_custom_target(check ${CMAKE_CTEST_COMMAND} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) |
| 343 | add_dependencies(check ${APP_NAME_LC}-test) | 363 | add_dependencies(check ${APP_NAME_LC}-test) |
| 344 | 364 | ||
| 365 | # Valgrind (memcheck) | ||
| 366 | find_program(VALGRIND_EXECUTABLE NAMES valgrind) | ||
| 367 | if(VALGRIND_EXECUTABLE) | ||
| 368 | set(CTEST_MEMORYCHECK_COMMAND ${VALGRIND_EXECUTABLE}) | ||
| 369 | set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "-q --trace-children=yes --leak-check=yes --track-origins=yes") | ||
| 370 | include(CTest) | ||
| 371 | add_custom_target(check-valgrind ${CMAKE_CTEST_COMMAND} -D ExperimentalMemCheck \${ARGS} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) | ||
| 372 | add_dependencies(check-valgrind ${APP_NAME_LC}-test) | ||
| 373 | endif() | ||
| 374 | |||
| 345 | # For testing commit series | 375 | # For testing commit series |
| 346 | add_custom_target(check-commits ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/scripts/common/checkcommits.cmake | 376 | add_custom_target(check-commits ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/scripts/common/CheckCommits.cmake |
| 347 | -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}) | 377 | -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}) |
| 378 | set_target_properties(check-commits PROPERTIES FOLDER "Build Utilities") | ||
| 379 | |||
| 380 | # code coverage | ||
| 381 | if(CMAKE_BUILD_TYPE STREQUAL Coverage) | ||
| 382 | if(EXISTS ${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/CodeCoverage.cmake) | ||
| 383 | include(${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/CodeCoverage.cmake) | ||
| 384 | else() | ||
| 385 | message(FATAL_ERROR "Code coverage not (yet) implemented for platform ${CORE_SYSTEM_NAME}") | ||
| 386 | endif() | ||
| 387 | endif() | ||
| 388 | |||
| 389 | # Documentation | ||
| 390 | find_package(Doxygen) | ||
| 391 | if(DOXYGEN_FOUND) | ||
| 392 | add_custom_target(doc | ||
| 393 | COMMAND ${DOXYGEN_EXECUTABLE} ${CORE_SOURCE_DIR}/doxygen_resources/Doxyfile.doxy | ||
| 394 | COMMAND ${CMAKE_COMMAND} -E echo "Documentation built to: file://${CORE_SOURCE_DIR}/docs/html/index.html" | ||
| 395 | WORKING_DIRECTORY ${CORE_SOURCE_DIR}/doxygen_resources | ||
| 396 | COMMENT "Generating Doxygen documentation" VERBATIM) | ||
| 397 | endif() | ||
| 348 | endif() | 398 | endif() |
| 349 | 399 | ||
| 350 | # link wrapper | 400 | # link wrapper |
| 351 | if(FFMPEG_LINK_EXECUTABLE) | 401 | if(FFMPEG_LINK_EXECUTABLE) |
| 352 | set(CMAKE_CXX_LINK_EXECUTABLE "${FFMPEG_LINK_EXECUTABLE}") | 402 | set(CMAKE_CXX_LINK_EXECUTABLE "${FFMPEG_LINK_EXECUTABLE}") |
| 353 | endif() | 403 | endif() |
| 404 | if(FFMPEG_CREATE_SHARED_LIBRARY) | ||
| 405 | set(CMAKE_CXX_CREATE_SHARED_LIBRARY "${FFMPEG_CREATE_SHARED_LIBRARY}") | ||
| 406 | endif() | ||
| 407 | |||
| 408 | # Platform specific additional extra targets | ||
| 409 | if(EXISTS ${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/ExtraTargets.cmake) | ||
| 410 | include(${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/ExtraTargets.cmake) | ||
| 411 | endif() | ||
| 412 | |||
| 413 | include(scripts/${CORE_SYSTEM_NAME}/Install.cmake) | ||
| 354 | 414 | ||
| 355 | # randr | 415 | # Add uninstall target |
| 356 | if(ENABLE_X11 AND XRANDR_FOUND) | 416 | if(CMAKE_GENERATOR MATCHES Makefile) |
| 357 | add_executable(kodi-xrandr ${CORE_SOURCE_DIR}/xbmc-xrandr.c) | 417 | add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/scripts/common/Uninstall.cmake) |
| 358 | target_link_libraries(kodi-xrandr ${SYSTEM_LDFLAGS} ${X_LIBRARIES} m ${XRANDR_LIBRARIES}) | 418 | set_target_properties(uninstall PROPERTIES FOLDER "Build Utilities") |
| 359 | endif() | 419 | endif() |
| 360 | 420 | ||
| 361 | # XBMCHelper | 421 | # Create target that allows to build binary-addons. |
| 362 | if(CORE_SYSTEM_TYPE STREQUAL darwin) | 422 | # Use make binary-addons ADDONS="visualization.spectrum" to select the addons to build. |
| 363 | add_subdirectory(${CORE_SOURCE_DIR}/tools/EventClients/Clients/OSXRemote build/XBMCHelper) | 423 | if(CMAKE_GENERATOR STREQUAL "Unix Makefiles") |
| 424 | if(CMAKE_CROSSCOMPILING) | ||
| 425 | set(_cross_args CROSS_COMPILING=yes TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) | ||
| 426 | endif() | ||
| 427 | if(NOT CORE_SYSTEM_NAME STREQUAL android) | ||
| 428 | set(_prefix ${CMAKE_BINARY_DIR}/addons) | ||
| 429 | set(_extra "CMAKE_EXTRA=-DPACKAGE_ZIP=ON") | ||
| 430 | else() | ||
| 431 | set(_prefix ${CMAKE_INSTALL_PREFIX}) | ||
| 432 | endif() | ||
| 433 | add_custom_target(binary-addons | ||
| 434 | COMMAND $(MAKE) -C ${CORE_SOURCE_DIR}/tools/depends/target/binary-addons clean | ||
| 435 | COMMAND $(MAKE) -C ${CORE_SOURCE_DIR}/tools/depends/target/binary-addons VERBOSE=1 V=99 | ||
| 436 | PREFIX=${_prefix} INSTALL_PREFIX=${_prefix} ${_cross_args} ${_extra}) | ||
| 437 | unset(_cross_args) | ||
| 438 | unset(_prefix) | ||
| 364 | endif() | 439 | endif() |
| 365 | 440 | ||
| 366 | include(scripts/${CORE_SYSTEM_NAME}/install.cmake) | 441 | # Prepare add-on build env |
| 442 | core_file_read_filtered(bindings ${CORE_SOURCE_DIR}/xbmc/addons/addon-bindings.mk) | ||
| 443 | foreach(binding ${bindings}) | ||
| 444 | string(REPLACE " =" ";" binding "${binding}") | ||
| 445 | string(REPLACE "+=" ";" binding "${binding}") | ||
| 446 | list(GET binding 1 header) | ||
| 447 | get_filename_component(file ${header} NAME) | ||
| 448 | configure_file(${CORE_SOURCE_DIR}/${header} ${CORE_BUILD_DIR}/include/${APP_NAME_LC}/${file} COPYONLY) | ||
| 449 | endforeach() | ||
| 450 | |||
| 451 | set(APP_LIB_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/${APP_NAME_LC}) | ||
| 452 | set(APP_INCLUDE_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include/${APP_NAME_LC}) | ||
| 453 | set(CXX11_SWITCH "-std=c++11") | ||
| 454 | configure_file(${PROJECT_SOURCE_DIR}/KodiConfig.cmake.in | ||
| 455 | ${CORE_BUILD_DIR}/lib/${APP_NAME_LC}/${APP_NAME}Config.cmake @ONLY) | ||
| 456 | configure_file(${PROJECT_SOURCE_DIR}/scripts/common/AddonHelpers.cmake | ||
| 457 | ${CORE_BUILD_DIR}/lib/${APP_NAME_LC}/AddonHelpers.cmake COPYONLY) | ||
| 458 | configure_file(${PROJECT_SOURCE_DIR}/scripts/common/AddOptions.cmake | ||
| 459 | ${CORE_BUILD_DIR}/lib/${APP_NAME_LC}/AddOptions.cmake COPYONLY) | ||
| 367 | 460 | ||
| 368 | # Status | 461 | # Status |
| 369 | message(STATUS "#---- CONFIGURATION ----#") | 462 | message(STATUS "#---- CONFIGURATION ----#") |
| @@ -388,6 +481,8 @@ if(VERBOSE) | |||
| 388 | message(STATUS "datarootdir: ${datarootdir}") | 481 | message(STATUS "datarootdir: ${datarootdir}") |
| 389 | message(STATUS "#---------------------------------------------#") | 482 | message(STATUS "#---------------------------------------------#") |
| 390 | message(STATUS "GIT_REV: ${APP_SCMID}") | 483 | message(STATUS "GIT_REV: ${APP_SCMID}") |
| 484 | message(STATUS "#---------------------------------------------#") | ||
| 485 | message(STATUS "CPACK_GENERATOR : ${CPACK_GENERATOR}") | ||
| 486 | message(STATUS "CPACK_SOURCE_GENERATOR: ${CPACK_SOURCE_GENERATOR}") | ||
| 487 | message(STATUS "#---------------------------------------------#") | ||
| 391 | endif() | 488 | endif() |
| 392 | message(STATUS "#---------------------------------------------#") | ||
| 393 | |||
