mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] ci: Use modern CMake command options in ci_verify_cmake.sh
Due to raising the minimum CMake version to 3.14, we can now run the CMake build verification (ci_verify_cmake.sh) from the libpng source dir, just as in the other scripts (ci_verify_*.sh). This is possible thanks to the modern CMake command options `cmake -B` and `cmake -S`. We can finally simplify the implementation of ci_verify_cmake.sh by removing a code complication that was annoying, and yet, necessary in peculiar Bash-on-Windows setups. Fun fact: CMake version 3.14 was released on 2019-03-14. Reportedly, on purpose! This is a cherry-pick of commit 558dfbb7570cb74205f978f11504b217a2c03c2c from branch 'libpng18'.
This commit is contained in:
parent
9ee82380da
commit
1bf304c43c
@ -17,12 +17,6 @@ CI_OUT_DIR="$CI_TOPLEVEL_DIR/out"
|
|||||||
CI_BUILD_DIR="$CI_OUT_DIR/ci_verify_cmake.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.build"
|
CI_BUILD_DIR="$CI_OUT_DIR/ci_verify_cmake.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.build"
|
||||||
CI_INSTALL_DIR="$CI_OUT_DIR/ci_verify_cmake.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.install"
|
CI_INSTALL_DIR="$CI_OUT_DIR/ci_verify_cmake.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.install"
|
||||||
|
|
||||||
# Keep the following relative paths in sync with the absolute paths.
|
|
||||||
# We use them for the benefit of native Windows tools that might be
|
|
||||||
# otherwise confused by the path encoding used by Bash-on-Windows.
|
|
||||||
CI_BUILD_TO_SRC_RELDIR="../.."
|
|
||||||
CI_BUILD_TO_INSTALL_RELDIR="../ci_verify_cmake.$CI_TARGET_SYSTEM.$CI_TARGET_ARCH.install"
|
|
||||||
|
|
||||||
function ci_init_build {
|
function ci_init_build {
|
||||||
# Ensure that the mandatory variables are initialized.
|
# Ensure that the mandatory variables are initialized.
|
||||||
CI_CMAKE="${CI_CMAKE:-cmake}"
|
CI_CMAKE="${CI_CMAKE:-cmake}"
|
||||||
@ -148,40 +142,33 @@ function ci_build {
|
|||||||
all_cmake_build_flags+=($CI_CMAKE_BUILD_FLAGS)
|
all_cmake_build_flags+=($CI_CMAKE_BUILD_FLAGS)
|
||||||
all_ctest_flags+=($CI_CTEST_FLAGS)
|
all_ctest_flags+=($CI_CTEST_FLAGS)
|
||||||
# And... build!
|
# And... build!
|
||||||
# Use $CI_BUILD_TO_SRC_RELDIR and $CI_BUILD_TO_INSTALL_RELDIR
|
|
||||||
# instead of $CI_SRC_DIR and $CI_INSTALL_DIR from this point onwards.
|
|
||||||
ci_spawn mkdir -p "$CI_BUILD_DIR"
|
ci_spawn mkdir -p "$CI_BUILD_DIR"
|
||||||
ci_spawn cd "$CI_BUILD_DIR"
|
|
||||||
[[ $CI_BUILD_TO_SRC_RELDIR -ef $CI_SRC_DIR ]] || {
|
|
||||||
ci_err_internal "bad or missing \$CI_BUILD_TO_SRC_RELDIR"
|
|
||||||
}
|
|
||||||
ci_spawn mkdir -p "$CI_INSTALL_DIR"
|
|
||||||
[[ $CI_BUILD_TO_INSTALL_RELDIR -ef $CI_INSTALL_DIR ]] || {
|
|
||||||
ci_err_internal "bad or missing \$CI_BUILD_TO_INSTALL_RELDIR"
|
|
||||||
}
|
|
||||||
# Spawn "cmake ...".
|
# Spawn "cmake ...".
|
||||||
ci_spawn "$CI_CMAKE" -DCMAKE_INSTALL_PREFIX="$CI_BUILD_TO_INSTALL_RELDIR" \
|
ci_spawn "$CI_CMAKE" -B "$CI_BUILD_DIR" \
|
||||||
"${all_cmake_vars[@]}" \
|
-S . \
|
||||||
"$CI_BUILD_TO_SRC_RELDIR"
|
-DCMAKE_INSTALL_PREFIX="$CI_INSTALL_DIR" \
|
||||||
|
"${all_cmake_vars[@]}"
|
||||||
# Spawn "cmake --build ...".
|
# Spawn "cmake --build ...".
|
||||||
ci_spawn "$CI_CMAKE" --build . \
|
ci_spawn "$CI_CMAKE" --build "$CI_BUILD_DIR" \
|
||||||
--config "$CI_CMAKE_BUILD_TYPE" \
|
--config "$CI_CMAKE_BUILD_TYPE" \
|
||||||
"${all_cmake_build_flags[@]}"
|
"${all_cmake_build_flags[@]}"
|
||||||
ci_expr $((CI_NO_TEST)) || {
|
ci_expr $((CI_NO_TEST)) || {
|
||||||
# Spawn "ctest" if testing is not disabled.
|
# Spawn "ctest" if testing is not disabled.
|
||||||
|
ci_spawn pushd "$CI_BUILD_DIR"
|
||||||
ci_spawn "$CI_CTEST" --build-config "$CI_CMAKE_BUILD_TYPE" \
|
ci_spawn "$CI_CTEST" --build-config "$CI_CMAKE_BUILD_TYPE" \
|
||||||
"${all_ctest_flags[@]}"
|
"${all_ctest_flags[@]}"
|
||||||
|
ci_spawn popd
|
||||||
}
|
}
|
||||||
ci_expr $((CI_NO_INSTALL)) || {
|
ci_expr $((CI_NO_INSTALL)) || {
|
||||||
# Spawn "cmake --build ... --target install" if installation is not disabled.
|
# Spawn "cmake --build ... --target install" if installation is not disabled.
|
||||||
ci_spawn "$CI_CMAKE" --build . \
|
ci_spawn "$CI_CMAKE" --build "$CI_BUILD_DIR" \
|
||||||
--config "$CI_CMAKE_BUILD_TYPE" \
|
--config "$CI_CMAKE_BUILD_TYPE" \
|
||||||
--target install \
|
--target install \
|
||||||
"${all_cmake_build_flags[@]}"
|
"${all_cmake_build_flags[@]}"
|
||||||
}
|
}
|
||||||
ci_expr $((CI_NO_CLEAN)) || {
|
ci_expr $((CI_NO_CLEAN)) || {
|
||||||
# Spawn "make --build ... --target clean" if cleaning is not disabled.
|
# Spawn "make --build ... --target clean" if cleaning is not disabled.
|
||||||
ci_spawn "$CI_CMAKE" --build . \
|
ci_spawn "$CI_CMAKE" --build "$CI_BUILD_DIR" \
|
||||||
--config "$CI_CMAKE_BUILD_TYPE" \
|
--config "$CI_CMAKE_BUILD_TYPE" \
|
||||||
--target clean \
|
--target clean \
|
||||||
"${all_cmake_build_flags[@]}"
|
"${all_cmake_build_flags[@]}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user