diff --git a/CONFIG b/CONFIG index 1f99a8b5b..8c49c7d2b 100644 --- a/CONFIG +++ b/CONFIG @@ -87,6 +87,9 @@ CONFIG_ENV= # installation. CONFIG_DPDK_DIR= +# This directory should contain 'include' and 'lib' directories for WPDK. +CONFIG_WPDK_DIR= + # Build SPDK FIO plugin. Requires CONFIG_FIO_SOURCE_DIR set to a valid # fio source code directory. CONFIG_FIO_PLUGIN=n diff --git a/Makefile b/Makefile index a50fa9435..ca52c0d5b 100644 --- a/Makefile +++ b/Makefile @@ -63,6 +63,13 @@ endif endif endif +ifeq ($(OS),Windows) +ifeq ($(CURDIR)/wpdk/build,$(CONFIG_WPDK_DIR)) +WPDK = wpdk +DIRS-y += wpdk +endif +endif + ifeq ($(CONFIG_SHARED),y) LIB = shared_lib else @@ -101,10 +108,11 @@ uninstall: $(DIRS-y) $(Q)echo "Uninstalled spdk" ifneq ($(SKIP_DPDK_BUILD),1) -dpdkbuild: $(DPDK_DEPS) +dpdkdeps $(DPDK_DEPS): $(WPDK) +dpdkbuild: $(WPDK) $(DPDK_DEPS) endif -lib: $(DPDKBUILD) $(VFIOUSERBUILD) +lib: $(WPDK) $(DPDKBUILD) $(VFIOUSERBUILD) module: lib shared_lib: module app: $(LIB) diff --git a/configure b/configure index 0316ed389..30b96ca68 100755 --- a/configure +++ b/configure @@ -96,6 +96,8 @@ function usage() { echo " No path required." echo " raid5 Build with bdev_raid module RAID5 support." echo " No path required." + echo " wpdk Build using WPDK to provide support for Windows (experimental)." + echo " The argument must be a directory containing lib and include." echo "" echo "Environment variables:" echo "" @@ -139,6 +141,10 @@ CC_TYPE=$(grep "CC_TYPE=" "$rootdir/mk/cc.mk" | cut -d "=" -f 2) arch=$($CC -dumpmachine) sys_name=$(uname -s) +if [[ $arch == *mingw* ]] || [[ $arch == *windows* ]]; then + sys_name=Windows +fi + # Sanitize default configuration. All parameters set by user explicit should fail # Force no ISA-L if non-x86 or non-aarch64 architecture if [[ "${CONFIG[ISAL]}" = "y" ]]; then @@ -276,6 +282,10 @@ for i in "$@"; do --without-dpdk) CONFIG[DPDK_DIR]= ;; + --with-wpdk=*) + check_dir "$i" + CONFIG[WPDK_DIR]=$(readlink -f ${i#*=}) + ;; --with-env=*) CONFIG[ENV]="${i#*=}" ;; @@ -539,6 +549,23 @@ else CONFIG[VIRTIO]="n" fi +if [[ $sys_name == "Windows" ]]; then + if [ -z "${CONFIG[WPDK_DIR]}" ]; then + if [ ! -f "$rootdir"/wpdk/Makefile ]; then + echo "WPDK not found; please specify --with-wpdk=. See https://wpdk.github.io." + exit 1 + else + CONFIG[WPDK_DIR]="${rootdir}/wpdk/build" + echo "Using default WPDK in ${CONFIG[WPDK_DIR]}" + fi + fi +else + if [ -n "${CONFIG[WPDK_DIR]}" ]; then + echo "ERROR: --with-wpdk is only supported for Windows" + exit 1 + fi +fi + if [ "${CONFIG[VTUNE]}" = "y" ]; then if [ -z "${CONFIG[VTUNE_DIR]}" ]; then echo "When VTune is enabled, you must specify the VTune directory using --with-vtune=path" @@ -660,9 +687,14 @@ if [[ "${CONFIG[ISAL]}" = "y" ]]; then cd $rootdir/isa-l ISAL_LOG=$rootdir/isa-l/spdk-isal.log + if [[ -n "${CONFIG[CROSS_PREFIX]}" ]]; then + ISAL_OPTS=("--host=${CONFIG[CROSS_PREFIX]}") + else + ISAL_OPTS=() + fi echo -n "Configuring ISA-L (logfile: $ISAL_LOG)..." ./autogen.sh &> $ISAL_LOG - ./configure CFLAGS="-fPIC -g -O2" --enable-shared=no >> $ISAL_LOG 2>&1 + ./configure CFLAGS="-fPIC -g -O2" "${ISAL_OPTS[@]}" --enable-shared=no >> $ISAL_LOG 2>&1 echo "done." cd $rootdir fi diff --git a/mk/spdk.common.mk b/mk/spdk.common.mk index 26d95f78a..ba3c9d01c 100644 --- a/mk/spdk.common.mk +++ b/mk/spdk.common.mk @@ -247,6 +247,18 @@ LDFLAGS += --coverage endif endif +ifeq ($(OS),Windows) +WPDK_DIR = $(abspath $(CONFIG_WPDK_DIR)) +COMMON_CFLAGS += -I$(WPDK_DIR)/include/wpdk -I$(WPDK_DIR)/include +LDFLAGS += -L$(WPDK_DIR)/lib +ifeq ($(CONFIG_SHARED),y) +SYS_LIBS += -lwpdk +else +SYS_LIBS += $(WPDK_DIR)/lib/libwpdk.a +endif +SYS_LIBS += -ldbghelp -lkernel32 -lsetupapi -lws2_32 -lrpcrt4 -liphlpapi +endif + include $(CONFIG_ENV)/env.mk ifeq ($(CONFIG_ASAN),y)