Skip to content

Commit

Permalink
win32*.sh: use ninja instead of make
Browse files Browse the repository at this point in the history
In order to avoid overcomplicating the ceph cmake files, we're
picking make targets individually.

This is quite inefficient. Ninja can improve the build concurrency,
reducing the build duration by almost 50%.

Signed-off-by: Lucian Petrut <[email protected]>
  • Loading branch information
petrutlucian94 committed Mar 5, 2021
1 parent eaa415f commit fca903f
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions win32_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ SKIP_CMAKE=${SKIP_CMAKE:-}
SKIP_DLL_COPY=${SKIP_DLL_COPY:-}
SKIP_TESTS=${SKIP_TESTS:-}
SKIP_BINDIR_CLEAN=${SKIP_BINDIR_CLEAN:-}
NUM_WORKERS=${NUM_WORKERS:-$num_vcpus}
# Use Ninja's default, it might be useful when having few cores.
NUM_WORKERS_DEFAULT=$(( $num_vcpus + 2 ))
NUM_WORKERS=${NUM_WORKERS:-$NUM_WORKERS_DEFAULT}
DEV_BUILD=${DEV_BUILD:-}
# Unless SKIP_ZIP is set, we're preparing an archive that contains the Ceph
# binaries, debug symbols as well as the required DLLs.
Expand Down Expand Up @@ -77,7 +79,7 @@ dbgSymbolDir="$strippedBinDir/${dbgDirname}"
depsSrcDir="$DEPS_DIR/src"
depsToolsetDir="$DEPS_DIR/mingw"

generatorUsed="Unix Makefiles"
cmakeGenerator="Ninja"
lz4Dir="${depsToolsetDir}/lz4"
sslDir="${depsToolsetDir}/openssl"
curlDir="${depsToolsetDir}/curl"
Expand Down Expand Up @@ -168,34 +170,25 @@ cmake -D CMAKE_PREFIX_PATH=$depsDirs \
-D WITH_CEPH_DEBUG_MUTEX=$WITH_CEPH_DEBUG_MUTEX \
-D DOKAN_INCLUDE_DIRS="$dokanSrcDir/dokan" \
-D DOKAN_LIBRARIES="$dokanLibDir/libdokan.a" \
-G "$generatorUsed" \
-G "$cmakeGenerator" \
$CEPH_DIR 2>&1 | tee "${BUILD_DIR}/cmake.log"
fi # [[ -z $SKIP_CMAKE ]]

if [[ -z $SKIP_BUILD ]]; then
echo "Building using $NUM_WORKERS workers. Log: ${BUILD_DIR}/build.log"
echo "" > "${BUILD_DIR}/build.log"

# We're going to use an associative array having subdirectories as keys
# and targets as values.
declare -A make_targets
make_targets["src/tools"]="ceph-conf rados"
make_targets["src/tools/immutable_object_cache"]="all"
make_targets["src/tools/rbd"]="all"
make_targets["src/tools/rbd_wnbd"]="all"
make_targets["src/compressor"]="all"
make_targets["src"]="cephfs"
make_targets["src/dokan"]="all"

cd $BUILD_DIR
ninja_targets="rados rbd rbd-wnbd "
ninja_targets+=" ceph-conf ceph-immutable-object-cache"
ninja_targets+=" cephfs ceph-dokan"
# TODO: do we actually need the ceph compression libs?
ninja_targets+=" compressor ceph_lz4 ceph_snappy ceph_zlib ceph_zstd"
if [[ -z $SKIP_TESTS ]]; then
make_targets["src/tools"]+=" ceph_radosacl ceph_scratchtool"
make_targets["src/test"]="all"
ninja_targets+=" test ceph_radosacl ceph_scratchtool"
fi

for target_subdir in "${!make_targets[@]}"; do
echo "Building $target_subdir: ${make_targets[$target_subdir]}" | tee -a "${BUILD_DIR}/build.log"
make -j $NUM_WORKERS -C $target_subdir ${make_targets[$target_subdir]} 2>&1 | tee -a "${BUILD_DIR}/build.log"
done
ninja -v $ninja_targets 2>&1 | tee "${BUILD_DIR}/build.log"
fi

if [[ -z $SKIP_DLL_COPY ]]; then
Expand Down

0 comments on commit fca903f

Please sign in to comment.