diff options
Diffstat (limited to 'cmake/scripts/common')
| -rw-r--r-- | cmake/scripts/common/AddonHelpers.cmake | 19 | ||||
| -rw-r--r-- | cmake/scripts/common/ArchSetup.cmake | 7 | ||||
| -rw-r--r-- | cmake/scripts/common/CheckTargetPlatform.cmake | 4 | ||||
| -rw-r--r-- | cmake/scripts/common/HandleDepends.cmake | 16 | ||||
| -rw-r--r-- | cmake/scripts/common/Macros.cmake | 14 | ||||
| -rw-r--r-- | cmake/scripts/common/ProjectMacros.cmake | 2 |
6 files changed, 43 insertions, 19 deletions
diff --git a/cmake/scripts/common/AddonHelpers.cmake b/cmake/scripts/common/AddonHelpers.cmake index 5470940..4bb4c98 100644 --- a/cmake/scripts/common/AddonHelpers.cmake +++ b/cmake/scripts/common/AddonHelpers.cmake | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | # Workaround for the fact that cpack's filenames are not customizable. | 1 | # Workaround for the fact that cpack's filenames are not customizable. |
| 2 | # Each add-on is added as a separate component to facilitate zip/tgz packaging. | 2 | # Each add-on is added as a separate component to facilitate zip/tgz packaging. |
| 3 | # The filenames are always of the form basename-component, which is | 3 | # The filenames are always of the form basename-component, which is |
| 4 | # incompatible with the addonid-version scheme we want. This hack renames | 4 | # incompatible with the addonid-version scheme we want. This hack renames |
| 5 | # the files from the file names generated by the 'package' target. | 5 | # the files from the file names generated by the 'package' target. |
| 6 | # Sadly we cannot extend the 'package' target, as it is a builtin target, see | 6 | # Sadly we cannot extend the 'package' target, as it is a builtin target, see |
| 7 | # http://public.kitware.com/Bug/view.php?id=8438 | 7 | # http://public.kitware.com/Bug/view.php?id=8438 |
| 8 | # Thus, we have to add an 'addon-package' target. | 8 | # Thus, we have to add an 'addon-package' target. |
| 9 | get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) | 9 | get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) |
| @@ -32,7 +32,7 @@ macro (addon_version dir prefix) | |||
| 32 | file(READ ${dir}/addon.xml ADDONXML) | 32 | file(READ ${dir}/addon.xml ADDONXML) |
| 33 | endif() | 33 | endif() |
| 34 | 34 | ||
| 35 | string(REGEX MATCH "<addon[^>]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML}) | 35 | string(REGEX MATCH "<addon[^>]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML}) |
| 36 | string(REGEX REPLACE ".*version=.([0-9\\.]+).*" "\\1" ${prefix}_VERSION ${VERSION_STRING}) | 36 | string(REGEX REPLACE ".*version=.([0-9\\.]+).*" "\\1" ${prefix}_VERSION ${VERSION_STRING}) |
| 37 | message(STATUS ${prefix}_VERSION=${${prefix}_VERSION}) | 37 | message(STATUS ${prefix}_VERSION=${${prefix}_VERSION}) |
| 38 | endmacro() | 38 | endmacro() |
| @@ -62,7 +62,7 @@ macro (build_addon target prefix libs) | |||
| 62 | # include path name already complete | 62 | # include path name already complete |
| 63 | list(APPEND USED_SOURCES ${${prefix}_HEADERS}) | 63 | list(APPEND USED_SOURCES ${${prefix}_HEADERS}) |
| 64 | else() | 64 | else() |
| 65 | # add the complete include path to begin | 65 | # add the complete include path to begin |
| 66 | foreach(hdr_file ${${prefix}_HEADERS}) | 66 | foreach(hdr_file ${${prefix}_HEADERS}) |
| 67 | list(APPEND USED_SOURCES ${PROJECT_SOURCE_DIR}/${hdr_file}) | 67 | list(APPEND USED_SOURCES ${PROJECT_SOURCE_DIR}/${hdr_file}) |
| 68 | endforeach() | 68 | endforeach() |
| @@ -86,19 +86,19 @@ macro (build_addon target prefix libs) | |||
| 86 | # include path name already complete | 86 | # include path name already complete |
| 87 | list(APPEND USED_SOURCES ${${prefix}_SOURCES}) | 87 | list(APPEND USED_SOURCES ${${prefix}_SOURCES}) |
| 88 | else() | 88 | else() |
| 89 | # add the complete include path to begin | 89 | # add the complete include path to begin |
| 90 | foreach(src_file ${${prefix}_SOURCES}) | 90 | foreach(src_file ${${prefix}_SOURCES}) |
| 91 | list(APPEND USED_SOURCES ${PROJECT_SOURCE_DIR}/${src_file}) | 91 | list(APPEND USED_SOURCES ${PROJECT_SOURCE_DIR}/${src_file}) |
| 92 | endforeach() | 92 | endforeach() |
| 93 | endif() | 93 | endif() |
| 94 | 94 | ||
| 95 | # Set defines used in addon.xml.in and read from versions.h to set add-on | 95 | # Set defines used in addon.xml.in and read from versions.h to set add-on |
| 96 | # version parts automatically | 96 | # version parts automatically |
| 97 | file(STRINGS ${KODI_INCLUDE_DIR}/versions.h BIN_ADDON_PARTS) | 97 | file(STRINGS ${KODI_INCLUDE_DIR}/versions.h BIN_ADDON_PARTS) |
| 98 | foreach(loop_var ${BIN_ADDON_PARTS}) | 98 | foreach(loop_var ${BIN_ADDON_PARTS}) |
| 99 | # Only pass strings with "#define ADDON_" from versions.h | 99 | # Only pass strings with "#define ADDON_" from versions.h |
| 100 | if(loop_var MATCHES "#define ADDON_") | 100 | if(loop_var MATCHES "#define ADDON_") |
| 101 | string(REGEX REPLACE "\\\n" " " loop_var ${loop_var}) # remove header line breaks | 101 | string(REGEX REPLACE "\\\n" " " loop_var ${loop_var}) # remove header line breaks |
| 102 | string(REGEX REPLACE "#define " "" loop_var ${loop_var}) # remove the #define name from string | 102 | string(REGEX REPLACE "#define " "" loop_var ${loop_var}) # remove the #define name from string |
| 103 | string(REGEX MATCHALL "[//a-zA-Z0-9._-]+" loop_var "${loop_var}") # separate the define values to a list | 103 | string(REGEX MATCHALL "[//a-zA-Z0-9._-]+" loop_var "${loop_var}") # separate the define values to a list |
| 104 | 104 | ||
| @@ -157,7 +157,8 @@ macro (build_addon target prefix libs) | |||
| 157 | target_link_libraries(${target} ${${libs}}) | 157 | target_link_libraries(${target} ${${libs}}) |
| 158 | set_target_properties(${target} PROPERTIES VERSION ${${prefix}_VERSION} | 158 | set_target_properties(${target} PROPERTIES VERSION ${${prefix}_VERSION} |
| 159 | SOVERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR} | 159 | SOVERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR} |
| 160 | PREFIX "") | 160 | PREFIX "" |
| 161 | POSITION_INDEPENDENT_CODE 1) | ||
| 161 | if(OS STREQUAL "android") | 162 | if(OS STREQUAL "android") |
| 162 | set_target_properties(${target} PROPERTIES PREFIX "lib") | 163 | set_target_properties(${target} PROPERTIES PREFIX "lib") |
| 163 | endif() | 164 | endif() |
| @@ -384,7 +385,7 @@ if(HAVE_LTO) | |||
| 384 | if(USE_LTO) | 385 | if(USE_LTO) |
| 385 | add_options(ALL_LANGUAGES ALL_BUILDS "-flto") | 386 | add_options(ALL_LANGUAGES ALL_BUILDS "-flto") |
| 386 | endif() | 387 | endif() |
| 387 | endif() | 388 | endif() |
| 388 | 389 | ||
| 389 | # set this to try linking dependencies as static as possible | 390 | # set this to try linking dependencies as static as possible |
| 390 | if(ADDONS_PREFER_STATIC_LIBS) | 391 | if(ADDONS_PREFER_STATIC_LIBS) |
diff --git a/cmake/scripts/common/ArchSetup.cmake b/cmake/scripts/common/ArchSetup.cmake index c97929e..4704193 100644 --- a/cmake/scripts/common/ArchSetup.cmake +++ b/cmake/scripts/common/ArchSetup.cmake | |||
| @@ -55,7 +55,7 @@ macro(check_builtin func var) | |||
| 55 | endmacro() | 55 | endmacro() |
| 56 | 56 | ||
| 57 | 57 | ||
| 58 | # -------- Main script --------- | 58 | # -------- Main script --------- |
| 59 | message(STATUS "System type: ${CMAKE_SYSTEM_NAME}") | 59 | message(STATUS "System type: ${CMAKE_SYSTEM_NAME}") |
| 60 | 60 | ||
| 61 | if(WITH_CPU) | 61 | if(WITH_CPU) |
| @@ -157,7 +157,8 @@ if(PLATFORM_DEFINES) | |||
| 157 | add_options(ALL_LANGUAGES ALL_BUILDS ${PLATFORM_DEFINES}) | 157 | add_options(ALL_LANGUAGES ALL_BUILDS ${PLATFORM_DEFINES}) |
| 158 | endif() | 158 | endif() |
| 159 | 159 | ||
| 160 | if(CMAKE_BUILD_TYPE STREQUAL "Debug") | 160 | if(NOT MSVC) |
| 161 | add_options (ALL_LANGUAGES DEBUG "-g" "-D_DEBUG" "-Wall") | 161 | add_options(ALL_LANGUAGES ALL_BUILDS "-Wall") |
| 162 | add_options(ALL_LANGUAGES DEBUG "-g" "-D_DEBUG") | ||
| 162 | endif() | 163 | endif() |
| 163 | 164 | ||
diff --git a/cmake/scripts/common/CheckTargetPlatform.cmake b/cmake/scripts/common/CheckTargetPlatform.cmake index 82ee668..526e4bd 100644 --- a/cmake/scripts/common/CheckTargetPlatform.cmake +++ b/cmake/scripts/common/CheckTargetPlatform.cmake | |||
| @@ -9,9 +9,9 @@ function(check_target_platform dir target_platform build) | |||
| 9 | if(EXISTS ${dir} AND EXISTS ${dir}/platforms.txt) | 9 | if(EXISTS ${dir} AND EXISTS ${dir}/platforms.txt) |
| 10 | # get all the specified platforms | 10 | # get all the specified platforms |
| 11 | file(STRINGS ${dir}/platforms.txt platforms) | 11 | file(STRINGS ${dir}/platforms.txt platforms) |
| 12 | 12 | ||
| 13 | list( LENGTH platforms listlen ) | 13 | list( LENGTH platforms listlen ) |
| 14 | if(${listlen} EQUAL 1) | 14 | if(${listlen} EQUAL 1) |
| 15 | string(REPLACE " " ";" platforms ${platforms}) | 15 | string(REPLACE " " ";" platforms ${platforms}) |
| 16 | endif() | 16 | endif() |
| 17 | 17 | ||
diff --git a/cmake/scripts/common/HandleDepends.cmake b/cmake/scripts/common/HandleDepends.cmake index fb110d6..47f7d9b 100644 --- a/cmake/scripts/common/HandleDepends.cmake +++ b/cmake/scripts/common/HandleDepends.cmake | |||
| @@ -231,9 +231,23 @@ function(add_addon_depends addon searchpath) | |||
| 231 | -DCMAKE_INCLUDE_PATH=${OUTPUT_DIR}/include) | 231 | -DCMAKE_INCLUDE_PATH=${OUTPUT_DIR}/include) |
| 232 | endif() | 232 | endif() |
| 233 | 233 | ||
| 234 | set(DOWNLOAD_DIR ${BUILD_DIR}/download) | ||
| 235 | if(EXISTS ${dir}/${id}.sha256) | ||
| 236 | file(STRINGS ${dir}/${id}.sha256 sha256sum) | ||
| 237 | list(GET sha256sum 0 sha256sum) | ||
| 238 | set(URL_HASH_COMMAND URL_HASH SHA256=${sha256sum}) | ||
| 239 | if(TARBALL_DIR) | ||
| 240 | set(DOWNLOAD_DIR ${TARBALL_DIR}) | ||
| 241 | endif() | ||
| 242 | else() | ||
| 243 | unset(URL_HASH_COMMAND) | ||
| 244 | message(AUTHOR_WARNING "${dir}/${id}.sha256 is missing") | ||
| 245 | endif() | ||
| 246 | |||
| 234 | externalproject_add(${id} | 247 | externalproject_add(${id} |
| 235 | URL ${url} | 248 | URL ${url} |
| 236 | DOWNLOAD_DIR ${BUILD_DIR}/download | 249 | "${URL_HASH_COMMAND}" |
| 250 | DOWNLOAD_DIR ${DOWNLOAD_DIR} | ||
| 237 | CONFIGURE_COMMAND ${CONFIGURE_COMMAND} | 251 | CONFIGURE_COMMAND ${CONFIGURE_COMMAND} |
| 238 | "${EXTERNALPROJECT_SETUP}") | 252 | "${EXTERNALPROJECT_SETUP}") |
| 239 | endif() | 253 | endif() |
diff --git a/cmake/scripts/common/Macros.cmake b/cmake/scripts/common/Macros.cmake index c21069d..0d89dd3 100644 --- a/cmake/scripts/common/Macros.cmake +++ b/cmake/scripts/common/Macros.cmake | |||
| @@ -468,7 +468,7 @@ function(core_optional_dyload_dep) | |||
| 468 | foreach(depspec ${ARGN}) | 468 | foreach(depspec ${ARGN}) |
| 469 | set(_required False) | 469 | set(_required False) |
| 470 | split_dependency_specification(${depspec} dep version) | 470 | split_dependency_specification(${depspec} dep version) |
| 471 | setup_enable_switch() | 471 | setup_enable_switch() |
| 472 | if(${enable_switch} STREQUAL AUTO) | 472 | if(${enable_switch} STREQUAL AUTO) |
| 473 | find_package_with_ver(${dep} ${version}) | 473 | find_package_with_ver(${dep} ${version}) |
| 474 | elseif(${${enable_switch}}) | 474 | elseif(${${enable_switch}}) |
| @@ -662,7 +662,11 @@ function(core_find_git_rev stamp) | |||
| 662 | string(REPLACE "\"" "" DATE ${DATE}) | 662 | string(REPLACE "\"" "" DATE ${DATE}) |
| 663 | string(REPLACE "-" "" DATE ${DATE}) | 663 | string(REPLACE "-" "" DATE ${DATE}) |
| 664 | else() | 664 | else() |
| 665 | string(TIMESTAMP DATE "%Y%m%d" UTC) | 665 | if(EXISTS ${CMAKE_SOURCE_DIR}/BUILDDATE) |
| 666 | file(STRINGS ${CMAKE_SOURCE_DIR}/BUILDDATE DATE LIMIT_INPUT 8) | ||
| 667 | else() | ||
| 668 | string(TIMESTAMP DATE "%Y%m%d" UTC) | ||
| 669 | endif() | ||
| 666 | if(EXISTS ${CMAKE_SOURCE_DIR}/VERSION) | 670 | if(EXISTS ${CMAKE_SOURCE_DIR}/VERSION) |
| 667 | file(STRINGS ${CMAKE_SOURCE_DIR}/VERSION HASH LIMIT_INPUT 16) | 671 | file(STRINGS ${CMAKE_SOURCE_DIR}/VERSION HASH LIMIT_INPUT 16) |
| 668 | else() | 672 | else() |
| @@ -687,6 +691,7 @@ endfunction() | |||
| 687 | # APP_NAME_UC - uppercased app name | 691 | # APP_NAME_UC - uppercased app name |
| 688 | # APP_PACKAGE - Android full package name | 692 | # APP_PACKAGE - Android full package name |
| 689 | # COMPANY_NAME - company name | 693 | # COMPANY_NAME - company name |
| 694 | # APP_WEBSITE - site url | ||
| 690 | # APP_VERSION_MAJOR - the app version major | 695 | # APP_VERSION_MAJOR - the app version major |
| 691 | # APP_VERSION_MINOR - the app version minor | 696 | # APP_VERSION_MINOR - the app version minor |
| 692 | # APP_VERSION_TAG - the app version tag | 697 | # APP_VERSION_TAG - the app version tag |
| @@ -711,7 +716,7 @@ macro(core_find_versions) | |||
| 711 | core_file_read_filtered(version_list ${CORE_SOURCE_DIR}/version.txt) | 716 | core_file_read_filtered(version_list ${CORE_SOURCE_DIR}/version.txt) |
| 712 | core_file_read_filtered(json_version ${CORE_SOURCE_DIR}/xbmc/interfaces/json-rpc/schema/version.txt) | 717 | core_file_read_filtered(json_version ${CORE_SOURCE_DIR}/xbmc/interfaces/json-rpc/schema/version.txt) |
| 713 | string(REGEX REPLACE "([^ ;]*) ([^;]*)" "\\1;\\2" version_list "${version_list};${json_version}") | 718 | string(REGEX REPLACE "([^ ;]*) ([^;]*)" "\\1;\\2" version_list "${version_list};${json_version}") |
| 714 | set(version_props | 719 | set(version_props |
| 715 | ADDON_API | 720 | ADDON_API |
| 716 | APP_NAME | 721 | APP_NAME |
| 717 | APP_PACKAGE | 722 | APP_PACKAGE |
| @@ -761,6 +766,9 @@ macro(core_find_versions) | |||
| 761 | # unset variables not used anywhere else | 766 | # unset variables not used anywhere else |
| 762 | unset(version_list) | 767 | unset(version_list) |
| 763 | unset(APP_APP_NAME) | 768 | unset(APP_APP_NAME) |
| 769 | unset(APP_COMPANY_NAME) | ||
| 770 | unset(APP_APP_PACKAGE) | ||
| 771 | unset(APP_JSONRPC_VERSION) | ||
| 764 | unset(BIN_ADDON_PARTS) | 772 | unset(BIN_ADDON_PARTS) |
| 765 | 773 | ||
| 766 | # bail if we can't parse version.txt | 774 | # bail if we can't parse version.txt |
diff --git a/cmake/scripts/common/ProjectMacros.cmake b/cmake/scripts/common/ProjectMacros.cmake index 641e047..fba5252 100644 --- a/cmake/scripts/common/ProjectMacros.cmake +++ b/cmake/scripts/common/ProjectMacros.cmake | |||
| @@ -46,7 +46,7 @@ function(copy_skin_to_buildtree skin) | |||
| 46 | endfunction() | 46 | endfunction() |
| 47 | 47 | ||
| 48 | # Get GTest tests as CMake tests. | 48 | # Get GTest tests as CMake tests. |
| 49 | # Copied from FindGTest.cmake | 49 | # Copied from FindGTest.cmake |
| 50 | # Thanks to Daniel Blezek <blezek@gmail.com> for the GTEST_ADD_TESTS code | 50 | # Thanks to Daniel Blezek <blezek@gmail.com> for the GTEST_ADD_TESTS code |
| 51 | function(GTEST_ADD_TESTS executable extra_args) | 51 | function(GTEST_ADD_TESTS executable extra_args) |
| 52 | if(NOT ARGN) | 52 | if(NOT ARGN) |
