]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: allow building CLI tools on Windows
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Mon, 25 Nov 2019 15:00:59 +0000 (15:00 +0000)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Mon, 31 Aug 2020 12:11:55 +0000 (12:11 +0000)
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 <lpetrut@cloudbasesolutions.com>
README.windows.rst
src/librbd/CMakeLists.txt
win32_build.sh

index f6a0ee8a9efa03a63861dada1a687bf75d95b99e..55fcb9ec88856e5aab9696f821e0c5193ac1fa1c 100644 (file)
@@ -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.
index 638abc372153d3c189827bae2d02edb065ccc3f4..0395040037598652bf832f40e93bfefb16db59f6 100644 (file)
@@ -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()
index 1986387a9508f8a5de0d0af70b2da9e39b4f4cd9..6abb9f5d62201d9c455d98caa1bd32eff64c98c6 100755 (executable)
@@ -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