From 2577b55681a97f3eec3fb0e3b5a4fb7f2cb18b8a Mon Sep 17 00:00:00 2001 From: manuel Date: Thu, 30 Aug 2018 00:42:04 +0200 Subject: sync with upstream --- cmake/scripts/common/AddonHelpers.cmake | 19 ++++++++++--------- cmake/scripts/common/ArchSetup.cmake | 7 ++++--- cmake/scripts/common/CheckTargetPlatform.cmake | 4 ++-- cmake/scripts/common/HandleDepends.cmake | 16 +++++++++++++++- cmake/scripts/common/Macros.cmake | 14 +++++++++++--- cmake/scripts/common/ProjectMacros.cmake | 2 +- 6 files changed, 43 insertions(+), 19 deletions(-) (limited to 'cmake/scripts/common') 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 @@ # Workaround for the fact that cpack's filenames are not customizable. # Each add-on is added as a separate component to facilitate zip/tgz packaging. -# The filenames are always of the form basename-component, which is +# The filenames are always of the form basename-component, which is # incompatible with the addonid-version scheme we want. This hack renames # the files from the file names generated by the 'package' target. -# Sadly we cannot extend the 'package' target, as it is a builtin target, see +# Sadly we cannot extend the 'package' target, as it is a builtin target, see # http://public.kitware.com/Bug/view.php?id=8438 # Thus, we have to add an 'addon-package' target. get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) @@ -32,7 +32,7 @@ macro (addon_version dir prefix) file(READ ${dir}/addon.xml ADDONXML) endif() - string(REGEX MATCH "]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML}) + string(REGEX MATCH "]*version.?=.?.[0-9\\.]+" VERSION_STRING ${ADDONXML}) string(REGEX REPLACE ".*version=.([0-9\\.]+).*" "\\1" ${prefix}_VERSION ${VERSION_STRING}) message(STATUS ${prefix}_VERSION=${${prefix}_VERSION}) endmacro() @@ -62,7 +62,7 @@ macro (build_addon target prefix libs) # include path name already complete list(APPEND USED_SOURCES ${${prefix}_HEADERS}) else() - # add the complete include path to begin + # add the complete include path to begin foreach(hdr_file ${${prefix}_HEADERS}) list(APPEND USED_SOURCES ${PROJECT_SOURCE_DIR}/${hdr_file}) endforeach() @@ -86,19 +86,19 @@ macro (build_addon target prefix libs) # include path name already complete list(APPEND USED_SOURCES ${${prefix}_SOURCES}) else() - # add the complete include path to begin + # add the complete include path to begin foreach(src_file ${${prefix}_SOURCES}) list(APPEND USED_SOURCES ${PROJECT_SOURCE_DIR}/${src_file}) endforeach() endif() - + # Set defines used in addon.xml.in and read from versions.h to set add-on # version parts automatically file(STRINGS ${KODI_INCLUDE_DIR}/versions.h BIN_ADDON_PARTS) foreach(loop_var ${BIN_ADDON_PARTS}) # Only pass strings with "#define ADDON_" from versions.h if(loop_var MATCHES "#define ADDON_") - string(REGEX REPLACE "\\\n" " " loop_var ${loop_var}) # remove header line breaks + string(REGEX REPLACE "\\\n" " " loop_var ${loop_var}) # remove header line breaks string(REGEX REPLACE "#define " "" loop_var ${loop_var}) # remove the #define name from string string(REGEX MATCHALL "[//a-zA-Z0-9._-]+" loop_var "${loop_var}") # separate the define values to a list @@ -157,7 +157,8 @@ macro (build_addon target prefix libs) target_link_libraries(${target} ${${libs}}) set_target_properties(${target} PROPERTIES VERSION ${${prefix}_VERSION} SOVERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR} - PREFIX "") + PREFIX "" + POSITION_INDEPENDENT_CODE 1) if(OS STREQUAL "android") set_target_properties(${target} PROPERTIES PREFIX "lib") endif() @@ -384,7 +385,7 @@ if(HAVE_LTO) if(USE_LTO) add_options(ALL_LANGUAGES ALL_BUILDS "-flto") endif() -endif() +endif() # set this to try linking dependencies as static as possible 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) endmacro() -# -------- Main script --------- +# -------- Main script --------- message(STATUS "System type: ${CMAKE_SYSTEM_NAME}") if(WITH_CPU) @@ -157,7 +157,8 @@ if(PLATFORM_DEFINES) add_options(ALL_LANGUAGES ALL_BUILDS ${PLATFORM_DEFINES}) endif() -if(CMAKE_BUILD_TYPE STREQUAL "Debug") - add_options (ALL_LANGUAGES DEBUG "-g" "-D_DEBUG" "-Wall") +if(NOT MSVC) + add_options(ALL_LANGUAGES ALL_BUILDS "-Wall") + add_options(ALL_LANGUAGES DEBUG "-g" "-D_DEBUG") endif() 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) if(EXISTS ${dir} AND EXISTS ${dir}/platforms.txt) # get all the specified platforms file(STRINGS ${dir}/platforms.txt platforms) - + list( LENGTH platforms listlen ) - if(${listlen} EQUAL 1) + if(${listlen} EQUAL 1) string(REPLACE " " ";" platforms ${platforms}) endif() 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) -DCMAKE_INCLUDE_PATH=${OUTPUT_DIR}/include) endif() + set(DOWNLOAD_DIR ${BUILD_DIR}/download) + if(EXISTS ${dir}/${id}.sha256) + file(STRINGS ${dir}/${id}.sha256 sha256sum) + list(GET sha256sum 0 sha256sum) + set(URL_HASH_COMMAND URL_HASH SHA256=${sha256sum}) + if(TARBALL_DIR) + set(DOWNLOAD_DIR ${TARBALL_DIR}) + endif() + else() + unset(URL_HASH_COMMAND) + message(AUTHOR_WARNING "${dir}/${id}.sha256 is missing") + endif() + externalproject_add(${id} URL ${url} - DOWNLOAD_DIR ${BUILD_DIR}/download + "${URL_HASH_COMMAND}" + DOWNLOAD_DIR ${DOWNLOAD_DIR} CONFIGURE_COMMAND ${CONFIGURE_COMMAND} "${EXTERNALPROJECT_SETUP}") 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) foreach(depspec ${ARGN}) set(_required False) split_dependency_specification(${depspec} dep version) - setup_enable_switch() + setup_enable_switch() if(${enable_switch} STREQUAL AUTO) find_package_with_ver(${dep} ${version}) elseif(${${enable_switch}}) @@ -662,7 +662,11 @@ function(core_find_git_rev stamp) string(REPLACE "\"" "" DATE ${DATE}) string(REPLACE "-" "" DATE ${DATE}) else() - string(TIMESTAMP DATE "%Y%m%d" UTC) + if(EXISTS ${CMAKE_SOURCE_DIR}/BUILDDATE) + file(STRINGS ${CMAKE_SOURCE_DIR}/BUILDDATE DATE LIMIT_INPUT 8) + else() + string(TIMESTAMP DATE "%Y%m%d" UTC) + endif() if(EXISTS ${CMAKE_SOURCE_DIR}/VERSION) file(STRINGS ${CMAKE_SOURCE_DIR}/VERSION HASH LIMIT_INPUT 16) else() @@ -687,6 +691,7 @@ endfunction() # APP_NAME_UC - uppercased app name # APP_PACKAGE - Android full package name # COMPANY_NAME - company name +# APP_WEBSITE - site url # APP_VERSION_MAJOR - the app version major # APP_VERSION_MINOR - the app version minor # APP_VERSION_TAG - the app version tag @@ -711,7 +716,7 @@ macro(core_find_versions) core_file_read_filtered(version_list ${CORE_SOURCE_DIR}/version.txt) core_file_read_filtered(json_version ${CORE_SOURCE_DIR}/xbmc/interfaces/json-rpc/schema/version.txt) string(REGEX REPLACE "([^ ;]*) ([^;]*)" "\\1;\\2" version_list "${version_list};${json_version}") - set(version_props + set(version_props ADDON_API APP_NAME APP_PACKAGE @@ -761,6 +766,9 @@ macro(core_find_versions) # unset variables not used anywhere else unset(version_list) unset(APP_APP_NAME) + unset(APP_COMPANY_NAME) + unset(APP_APP_PACKAGE) + unset(APP_JSONRPC_VERSION) unset(BIN_ADDON_PARTS) # 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) endfunction() # Get GTest tests as CMake tests. -# Copied from FindGTest.cmake +# Copied from FindGTest.cmake # Thanks to Daniel Blezek for the GTEST_ADD_TESTS code function(GTEST_ADD_TESTS executable extra_args) if(NOT ARGN) -- cgit v1.2.3