diff options
| author | manuel <manuel@mausz.at> | 2020-07-02 23:09:26 +0200 |
|---|---|---|
| committer | manuel <manuel@mausz.at> | 2020-07-02 23:09:26 +0200 |
| commit | 5f8335c1e49ce108ef3481863833c98efa00411b (patch) | |
| tree | f02b5c1c9765bb6a14c8eb42bb4f81b9face0b55 /cmake/scripts/common | |
| parent | e317daf081a1048904fdf0b548946fa3ba6593a7 (diff) | |
| download | kodi-pvr-build-5f8335c1e49ce108ef3481863833c98efa00411b.tar.gz kodi-pvr-build-5f8335c1e49ce108ef3481863833c98efa00411b.tar.bz2 kodi-pvr-build-5f8335c1e49ce108ef3481863833c98efa00411b.zip | |
Diffstat (limited to 'cmake/scripts/common')
| -rw-r--r-- | cmake/scripts/common/AddonHelpers.cmake | 53 | ||||
| -rw-r--r-- | cmake/scripts/common/AddonHelpers.dox | 59 | ||||
| -rw-r--r-- | cmake/scripts/common/ArchSetup.cmake | 26 | ||||
| -rw-r--r-- | cmake/scripts/common/CheckTargetPlatform.cmake | 5 | ||||
| -rw-r--r-- | cmake/scripts/common/CompilerSettings.cmake | 7 | ||||
| -rw-r--r-- | cmake/scripts/common/GenerateVersionedFiles.cmake | 3 | ||||
| -rw-r--r-- | cmake/scripts/common/HandleDepends.cmake | 20 | ||||
| -rw-r--r-- | cmake/scripts/common/Macros.cmake | 72 | ||||
| -rw-r--r-- | cmake/scripts/common/PrepareEnv.cmake | 17 |
9 files changed, 144 insertions, 118 deletions
diff --git a/cmake/scripts/common/AddonHelpers.cmake b/cmake/scripts/common/AddonHelpers.cmake index 2f3f302..c541ad7 100644 --- a/cmake/scripts/common/AddonHelpers.cmake +++ b/cmake/scripts/common/AddonHelpers.cmake | |||
| @@ -92,6 +92,7 @@ macro (build_addon target prefix libs) | |||
| 92 | endforeach() | 92 | endforeach() |
| 93 | endif() | 93 | endif() |
| 94 | 94 | ||
| 95 | message(STATUS "Addon dependency check ...") | ||
| 95 | # Set defines used in addon.xml.in and read from versions.h to set add-on | 96 | # Set defines used in addon.xml.in and read from versions.h to set add-on |
| 96 | # version parts automatically | 97 | # version parts automatically |
| 97 | file(STRINGS ${KODI_INCLUDE_DIR}/versions.h BIN_ADDON_PARTS) | 98 | file(STRINGS ${KODI_INCLUDE_DIR}/versions.h BIN_ADDON_PARTS) |
| @@ -108,7 +109,8 @@ macro (build_addon target prefix libs) | |||
| 108 | if("${include_name}" MATCHES "_DEPENDS") | 109 | if("${include_name}" MATCHES "_DEPENDS") |
| 109 | # Use start definition name as base for other value type | 110 | # Use start definition name as base for other value type |
| 110 | list(GET loop_var 0 list_name) | 111 | list(GET loop_var 0 list_name) |
| 111 | string(REPLACE "_DEPENDS" "" depends_name ${list_name}) | 112 | string(REPLACE "_DEPENDS" "_MIN" depends_minver ${list_name}) |
| 113 | string(REPLACE "_DEPENDS" "" depends_ver ${list_name}) | ||
| 112 | string(REPLACE "_DEPENDS" "_XML_ID" xml_entry_name ${list_name}) | 114 | string(REPLACE "_DEPENDS" "_XML_ID" xml_entry_name ${list_name}) |
| 113 | string(REPLACE "_DEPENDS" "_USED" used_type_name ${list_name}) | 115 | string(REPLACE "_DEPENDS" "_USED" used_type_name ${list_name}) |
| 114 | 116 | ||
| @@ -120,16 +122,14 @@ macro (build_addon target prefix libs) | |||
| 120 | foreach(src_file ${USED_SOURCES}) | 122 | foreach(src_file ${USED_SOURCES}) |
| 121 | file(STRINGS ${src_file} BIN_ADDON_SRC_PARTS) | 123 | file(STRINGS ${src_file} BIN_ADDON_SRC_PARTS) |
| 122 | foreach(loop_var ${BIN_ADDON_SRC_PARTS}) | 124 | foreach(loop_var ${BIN_ADDON_SRC_PARTS}) |
| 123 | string(FIND "${loop_var}" "#include" matchres) | 125 | string(REGEX MATCH "^[ \t]*#[ \t]*(include|import)[ \t]*[<\"](kodi\/)?(.+)[\">]" include_name "${loop_var}") |
| 124 | if("${matchres}" EQUAL 0) | 126 | if(include_name AND CMAKE_MATCH_3 MATCHES ^${depend_header}) |
| 125 | string(REPLACE " " ";" loop_var "${loop_var}") | 127 | get_directory_property(CURRENT_DEFS COMPILE_DEFINITIONS) |
| 126 | list(GET loop_var 1 include_name) | 128 | if(NOT used_type_name IN_LIST CURRENT_DEFS) |
| 127 | string(REGEX REPLACE "[<>\"]|kodi/" "" include_name "${include_name}") | 129 | set(ADDON_DEPENDS "${ADDON_DEPENDS}\n<import addon=\"${${xml_entry_name}}\" minversion=\"${${depends_minver}}\" version=\"${${depends_ver}}\"/>") |
| 128 | if(include_name MATCHES ${depend_header}) | 130 | # Inform with them the addon header about used type, if not present before |
| 129 | set(ADDON_DEPENDS "${ADDON_DEPENDS}\n<import addon=\"${${xml_entry_name}}\" version=\"${${depends_name}}\"/>") | ||
| 130 | # Inform with them the addon header about used type | ||
| 131 | add_definitions(-D${used_type_name}) | 131 | add_definitions(-D${used_type_name}) |
| 132 | message(STATUS "Added usage definition: ${used_type_name}") | 132 | message(STATUS " - Added API usage definition: ${used_type_name} (Version: \"${${depends_ver}}\", Min. Version: \"${${depends_minver}}\")") |
| 133 | set(FOUND_HEADER_USAGE 1) | 133 | set(FOUND_HEADER_USAGE 1) |
| 134 | endif() | 134 | endif() |
| 135 | endif() | 135 | endif() |
| @@ -276,6 +276,18 @@ macro (build_addon target prefix libs) | |||
| 276 | install(FILES ${${prefix}_ADDITIONAL_BINARY} DESTINATION ${target} | 276 | install(FILES ${${prefix}_ADDITIONAL_BINARY} DESTINATION ${target} |
| 277 | COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG}) | 277 | COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG}) |
| 278 | endif() | 278 | endif() |
| 279 | if(${prefix}_ADDITIONAL_BINARY_EXE) | ||
| 280 | install(PROGRAMS ${${prefix}_ADDITIONAL_BINARY_EXE} DESTINATION ${target} | ||
| 281 | COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG}) | ||
| 282 | endif() | ||
| 283 | if(${prefix}_ADDITIONAL_BINARY_PARTS) | ||
| 284 | install(FILES ${${prefix}_ADDITIONAL_BINARY_PARTS} DESTINATION ${target} | ||
| 285 | COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG}) | ||
| 286 | endif() | ||
| 287 | if(${prefix}_ADDITIONAL_BINARY_DIRS) | ||
| 288 | install(DIRECTORY ${${prefix}_ADDITIONAL_BINARY_DIRS} DESTINATION ${target} USE_SOURCE_PERMISSIONS | ||
| 289 | COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG}) | ||
| 290 | endif() | ||
| 279 | else() # NOT WIN32 | 291 | else() # NOT WIN32 |
| 280 | if(NOT CPACK_PACKAGE_DIRECTORY) | 292 | if(NOT CPACK_PACKAGE_DIRECTORY) |
| 281 | set(CPACK_PACKAGE_DIRECTORY ${CMAKE_BINARY_DIR}) | 293 | set(CPACK_PACKAGE_DIRECTORY ${CMAKE_BINARY_DIR}) |
| @@ -296,6 +308,18 @@ macro (build_addon target prefix libs) | |||
| 296 | install(FILES ${${prefix}_ADDITIONAL_BINARY} DESTINATION ${target} | 308 | install(FILES ${${prefix}_ADDITIONAL_BINARY} DESTINATION ${target} |
| 297 | COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG}) | 309 | COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG}) |
| 298 | endif() | 310 | endif() |
| 311 | if(${prefix}_ADDITIONAL_BINARY_EXE) | ||
| 312 | install(PROGRAMS ${${prefix}_ADDITIONAL_BINARY_EXE} DESTINATION ${target} | ||
| 313 | COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG}) | ||
| 314 | endif() | ||
| 315 | if(${prefix}_ADDITIONAL_BINARY_PARTS) | ||
| 316 | install(FILES ${${prefix}_ADDITIONAL_BINARY_PARTS} DESTINATION ${target} | ||
| 317 | COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG}) | ||
| 318 | endif() | ||
| 319 | if(${prefix}_ADDITIONAL_BINARY_DIRS) | ||
| 320 | install(DIRECTORY ${${prefix}_ADDITIONAL_BINARY_DIRS} DESTINATION ${target} USE_SOURCE_PERMISSIONS | ||
| 321 | COMPONENT ${target}-${${prefix}_VERSION}-${PLATFORM_TAG}) | ||
| 322 | endif() | ||
| 299 | endif() | 323 | endif() |
| 300 | add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext}) | 324 | add_cpack_workaround(${target} ${${prefix}_VERSION} ${ext}) |
| 301 | else() | 325 | else() |
| @@ -339,6 +363,15 @@ macro (build_addon target prefix libs) | |||
| 339 | if(${prefix}_ADDITIONAL_BINARY) | 363 | if(${prefix}_ADDITIONAL_BINARY) |
| 340 | install(FILES ${${prefix}_ADDITIONAL_BINARY} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target}) | 364 | install(FILES ${${prefix}_ADDITIONAL_BINARY} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target}) |
| 341 | endif() | 365 | endif() |
| 366 | if(${prefix}_ADDITIONAL_BINARY_EXE) | ||
| 367 | install(PROGRAMS ${${prefix}_ADDITIONAL_BINARY_EXE} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target}) | ||
| 368 | endif() | ||
| 369 | if(${prefix}_ADDITIONAL_BINARY_PARTS) | ||
| 370 | install(FILES ${${prefix}_ADDITIONAL_BINARY_PARTS} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target}) | ||
| 371 | endif() | ||
| 372 | if(${prefix}_ADDITIONAL_BINARY_DIRS) | ||
| 373 | install(DIRECTORY ${${prefix}_ADDITIONAL_BINARY_DIRS} DESTINATION ${CMAKE_INSTALL_LIBDIR}/addons/${target} USE_SOURCE_PERMISSIONS) | ||
| 374 | endif() | ||
| 342 | endif() | 375 | endif() |
| 343 | if(${APP_NAME_UC}_BUILD_DIR) | 376 | if(${APP_NAME_UC}_BUILD_DIR) |
| 344 | file(GLOB_RECURSE files ${CMAKE_CURRENT_SOURCE_DIR}/${target}/*) | 377 | file(GLOB_RECURSE files ${CMAKE_CURRENT_SOURCE_DIR}/${target}/*) |
diff --git a/cmake/scripts/common/AddonHelpers.dox b/cmake/scripts/common/AddonHelpers.dox new file mode 100644 index 0000000..d3acec0 --- /dev/null +++ b/cmake/scripts/common/AddonHelpers.dox | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | /*! | ||
| 2 | \addtogroup cpp_cmake | ||
| 3 | |||
| 4 | Kodi which uses it as a library for its binary addons has a special build | ||
| 5 | system for this. | ||
| 6 | |||
| 7 | To implement this, a CMake macro brought by Kodi is used, this is | ||
| 8 | "build_addon (...)". This processes various definitions passed by the addon to | ||
| 9 | process the construction. | ||
| 10 | |||
| 11 | |||
| 12 | -------------------------------------------------------------------------------- | ||
| 13 | |||
| 14 | <b>Here a minmal example of the for addon used CMakeLists.txt:</b> | ||
| 15 | |||
| 16 | ~~~~~~~~~~~~~{.cmake} | ||
| 17 | cmake_minimum_required(VERSION 3.5) | ||
| 18 | project(example.addon) | ||
| 19 | |||
| 20 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}) | ||
| 21 | |||
| 22 | find_package(Kodi REQUIRED) | ||
| 23 | |||
| 24 | include_directories(${KODI_INCLUDE_DIR} | ||
| 25 | |||
| 26 | set(DEPLIBS ) # Here empty | ||
| 27 | set(EXAMPLE_SOURCES src/main.cpp) | ||
| 28 | set(EXAMPLE_HEADERS src/main.h) | ||
| 29 | |||
| 30 | build_addon((example.addon EXAMPLE DEPLIBS) | ||
| 31 | |||
| 32 | include(CPack) | ||
| 33 | ~~~~~~~~~~~~~ | ||
| 34 | |||
| 35 | |||
| 36 | -------------------------------------------------------------------------------- | ||
| 37 | |||
| 38 | This is a list of special variables that can be passed to the macro. | ||
| 39 | The parts defined with "*" must be given the second name given to the macro. | ||
| 40 | |||
| 41 | Here to define the necessary creation and installation files on addon CMakeLists.txt: | ||
| 42 | | Name | Description | ||
| 43 | |-----------------------------|------------------------------------------------- | ||
| 44 | | *_SOURCES | List of source code files to be complicated. | ||
| 45 | | *_HEADERS | List of used source code header files. | ||
| 46 | | *_CUSTOM_BINARY | For special cases where an already created library from an external source is inserted, the <b>"* _SOURCES"</b> and <b>"* _HEADERS"</b> are unused in this case.<br>This is currently used primarily on game addons. | ||
| 47 | | *_CUSTOM_DATA | To add additional required data from a folder, which are stored in the shared folder of the addon.<br>With a "/" at the end of the content given to the folder is used, without the folder itself. | ||
| 48 | | *_ADDITIONAL_BINARY | In case the additional library has to be installed for the addon, the path or CMake name can be given here. | ||
| 49 | | *_ADDITIONAL_BINARY_EXE | In case you need to addon an additional application you can give the path or CMake name, it will be in the same folder as the addon library.<br>The mode bits are set there as EXE. | ||
| 50 | | *_ADDITIONAL_BINARY_DIRS | To add complete folders additionally to folders containing the addon library.<br>With a "/" at the end of the content given to the folder is used, without the folder itself. | ||
| 51 | |||
| 52 | External creation Options, given by `-D...`: | ||
| 53 | | Name | Description | ||
| 54 | |-----------------------------|------------------------------------------------- | ||
| 55 | | PACKAGE_ZIP | To create a package as a ZIP file. This is also used to install locally addon together.<br>Default is OFF. | ||
| 56 | | PACKAGE_TGZ | To create a package as a TGZ file.<br>Default is OFF. | ||
| 57 | | BUILD_SHARED_LIBS | To define if addon library is shared or static.<br>Default is ON to have shared. | ||
| 58 | | USE_LTO | Use link time optimization.<br>Default is OFF. | ||
| 59 | */ | ||
diff --git a/cmake/scripts/common/ArchSetup.cmake b/cmake/scripts/common/ArchSetup.cmake index 07ce6d4..2e1eb12 100644 --- a/cmake/scripts/common/ArchSetup.cmake +++ b/cmake/scripts/common/ArchSetup.cmake | |||
| @@ -18,24 +18,7 @@ include(CheckCXXSourceCompiles) | |||
| 18 | include(CheckSymbolExists) | 18 | include(CheckSymbolExists) |
| 19 | include(CheckFunctionExists) | 19 | include(CheckFunctionExists) |
| 20 | include(CheckIncludeFile) | 20 | include(CheckIncludeFile) |
| 21 | 21 | include(CheckTypeSize) | |
| 22 | # Macro to check if a given type exists in a given header | ||
| 23 | # Arguments: | ||
| 24 | # header the header to check | ||
| 25 | # type the type to check for existence | ||
| 26 | # var the compiler definition to set if type exists | ||
| 27 | # On return: | ||
| 28 | # If type was found, the definition is added to SYSTEM_DEFINES | ||
| 29 | macro(check_type header type var) | ||
| 30 | check_cxx_source_compiles("#include <${header}> | ||
| 31 | int main() | ||
| 32 | { | ||
| 33 | ${type} s; | ||
| 34 | }" ${var}) | ||
| 35 | if(${var}) | ||
| 36 | list(APPEND SYSTEM_DEFINES -D${var}=1) | ||
| 37 | endif() | ||
| 38 | endmacro() | ||
| 39 | 22 | ||
| 40 | # Macro to check if a given builtin function exists | 23 | # Macro to check if a given builtin function exists |
| 41 | # Arguments: | 24 | # Arguments: |
| @@ -95,17 +78,12 @@ endif() | |||
| 95 | include(${CMAKE_SOURCE_DIR}/cmake/scripts/${CORE_SYSTEM_NAME}/ArchSetup.cmake) | 78 | include(${CMAKE_SOURCE_DIR}/cmake/scripts/${CORE_SYSTEM_NAME}/ArchSetup.cmake) |
| 96 | 79 | ||
| 97 | message(STATUS "Core system type: ${CORE_SYSTEM_NAME}") | 80 | message(STATUS "Core system type: ${CORE_SYSTEM_NAME}") |
| 98 | message(STATUS "Platform: ${PLATFORM}") | 81 | message(STATUS "Platform: ${CORE_PLATFORM_NAME}") |
| 99 | message(STATUS "CPU: ${CPU}, ARCH: ${ARCH}") | 82 | message(STATUS "CPU: ${CPU}, ARCH: ${ARCH}") |
| 100 | message(STATUS "Cross-Compiling: ${CMAKE_CROSSCOMPILING}") | 83 | message(STATUS "Cross-Compiling: ${CMAKE_CROSSCOMPILING}") |
| 101 | message(STATUS "Execute build artefacts on host: ${CORE_HOST_IS_TARGET}") | 84 | message(STATUS "Execute build artefacts on host: ${CORE_HOST_IS_TARGET}") |
| 102 | message(STATUS "Depends based build: ${KODI_DEPENDSBUILD}") | 85 | message(STATUS "Depends based build: ${KODI_DEPENDSBUILD}") |
| 103 | 86 | ||
| 104 | check_type(string std::u16string HAVE_STD__U16_STRING) | ||
| 105 | check_type(string std::u32string HAVE_STD__U32_STRING) | ||
| 106 | check_type(string char16_t HAVE_CHAR16_T) | ||
| 107 | check_type(string char32_t HAVE_CHAR32_T) | ||
| 108 | check_type(stdint.h uint_least16_t HAVE_STDINT_H) | ||
| 109 | check_symbol_exists(posix_fadvise fcntl.h HAVE_POSIX_FADVISE) | 87 | check_symbol_exists(posix_fadvise fcntl.h HAVE_POSIX_FADVISE) |
| 110 | check_symbol_exists(PRIdMAX inttypes.h HAVE_INTTYPES_H) | 88 | check_symbol_exists(PRIdMAX inttypes.h HAVE_INTTYPES_H) |
| 111 | check_builtin("long* temp=0; long ret=__sync_add_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_ADD_AND_FETCH) | 89 | check_builtin("long* temp=0; long ret=__sync_add_and_fetch(temp, 1)" HAS_BUILTIN_SYNC_ADD_AND_FETCH) |
diff --git a/cmake/scripts/common/CheckTargetPlatform.cmake b/cmake/scripts/common/CheckTargetPlatform.cmake index 526e4bd..d776085 100644 --- a/cmake/scripts/common/CheckTargetPlatform.cmake +++ b/cmake/scripts/common/CheckTargetPlatform.cmake | |||
| @@ -29,7 +29,10 @@ function(check_target_platform dir target_platform build) | |||
| 29 | string(SUBSTRING ${platform} 1 ${platform_length} platform) | 29 | string(SUBSTRING ${platform} 1 ${platform_length} platform) |
| 30 | 30 | ||
| 31 | # check if the current platform does not match the extracted platform | 31 | # check if the current platform does not match the extracted platform |
| 32 | if(NOT ${platform} STREQUAL ${target_platform}) | 32 | if(${platform} STREQUAL ${target_platform}) |
| 33 | set(${build} FALSE) | ||
| 34 | break() | ||
| 35 | elseif(NOT ${platform} STREQUAL ${target_platform}) | ||
| 33 | set(${build} TRUE) | 36 | set(${build} TRUE) |
| 34 | endif() | 37 | endif() |
| 35 | endif() | 38 | endif() |
diff --git a/cmake/scripts/common/CompilerSettings.cmake b/cmake/scripts/common/CompilerSettings.cmake new file mode 100644 index 0000000..b4e7e89 --- /dev/null +++ b/cmake/scripts/common/CompilerSettings.cmake | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | # Languages and global compiler settings | ||
| 2 | if(NOT DEFINED CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD LESS 14) | ||
| 3 | set(CMAKE_CXX_STANDARD 14) | ||
| 4 | endif() | ||
| 5 | set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
| 6 | set(CMAKE_CXX_EXTENSIONS OFF) | ||
| 7 | set(CMAKE_ASM_FLAGS "${CMAKE_C_FLAGS} -x assembler-with-cpp") | ||
diff --git a/cmake/scripts/common/GenerateVersionedFiles.cmake b/cmake/scripts/common/GenerateVersionedFiles.cmake index 1d324db..d54b524 100644 --- a/cmake/scripts/common/GenerateVersionedFiles.cmake +++ b/cmake/scripts/common/GenerateVersionedFiles.cmake | |||
| @@ -24,9 +24,6 @@ foreach(loop_var ${ADDON_XML_IN_FILE}) | |||
| 24 | string(REPLACE ${CORE_SOURCE_DIR} ${CMAKE_BINARY_DIR} dest_dir ${source_dir}) | 24 | string(REPLACE ${CORE_SOURCE_DIR} ${CMAKE_BINARY_DIR} dest_dir ${source_dir}) |
| 25 | file(MAKE_DIRECTORY ${dest_dir}) | 25 | file(MAKE_DIRECTORY ${dest_dir}) |
| 26 | 26 | ||
| 27 | # copy everything except addon.xml.in to build folder | ||
| 28 | file(COPY "${source_dir}" DESTINATION "${CMAKE_BINARY_DIR}/addons" REGEX ".xml.in" EXCLUDE) | ||
| 29 | |||
| 30 | configure_file(${source_dir}/addon.xml.in ${dest_dir}/addon.xml @ONLY) | 27 | configure_file(${source_dir}/addon.xml.in ${dest_dir}/addon.xml @ONLY) |
| 31 | 28 | ||
| 32 | unset(source_dir) | 29 | unset(source_dir) |
diff --git a/cmake/scripts/common/HandleDepends.cmake b/cmake/scripts/common/HandleDepends.cmake index 40e382b..7cacd25 100644 --- a/cmake/scripts/common/HandleDepends.cmake +++ b/cmake/scripts/common/HandleDepends.cmake | |||
| @@ -68,8 +68,8 @@ function(add_addon_depends addon searchpath) | |||
| 68 | -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} | 68 | -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} |
| 69 | -DENABLE_STATIC=1 | 69 | -DENABLE_STATIC=1 |
| 70 | -DBUILD_SHARED_LIBS=0) | 70 | -DBUILD_SHARED_LIBS=0) |
| 71 | # windows store args | 71 | # windows args |
| 72 | if (CMAKE_SYSTEM_NAME STREQUAL WindowsStore) | 72 | if (CMAKE_SYSTEM_NAME STREQUAL WindowsStore OR CMAKE_SYSTEM_NAME STREQUAL Windows) |
| 73 | list(APPEND BUILD_ARGS -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} | 73 | list(APPEND BUILD_ARGS -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} |
| 74 | -DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}) | 74 | -DCMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}) |
| 75 | endif() | 75 | endif() |
| @@ -78,8 +78,10 @@ function(add_addon_depends addon searchpath) | |||
| 78 | # make sure we create strings, not lists | 78 | # make sure we create strings, not lists |
| 79 | set(TMP_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_DEFINES}") | 79 | set(TMP_C_FLAGS "${CMAKE_C_FLAGS} ${ARCH_DEFINES}") |
| 80 | set(TMP_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_DEFINES}") | 80 | set(TMP_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARCH_DEFINES}") |
| 81 | set(TMP_EXE_LINKER_FLAGS "-L${OUTPUT_DIR}/lib ${CMAKE_EXE_LINKER_FLAGS}") | ||
| 81 | list(APPEND BUILD_ARGS -DCMAKE_C_FLAGS=${TMP_C_FLAGS} | 82 | list(APPEND BUILD_ARGS -DCMAKE_C_FLAGS=${TMP_C_FLAGS} |
| 82 | -DCMAKE_CXX_FLAGS=${TMP_CXX_FLAGS}) | 83 | -DCMAKE_CXX_FLAGS=${TMP_CXX_FLAGS} |
| 84 | -DCMAKE_EXE_LINKER_FLAGS=${TMP_EXE_LINKER_FLAGS}) | ||
| 83 | endif() | 85 | endif() |
| 84 | 86 | ||
| 85 | if(CMAKE_TOOLCHAIN_FILE) | 87 | if(CMAKE_TOOLCHAIN_FILE) |
| @@ -88,6 +90,17 @@ function(add_addon_depends addon searchpath) | |||
| 88 | message(${BUILD_ARGS}) | 90 | message(${BUILD_ARGS}) |
| 89 | endif() | 91 | endif() |
| 90 | 92 | ||
| 93 | # used for addons where need special folders to store there content (if | ||
| 94 | # not set the addon define it byself). | ||
| 95 | # e.g. Google Chromium addon where his git bring: | ||
| 96 | # - "unable to create file" ... "Filename too long" | ||
| 97 | # see also WARNING by Windows on: https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart | ||
| 98 | if(THIRD_PARTY_PATH) | ||
| 99 | message(STATUS "Third party lib path specified") | ||
| 100 | message(STATUS ${THIRD_PARTY_PATH}) | ||
| 101 | list(APPEND BUILD_ARGS -DTHIRD_PARTY_PATH=${THIRD_PARTY_PATH}) | ||
| 102 | endif() | ||
| 103 | |||
| 91 | set(PATCH_COMMAND) | 104 | set(PATCH_COMMAND) |
| 92 | 105 | ||
| 93 | # if there's a CMakeLists.txt use it to prepare the build | 106 | # if there's a CMakeLists.txt use it to prepare the build |
| @@ -215,7 +228,6 @@ function(add_addon_depends addon searchpath) | |||
| 215 | -DOUTPUT_DIR=${OUTPUT_DIR} | 228 | -DOUTPUT_DIR=${OUTPUT_DIR} |
| 216 | -DCMAKE_PREFIX_PATH=${OUTPUT_DIR} | 229 | -DCMAKE_PREFIX_PATH=${OUTPUT_DIR} |
| 217 | -DCMAKE_INSTALL_PREFIX=${OUTPUT_DIR} | 230 | -DCMAKE_INSTALL_PREFIX=${OUTPUT_DIR} |
| 218 | -DCMAKE_EXE_LINKER_FLAGS=-L${OUTPUT_DIR}/lib | ||
| 219 | -DCMAKE_INCLUDE_PATH=${OUTPUT_DIR}/include) | 231 | -DCMAKE_INCLUDE_PATH=${OUTPUT_DIR}/include) |
| 220 | endif() | 232 | endif() |
| 221 | 233 | ||
diff --git a/cmake/scripts/common/Macros.cmake b/cmake/scripts/common/Macros.cmake index eefd7c8..f7327e3 100644 --- a/cmake/scripts/common/Macros.cmake +++ b/cmake/scripts/common/Macros.cmake | |||
| @@ -111,26 +111,6 @@ function(core_add_test_library name) | |||
| 111 | endforeach() | 111 | endforeach() |
| 112 | endfunction() | 112 | endfunction() |
| 113 | 113 | ||
| 114 | # Add an addon callback library | ||
| 115 | # Arguments: | ||
| 116 | # name name of the library to add | ||
| 117 | # Implicit arguments: | ||
| 118 | # SOURCES the sources of the library | ||
| 119 | # HEADERS the headers of the library (only for IDE support) | ||
| 120 | # OTHERS other library related files (only for IDE support) | ||
| 121 | # On return: | ||
| 122 | # Library target is defined and added to LIBRARY_FILES | ||
| 123 | function(core_add_addon_library name) | ||
| 124 | get_filename_component(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} NAME) | ||
| 125 | list(APPEND SOURCES lib${name}.cpp) | ||
| 126 | core_add_shared_library(${name} OUTPUT_DIRECTORY addons/${DIRECTORY}) | ||
| 127 | set_target_properties(${name} PROPERTIES FOLDER addons) | ||
| 128 | target_include_directories(${name} PRIVATE | ||
| 129 | ${CMAKE_CURRENT_SOURCE_DIR} | ||
| 130 | ${CMAKE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi | ||
| 131 | ${CMAKE_SOURCE_DIR}/xbmc) | ||
| 132 | endfunction() | ||
| 133 | |||
| 134 | # Add an dl-loaded shared library | 114 | # Add an dl-loaded shared library |
| 135 | # Arguments: | 115 | # Arguments: |
| 136 | # name name of the library to add | 116 | # name name of the library to add |
| @@ -386,25 +366,6 @@ function(core_require_dep) | |||
| 386 | endforeach() | 366 | endforeach() |
| 387 | endfunction() | 367 | endfunction() |
| 388 | 368 | ||
| 389 | # add required dyloaded dependencies of main application | ||
| 390 | # Arguments: | ||
| 391 | # dep_list One or many dependency specifications (see split_dependency_specification) | ||
| 392 | # for syntax). The dependency name is used uppercased as variable prefix. | ||
| 393 | # On return: | ||
| 394 | # dependency added to ${SYSTEM_INCLUDES}, ${dep}_SONAME is set up | ||
| 395 | function(core_require_dyload_dep) | ||
| 396 | foreach(depspec ${ARGN}) | ||
| 397 | split_dependency_specification(${depspec} dep version) | ||
| 398 | find_package_with_ver(${dep} ${version} REQUIRED) | ||
| 399 | string(TOUPPER ${dep} depup) | ||
| 400 | list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) | ||
| 401 | list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) | ||
| 402 | find_soname(${depup} REQUIRED) | ||
| 403 | export_dep() | ||
| 404 | set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE) | ||
| 405 | endforeach() | ||
| 406 | endfunction() | ||
| 407 | |||
| 408 | # helper macro for optional deps | 369 | # helper macro for optional deps |
| 409 | macro(setup_enable_switch) | 370 | macro(setup_enable_switch) |
| 410 | string(TOUPPER ${dep} depup) | 371 | string(TOUPPER ${dep} depup) |
| @@ -450,39 +411,6 @@ function(core_optional_dep) | |||
| 450 | set(final_message ${final_message} PARENT_SCOPE) | 411 | set(final_message ${final_message} PARENT_SCOPE) |
| 451 | endfunction() | 412 | endfunction() |
| 452 | 413 | ||
| 453 | # add optional dyloaded dependencies of main application | ||
| 454 | # Arguments: | ||
| 455 | # dep_list One or many dependency specifications (see split_dependency_specification) | ||
| 456 | # for syntax). The dependency name is used uppercased as variable prefix. | ||
| 457 | # On return: | ||
| 458 | # dependency optionally added to ${SYSTEM_INCLUDES}, ${DEP_DEFINES}, ${dep}_SONAME is set up | ||
| 459 | function(core_optional_dyload_dep) | ||
| 460 | foreach(depspec ${ARGN}) | ||
| 461 | set(_required False) | ||
| 462 | split_dependency_specification(${depspec} dep version) | ||
| 463 | setup_enable_switch() | ||
| 464 | if(${enable_switch} STREQUAL AUTO) | ||
| 465 | find_package_with_ver(${dep} ${version}) | ||
| 466 | elseif(${${enable_switch}}) | ||
| 467 | find_package_with_ver(${dep} ${version} REQUIRED) | ||
| 468 | set(_required True) | ||
| 469 | endif() | ||
| 470 | |||
| 471 | if(${depup}_FOUND) | ||
| 472 | list(APPEND SYSTEM_INCLUDES ${${depup}_INCLUDE_DIRS}) | ||
| 473 | find_soname(${depup} REQUIRED) | ||
| 474 | list(APPEND DEP_DEFINES ${${depup}_DEFINITIONS}) | ||
| 475 | set(final_message ${final_message} "${depup} enabled: Yes" PARENT_SCOPE) | ||
| 476 | export_dep() | ||
| 477 | set(${depup}_SONAME ${${depup}_SONAME} PARENT_SCOPE) | ||
| 478 | elseif(_required) | ||
| 479 | message(FATAL_ERROR "${depup} enabled but not found") | ||
| 480 | else() | ||
| 481 | set(final_message ${final_message} "${depup} enabled: No" PARENT_SCOPE) | ||
| 482 | endif() | ||
| 483 | endforeach() | ||
| 484 | endfunction() | ||
| 485 | |||
| 486 | function(core_file_read_filtered result filepattern) | 414 | function(core_file_read_filtered result filepattern) |
| 487 | # Reads STRINGS from text files | 415 | # Reads STRINGS from text files |
| 488 | # with comments filtered out | 416 | # with comments filtered out |
diff --git a/cmake/scripts/common/PrepareEnv.cmake b/cmake/scripts/common/PrepareEnv.cmake index 753dca1..559788f 100644 --- a/cmake/scripts/common/PrepareEnv.cmake +++ b/cmake/scripts/common/PrepareEnv.cmake | |||
| @@ -34,6 +34,14 @@ endif() | |||
| 34 | 34 | ||
| 35 | set(PLATFORM_TAG ${CORE_SYSTEM_NAME}) | 35 | set(PLATFORM_TAG ${CORE_SYSTEM_NAME}) |
| 36 | 36 | ||
| 37 | # The CPU variable is given either by ./tools/depends or by the | ||
| 38 | # ./cmake/scripts/common/ArchSetup.cmake (which refers to the Kodi building | ||
| 39 | # itself). However, this file is only used by addons, so CPU can not always | ||
| 40 | # be defined, so in this case, if empty, the base CPU will be used. | ||
| 41 | if(NOT CPU) | ||
| 42 | set(CPU ${CMAKE_SYSTEM_PROCESSOR}) | ||
| 43 | endif() | ||
| 44 | |||
| 37 | if(CORE_SYSTEM_NAME STREQUAL android) | 45 | if(CORE_SYSTEM_NAME STREQUAL android) |
| 38 | if (CPU MATCHES "v7a") | 46 | if (CPU MATCHES "v7a") |
| 39 | set(PLATFORM_TAG ${PLATFORM_TAG}-armv7) | 47 | set(PLATFORM_TAG ${PLATFORM_TAG}-armv7) |
| @@ -41,13 +49,14 @@ if(CORE_SYSTEM_NAME STREQUAL android) | |||
| 41 | set(PLATFORM_TAG ${PLATFORM_TAG}-aarch64) | 49 | set(PLATFORM_TAG ${PLATFORM_TAG}-aarch64) |
| 42 | elseif (CPU MATCHES "i686") | 50 | elseif (CPU MATCHES "i686") |
| 43 | set(PLATFORM_TAG ${PLATFORM_TAG}-i686) | 51 | set(PLATFORM_TAG ${PLATFORM_TAG}-i686) |
| 52 | elseif (CPU MATCHES "x86_64") | ||
| 53 | set(PLATFORM_TAG ${PLATFORM_TAG}-x86_64) | ||
| 44 | else() | 54 | else() |
| 45 | message(FATAL_ERROR "Unsupported architecture") | 55 | message(FATAL_ERROR "Unsupported architecture") |
| 46 | endif() | 56 | endif() |
| 47 | elseif(CORE_SYSTEM_NAME STREQUAL ios) | 57 | elseif(CORE_SYSTEM_NAME STREQUAL darwin_embedded) |
| 48 | if (CPU MATCHES armv7) | 58 | set(PLATFORM_TAG ${CORE_PLATFORM_NAME}) |
| 49 | set(PLATFORM_TAG ${PLATFORM_TAG}-armv7) | 59 | if (CPU MATCHES arm64) |
| 50 | elseif (CPU MATCHES arm64) | ||
| 51 | set(PLATFORM_TAG ${PLATFORM_TAG}-aarch64) | 60 | set(PLATFORM_TAG ${PLATFORM_TAG}-aarch64) |
| 52 | else() | 61 | else() |
| 53 | message(FATAL_ERROR "Unsupported architecture") | 62 | message(FATAL_ERROR "Unsupported architecture") |
