diff options
Diffstat (limited to 'cmake/scripts/common/Macros.cmake')
| -rw-r--r-- | cmake/scripts/common/Macros.cmake | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/cmake/scripts/common/Macros.cmake b/cmake/scripts/common/Macros.cmake index 9f00bb7..d508f87 100644 --- a/cmake/scripts/common/Macros.cmake +++ b/cmake/scripts/common/Macros.cmake | |||
| @@ -72,11 +72,15 @@ function(core_add_library name) | |||
| 72 | add_library(${name} STATIC ${SOURCES} ${HEADERS} ${OTHERS}) | 72 | add_library(${name} STATIC ${SOURCES} ${HEADERS} ${OTHERS}) |
| 73 | set_target_properties(${name} PROPERTIES PREFIX "") | 73 | set_target_properties(${name} PROPERTIES PREFIX "") |
| 74 | set(core_DEPENDS ${name} ${core_DEPENDS} CACHE STRING "" FORCE) | 74 | set(core_DEPENDS ${name} ${core_DEPENDS} CACHE STRING "" FORCE) |
| 75 | add_dependencies(${name} libcpluff ffmpeg dvdnav crossguid ${PLATFORM_GLOBAL_TARGET_DEPS}) | 75 | set(lib_DEPS libcpluff ffmpeg crossguid ${PLATFORM_GLOBAL_TARGET_DEPS}) |
| 76 | if(NOT CORE_SYSTEM_NAME STREQUAL windowsstore) | ||
| 77 | list(APPEND lib_DEPS dvdnav) | ||
| 78 | endif() | ||
| 79 | add_dependencies(${name} ${lib_DEPS}) | ||
| 76 | set(CORE_LIBRARY ${name} PARENT_SCOPE) | 80 | set(CORE_LIBRARY ${name} PARENT_SCOPE) |
| 77 | 81 | ||
| 78 | # Add precompiled headers to Kodi main libraries | 82 | # Add precompiled headers to Kodi main libraries |
| 79 | if(CORE_SYSTEM_NAME STREQUAL windows) | 83 | if(CORE_SYSTEM_NAME MATCHES windows) |
| 80 | add_precompiled_header(${name} pch.h ${CMAKE_SOURCE_DIR}/xbmc/platform/win32/pch.cpp PCH_TARGET kodi) | 84 | add_precompiled_header(${name} pch.h ${CMAKE_SOURCE_DIR}/xbmc/platform/win32/pch.cpp PCH_TARGET kodi) |
| 81 | set_language_cxx(${name}) | 85 | set_language_cxx(${name}) |
| 82 | target_link_libraries(${name} PUBLIC effects11) | 86 | target_link_libraries(${name} PUBLIC effects11) |
| @@ -102,7 +106,11 @@ function(core_add_test_library name) | |||
| 102 | set_target_properties(${name} PROPERTIES PREFIX "" | 106 | set_target_properties(${name} PROPERTIES PREFIX "" |
| 103 | EXCLUDE_FROM_ALL 1 | 107 | EXCLUDE_FROM_ALL 1 |
| 104 | FOLDER "Build Utilities/tests") | 108 | FOLDER "Build Utilities/tests") |
| 105 | add_dependencies(${name} libcpluff ffmpeg dvdnav crossguid) | 109 | set(lib_DEPS libcpluff ffmpeg crossguid ${PLATFORM_GLOBAL_TARGET_DEPS}) |
| 110 | if(NOT CORE_SYSTEM_NAME STREQUAL windowsstore) | ||
| 111 | list(APPEND lib_DEPS dvdnav) | ||
| 112 | endif() | ||
| 113 | add_dependencies(${name} ${lib_DEPS}) | ||
| 106 | set(test_archives ${test_archives} ${name} CACHE STRING "" FORCE) | 114 | set(test_archives ${test_archives} ${name} CACHE STRING "" FORCE) |
| 107 | endif() | 115 | endif() |
| 108 | foreach(src IN LISTS SOURCES SUPPORTED_SOURCES HEADERS OTHERS) | 116 | foreach(src IN LISTS SOURCES SUPPORTED_SOURCES HEADERS OTHERS) |
| @@ -314,6 +322,7 @@ function(copy_files_from_filelist_to_buildtree pattern) | |||
| 314 | copy_file_to_buildtree(${CMAKE_SOURCE_DIR}/${file} DIRECTORY ${dest} ${DIR_OPTION}) | 322 | copy_file_to_buildtree(${CMAKE_SOURCE_DIR}/${file} DIRECTORY ${dest} ${DIR_OPTION}) |
| 315 | endif() | 323 | endif() |
| 316 | endforeach() | 324 | endforeach() |
| 325 | set(DIR_OPTION) | ||
| 317 | endforeach() | 326 | endforeach() |
| 318 | endforeach() | 327 | endforeach() |
| 319 | endforeach() | 328 | endforeach() |
| @@ -583,7 +592,8 @@ function(core_find_git_rev stamp) | |||
| 583 | else() | 592 | else() |
| 584 | find_package(Git) | 593 | find_package(Git) |
| 585 | if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git) | 594 | if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git) |
| 586 | execute_process(COMMAND ${GIT_EXECUTABLE} update-index --ignore-submodules --refresh -q) | 595 | execute_process(COMMAND ${GIT_EXECUTABLE} update-index --ignore-submodules -q --refresh |
| 596 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) | ||
| 587 | execute_process(COMMAND ${GIT_EXECUTABLE} diff-files --ignore-submodules --quiet -- | 597 | execute_process(COMMAND ${GIT_EXECUTABLE} diff-files --ignore-submodules --quiet -- |
| 588 | RESULT_VARIABLE status_code | 598 | RESULT_VARIABLE status_code |
| 589 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) | 599 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) |
| @@ -610,7 +620,11 @@ function(core_find_git_rev stamp) | |||
| 610 | string(REPLACE "-" "" DATE ${DATE}) | 620 | string(REPLACE "-" "" DATE ${DATE}) |
| 611 | else() | 621 | else() |
| 612 | string(TIMESTAMP DATE "%Y%m%d" UTC) | 622 | string(TIMESTAMP DATE "%Y%m%d" UTC) |
| 613 | set(HASH "nogitfound") | 623 | if(EXISTS ${CMAKE_SOURCE_DIR}/VERSION) |
| 624 | file(STRINGS ${CMAKE_SOURCE_DIR}/VERSION HASH LIMIT_INPUT 16) | ||
| 625 | else() | ||
| 626 | set(HASH "nogitfound") | ||
| 627 | endif() | ||
| 614 | endif() | 628 | endif() |
| 615 | cmake_parse_arguments(arg "FULL" "" "" ${ARGN}) | 629 | cmake_parse_arguments(arg "FULL" "" "" ${ARGN}) |
| 616 | if(arg_FULL) | 630 | if(arg_FULL) |
| @@ -637,6 +651,7 @@ endfunction() | |||
| 637 | # APP_VERSION - the app version (${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}-${APP_VERSION_TAG}) | 651 | # APP_VERSION - the app version (${APP_VERSION_MAJOR}.${APP_VERSION_MINOR}-${APP_VERSION_TAG}) |
| 638 | # APP_ADDON_API - the addon API version in the form of 16.9.702 | 652 | # APP_ADDON_API - the addon API version in the form of 16.9.702 |
| 639 | # FILE_VERSION - file version in the form of 16,9,702,0 - Windows only | 653 | # FILE_VERSION - file version in the form of 16,9,702,0 - Windows only |
| 654 | # JSONRPC_VERSION - the json api version in the form of 8.3.0 | ||
| 640 | # | 655 | # |
| 641 | # Set various variables defined in "versions.h" | 656 | # Set various variables defined in "versions.h" |
| 642 | macro(core_find_versions) | 657 | macro(core_find_versions) |
| @@ -651,9 +666,28 @@ macro(core_find_versions) | |||
| 651 | 666 | ||
| 652 | include(CMakeParseArguments) | 667 | include(CMakeParseArguments) |
| 653 | core_file_read_filtered(version_list ${CORE_SOURCE_DIR}/version.txt) | 668 | core_file_read_filtered(version_list ${CORE_SOURCE_DIR}/version.txt) |
| 654 | string(REPLACE " " ";" version_list "${version_list}") | 669 | core_file_read_filtered(json_version ${CORE_SOURCE_DIR}/xbmc/interfaces/json-rpc/schema/version.txt) |
| 655 | cmake_parse_arguments(APP "" "APP_NAME;COMPANY_NAME;WEBSITE;VERSION_MAJOR;VERSION_MINOR;VERSION_TAG;VERSION_CODE;ADDON_API;APP_PACKAGE" "" ${version_list}) | 670 | string(REGEX REPLACE "([^ ;]*) ([^;]*)" "\\1;\\2" version_list "${version_list};${json_version}") |
| 656 | 671 | set(version_props | |
| 672 | ADDON_API | ||
| 673 | APP_NAME | ||
| 674 | APP_PACKAGE | ||
| 675 | COMPANY_NAME | ||
| 676 | JSONRPC_VERSION | ||
| 677 | PACKAGE_DESCRIPTION | ||
| 678 | PACKAGE_IDENTITY | ||
| 679 | PACKAGE_PUBLISHER | ||
| 680 | VERSION_MAJOR | ||
| 681 | VERSION_MINOR | ||
| 682 | VERSION_TAG | ||
| 683 | VERSION_CODE | ||
| 684 | WEBSITE | ||
| 685 | ) | ||
| 686 | cmake_parse_arguments(APP "" "${version_props}" "" ${version_list}) | ||
| 687 | |||
| 688 | if(NOT ${APP_VERSION_CODE} MATCHES "^[0-9]+\\.[0-9][0-9]?\\.[0-9][0-9]?[0-9]?$") | ||
| 689 | message(FATAL_ERROR "VERSION_CODE was set to ${APP_VERSION_CODE} in version.txt, but it has to match '^\\d+\\.\\d{1,2}\\.\\d{1,3}$'") | ||
| 690 | endif() | ||
| 657 | set(APP_NAME ${APP_APP_NAME}) # inconsistency but APP_APP_NAME looks weird | 691 | set(APP_NAME ${APP_APP_NAME}) # inconsistency but APP_APP_NAME looks weird |
| 658 | string(TOLOWER ${APP_APP_NAME} APP_NAME_LC) | 692 | string(TOLOWER ${APP_APP_NAME} APP_NAME_LC) |
| 659 | string(TOUPPER ${APP_APP_NAME} APP_NAME_UC) | 693 | string(TOUPPER ${APP_APP_NAME} APP_NAME_UC) |
| @@ -665,6 +699,7 @@ macro(core_find_versions) | |||
| 665 | string(TOLOWER ${APP_VERSION_TAG} APP_VERSION_TAG_LC) | 699 | string(TOLOWER ${APP_VERSION_TAG} APP_VERSION_TAG_LC) |
| 666 | endif() | 700 | endif() |
| 667 | string(REPLACE "." "," FILE_VERSION ${APP_ADDON_API}.0) | 701 | string(REPLACE "." "," FILE_VERSION ${APP_ADDON_API}.0) |
| 702 | set(JSONRPC_VERSION ${APP_JSONRPC_VERSION}) | ||
| 668 | 703 | ||
| 669 | # Set defines used in addon.xml.in and read from versions.h to set add-on | 704 | # Set defines used in addon.xml.in and read from versions.h to set add-on |
| 670 | # version parts automatically | 705 | # version parts automatically |
| @@ -689,6 +724,9 @@ macro(core_find_versions) | |||
| 689 | if(NOT DEFINED APP_VERSION_MAJOR OR NOT DEFINED APP_VERSION_MINOR) | 724 | if(NOT DEFINED APP_VERSION_MAJOR OR NOT DEFINED APP_VERSION_MINOR) |
| 690 | message(FATAL_ERROR "Could not determine app version! Make sure that ${CORE_SOURCE_DIR}/version.txt exists") | 725 | message(FATAL_ERROR "Could not determine app version! Make sure that ${CORE_SOURCE_DIR}/version.txt exists") |
| 691 | endif() | 726 | endif() |
| 727 | if(NOT DEFINED JSONRPC_VERSION) | ||
| 728 | message(FATAL_ERROR "Could not determine json-rpc version! Make sure that ${CORE_SOURCE_DIR}/xbmc/interfaces/json-rpc/schema/version.txt exists") | ||
| 729 | endif() | ||
| 692 | endmacro() | 730 | endmacro() |
| 693 | 731 | ||
| 694 | # add-on xml's | 732 | # add-on xml's |
