aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzard <fuzzard@users.noreply.github.com>2022-05-24 06:55:00 +1000
committerGitHub <noreply@github.com>2022-05-24 06:55:00 +1000
commit89f7ada153148efa800e05f44d70e0d2baaf94dc (patch)
tree4a44093502722b331798dc2a6524017df0f30ecd
parent01dc46f11860b098caf84417747859ced7114eba (diff)
parent0ff12d6cc391a4e48fce554790ba41acbcf5f036 (diff)
Merge pull request #21043 from fuzzard/cmake_spdlogtype
[cmake] provide internal depends builds with build_type
-rw-r--r--cmake/modules/FindCrossGUID.cmake6
-rw-r--r--cmake/modules/FindFFMPEG.cmake1
-rw-r--r--cmake/modules/FindFlatBuffers.cmake6
-rw-r--r--cmake/modules/FindGtest.cmake3
-rw-r--r--cmake/modules/FindLibAndroidJNI.cmake4
-rw-r--r--cmake/scripts/common/ModuleHelpers.cmake15
-rw-r--r--docs/README.Linux.md1
7 files changed, 30 insertions, 6 deletions
diff --git a/cmake/modules/FindCrossGUID.cmake b/cmake/modules/FindCrossGUID.cmake
index adf8d57c60..4783128765 100644
--- a/cmake/modules/FindCrossGUID.cmake
+++ b/cmake/modules/FindCrossGUID.cmake
@@ -40,10 +40,10 @@ if(ENABLE_INTERNAL_CROSSGUID)
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(CROSSGUID_BUILD_TYPE Release)
+
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/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/scripts/common/ModuleHelpers.cmake b/cmake/scripts/common/ModuleHelpers.cmake
index ab6357116c..a31286c0bb 100644
--- a/cmake/scripts/common/ModuleHelpers.cmake
+++ b/cmake/scripts/common/ModuleHelpers.cmake
@@ -136,6 +136,21 @@ 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}")
+ 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)
diff --git a/docs/README.Linux.md b/docs/README.Linux.md
index 287446acf3..e6257caf6a 100644
--- a/docs/README.Linux.md
+++ b/docs/README.Linux.md
@@ -120,6 +120,7 @@ sudo make -C tools/depends/target/waylandpp PREFIX=/usr/local
### 3.2. Enable internal dependencies
Some dependencies can be configured to build before Kodi. That's the case with `flatbuffers`, `crossguid`, `libfmt`, `libspdlog`, `rapidjson`, `fstrcmp` and `dav1d`. To enable the internal build of a dependency, append `-DENABLE_INTERNAL_<DEPENDENCY_NAME>=ON` to the configure command below. For example, configuring an X11 build with internal `fmt` would become `cmake ../kodi -DCMAKE_INSTALL_PREFIX=/usr/local -DENABLE_INTERNAL_FMT=ON` instead of `cmake ../kodi -DCMAKE_INSTALL_PREFIX=/usr/local`.
+Internal dependencies that are based on cmake upstream (currently crossguid, ffmpeg, fmt, spdlog) can have their build type overridden by defining `-D<DEPENDENCY_NAME>_BUILD_TYPE=<buildtype>`. Build Type can be one of `Release, RelWithDebInfo, Debug, MinSizeRel`. eg `-DFFMPEG_BUILD_TYPE=RelWithDebInfo`. If not provided, the build type will be the same as the core Kodi project.
**Note:** fstrcmp requires libtool