diff options
Diffstat (limited to 'cmake/scripts/common/AddonHelpers.cmake')
| -rw-r--r-- | cmake/scripts/common/AddonHelpers.cmake | 19 |
1 files changed, 10 insertions, 9 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) |
