diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/FindCrossGUID.cmake | 15 | ||||
-rw-r--r-- | cmake/modules/FindFFMPEG.cmake | 1 | ||||
-rw-r--r-- | cmake/modules/FindFlatBuffers.cmake | 6 | ||||
-rw-r--r-- | cmake/modules/FindFmt.cmake | 5 | ||||
-rw-r--r-- | cmake/modules/FindGtest.cmake | 3 | ||||
-rw-r--r-- | cmake/modules/FindLibAndroidJNI.cmake | 4 | ||||
-rw-r--r-- | cmake/modules/FindPatch.cmake | 115 | ||||
-rw-r--r-- | cmake/modules/FindRapidJSON.cmake | 4 | ||||
-rw-r--r-- | cmake/modules/FindSpdlog.cmake | 5 | ||||
-rw-r--r-- | cmake/modules/FindTagLib.cmake | 55 | ||||
-rw-r--r-- | cmake/modules/MOLD.cmake | 41 | ||||
-rw-r--r-- | cmake/scripts/android/ArchSetup.cmake | 2 | ||||
-rw-r--r-- | cmake/scripts/common/ModuleHelpers.cmake | 33 | ||||
-rw-r--r-- | cmake/scripts/freebsd/ArchSetup.cmake | 9 | ||||
-rw-r--r-- | cmake/scripts/linux/ArchSetup.cmake | 9 | ||||
-rw-r--r-- | cmake/treedata/common/subdirs.txt | 1 |
16 files changed, 226 insertions, 82 deletions
diff --git a/cmake/modules/FindCrossGUID.cmake b/cmake/modules/FindCrossGUID.cmake index adf8d57c60..c1a1d37106 100644 --- a/cmake/modules/FindCrossGUID.cmake +++ b/cmake/modules/FindCrossGUID.cmake @@ -18,11 +18,7 @@ if(ENABLE_INTERNAL_CROSSGUID) set(MODULE_LC crossguid) - # Temp: We force CMAKE_BUILD_TYPE to release, and makefile builds respect this - # Multi config generators (eg VS, Xcode) dont, so handle debug postfix build/link for them only - if(NOT (CMAKE_GENERATOR STREQUAL "Unix Makefiles" OR CMAKE_GENERATOR STREQUAL "Ninja")) - set(CROSSGUID_DEBUG_POSTFIX "-dgb") - endif() + set(CROSSGUID_DEBUG_POSTFIX "-dgb") SETUP_BUILD_VARS() @@ -33,17 +29,14 @@ if(ENABLE_INTERNAL_CROSSGUID) list(APPEND CROSSGUID_DEFINITIONS -DGUID_ANDROID) endif() - # Use custom findpatch to handle windows patch binary if not available - include(cmake/modules/FindPatch.cmake) + # find the path to the patch executable + find_package(Patch MODULE REQUIRED) set(PATCH_COMMAND ${PATCH_EXECUTABLE} -p1 -i ${CMAKE_SOURCE_DIR}/tools/depends/target/crossguid/001-fix-unused-function.patch COMMAND ${PATCH_EXECUTABLE} -p1 -i ${CMAKE_SOURCE_DIR}/tools/depends/target/crossguid/002-disable-Wall-error.patch) - # Force release build type. crossguid forces a debug postfix -dgb. may want to patch this - # if we enable adaptive build type for the library. set(CMAKE_ARGS -DCROSSGUID_TESTS=OFF - -DDISABLE_WALL=ON - -DCMAKE_BUILD_TYPE=Release) + -DDISABLE_WALL=ON) BUILD_DEP_TARGET() diff --git a/cmake/modules/FindFFMPEG.cmake b/cmake/modules/FindFFMPEG.cmake index 5ce39c9c62..31bc93dc99 100644 --- a/cmake/modules/FindFFMPEG.cmake +++ b/cmake/modules/FindFFMPEG.cmake @@ -74,7 +74,6 @@ macro(buildFFMPEG) list(APPEND LINKER_FLAGS ${SYSTEM_LDFLAGS}) set(CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH} -DFFMPEG_VER=${FFMPEG_VER} -DCORE_SYSTEM_NAME=${CORE_SYSTEM_NAME} diff --git a/cmake/modules/FindFlatBuffers.cmake b/cmake/modules/FindFlatBuffers.cmake index 4b03986923..3b01e5d379 100644 --- a/cmake/modules/FindFlatBuffers.cmake +++ b/cmake/modules/FindFlatBuffers.cmake @@ -19,8 +19,10 @@ if(ENABLE_INTERNAL_FLATBUFFERS) set(FLATBUFFERS_FLATC_EXECUTABLE ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/bin/flatc CACHE INTERNAL "FlatBuffer compiler") set(FLATBUFFERS_INCLUDE_DIR ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/include CACHE INTERNAL "FlatBuffer include dir") - set(CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release - -DFLATBUFFERS_CODE_COVERAGE=OFF + # Override build type detection and always build as release + set(FLATBUFFERS_BUILD_TYPE Release) + + set(CMAKE_ARGS -DFLATBUFFERS_CODE_COVERAGE=OFF -DFLATBUFFERS_BUILD_TESTS=OFF -DFLATBUFFERS_INSTALL=ON -DFLATBUFFERS_BUILD_FLATLIB=OFF diff --git a/cmake/modules/FindFmt.cmake b/cmake/modules/FindFmt.cmake index 096f927ad6..9747ae4e47 100644 --- a/cmake/modules/FindFmt.cmake +++ b/cmake/modules/FindFmt.cmake @@ -17,6 +17,9 @@ if(ENABLE_INTERNAL_FMT) set(MODULE_LC fmt) + # fmt debug uses postfix d for all platforms + set(FMT_DEBUG_POSTFIX d) + SETUP_BUILD_VARS() if(APPLE) @@ -27,7 +30,7 @@ if(ENABLE_INTERNAL_FMT) if(WIN32 OR WINDOWS_STORE) # find the path to the patch executable - find_program(PATCH_EXECUTABLE NAMES patch patch.exe REQUIRED) + find_package(Patch MODULE REQUIRED) set(patch ${CMAKE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/001-windows-pdb-symbol-gen.patch) PATCH_LF_CHECK(${patch}) diff --git a/cmake/modules/FindGtest.cmake b/cmake/modules/FindGtest.cmake index 3d2ec93aa2..eba6adc6bc 100644 --- a/cmake/modules/FindGtest.cmake +++ b/cmake/modules/FindGtest.cmake @@ -22,6 +22,9 @@ if(ENABLE_INTERNAL_GTEST) set(GTEST_VERSION ${${MODULE}_VER}) + # Override build type detection and always build as release + set(GTEST_BUILD_TYPE Release) + set(CMAKE_ARGS -DBUILD_GMOCK=OFF -DINSTALL_GTEST=ON -DBUILD_SHARED_LIBS=OFF diff --git a/cmake/modules/FindLibAndroidJNI.cmake b/cmake/modules/FindLibAndroidJNI.cmake index d100f9c721..506e70fe09 100644 --- a/cmake/modules/FindLibAndroidJNI.cmake +++ b/cmake/modules/FindLibAndroidJNI.cmake @@ -18,6 +18,10 @@ set(MODULE_LC libandroidjni) SETUP_BUILD_VARS() +set(LIBANDROIDJNI_BUILD_TYPE Release) + +# We still need to supply SOMETHING to CMAKE_ARGS to initiate a cmake BUILD_DEP_TARGET +# Setting cmake_build_type twice wont cause issues set(CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release) BUILD_DEP_TARGET() diff --git a/cmake/modules/FindPatch.cmake b/cmake/modules/FindPatch.cmake index 3f6afd7c1b..4fbf5a6dbd 100644 --- a/cmake/modules/FindPatch.cmake +++ b/cmake/modules/FindPatch.cmake @@ -8,53 +8,72 @@ # # PATCH_EXECUTABLE - patch executable -find_program(PATCH_EXECUTABLE NAMES patch patch.exe) -if(NOT PATCH_EXECUTABLE) - if(WIN32 OR WINDOWSSTORE) - # Set mirror for potential patch binary download - if(NOT KODI_MIRROR) - set(KODI_MIRROR "http://mirrors.kodi.tv") - endif() - - set(PATCH_ARCHIVE_NAME "patch-2.7.6-bin") - set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip") - set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}") - set(PATCH_DOWNLOAD ${TARBALL_DIR}/${PATCH_ARCHIVE}) - - # download the archive containing patch.exe - message(STATUS "Downloading patch utility from ${PATCH_URL}...") - file(DOWNLOAD "${PATCH_URL}" "${PATCH_DOWNLOAD}" STATUS PATCH_DL_STATUS LOG PATCH_LOG SHOW_PROGRESS) - list(GET PATCH_DL_STATUS 0 PATCH_RETCODE) - if(NOT PATCH_RETCODE EQUAL 0) - message(FATAL_ERROR "ERROR downloading ${PATCH_URL} - status: ${PATCH_DL_STATUS} log: ${PATCH_LOG}") - endif() - - # CORE_BUILD_DIR may not exist as yet, so create just in case - if(NOT EXISTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}) - file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}) - endif() - - # extract the archive containing patch.exe - execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${PATCH_DOWNLOAD} - WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}) - - # make sure the extraction worked and that patch.exe is there - set(PATCH_PATH ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${PATCH_ARCHIVE_NAME}) - if(NOT EXISTS "${PATCH_PATH}/bin/patch.exe") - message(FATAL_ERROR "ERROR extracting patch utility from ${PATCH_PATH}") - endif() - - # copy patch.exe into the output directory - file(INSTALL "${PATCH_PATH}/bin/patch.exe" DESTINATION ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/bin) - # copy patch depends - file(GLOB PATCH_BINARIES ${PATCH_PATH}/bin/*.dll) - if(NOT "${PATCH_BINARIES}" STREQUAL "") - file(INSTALL ${PATCH_BINARIES} DESTINATION ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/bin) - endif() - - # make sure that cmake can find the copied patch.exe - find_program(PATCH_EXECUTABLE NAMES patch.exe HINTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/bin REQUIRED) - else() - message(FATAL_ERROR "ERROR - No patch executable found") +if(CMAKE_HOST_WIN32) + + find_package(Git) + if(Git_FOUND) + get_filename_component(GIT_DIR ${GIT_EXECUTABLE} DIRECTORY) + endif() + + find_program(PATCH_EXE NAMES patch.exe HINTS "${GIT_DIR}/.." PATH_SUFFIXES usr/bin) +else() + # Freebsd patch is insufficient (too old) look for gnu patch first + find_program(PATCH_EXE NAMES gpatch patch) +endif() + +if(CMAKE_HOST_WIN32 AND NOT PATCH_EXE) + # Set mirror for potential patch binary download + if(NOT KODI_MIRROR) + set(KODI_MIRROR "http://mirrors.kodi.tv") + endif() + + set(PATCH_ARCHIVE_NAME "patch-2.7.6-bin") + set(PATCH_ARCHIVE "${PATCH_ARCHIVE_NAME}.zip") + set(PATCH_URL "${KODI_MIRROR}/build-deps/win32/${PATCH_ARCHIVE}") + set(PATCH_DOWNLOAD ${TARBALL_DIR}/${PATCH_ARCHIVE}) + + # download the archive containing patch.exe + message(STATUS "Downloading patch utility from ${PATCH_URL}...") + file(DOWNLOAD "${PATCH_URL}" "${PATCH_DOWNLOAD}" STATUS PATCH_DL_STATUS LOG PATCH_LOG SHOW_PROGRESS) + list(GET PATCH_DL_STATUS 0 PATCH_RETCODE) + if(NOT PATCH_RETCODE EQUAL 0) + message(FATAL_ERROR "ERROR downloading ${PATCH_URL} - status: ${PATCH_DL_STATUS} log: ${PATCH_LOG}") + endif() + + # CORE_BUILD_DIR may not exist as yet, so create just in case + if(NOT EXISTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}) endif() + + # extract the archive containing patch.exe + execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzvf ${PATCH_DOWNLOAD} + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}) + + # make sure the extraction worked and that patch.exe is there + set(PATCH_PATH ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/${PATCH_ARCHIVE_NAME}) + if(NOT EXISTS "${PATCH_PATH}/bin/patch.exe") + message(FATAL_ERROR "ERROR extracting patch utility from ${PATCH_PATH}") + endif() + + # copy patch.exe into the output directory + file(INSTALL "${PATCH_PATH}/bin/patch.exe" DESTINATION ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/bin) + # copy patch depends + file(GLOB PATCH_BINARIES ${PATCH_PATH}/bin/*.dll) + if(NOT "${PATCH_BINARIES}" STREQUAL "") + file(INSTALL ${PATCH_BINARIES} DESTINATION ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/bin) + endif() + + # make sure that cmake can find the copied patch.exe + find_program(PATCH_EXE NAMES patch.exe HINTS ${CMAKE_BINARY_DIR}/${CORE_BUILD_DIR}/bin REQUIRED) +endif() + +include(FindPackageHandleStandardArgs) + +set(FPHSA_NAME_MISMATCHED 1) # Suppress warnings, see https://cmake.org/cmake/help/v3.17/module/FindPackageHandleStandardArgs.html +find_package_handle_standard_args(PATCH REQUIRED_VARS PATCH_EXE) +unset(FPHSA_NAME_MISMATCHED) + +if(PATCH_FOUND) + set(PATCH_EXECUTABLE "${PATCH_EXE}") + mark_as_advanced(PATCH_EXE) endif() diff --git a/cmake/modules/FindRapidJSON.cmake b/cmake/modules/FindRapidJSON.cmake index be00f123f8..ba222f5b11 100644 --- a/cmake/modules/FindRapidJSON.cmake +++ b/cmake/modules/FindRapidJSON.cmake @@ -18,8 +18,8 @@ if(ENABLE_INTERNAL_RapidJSON) set(RapidJSON_INCLUDE_DIR ${${MODULE}_INCLUDE_DIR}) set(RapidJSON_VERSION ${${MODULE}_VER}) - # Use custom findpatch to handle windows patch binary if not available - include(cmake/modules/FindPatch.cmake) + # find the path to the patch executable + find_package(Patch MODULE REQUIRED) set(PATCH_COMMAND ${PATCH_EXECUTABLE} -p1 -i ${CORE_SOURCE_DIR}/tools/depends/target/rapidjson/001-remove_custom_cxx_flags.patch COMMAND ${PATCH_EXECUTABLE} -p1 -i ${CORE_SOURCE_DIR}/tools/depends/target/rapidjson/002-cmake-removedocs-examples.patch diff --git a/cmake/modules/FindSpdlog.cmake b/cmake/modules/FindSpdlog.cmake index ae5c68aedb..42b26ab4a5 100644 --- a/cmake/modules/FindSpdlog.cmake +++ b/cmake/modules/FindSpdlog.cmake @@ -18,6 +18,9 @@ if(ENABLE_INTERNAL_SPDLOG) set(MODULE_LC spdlog) + # spdlog debug uses postfix d for all platforms + set(SPDLOG_DEBUG_POSTFIX d) + SETUP_BUILD_VARS() if(APPLE) @@ -26,7 +29,7 @@ if(ENABLE_INTERNAL_SPDLOG) if(WIN32 OR WINDOWS_STORE) # find the path to the patch executable - find_program(PATCH_EXECUTABLE NAMES patch patch.exe REQUIRED) + find_package(Patch MODULE REQUIRED) set(patch ${CMAKE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/001-windows-pdb-symbol-gen.patch) PATCH_LF_CHECK(${patch}) diff --git a/cmake/modules/FindTagLib.cmake b/cmake/modules/FindTagLib.cmake index ac7b7ec807..9ee5e92a3d 100644 --- a/cmake/modules/FindTagLib.cmake +++ b/cmake/modules/FindTagLib.cmake @@ -13,17 +13,54 @@ # # TagLib::TagLib - The TagLib library -if(PKG_CONFIG_FOUND) - pkg_check_modules(PC_TAGLIB taglib>=1.9.0 QUIET) -endif() +if(ENABLE_INTERNAL_TAGLIB) + include(cmake/scripts/common/ModuleHelpers.cmake) + + set(MODULE_LC taglib) + + # Debug postfix only used for windows + if(WIN32 OR WINDOWS_STORE) + set(TAGLIB_DEBUG_POSTFIX "d") + else() + set(TAGLIB_DEBUG_POSTFIX "") + endif() + + SETUP_BUILD_VARS() -find_path(TAGLIB_INCLUDE_DIR taglib/tag.h - PATHS ${PC_TAGLIB_INCLUDEDIR}) -find_library(TAGLIB_LIBRARY_RELEASE NAMES tag + set(TAGLIB_VERSION ${${MODULE}_VER}) + + if(WIN32 OR WINDOWS_STORE) + # find the path to the patch executable + find_package(Patch MODULE REQUIRED) + + set(patch ${CMAKE_SOURCE_DIR}/tools/depends/target/${MODULE_LC}/001-cmake-pdb-debug.patch) + PATCH_LF_CHECK(${patch}) + + set(PATCH_COMMAND ${PATCH_EXECUTABLE} -p1 -i ${patch}) + endif() + + set(CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF + -DBUILD_BINDINGS=OFF) + + BUILD_DEP_TARGET() + + # Add target to libkodi to build + set_property(GLOBAL APPEND PROPERTY INTERNAL_DEPS_PROP taglib) +else() + + if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_TAGLIB taglib>=1.9.0 QUIET) + endif() + + find_path(TAGLIB_INCLUDE_DIR taglib/tag.h + PATHS ${PC_TAGLIB_INCLUDEDIR}) + find_library(TAGLIB_LIBRARY_RELEASE NAMES tag + PATHS ${PC_TAGLIB_LIBDIR}) + find_library(TAGLIB_LIBRARY_DEBUG NAMES tagd PATHS ${PC_TAGLIB_LIBDIR}) -find_library(TAGLIB_LIBRARY_DEBUG NAMES tagd - PATHS ${PC_TAGLIB_LIBDIR}) -set(TAGLIB_VERSION ${PC_TAGLIB_VERSION}) + set(TAGLIB_VERSION ${PC_TAGLIB_VERSION}) + +endif() include(SelectLibraryConfigurations) select_library_configurations(TAGLIB) diff --git a/cmake/modules/MOLD.cmake b/cmake/modules/MOLD.cmake index 0ecb276c8f..cb29ed1e95 100644 --- a/cmake/modules/MOLD.cmake +++ b/cmake/modules/MOLD.cmake @@ -16,6 +16,45 @@ if(ENABLE_MOLD) endif() execute_process(COMMAND ${CMAKE_CXX_COMPILER} ${COMPILER_ARGS} -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION) + + set(DEFAULT_ENABLE_DEBUGFISSION FALSE) + if(CMAKE_BUILD_TYPE STREQUAL Debug OR + CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) + set(DEFAULT_ENABLE_DEBUGFISSION TRUE) + endif() + + include(CMakeDependentOption) + cmake_dependent_option(ENABLE_DEBUGFISSION "Enable Debug Fission support" ON + "DEFAULT_ENABLE_DEBUGFISSION" OFF) + + if(ENABLE_DEBUGFISSION) + include(TestCXXAcceptsFlag) + check_cxx_accepts_flag(-gsplit-dwarf CXX_ACCEPTS_GSPLIT_DWARF) + + # extract mold version + set(LD_VERSION_LIST ${LD_VERSION}) + separate_arguments(LD_VERSION_LIST) + list(GET LD_VERSION_LIST 1 MOLD_VERSION) + + set(DEBUGFISSION_AVAILABLE FALSE) + if(CXX_ACCEPTS_GSPLIT_DWARF) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -gsplit-dwarf") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -gsplit-dwarf") + if(${MOLD_VERSION} VERSION_GREATER_EQUAL "1.2.0") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gdb-index") + set(DEBUGFISSION_AVAILABLE TRUE) + endif() + endif() + + if(DEBUGFISSION_AVAILABLE) + message(STATUS "Debug Fission enabled") + else() + message(WARNING "Debug Fission is not available") + endif() + endif() + if(LD_VERSION MATCHES "mold") include(FindPackageHandleStandardArgs) find_program(MOLD_EXECUTABLE mold) @@ -25,7 +64,7 @@ if(ENABLE_MOLD) set(CMAKE_LINKER ${MOLD_EXECUTABLE}) set(CMAKE_CXX_LINK_FLAGS ${COMPILER_ARGS}) set(CMAKE_C_LINK_FLAGS ${COMPILER_ARGS}) - set(CMAKE_EXE_LINKER_FLAGS "${LD_FLAGS} ${COMPILER_ARGS}") + set(CMAKE_EXE_LINKER_FLAGS "${LD_FLAGS} ${COMPILER_ARGS} ${CMAKE_EXE_LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}") message(STATUS "Linker: mold") diff --git a/cmake/scripts/android/ArchSetup.cmake b/cmake/scripts/android/ArchSetup.cmake index 2fe85fe2f7..6c1e96de29 100644 --- a/cmake/scripts/android/ArchSetup.cmake +++ b/cmake/scripts/android/ArchSetup.cmake @@ -42,4 +42,6 @@ set(ENABLE_X11 OFF CACHE BOOL "" FORCE) set(ENABLE_OPTICAL OFF CACHE BOOL "" FORCE) set(ENABLE_MDNS OFF CACHE BOOL "" FORCE) +set(DEBUG_POSTFIX d CACHE STRING "Debug library postfix.") + list(APPEND DEPLIBS android log jnigraphics mediandk) diff --git a/cmake/scripts/common/ModuleHelpers.cmake b/cmake/scripts/common/ModuleHelpers.cmake index ab6357116c..99afc4965d 100644 --- a/cmake/scripts/common/ModuleHelpers.cmake +++ b/cmake/scripts/common/ModuleHelpers.cmake @@ -49,25 +49,24 @@ function(get_versionfile_data module_name) if(${UPPER_MODULE_NAME}_BYPRODUCT) # strip the extension, if debug, add DEBUG_POSTFIX and then add the extension back - if(${UPPER_MODULE_NAME}_DEBUG_POSTFIX) + if(DEFINED ${UPPER_MODULE_NAME}_DEBUG_POSTFIX) set(_POSTFIX ${${UPPER_MODULE_NAME}_DEBUG_POSTFIX}) else() set(_POSTFIX ${DEBUG_POSTFIX}) endif() # Only add debug postfix if platform or module supply a DEBUG_POSTFIX - if(NOT _POSTFIX STREQUAL "") + if(DEFINED _POSTFIX AND NOT _POSTFIX STREQUAL "") string(REGEX REPLACE "\\.[^.]*$" "" ${UPPER_MODULE_NAME}_BYPRODUCT_DEBUG ${${UPPER_MODULE_NAME}_BYPRODUCT}) if(WIN32 OR WINDOWS_STORE) set(${UPPER_MODULE_NAME}_BYPRODUCT_DEBUG "${${UPPER_MODULE_NAME}_BYPRODUCT_DEBUG}${_POSTFIX}.lib") else() set(${UPPER_MODULE_NAME}_BYPRODUCT_DEBUG "${${UPPER_MODULE_NAME}_BYPRODUCT_DEBUG}${_POSTFIX}.a") endif() - - # Set Debug and Release library names + # Set Debug library names set(${UPPER_MODULE_NAME}_LIBRARY_DEBUG ${DEPENDS_PATH}/lib/${${UPPER_MODULE_NAME}_BYPRODUCT_DEBUG} PARENT_SCOPE) - set(${UPPER_MODULE_NAME}_LIBRARY_RELEASE ${DEPENDS_PATH}/lib/${${UPPER_MODULE_NAME}_BYPRODUCT} PARENT_SCOPE) endif() + set(${UPPER_MODULE_NAME}_LIBRARY_RELEASE ${DEPENDS_PATH}/lib/${${UPPER_MODULE_NAME}_BYPRODUCT} PARENT_SCOPE) set(${UPPER_MODULE_NAME}_LIBRARY ${DEPENDS_PATH}/lib/${${UPPER_MODULE_NAME}_BYPRODUCT} PARENT_SCOPE) endif() @@ -136,6 +135,28 @@ macro(BUILD_DEP_TARGET) if(CMAKE_TOOLCHAIN_FILE) list(APPEND CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") endif() + + # Set build type for dep build. + # if MODULE has set a manual build type, use it, otherwise use project build type + if(${MODULE}_BUILD_TYPE) + list(APPEND CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${${MODULE}_BUILD_TYPE}") + # Build_type is forced, so unset the opposite <MODULE>_LIBRARY_<TYPE> to only give + # select_library_configurations one library name to choose from + if(${MODULE}_BUILD_TYPE STREQUAL "Release") + unset(${MODULE}_LIBRARY_DEBUG) + else() + unset(${MODULE}_LIBRARY_RELEASE) + endif() + else() + # single config generator (ie Make, Ninja) + if(CMAKE_BUILD_TYPE) + list(APPEND CMAKE_ARGS "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}") + else() + # Multi-config generators (eg VS, Xcode, Ninja Multi-Config) will not have CMAKE_BUILD_TYPE + # Use config genex to generate the types + list(APPEND CMAKE_ARGS "-DCMAKE_BUILD_TYPE=$<CONFIG>") + endif() + endif() endif() if(PATCH_COMMAND) @@ -202,7 +223,7 @@ endmacro() # Macro to test format of line endings of a patch # Windows Specific macro(PATCH_LF_CHECK patch) - if(WIN32 OR WINDOWS_STORE) + if(CMAKE_HOST_WIN32) # On Windows "patch.exe" can only handle CR-LF line-endings. # Our patches have LF-only line endings - except when they # have been checked out as part of a dependency hosted on Git diff --git a/cmake/scripts/freebsd/ArchSetup.cmake b/cmake/scripts/freebsd/ArchSetup.cmake index 1a8c471113..87f4f0c9cc 100644 --- a/cmake/scripts/freebsd/ArchSetup.cmake +++ b/cmake/scripts/freebsd/ArchSetup.cmake @@ -35,3 +35,12 @@ endif() # Additional SYSTEM_DEFINES list(APPEND SYSTEM_DEFINES -DHAS_POSIX_NETWORK -DHAS_FREEBSD_NETWORK) + +# Build internal libs +if(NOT USE_INTERNAL_LIBS) + if(KODI_DEPENDSBUILD) + set(USE_INTERNAL_LIBS ON) + else() + set(USE_INTERNAL_LIBS OFF) + endif() +endif() diff --git a/cmake/scripts/linux/ArchSetup.cmake b/cmake/scripts/linux/ArchSetup.cmake index b59d145fb2..35ab1402f5 100644 --- a/cmake/scripts/linux/ArchSetup.cmake +++ b/cmake/scripts/linux/ArchSetup.cmake @@ -190,3 +190,12 @@ if(ARCH_IS_BIGENDIAN) else() message(STATUS "Host architecture is little-endian") endif() + +# Build internal libs +if(NOT USE_INTERNAL_LIBS) + if(KODI_DEPENDSBUILD) + set(USE_INTERNAL_LIBS ON) + else() + set(USE_INTERNAL_LIBS OFF) + endif() +endif() diff --git a/cmake/treedata/common/subdirs.txt b/cmake/treedata/common/subdirs.txt index 027f276d3b..006c7ab4f7 100644 --- a/cmake/treedata/common/subdirs.txt +++ b/cmake/treedata/common/subdirs.txt @@ -3,6 +3,7 @@ xbmc/addons addons xbmc/addons/addoninfo addons_addoninfo xbmc/addons/binary-addons addons_binary-addons xbmc/addons/gui addons_gui +xbmc/addons/gui/skin addons_gui_skin xbmc/addons/interfaces addons_interfaces xbmc/addons/interfaces/gui addons_interfaces_gui xbmc/addons/interfaces/gui/controls addons_interfaces_gui_controls |