File tree Expand file tree Collapse file tree 3 files changed +31
-6
lines changed Expand file tree Collapse file tree 3 files changed +31
-6
lines changed Original file line number Diff line number Diff line change 1- CI_DESC=" CI job using old Cap'n Proto version "
1+ CI_DESC=" CI job using old Cap'n Proto and cmake versions "
22CI_DIR=build-olddeps
33export CXXFLAGS=" -Werror -Wall -Wextra -Wpedantic -Wno-unused-parameter -Wno-error=array-bounds"
4- NIX_ARGS=(--argstr capnprotoVersion " 0.7.1" )
4+ NIX_ARGS=(--argstr capnprotoVersion " 0.7.1" --argstr cmakeVersion " 3.12.4 " )
55BUILD_ARGS=(-k)
Original file line number Diff line number Diff line change 1818[ -n " ${CI_CLEAN-} " ] && rm -rf " ${CI_DIR} "
1919
2020cmake --version
21+ cmake_ver=$( cmake --version | awk ' /version/{print $3; exit}' )
22+ ver_ge () { [ " $( printf ' %s\n' " $2 " " $1 " | sort -V | head -n1) " = " $2 " ]; }
2123
22- cmake -B " $CI_DIR " " ${CMAKE_ARGS[@]+" ${CMAKE_ARGS[@]} " } "
23- cmake --build " $CI_DIR " -t " ${BUILD_TARGETS[@]} " -- " ${BUILD_ARGS[@]+" ${BUILD_ARGS[@]} " } "
24- ctest --test-dir " $CI_DIR " --output-on-failure
24+ src_dir=$PWD
25+ mkdir -p " $CI_DIR "
26+ cd " $CI_DIR "
27+ cmake " $src_dir " " ${CMAKE_ARGS[@]+" ${CMAKE_ARGS[@]} " } "
28+ if ver_ge " $cmake_ver " " 3.15" ; then
29+ cmake --build . -t " ${BUILD_TARGETS[@]} " -- " ${BUILD_ARGS[@]+" ${BUILD_ARGS[@]} " } "
30+ else
31+ # Older versions of cmake can only build one target at a time with --target,
32+ # and do not support -t shortcut
33+ for t in " ${BUILD_TARGETS[@]} " ; do
34+ cmake --build . --target " $t " -- " ${BUILD_ARGS[@]+" ${BUILD_ARGS[@]} " } "
35+ done
36+ fi
37+ ctest --output-on-failure
Original file line number Diff line number Diff line change 33, enableLibcxx ? false # Whether to use libc++ toolchain and libraries instead of libstdc++
44, minimal ? false # Whether to create minimal shell without extra tools (faster when cross compiling)
55, capnprotoVersion ? null
6+ , cmakeVersion ? null
67} :
78
89let
3738 capnproto = capnprotoBase . override ( lib . optionalAttrs enableLibcxx { clangStdenv = llvm . libcxxStdenv ; } ) ;
3839 clang = if enableLibcxx then llvm . libcxxClang else llvm . clang ;
3940 clang-tools = llvm . clang-tools . override { inherit enableLibcxx ; } ;
41+ cmakeHashes = {
42+ "3.12.4" = "sha256-UlVYS/0EPrcXViz/iULUcvHA5GecSUHYS6raqbKOMZQ=" ;
43+ } ;
44+ cmakeBuild = if cmakeVersion == null then pkgs . cmake else ( pkgs . cmake . overrideAttrs ( old : {
45+ version = cmakeVersion ;
46+ src = pkgs . fetchurl {
47+ url = "https://cmake.org/files/v${ lib . versions . majorMinor cmakeVersion } /cmake-${ cmakeVersion } .tar.gz" ;
48+ hash = lib . attrByPath [ cmakeVersion ] "" cmakeHashes ;
49+ } ;
50+ patches = [ ] ;
51+ } ) ) . override { isMinimalBuild = true ; } ;
4052in crossPkgs . mkShell {
4153 buildInputs = [
4254 capnproto
4355 ] ;
4456 nativeBuildInputs = with pkgs ; [
45- cmake
57+ cmakeBuild
4658 include-what-you-use
4759 ninja
4860 ] ++ lib . optionals ( ! minimal ) [
You can’t perform that action at this time.
0 commit comments