diff options
Diffstat (limited to 'project/cmake/scripts/common')
| -rw-r--r-- | project/cmake/scripts/common/HandleDepends.cmake | 43 | ||||
| -rw-r--r-- | project/cmake/scripts/common/Macros.cmake | 9 | ||||
| -rw-r--r-- | project/cmake/scripts/common/PrepareEnv.cmake | 47 |
3 files changed, 46 insertions, 53 deletions
diff --git a/project/cmake/scripts/common/HandleDepends.cmake b/project/cmake/scripts/common/HandleDepends.cmake index adc105b..880ccdf 100644 --- a/project/cmake/scripts/common/HandleDepends.cmake +++ b/project/cmake/scripts/common/HandleDepends.cmake | |||
| @@ -17,7 +17,6 @@ function(add_addon_depends addon searchpath) | |||
| 17 | file MATCHES noinstall.txt OR | 17 | file MATCHES noinstall.txt OR |
| 18 | file MATCHES flags.txt OR | 18 | file MATCHES flags.txt OR |
| 19 | file MATCHES deps.txt OR | 19 | file MATCHES deps.txt OR |
| 20 | file MATCHES "[a-z]+-deps[.]txt" OR | ||
| 21 | file MATCHES platforms.txt)) | 20 | file MATCHES platforms.txt)) |
| 22 | message(STATUS "Processing ${file}") | 21 | message(STATUS "Processing ${file}") |
| 23 | file(STRINGS ${file} def) | 22 | file(STRINGS ${file} def) |
| @@ -50,11 +49,7 @@ function(add_addon_depends addon searchpath) | |||
| 50 | if(EXISTS ${dir}/flags.txt) | 49 | if(EXISTS ${dir}/flags.txt) |
| 51 | set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/flags.txt) | 50 | set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/flags.txt) |
| 52 | file(STRINGS ${dir}/flags.txt extraflags) | 51 | file(STRINGS ${dir}/flags.txt extraflags) |
| 53 | |||
| 54 | # replace some custom placeholders | ||
| 55 | string(REPLACE "@MINGW_TOOLCHAIN_FILE@" "${OUTPUT_DIR}/Toolchain_mingw32.cmake" extraflags "${extraflags}") | ||
| 56 | string(REPLACE " " ";" extraflags ${extraflags}) | 52 | string(REPLACE " " ";" extraflags ${extraflags}) |
| 57 | |||
| 58 | message(STATUS "${id} extraflags: ${extraflags}") | 53 | message(STATUS "${id} extraflags: ${extraflags}") |
| 59 | endif() | 54 | endif() |
| 60 | 55 | ||
| @@ -108,18 +103,11 @@ function(add_addon_depends addon searchpath) | |||
| 108 | endif() | 103 | endif() |
| 109 | endif() | 104 | endif() |
| 110 | 105 | ||
| 106 | # on windows "patch.exe" can only handle CR-LF line-endings so we | ||
| 107 | # need to force it to also handle LF-only line endings | ||
| 111 | set(PATCH_PROGRAM ${PATCH_EXECUTABLE}) | 108 | set(PATCH_PROGRAM ${PATCH_EXECUTABLE}) |
| 112 | |||
| 113 | # On Windows "patch.exe" can only handle CR-LF line-endings. | ||
| 114 | # Our patches have LF-only line endings - except when they | ||
| 115 | # have been checked out as part of a dependency hosted on Git | ||
| 116 | # and core.autocrlf=true. | ||
| 117 | if(WIN32) | 109 | if(WIN32) |
| 118 | file(READ ${patch} patch_content_hex HEX) | 110 | set(PATCH_PROGRAM "\"${PATCH_PROGRAM}\" --binary") |
| 119 | # Force handle LF-only line endings | ||
| 120 | if(NOT patch_content_hex MATCHES "0d0a") | ||
| 121 | set(PATCH_PROGRAM "\"${PATCH_PROGRAM}\" --binary") | ||
| 122 | endif() | ||
| 123 | endif() | 111 | endif() |
| 124 | endif() | 112 | endif() |
| 125 | 113 | ||
| @@ -143,11 +131,8 @@ function(add_addon_depends addon searchpath) | |||
| 143 | set(INSTALL_COMMAND INSTALL_COMMAND "") | 131 | set(INSTALL_COMMAND INSTALL_COMMAND "") |
| 144 | endif() | 132 | endif() |
| 145 | 133 | ||
| 146 | # check if there's a platform-specific or generic deps.txt containing dependencies on other libraries | 134 | # check if there's a deps.txt containing dependencies on other libraries |
| 147 | if(EXISTS ${dir}/${CORE_SYSTEM_NAME}-deps.txt) | 135 | if(EXISTS ${dir}/deps.txt) |
| 148 | file(STRINGS ${dir}/${CORE_SYSTEM_NAME}-deps.txt deps) | ||
| 149 | message(STATUS "${id} depends: ${deps}") | ||
| 150 | elseif(EXISTS ${dir}/deps.txt) | ||
| 151 | set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/deps.txt) | 136 | set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/deps.txt) |
| 152 | file(STRINGS ${dir}/deps.txt deps) | 137 | file(STRINGS ${dir}/deps.txt deps) |
| 153 | message(STATUS "${id} depends: ${deps}") | 138 | message(STATUS "${id} depends: ${deps}") |
| @@ -176,10 +161,6 @@ function(add_addon_depends addon searchpath) | |||
| 176 | PATCH_COMMAND ${PATCH_COMMAND} | 161 | PATCH_COMMAND ${PATCH_COMMAND} |
| 177 | "${INSTALL_COMMAND}") | 162 | "${INSTALL_COMMAND}") |
| 178 | 163 | ||
| 179 | if(CMAKE_VERSION VERSION_GREATER 3.5.9) | ||
| 180 | list(APPEND EXTERNALPROJECT_SETUP GIT_SHALLOW 1) | ||
| 181 | endif() | ||
| 182 | |||
| 183 | # if there's an url defined we need to pass that to externalproject_add() | 164 | # if there's an url defined we need to pass that to externalproject_add() |
| 184 | if(DEFINED url AND NOT "${url}" STREQUAL "") | 165 | if(DEFINED url AND NOT "${url}" STREQUAL "") |
| 185 | # check if there's a third parameter in the file | 166 | # check if there's a third parameter in the file |
| @@ -191,20 +172,6 @@ function(add_addon_depends addon searchpath) | |||
| 191 | GIT_REPOSITORY ${url} | 172 | GIT_REPOSITORY ${url} |
| 192 | GIT_TAG ${revision} | 173 | GIT_TAG ${revision} |
| 193 | "${EXTERNALPROJECT_SETUP}") | 174 | "${EXTERNALPROJECT_SETUP}") |
| 194 | |||
| 195 | # For patchfiles to work, disable (users globally set) autocrlf=true | ||
| 196 | if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_GREATER 3.7) | ||
| 197 | message(AUTHOR_WARNING "Make use of GIT_CONFIG") | ||
| 198 | endif() | ||
| 199 | if(WIN32 AND patches) | ||
| 200 | externalproject_add_step(${id} gitconfig | ||
| 201 | COMMAND git config core.autocrlf false | ||
| 202 | COMMAND git rm -rf --cached . | ||
| 203 | COMMAND git reset --hard HEAD | ||
| 204 | COMMENT "Performing gitconfig step: Disabling autocrlf to enable patching for '${id}'" | ||
| 205 | DEPENDERS patch | ||
| 206 | WORKING_DIRECTORY <SOURCE_DIR>) | ||
| 207 | endif() | ||
| 208 | else() | 175 | else() |
| 209 | set(CONFIGURE_COMMAND "") | 176 | set(CONFIGURE_COMMAND "") |
| 210 | if(NOT WIN32) | 177 | if(NOT WIN32) |
diff --git a/project/cmake/scripts/common/Macros.cmake b/project/cmake/scripts/common/Macros.cmake index cce3245..71c39ef 100644 --- a/project/cmake/scripts/common/Macros.cmake +++ b/project/cmake/scripts/common/Macros.cmake | |||
| @@ -155,12 +155,9 @@ function(core_add_shared_library name) | |||
| 155 | add_library(${name} SHARED ${SOURCES} ${HEADERS} ${OTHERS}) | 155 | add_library(${name} SHARED ${SOURCES} ${HEADERS} ${OTHERS}) |
| 156 | set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY} | 156 | set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY} |
| 157 | RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY} | 157 | RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY} |
| 158 | RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY} | ||
| 159 | RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY} | ||
| 158 | OUTPUT_NAME ${OUTPUT_NAME} PREFIX "") | 160 | OUTPUT_NAME ${OUTPUT_NAME} PREFIX "") |
| 159 | foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) | ||
| 160 | string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG) | ||
| 161 | set_target_properties(${name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY} | ||
| 162 | RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY}) | ||
| 163 | endforeach() | ||
| 164 | 161 | ||
| 165 | set(LIBRARY_FILES ${LIBRARY_FILES} ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY}/${OUTPUT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} CACHE STRING "" FORCE) | 162 | set(LIBRARY_FILES ${LIBRARY_FILES} ${CMAKE_BINARY_DIR}/${OUTPUT_DIRECTORY}/${OUTPUT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} CACHE STRING "" FORCE) |
| 166 | add_dependencies(${APP_NAME_LC}-libraries ${name}) | 163 | add_dependencies(${APP_NAME_LC}-libraries ${name}) |
| @@ -598,9 +595,9 @@ macro(core_find_versions) | |||
| 598 | set(APP_VERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}) | 595 | set(APP_VERSION ${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}) |
| 599 | if(APP_VERSION_TAG) | 596 | if(APP_VERSION_TAG) |
| 600 | set(APP_VERSION ${APP_VERSION}-${APP_VERSION_TAG}) | 597 | set(APP_VERSION ${APP_VERSION}-${APP_VERSION_TAG}) |
| 601 | string(TOLOWER ${APP_VERSION_TAG} APP_VERSION_TAG_LC) | ||
| 602 | endif() | 598 | endif() |
| 603 | string(REPLACE "." "," FILE_VERSION ${APP_ADDON_API}.0) | 599 | string(REPLACE "." "," FILE_VERSION ${APP_ADDON_API}.0) |
| 600 | string(TOLOWER ${APP_VERSION_TAG} APP_VERSION_TAG_LC) | ||
| 604 | file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version REGEX "^.*GUILIB_API_VERSION (.*)$") | 601 | file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version REGEX "^.*GUILIB_API_VERSION (.*)$") |
| 605 | string(REGEX REPLACE ".*\"(.*)\"" "\\1" guilib_version ${guilib_version}) | 602 | string(REGEX REPLACE ".*\"(.*)\"" "\\1" guilib_version ${guilib_version}) |
| 606 | file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version_min REGEX "^.*GUILIB_MIN_API_VERSION (.*)$") | 603 | file(STRINGS ${CORE_SOURCE_DIR}/xbmc/addons/kodi-addon-dev-kit/include/kodi/libKODI_guilib.h guilib_version_min REGEX "^.*GUILIB_MIN_API_VERSION (.*)$") |
diff --git a/project/cmake/scripts/common/PrepareEnv.cmake b/project/cmake/scripts/common/PrepareEnv.cmake index 51be739..8e02382 100644 --- a/project/cmake/scripts/common/PrepareEnv.cmake +++ b/project/cmake/scripts/common/PrepareEnv.cmake | |||
| @@ -51,14 +51,43 @@ foreach(binding ${bindings}) | |||
| 51 | configure_file(${CORE_SOURCE_DIR}/${header} ${APP_INCLUDE_DIR} COPYONLY) | 51 | configure_file(${CORE_SOURCE_DIR}/${header} ${APP_INCLUDE_DIR} COPYONLY) |
| 52 | endforeach() | 52 | endforeach() |
| 53 | 53 | ||
| 54 | ### processing additional tools required by the platform | 54 | ### on windows we need a "patch" binary to be able to patch 3rd party sources |
| 55 | if(EXISTS ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/) | 55 | if(WIN32) |
| 56 | file(GLOB platform_tools ${CORE_SOURCE_DIR}/project/cmake/scripts/${CORE_SYSTEM_NAME}/tools/*.cmake) | 56 | find_program(PATCH_FOUND NAMES patch patch.exe) |
| 57 | foreach(platform_tool ${platform_tools}) | 57 | if(PATCH_FOUND) |
| 58 | get_filename_component(platform_tool_name ${platform_tool} NAME_WE) | 58 | message(STATUS "patch utility found at ${PATCH_FOUND}") |
| 59 | message(STATUS "Processing ${CORE_SYSTEM_NAME} specific tool: ${platform_tool_name}") | 59 | else() |
| 60 | set(PATCH_ARCHIVE_NAME "patch-2.5.9-7-bin-3") | ||
| 61 | set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip") | ||
| 62 | set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}") | ||
| 63 | set(PATCH_DOWNLOAD ${BUILD_DIR}/download/${PATCH_ARCHIVE}) | ||
| 60 | 64 | ||
| 61 | # include the file | 65 | # download the archive containing patch.exe |
| 62 | include(${platform_tool}) | 66 | message(STATUS "Downloading patch utility from ${PATCH_URL}...") |
| 63 | endforeach() | 67 | file(DOWNLOAD "${PATCH_URL}" "${PATCH_DOWNLOAD}" STATUS PATCH_DL_STATUS LOG PATCH_LOG SHOW_PROGRESS) |
| 68 | list(GET PATCH_DL_STATUS 0 PATCH_RETCODE) | ||
| 69 | if(NOT ${PATCH_RETCODE} EQUAL 0) | ||
| 70 | message(FATAL_ERROR "ERROR downloading ${PATCH_URL} - status: ${PATCH_DL_STATUS} log: ${PATCH_LOG}") | ||
| 71 | endif() | ||
| 72 | |||
| 73 | # extract the archive containing patch.exe | ||
| 74 | execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${PATCH_DOWNLOAD} | ||
| 75 | WORKING_DIRECTORY ${BUILD_DIR}) | ||
| 76 | |||
| 77 | # make sure the extraction worked and that patch.exe is there | ||
| 78 | set(PATCH_PATH ${BUILD_DIR}/${PATCH_ARCHIVE_NAME}) | ||
| 79 | set(PATCH_BINARY_PATH ${PATCH_PATH}/bin/patch.exe) | ||
| 80 | if(NOT EXISTS ${PATCH_PATH} OR NOT EXISTS ${PATCH_BINARY_PATH}) | ||
| 81 | message(FATAL_ERROR "ERROR extracting patch utility from ${PATCH_DOWNLOAD_DIR}") | ||
| 82 | endif() | ||
| 83 | |||
| 84 | # copy patch.exe into the output directory | ||
| 85 | file(INSTALL ${PATCH_BINARY_PATH} DESTINATION ${ADDON_DEPENDS_PATH}/bin) | ||
| 86 | |||
| 87 | # make sure that cmake can find the copied patch.exe | ||
| 88 | find_program(PATCH_FOUND NAMES patch patch.exe) | ||
| 89 | if(NOT PATCH_FOUND) | ||
| 90 | message(FATAL_ERROR "ERROR installing patch utility from ${PATCH_BINARY_PATH} to ${ADDON_DEPENDS_PATH}/bin") | ||
| 91 | endif() | ||
| 92 | endif() | ||
| 64 | endif() | 93 | endif() |
