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 /project/cmake/CMakeLists.txt | |
| 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 'project/cmake/CMakeLists.txt')
| -rw-r--r-- | project/cmake/CMakeLists.txt | 501 |
1 files changed, 0 insertions, 501 deletions
diff --git a/project/cmake/CMakeLists.txt b/project/cmake/CMakeLists.txt deleted file mode 100644 index c70b18d..0000000 --- a/project/cmake/CMakeLists.txt +++ /dev/null | |||
| @@ -1,501 +0,0 @@ | |||
| 1 | cmake_minimum_required(VERSION 3.1) | ||
| 2 | project(kodi LANGUAGES CXX C ASM) | ||
| 3 | |||
| 4 | list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/modules) | ||
| 5 | if(DEPENDS_DIR) | ||
| 6 | list(APPEND CMAKE_PREFIX_PATH ${DEPENDS_DIR}) | ||
| 7 | endif() | ||
| 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 | ||
| 35 | set(CMAKE_CXX_STANDARD 11) | ||
| 36 | set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| 37 | set(CMAKE_CXX_EXTENSIONS OFF) | ||
| 38 | set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp") | ||
| 39 | |||
| 40 | # general | ||
| 41 | option(VERBOSE "Enable verbose output?" OFF) | ||
| 42 | option(ENABLE_DVDCSS "Enable libdvdcss support?" ON) | ||
| 43 | option(ENABLE_UPNP "Enable UPnP support?" ON) | ||
| 44 | option(ENABLE_NONFREE "Enable non-free components?" ON) | ||
| 45 | option(ENABLE_AIRTUNES "Enable AirTunes support?" ON) | ||
| 46 | option(ENABLE_CEC "Enable CEC support?" ON) | ||
| 47 | option(ENABLE_OPTICAL "Enable optical support?" ON) | ||
| 48 | # use ffmpeg from depends or system | ||
| 49 | option(ENABLE_INTERNAL_FFMPEG "Enable internal ffmpeg?" OFF) | ||
| 50 | if(UNIX) | ||
| 51 | option(FFMPEG_PATH "Path to external ffmpeg?" "") | ||
| 52 | option(ENABLE_INTERNAL_CROSSGUID "Enable internal crossguid?" ON) | ||
| 53 | option(ENABLE_OPENSSL "Enable OpenSSL?" ON) | ||
| 54 | option(ENABLE_SDL "Enable SDL?" OFF) | ||
| 55 | option(ENABLE_MIR "Enable MIR?" OFF) | ||
| 56 | if(CORE_SYSTEM_NAME STREQUAL linux OR CORE_SYSTEM_NAME STREQUAL freebsd) | ||
| 57 | option(ENABLE_X11 "Enable X11 support?" ON) | ||
| 58 | option(ENABLE_AML "Enable AML?" OFF) | ||
| 59 | endif() | ||
| 60 | endif() | ||
| 61 | # System options | ||
| 62 | if(NOT WIN32) | ||
| 63 | option(WITH_ARCH "build with given arch" OFF) | ||
| 64 | option(WITH_CPU "build with given cpu" OFF) | ||
| 65 | option(ENABLE_CCACHE "Enable Ccache support" ON) | ||
| 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() | ||
| 71 | |||
| 72 | # Build static libraries per directory | ||
| 73 | if(NOT CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT CMAKE_GENERATOR STREQUAL Xcode) | ||
| 74 | set(ENABLE_STATIC_LIBS TRUE) | ||
| 75 | else() | ||
| 76 | set(ENABLE_STATIC_LIBS FALSE) | ||
| 77 | endif() | ||
| 78 | |||
| 79 | core_find_git_rev(APP_SCMID FULL) | ||
| 80 | core_find_versions() | ||
| 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 | |||
| 87 | set(INCLUDES ${CORE_SOURCE_DIR} | ||
| 88 | ${CORE_SOURCE_DIR}/addons/library.xbmc.addon | ||
| 89 | ${CORE_SOURCE_DIR}/lib | ||
| 90 | ${CORE_SOURCE_DIR}/lib/gtest/include | ||
| 91 | ${CORE_SOURCE_DIR}/xbmc | ||
| 92 | ${CORE_SOURCE_DIR}/xbmc/${PLATFORM_DIR} | ||
| 93 | ${CORE_SOURCE_DIR}/xbmc/cores/VideoPlayer | ||
| 94 | ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}) | ||
| 95 | |||
| 96 | find_package(PkgConfig) | ||
| 97 | if(CMAKE_CROSSCOMPILING) | ||
| 98 | if(PKG_CONFIG_EXECUTABLE) | ||
| 99 | set(PKG_CONFIG_FOUND TRUE) | ||
| 100 | endif() | ||
| 101 | endif() | ||
| 102 | |||
| 103 | find_package(Threads REQUIRED QUIET) | ||
| 104 | list(APPEND DEPLIBS ${CMAKE_THREAD_LIBS_INIT}) | ||
| 105 | |||
| 106 | # Required dependencies | ||
| 107 | set(required_deps Sqlite3 FreeType PCRE Cpluff LibDvd | ||
| 108 | TinyXML Python Yajl | ||
| 109 | Lzo2 Fribidi TagLib FFMPEG CrossGUID) | ||
| 110 | if(NOT WIN32) | ||
| 111 | list(APPEND required_deps ZLIB) | ||
| 112 | else() | ||
| 113 | list(APPEND required_deps D3DX11Effects) | ||
| 114 | endif() | ||
| 115 | if(CORE_SYSTEM_NAME STREQUAL android) | ||
| 116 | list(APPEND required_deps Zip) | ||
| 117 | endif() | ||
| 118 | |||
| 119 | # Optional dependencies | ||
| 120 | set(optional_deps MicroHttpd MySqlClient SSH XSLT | ||
| 121 | Alsa UDEV DBus Avahi SmbClient | ||
| 122 | PulseAudio VDPAU VAAPI Bluetooth CAP) | ||
| 123 | |||
| 124 | # Required, dyloaded deps | ||
| 125 | set(required_dyload Curl ASS) | ||
| 126 | |||
| 127 | # Optional, dyloaded deps | ||
| 128 | set(dyload_optional CEC Bluray Plist NFS) | ||
| 129 | |||
| 130 | # Required by shared objects we link | ||
| 131 | set(required_dep_libs EXPAT) | ||
| 132 | |||
| 133 | # Required tools | ||
| 134 | find_package(TexturePacker REQUIRED) | ||
| 135 | find_package(JsonSchemaBuilder REQUIRED) | ||
| 136 | |||
| 137 | foreach(dep ${required_dep_libs}) | ||
| 138 | find_package(${dep} REQUIRED) | ||
| 139 | endforeach() | ||
| 140 | |||
| 141 | foreach(dep ${required_deps}) | ||
| 142 | core_require_dep(${dep}) | ||
| 143 | endforeach() | ||
| 144 | |||
| 145 | foreach(dep ${optional_deps}) | ||
| 146 | core_optional_dep(${dep}) | ||
| 147 | endforeach() | ||
| 148 | |||
| 149 | if(NOT UDEV_FOUND) | ||
| 150 | core_optional_dep(LibUSB) | ||
| 151 | endif() | ||
| 152 | |||
| 153 | foreach(dep ${required_dyload}) | ||
| 154 | core_require_dyload_dep(${dep}) | ||
| 155 | endforeach() | ||
| 156 | |||
| 157 | foreach(dep ${dyload_optional}) | ||
| 158 | core_optional_dyload_dep(${dep}) | ||
| 159 | endforeach() | ||
| 160 | |||
| 161 | if(ENABLE_OPENSSL) | ||
| 162 | core_require_dep(OpenSSL) | ||
| 163 | list(APPEND DEP_DEFINES "-DHAVE_OPENSSL=1") | ||
| 164 | endif() | ||
| 165 | |||
| 166 | if(ENABLE_UPNP) | ||
| 167 | list(APPEND DEP_DEFINES "-DUSE_UPNP=1") | ||
| 168 | endif() | ||
| 169 | |||
| 170 | if(ENABLE_NONFREE) | ||
| 171 | list(APPEND DEP_DEFINES "-DHAVE_XBMC_NONFREE=1") | ||
| 172 | endif() | ||
| 173 | |||
| 174 | if(ENABLE_OPTICAL) | ||
| 175 | list(APPEND DEP_DEFINES -DHAS_DVD_DRIVE) | ||
| 176 | core_require_dep(Cdio) | ||
| 177 | endif() | ||
| 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 | |||
| 184 | if(ENABLE_AIRTUNES) | ||
| 185 | find_package(Shairplay) | ||
| 186 | if(SHAIRPLAY_FOUND) | ||
| 187 | core_require_dyload_dep(Shairplay) | ||
| 188 | endif() | ||
| 189 | endif() | ||
| 190 | |||
| 191 | if(CORE_SYSTEM_NAME STREQUAL osx) | ||
| 192 | core_require_dep(Sdl) | ||
| 193 | else() | ||
| 194 | core_optional_dep(Sdl) | ||
| 195 | endif() | ||
| 196 | |||
| 197 | if(NOT WIN32) | ||
| 198 | core_optional_dep(OpenGl) | ||
| 199 | if(OPENGL_FOUND) | ||
| 200 | if(ENABLE_MIR) | ||
| 201 | core_require_dep(Mir ENABLE_MIR) | ||
| 202 | core_optional_dep(LibDRM ENABLE_MIR) | ||
| 203 | else() | ||
| 204 | core_optional_dep(X ENABLE_X11) | ||
| 205 | core_optional_dep(XRandR ENABLE_X11) | ||
| 206 | core_optional_dep(LibDRM ENABLE_X11) | ||
| 207 | endif() | ||
| 208 | else() | ||
| 209 | core_optional_dep(OpenGLES) | ||
| 210 | if(OPENGLES_FOUND) | ||
| 211 | if(ENABLE_MIR) | ||
| 212 | core_require_dep(Mir ENABLE_MIR) | ||
| 213 | core_optional_dep(LibDRM ENABLE_MIR) | ||
| 214 | else() | ||
| 215 | core_optional_dep(X ENABLE_X11) | ||
| 216 | core_optional_dep(LibDRM ENABLE_X11) | ||
| 217 | endif() | ||
| 218 | endif() | ||
| 219 | endif() | ||
| 220 | if(NOT APPLE) | ||
| 221 | core_require_dep(EGL) | ||
| 222 | endif() | ||
| 223 | endif() | ||
| 224 | |||
| 225 | if(CORE_SYSTEM_NAME STREQUAL android OR CORE_SYSTEM_NAME STREQUAL linux) | ||
| 226 | core_optional_dep(AML) | ||
| 227 | elseif(CORE_SYSTEM_NAME STREQUAL rbpi) | ||
| 228 | core_require_dep(MMAL) | ||
| 229 | endif() | ||
| 230 | |||
| 231 | if(ENABLE_CCACHE) | ||
| 232 | core_optional_dep(CCache) | ||
| 233 | endif() | ||
| 234 | |||
| 235 | # Compile Info | ||
| 236 | add_custom_command(OUTPUT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp | ||
| 237 | ${CMAKE_BINARY_DIR}/addons/xbmc.addon/addon.xml | ||
| 238 | ${CMAKE_BINARY_DIR}/addons/kodi.guilib/addon.xml | ||
| 239 | COMMAND ${CMAKE_COMMAND} -DCORE_SOURCE_DIR=${CORE_SOURCE_DIR} | ||
| 240 | -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} | ||
| 241 | -DCORE_BUILD_DIR=${CORE_BUILD_DIR} | ||
| 242 | -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR} | ||
| 243 | -DARCH_DEFINES="${ARCH_DEFINES}" | ||
| 244 | -DAPP_SCMID=${APP_SCMID} | ||
| 245 | -Dprefix=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} | ||
| 246 | -P ${PROJECT_SOURCE_DIR}/scripts/common/GenerateVersionedFiles.cmake | ||
| 247 | DEPENDS ${CORE_SOURCE_DIR}/version.txt | ||
| 248 | ${CORE_SOURCE_DIR}/addons/xbmc.addon/addon.xml.in | ||
| 249 | ${CORE_SOURCE_DIR}/addons/kodi.guilib/addon.xml.in | ||
| 250 | ${CORE_SOURCE_DIR}/xbmc/CompileInfo.cpp.in) | ||
| 251 | list(APPEND install_data addons/xbmc.addon/addon.xml) | ||
| 252 | list(APPEND install_data addons/xbmc.json/addon.xml) | ||
| 253 | list(APPEND install_data addons/kodi.guilib/addon.xml) | ||
| 254 | add_library(compileinfo OBJECT ${CORE_BUILD_DIR}/xbmc/CompileInfo.cpp) | ||
| 255 | set_target_properties(compileinfo PROPERTIES FOLDER "Build Utilities") | ||
| 256 | target_compile_options(compileinfo PRIVATE "${SYSTEM_DEFINES}") | ||
| 257 | |||
| 258 | # RC File | ||
| 259 | if(WIN32) | ||
| 260 | configure_file(${CORE_SOURCE_DIR}/xbmc/platform/win32/XBMC_PC.rc.in | ||
| 261 | ${CORE_BUILD_DIR}/xbmc/platform/win32/XBMC_PC.rc @ONLY) | ||
| 262 | add_library(resources OBJECT ${CORE_BUILD_DIR}/xbmc/platform/win32/XBMC_PC.rc) | ||
| 263 | set_target_properties(resources PROPERTIES FOLDER "Build Utilities") | ||
| 264 | target_include_directories(resources PRIVATE ${CORE_SOURCE_DIR}/tools/windows/packaging/media) | ||
| 265 | set(RESOURCES $<TARGET_OBJECTS:resources>) | ||
| 266 | endif() | ||
| 267 | |||
| 268 | include_directories(${INCLUDES} ${SYSTEM_INCLUDES}) | ||
| 269 | add_compile_options(${ARCH_DEFINES} "${SYSTEM_DEFINES}" ${DEP_DEFINES} ${PATH_DEFINES}) | ||
| 270 | |||
| 271 | set(core_DEPENDS "" CACHE STRING "" FORCE) | ||
| 272 | set(test_archives "" CACHE STRING "" FORCE) | ||
| 273 | set(test_sources "" CACHE STRING "" FORCE) | ||
| 274 | mark_as_advanced(core_DEPENDS) | ||
| 275 | mark_as_advanced(test_archives) | ||
| 276 | mark_as_advanced(test_sources) | ||
| 277 | |||
| 278 | add_subdirectory(${CORE_SOURCE_DIR}/lib/gtest ${CORE_BUILD_DIR}/gtest EXCLUDE_FROM_ALL) | ||
| 279 | set_target_properties(gtest PROPERTIES FOLDER "External Projects") | ||
| 280 | |||
| 281 | # copy files to build tree | ||
| 282 | copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/common/*.txt | ||
| 283 | ${PROJECT_SOURCE_DIR}/installdata/${CORE_SYSTEM_NAME}/*.txt) | ||
| 284 | |||
| 285 | list(APPEND SKINS "${CORE_SOURCE_DIR}/addons/skin.estuary\;${CORE_SOURCE_DIR}") | ||
| 286 | list(APPEND SKINS "${CORE_SOURCE_DIR}/addons/skin.estouchy\;${CORE_SOURCE_DIR}") | ||
| 287 | |||
| 288 | # These are skins that are copied into place from the source tree | ||
| 289 | foreach(skin ${SKINS}) | ||
| 290 | list(GET skin 0 dir) | ||
| 291 | list(GET skin 1 relative) | ||
| 292 | copy_skin_to_buildtree(${dir} ${relative}) | ||
| 293 | endforeach() | ||
| 294 | |||
| 295 | add_custom_target(pack-skins ALL | ||
| 296 | DEPENDS TexturePacker::TexturePacker export-files ${XBT_FILES}) | ||
| 297 | set_target_properties(pack-skins PROPERTIES FOLDER "Build Utilities") | ||
| 298 | |||
| 299 | file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/system/players/VideoPlayer) | ||
| 300 | |||
| 301 | set(LIBCEC_SONAME "${CEC_SONAME}") | ||
| 302 | if(NOT CORE_SYSTEM_NAME STREQUAL windows AND NOT CORE_SYSTEM_NAME STREQUAL android) | ||
| 303 | configure_file(${CORE_SOURCE_DIR}/xbmc/DllPaths_generated.h.in | ||
| 304 | ${CORE_BUILD_DIR}/DllPaths_generated.h @ONLY) | ||
| 305 | elseif(CORE_SYSTEM_NAME STREQUAL android) | ||
| 306 | configure_file(${CORE_SOURCE_DIR}/xbmc/DllPaths_generated_android.h.in | ||
| 307 | ${CORE_BUILD_DIR}/DllPaths_generated_android.h @ONLY) | ||
| 308 | endif() | ||
| 309 | |||
| 310 | # main library (used for main binary and tests) | ||
| 311 | add_library(lib${APP_NAME_LC} STATIC $<TARGET_OBJECTS:compileinfo>) | ||
| 312 | set_target_properties(lib${APP_NAME_LC} PROPERTIES PREFIX "") | ||
| 313 | add_dependencies(lib${APP_NAME_LC} libcpluff ffmpeg dvdnav crossguid) | ||
| 314 | |||
| 315 | # Codegen | ||
| 316 | add_subdirectory(${CORE_SOURCE_DIR}/xbmc/interfaces/swig build/swig) | ||
| 317 | |||
| 318 | # Other files (IDE) | ||
| 319 | set(OTHER_FILES README.md) | ||
| 320 | |||
| 321 | # Subdirs | ||
| 322 | core_add_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/common/*.txt | ||
| 323 | ${PROJECT_SOURCE_DIR}/treedata/${CORE_SYSTEM_NAME}/*.txt) | ||
| 324 | core_add_optional_subdirs_from_filelist(${PROJECT_SOURCE_DIR}/treedata/optional/common/*.txt | ||
| 325 | ${PROJECT_SOURCE_DIR}/treedata/optional/${CORE_SYSTEM_NAME}/*.txt) | ||
| 326 | |||
| 327 | target_link_libraries(lib${APP_NAME_LC} PUBLIC ${core_DEPENDS} ${SYSTEM_LDFLAGS} ${DEPLIBS} ${CMAKE_DL_LIBS}) | ||
| 328 | set_target_properties(lib${APP_NAME_LC} PROPERTIES PROJECT_LABEL "xbmc") | ||
| 329 | source_group_by_folder(lib${APP_NAME_LC} RELATIVE ${CORE_SOURCE_DIR}/xbmc) | ||
| 330 | if(WIN32) | ||
| 331 | add_precompiled_header(lib${APP_NAME_LC} pch.h ${CORE_SOURCE_DIR}/xbmc/platform/win32/pch.cpp PCH_TARGET kodi) | ||
| 332 | set_language_cxx(lib${APP_NAME_LC}) | ||
| 333 | endif() | ||
| 334 | |||
| 335 | # main binary | ||
| 336 | if(NOT CORE_SYSTEM_NAME STREQUAL android) | ||
| 337 | add_executable(${APP_NAME_LC} ${CORE_MAIN_SOURCE} "${RESOURCES}" ${OTHER_FILES}) | ||
| 338 | else() | ||
| 339 | set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") | ||
| 340 | add_library(${APP_NAME_LC} SHARED ${CORE_MAIN_SOURCE} "${RESOURCES}" ${OTHER_FILES}) | ||
| 341 | endif() | ||
| 342 | add_dependencies(${APP_NAME_LC} ${APP_NAME_LC}-libraries export-files pack-skins) | ||
| 343 | whole_archive(_MAIN_LIBRARIES ${core_DEPENDS}) | ||
| 344 | target_link_libraries(${APP_NAME_LC} ${_MAIN_LIBRARIES} lib${APP_NAME_LC} ${DEPLIBS}) | ||
| 345 | unset(_MAIN_LIBRARIES) | ||
| 346 | |||
| 347 | if(WIN32) | ||
| 348 | set_target_properties(${APP_NAME_LC} PROPERTIES WIN32_EXECUTABLE ON) | ||
| 349 | set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${APP_NAME_LC}) | ||
| 350 | target_sources(${APP_NAME_LC} PRIVATE ${CORE_SOURCE_DIR}/xbmc/platform/win32/app.manifest) | ||
| 351 | elseif(CORE_SYSTEM_NAME STREQUAL android) | ||
| 352 | # Nothing | ||
| 353 | elseif(CORE_SYSTEM_NAME STREQUAL ios) | ||
| 354 | set_target_properties(${APP_NAME_LC} PROPERTIES OUTPUT_NAME ${APP_NAME} | ||
| 355 | MACOSX_BUNDLE_INFO_PLIST ${CORE_SOURCE_DIR}/xbmc/platform/darwin/ios/Info.plist.in) | ||
| 356 | else() | ||
| 357 | set_target_properties(${APP_NAME_LC} PROPERTIES SUFFIX ".bin") | ||
| 358 | endif() | ||
| 359 | |||
| 360 | # testing | ||
| 361 | copy_files_from_filelist_to_buildtree(${PROJECT_SOURCE_DIR}/installdata/test-reference-data.txt NO_INSTALL) | ||
| 362 | add_executable(${APP_NAME_LC}-test EXCLUDE_FROM_ALL ${CORE_SOURCE_DIR}/xbmc/test/xbmc-test.cpp ${test_sources}) | ||
| 363 | whole_archive(_TEST_LIBRARIES ${core_DEPENDS} gtest) | ||
| 364 | target_link_libraries(${APP_NAME_LC}-test PRIVATE ${SYSTEM_LDFLAGS} ${_TEST_LIBRARIES} lib${APP_NAME_LC} ${DEPLIBS} ${CMAKE_DL_LIBS}) | ||
| 365 | unset(_TEST_LIBRARIES) | ||
| 366 | add_dependencies(${APP_NAME_LC}-test ${APP_NAME_LC}-libraries export-files) | ||
| 367 | if(WIN32) | ||
| 368 | add_precompiled_header(${APP_NAME_LC}-test pch.h ${CORE_SOURCE_DIR}/xbmc/platform/win32/pch.cpp PCH_TARGET kodi) | ||
| 369 | endif() | ||
| 370 | |||
| 371 | # Enable unit-test related targets | ||
| 372 | if(CORE_HOST_IS_TARGET) | ||
| 373 | enable_testing() | ||
| 374 | gtest_add_tests(${APP_NAME_LC}-test "" ${test_sources}) | ||
| 375 | add_custom_target(check ${CMAKE_CTEST_COMMAND} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) | ||
| 376 | add_dependencies(check ${APP_NAME_LC}-test) | ||
| 377 | |||
| 378 | # Valgrind (memcheck) | ||
| 379 | find_program(VALGRIND_EXECUTABLE NAMES valgrind) | ||
| 380 | if(VALGRIND_EXECUTABLE) | ||
| 381 | set(CTEST_MEMORYCHECK_COMMAND ${VALGRIND_EXECUTABLE}) | ||
| 382 | set(CTEST_MEMORYCHECK_COMMAND_OPTIONS "-q --trace-children=yes --leak-check=yes --track-origins=yes") | ||
| 383 | include(CTest) | ||
| 384 | add_custom_target(check-valgrind ${CMAKE_CTEST_COMMAND} -D ExperimentalMemCheck \${ARGS} WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) | ||
| 385 | add_dependencies(check-valgrind ${APP_NAME_LC}-test) | ||
| 386 | endif() | ||
| 387 | |||
| 388 | # For testing commit series | ||
| 389 | add_custom_target(check-commits ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/scripts/common/CheckCommits.cmake | ||
| 390 | -DCMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}) | ||
| 391 | set_target_properties(check-commits PROPERTIES FOLDER "Build Utilities") | ||
| 392 | |||
| 393 | # code coverage | ||
| 394 | if(CMAKE_BUILD_TYPE STREQUAL Coverage) | ||
| 395 | if(EXISTS ${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/CodeCoverage.cmake) | ||
| 396 | include(${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/CodeCoverage.cmake) | ||
| 397 | else() | ||
| 398 | message(FATAL_ERROR "Code coverage not (yet) implemented for platform ${CORE_SYSTEM_NAME}") | ||
| 399 | endif() | ||
| 400 | endif() | ||
| 401 | |||
| 402 | # Documentation | ||
| 403 | find_package(Doxygen) | ||
| 404 | if(DOXYGEN_FOUND) | ||
| 405 | add_custom_target(doc | ||
| 406 | COMMAND ${DOXYGEN_EXECUTABLE} ${CORE_SOURCE_DIR}/doxygen_resources/Doxyfile.doxy | ||
| 407 | COMMAND ${CMAKE_COMMAND} -E echo "Documentation built to: file://${CORE_SOURCE_DIR}/docs/html/index.html" | ||
| 408 | WORKING_DIRECTORY ${CORE_SOURCE_DIR}/doxygen_resources | ||
| 409 | COMMENT "Generating Doxygen documentation" VERBATIM) | ||
| 410 | endif() | ||
| 411 | endif() | ||
| 412 | |||
| 413 | # link wrapper | ||
| 414 | if(FFMPEG_LINK_EXECUTABLE) | ||
| 415 | set(CMAKE_CXX_LINK_EXECUTABLE "${FFMPEG_LINK_EXECUTABLE}") | ||
| 416 | endif() | ||
| 417 | if(FFMPEG_CREATE_SHARED_LIBRARY) | ||
| 418 | set(CMAKE_CXX_CREATE_SHARED_LIBRARY "${FFMPEG_CREATE_SHARED_LIBRARY}") | ||
| 419 | endif() | ||
| 420 | |||
| 421 | # Platform specific additional extra targets | ||
| 422 | if(EXISTS ${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/ExtraTargets.cmake) | ||
| 423 | include(${PROJECT_SOURCE_DIR}/scripts/${CORE_SYSTEM_NAME}/ExtraTargets.cmake) | ||
| 424 | endif() | ||
| 425 | |||
| 426 | include(scripts/${CORE_SYSTEM_NAME}/Install.cmake) | ||
| 427 | |||
| 428 | # Add uninstall target | ||
| 429 | if(CMAKE_GENERATOR MATCHES Makefile) | ||
| 430 | add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/scripts/common/Uninstall.cmake) | ||
| 431 | set_target_properties(uninstall PROPERTIES FOLDER "Build Utilities") | ||
| 432 | endif() | ||
| 433 | |||
| 434 | # Create target that allows to build binary-addons. | ||
| 435 | # Use make binary-addons ADDONS="visualization.spectrum" to select the addons to build. | ||
| 436 | if(CMAKE_GENERATOR STREQUAL "Unix Makefiles") | ||
| 437 | if(CMAKE_CROSSCOMPILING) | ||
| 438 | set(_cross_args CROSS_COMPILING=yes TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}) | ||
| 439 | endif() | ||
| 440 | if(NOT CORE_SYSTEM_NAME STREQUAL android) | ||
| 441 | set(_prefix ${CMAKE_BINARY_DIR}/addons) | ||
| 442 | set(_extra "CMAKE_EXTRA=-DPACKAGE_ZIP=ON") | ||
| 443 | else() | ||
| 444 | set(_prefix ${CMAKE_INSTALL_PREFIX}) | ||
| 445 | endif() | ||
| 446 | add_custom_target(binary-addons | ||
| 447 | COMMAND $(MAKE) -C ${CORE_SOURCE_DIR}/tools/depends/target/binary-addons clean | ||
| 448 | COMMAND $(MAKE) -C ${CORE_SOURCE_DIR}/tools/depends/target/binary-addons VERBOSE=1 V=99 | ||
| 449 | PREFIX=${_prefix} INSTALL_PREFIX=${_prefix} ${_cross_args} ${_extra}) | ||
| 450 | unset(_cross_args) | ||
| 451 | unset(_prefix) | ||
| 452 | endif() | ||
| 453 | |||
| 454 | # Prepare add-on build env | ||
| 455 | core_file_read_filtered(bindings ${CORE_SOURCE_DIR}/xbmc/addons/addon-bindings.mk) | ||
| 456 | foreach(binding ${bindings}) | ||
| 457 | string(REPLACE " =" ";" binding "${binding}") | ||
| 458 | string(REPLACE "+=" ";" binding "${binding}") | ||
| 459 | list(GET binding 1 header) | ||
| 460 | get_filename_component(file ${header} NAME) | ||
| 461 | configure_file(${CORE_SOURCE_DIR}/${header} ${CORE_BUILD_DIR}/include/${APP_NAME_LC}/${file} COPYONLY) | ||
| 462 | endforeach() | ||
| 463 | |||
| 464 | set(APP_LIB_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/lib/${APP_NAME_LC}) | ||
| 465 | set(APP_INCLUDE_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include/${APP_NAME_LC}) | ||
| 466 | set(CXX11_SWITCH "-std=c++11") | ||
| 467 | configure_file(${PROJECT_SOURCE_DIR}/KodiConfig.cmake.in | ||
| 468 | ${CORE_BUILD_DIR}/lib/${APP_NAME_LC}/${APP_NAME}Config.cmake @ONLY) | ||
| 469 | configure_file(${PROJECT_SOURCE_DIR}/scripts/common/AddonHelpers.cmake | ||
| 470 | ${CORE_BUILD_DIR}/lib/${APP_NAME_LC}/AddonHelpers.cmake COPYONLY) | ||
| 471 | configure_file(${PROJECT_SOURCE_DIR}/scripts/common/AddOptions.cmake | ||
| 472 | ${CORE_BUILD_DIR}/lib/${APP_NAME_LC}/AddOptions.cmake COPYONLY) | ||
| 473 | |||
| 474 | # Status | ||
| 475 | message(STATUS "#---- CONFIGURATION ----#") | ||
| 476 | foreach(msg ${final_message}) | ||
| 477 | message(STATUS ${msg}) | ||
| 478 | endforeach() | ||
| 479 | |||
| 480 | if(VERBOSE) | ||
| 481 | message(STATUS "\n#--------------- Internal Variables -------------#") | ||
| 482 | message(STATUS "DEPLIBS: ${DEPLIBS}") | ||
| 483 | message(STATUS "core_DEPENDS: ${core_DEPENDS}") | ||
| 484 | message(STATUS "#---------------------------------------------#") | ||
| 485 | message(STATUS "SYSTEM_LDFLAGS : ${SYSTEM_LDFLAGS}") | ||
| 486 | message(STATUS "CMAKE_DL_LIBS : ${CMAKE_DL_LIBS}") | ||
| 487 | message(STATUS "CMAKE_C_FLAGS : ${CMAKE_C_FLAGS}") | ||
| 488 | message(STATUS "CMAKE_CXX_FLAGS : ${CMAKE_CXX_FLAGS}") | ||
| 489 | message(STATUS "CMAKE_EXE_LINKER_FLAGS: ${CMAKE_EXE_LINKER_FLAGS}") | ||
| 490 | message(STATUS "#---------------------------------------------#") | ||
| 491 | message(STATUS "bindir : ${bindir}") | ||
| 492 | message(STATUS "includedir : ${includedir}") | ||
| 493 | message(STATUS "libdir : ${libdir}") | ||
| 494 | message(STATUS "datarootdir: ${datarootdir}") | ||
| 495 | message(STATUS "#---------------------------------------------#") | ||
| 496 | message(STATUS "GIT_REV: ${APP_SCMID}") | ||
| 497 | message(STATUS "#---------------------------------------------#") | ||
| 498 | message(STATUS "CPACK_GENERATOR : ${CPACK_GENERATOR}") | ||
| 499 | message(STATUS "CPACK_SOURCE_GENERATOR: ${CPACK_SOURCE_GENERATOR}") | ||
| 500 | message(STATUS "#---------------------------------------------#") | ||
| 501 | endif() | ||
