From: Lucian Petrut Date: Mon, 25 Nov 2019 15:00:59 +0000 (+0000) Subject: cmake: allow building CLI tools on Windows X-Git-Tag: v16.1.0~1226^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d024506f644a8b87eec009b64bcd98b175236484;p=ceph.git cmake: allow building CLI tools on Windows For now, we'll only build some of the Ceph CLI binaries when targeting Windows. In order to avoid over complicating the cmake files, it was decided that the build script should pick the targets that are to be compiled. To keep the build script relatively simple, we'll stop supporting Ninja, sticking to "make". Another reason for that is that some targets cannot be compiled using Ninja: http://paste.openstack.org/raw/796649/ Signed-off-by: Lucian Petrut --- diff --git a/README.windows.rst b/README.windows.rst index f6a0ee8a9ef..55fcb9ec888 100644 --- a/README.windows.rst +++ b/README.windows.rst @@ -30,7 +30,6 @@ DEPS_DIR The directory where the Ceph $CEPH_DIR/build.deps dependencies will be built. NUM_WORKERS The number of workers to use The number of vcpus when building Ceph. available -NINJA_BUILD Use Ninja instead of make. CLEAN_BUILD Clean the build directory. SKIP_BUILD Run cmake without actually performing the build. diff --git a/src/librbd/CMakeLists.txt b/src/librbd/CMakeLists.txt index 638abc37215..03950400375 100644 --- a/src/librbd/CMakeLists.txt +++ b/src/librbd/CMakeLists.txt @@ -262,7 +262,7 @@ if(ENABLE_SHARED) SOVERSION 1 CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON) - if(NOT APPLE) + if(NOT APPLE AND NOT WIN32) set_property(TARGET librbd APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--exclude-libs,ALL") endif() diff --git a/win32_build.sh b/win32_build.sh index 1986387a950..6abb9f5d622 100755 --- a/win32_build.sh +++ b/win32_build.sh @@ -14,7 +14,6 @@ DEPS_DIR="${DEPS_DIR:-$CEPH_DIR/build.deps}" CLEAN_BUILD=${CLEAN_BUILD:-} SKIP_BUILD=${SKIP_BUILD:-} NUM_WORKERS=${NUM_WORKERS:-$num_vcpus} -NINJA_BUILD=${NINJA_BUILD:-} DEV_BUILD=${DEV_BUILD:-} # We'll have to be explicit here since auto-detecting doesn't work @@ -36,11 +35,7 @@ zlibDir="${depsToolsetDir}/zlib" backtraceDir="${depsToolsetDir}/backtrace" snappyDir="${depsToolsetDir}/snappy" winLibDir="${depsToolsetDir}/windows/lib" -if [[ -n $NINJA_BUILD ]]; then - generatorUsed="Ninja" -else - generatorUsed="Unix Makefiles" -fi +generatorUsed="Unix Makefiles" pyVersion=`python -c "import sys; print('%d.%d' % (sys.version_info.major, sys.version_info.minor))"` @@ -110,17 +105,19 @@ cmake -D CMAKE_PREFIX_PATH=$depsDirs \ if [[ -z $SKIP_BUILD ]]; then echo "Building using $NUM_WORKERS workers. Log: ${BUILD_DIR}/build.log" - echo "NINJA_BUILD = $NINJA_BUILD" - - # We're currently limitting the build scope to the rados/rbd binaries. - if [[ -n $NINJA_BUILD ]]; then - cd $BUILD_DIR - ninja -v rados.exe rbd.exe compressor | tee "${BUILD_DIR}/build.log" - else - cd $BUILD_DIR/src/tools - make -j $NUM_WORKERS 2>&1 | tee "${BUILD_DIR}/build.log" - - cd $BUILD_DIR/src/compressor - make -j $NUM_WORKERS 2>&1 | tee -a "${BUILD_DIR}/build.log" - fi + 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 ceph_radosacl ceph_scratchtool rados" + make_targets["src/tools/immutable_object_cache"]="all" + make_targets["src/tools/rbd"]="all" + make_targets["src/tools/rbd_mirror"]="all" + make_targets["src/compressor"]="all" + + 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 fi