diff --git a/Makefile b/Makefile index d10dd35ad..8f184a9ee 100644 --- a/Makefile +++ b/Makefile @@ -23,166 +23,5 @@ # =========================================================================== -#------------------------------------------------------------------------------- -# environment -# -TOP ?= $(CURDIR) -include $(TOP)/build/Makefile.shell - - -#------------------------------------------------------------------------------- -# default -# -SUBDIRS = \ - shared \ - tools \ - ngs \ - -# common targets for non-leaf Makefiles; must follow a definition of SUBDIRS -include $(TOP)/build/Makefile.targets - -default: $(SUBDIRS) - -test: all - -$(SUBDIRS) test: - @ $(MAKE) -C $@ - -.PHONY: default $(SUBDIRS) test - -#------------------------------------------------------------------------------- -# all -# -$(SUBDIRS_ALL): - -#------------------------------------------------------------------------------- -# std -# -$(SUBDIRS_STD): - -#------------------------------------------------------------------------------- -# install -# -install install-delite: - @ echo "Checking make status of tools..." - @ $(MAKE) -s --no-print-directory TOP=$(CURDIR) std - @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.install $@ - -uninstall: - @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.install uninstall - -.PHONY: install uninstall - -#------------------------------------------------------------------------------- -# clean -# -clean: clean_deb clean_rpm clean_test - -clean_test: - @ $(MAKE) -s -C test clean - -#------------------------------------------------------------------------------- -# runtests -# -runtests: runtests_test - -runtests_test: - @ $(MAKE) -s -C test runtests - -# @ $(MAKE) -s -C ngs runtests - -#------------------------------------------------------------------------------- -# slowtests -# -slowtests: slowtests_test - -slowtests_test: - @ $(MAKE) -s -C test slowtests - -#------------------------------------------------------------------------------- -# valgrind -# -valgrind: valgrind_test - -valgrind_test: - @ $(MAKE) -s -C test valgrind - -#------------------------------------------------------------------------------- -# RPM -# -ifeq (mac,$(OS)) -rpm: - @ echo "Not making rpm on Mac" -clean_rpm: -else -rpm: std - @ $(MAKE) rpm -s TOP=$(CURDIR) -f build/Makefile.rpm -clean_rpm: - @ $(MAKE) clean_rpm -s TOP=$(CURDIR) -f build/Makefile.rpm -endif - -#------------------------------------------------------------------------------- -# DEB -# -ifeq (mac,$(OS)) -deb: std -else -deb: -endif - @ $(MAKE) deb -s TOP=$(CURDIR) -f build/Makefile.deb -clean_deb: - @ $(MAKE) clean_deb -s TOP=$(CURDIR) -f build/Makefile.deb - -#------------------------------------------------------------------------------- -# pass-through targets -# -COMPILERS = GCC ICC VC++ CLANG -ARCHITECTURES = i386 x86_64 sparc32 sparc64 -CONFIG = debug profile release -PUBLISH = scm pubtools -REPORTS = bindir targdir osdir config compilers architecture architectures -PASSTHRUS = \ - out \ - CC $(COMPILERS) \ - $(ARCHITECTURES) \ - $(CONFIG) $(PUBLISH) \ - purify purecov \ - local static dynamic - -$(RHOSTS): - @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env local - @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env require-proxy-exec - @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env $@ - @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env rebuild-dirlinks config - -$(PASSTHRUS): - @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env $@ - @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env rebuild-dirlinks config - -$(REPORTS): - @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env $@ - -.PHONY: $(PASSTHRUS) $(RHOSTS) $(REPORTS) - - -#------------------------------------------------------------------------------- -# configuration help -# -help configure: - @ echo "Before initial build, run './configure --build-prefix=' from" - @ echo "the project root to set the output directory of your builds." - @ echo - @ echo "To select a compiler, run 'make ' where" - @ echo "comp = { "$(COMPILERS)" }." - @ echo - @ echo "For hosts that support cross-compilation ( only Macintosh today )," - @ echo "you can run 'make ' where arch = { "$(ARCHITECTURES)" }." - @ echo - @ echo "To set a build configuration, run 'make ' where" - @ echo "config = { "$(CONFIG)" }." - @ echo - @ echo "To select a remote build configuration, run 'make ' where" - @ echo "rhost = { "$(RHOSTS)" }." - @ echo - -.PHONY: help configure +TOP ?= $(shell pwd) +include $(TOP)/build/Makefile.env \ No newline at end of file diff --git a/Makefile.old b/Makefile.old new file mode 100644 index 000000000..d10dd35ad --- /dev/null +++ b/Makefile.old @@ -0,0 +1,188 @@ +# =========================================================================== +# +# PUBLIC DOMAIN NOTICE +# National Center for Biotechnology Information +# +# This software/database is a "United States Government Work" under the +# terms of the United States Copyright Act. It was written as part of +# the author's official duties as a United States Government employee and +# thus cannot be copyrighted. This software/database is freely available +# to the public for use. The National Library of Medicine and the U.S. +# Government have not placed any restriction on its use or reproduction. +# +# Although all reasonable efforts have been taken to ensure the accuracy +# and reliability of the software and data, the NLM and the U.S. +# Government do not and cannot warrant the performance or results that +# may be obtained by using this software or data. The NLM and the U.S. +# Government disclaim all warranties, express or implied, including +# warranties of performance, merchantability or fitness for any particular +# purpose. +# +# Please cite the author in any work or product based on this material. +# +# =========================================================================== + + +#------------------------------------------------------------------------------- +# environment +# +TOP ?= $(CURDIR) +include $(TOP)/build/Makefile.shell + + +#------------------------------------------------------------------------------- +# default +# +SUBDIRS = \ + shared \ + tools \ + ngs \ + +# common targets for non-leaf Makefiles; must follow a definition of SUBDIRS +include $(TOP)/build/Makefile.targets + +default: $(SUBDIRS) + +test: all + +$(SUBDIRS) test: + @ $(MAKE) -C $@ + +.PHONY: default $(SUBDIRS) test + +#------------------------------------------------------------------------------- +# all +# +$(SUBDIRS_ALL): + +#------------------------------------------------------------------------------- +# std +# +$(SUBDIRS_STD): + +#------------------------------------------------------------------------------- +# install +# +install install-delite: + @ echo "Checking make status of tools..." + @ $(MAKE) -s --no-print-directory TOP=$(CURDIR) std + @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.install $@ + +uninstall: + @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.install uninstall + +.PHONY: install uninstall + +#------------------------------------------------------------------------------- +# clean +# +clean: clean_deb clean_rpm clean_test + +clean_test: + @ $(MAKE) -s -C test clean + +#------------------------------------------------------------------------------- +# runtests +# +runtests: runtests_test + +runtests_test: + @ $(MAKE) -s -C test runtests + +# @ $(MAKE) -s -C ngs runtests + +#------------------------------------------------------------------------------- +# slowtests +# +slowtests: slowtests_test + +slowtests_test: + @ $(MAKE) -s -C test slowtests + +#------------------------------------------------------------------------------- +# valgrind +# +valgrind: valgrind_test + +valgrind_test: + @ $(MAKE) -s -C test valgrind + +#------------------------------------------------------------------------------- +# RPM +# +ifeq (mac,$(OS)) +rpm: + @ echo "Not making rpm on Mac" +clean_rpm: +else +rpm: std + @ $(MAKE) rpm -s TOP=$(CURDIR) -f build/Makefile.rpm +clean_rpm: + @ $(MAKE) clean_rpm -s TOP=$(CURDIR) -f build/Makefile.rpm +endif + +#------------------------------------------------------------------------------- +# DEB +# +ifeq (mac,$(OS)) +deb: std +else +deb: +endif + @ $(MAKE) deb -s TOP=$(CURDIR) -f build/Makefile.deb +clean_deb: + @ $(MAKE) clean_deb -s TOP=$(CURDIR) -f build/Makefile.deb + +#------------------------------------------------------------------------------- +# pass-through targets +# +COMPILERS = GCC ICC VC++ CLANG +ARCHITECTURES = i386 x86_64 sparc32 sparc64 +CONFIG = debug profile release +PUBLISH = scm pubtools +REPORTS = bindir targdir osdir config compilers architecture architectures +PASSTHRUS = \ + out \ + CC $(COMPILERS) \ + $(ARCHITECTURES) \ + $(CONFIG) $(PUBLISH) \ + purify purecov \ + local static dynamic + +$(RHOSTS): + @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env local + @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env require-proxy-exec + @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env $@ + @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env rebuild-dirlinks config + +$(PASSTHRUS): + @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env $@ + @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env rebuild-dirlinks config + +$(REPORTS): + @ $(MAKE) -s TOP=$(CURDIR) -f build/Makefile.env $@ + +.PHONY: $(PASSTHRUS) $(RHOSTS) $(REPORTS) + + +#------------------------------------------------------------------------------- +# configuration help +# +help configure: + @ echo "Before initial build, run './configure --build-prefix=' from" + @ echo "the project root to set the output directory of your builds." + @ echo + @ echo "To select a compiler, run 'make ' where" + @ echo "comp = { "$(COMPILERS)" }." + @ echo + @ echo "For hosts that support cross-compilation ( only Macintosh today )," + @ echo "you can run 'make ' where arch = { "$(ARCHITECTURES)" }." + @ echo + @ echo "To set a build configuration, run 'make ' where" + @ echo "config = { "$(CONFIG)" }." + @ echo + @ echo "To select a remote build configuration, run 'make ' where" + @ echo "rhost = { "$(RHOSTS)" }." + @ echo + +.PHONY: help configure diff --git a/build/Makefile.env b/build/Makefile.env index af853be38..fe7306936 100644 --- a/build/Makefile.env +++ b/build/Makefile.env @@ -22,403 +22,131 @@ # # =========================================================================== -# pick up dependencies from object directory -ifdef SRCDIR - include $(wildcard *.d) -endif +default all std: makedirs cmake # determine shell environment -include $(TOP)/build/Makefile.shell - -# load build configuration -include $(CONFIG_FILE) - -# normally build shared and static external libs -LIBEXT = $(LIBX) $(SHLX) - -# normally build static intermediate libs -ILIBEXT = $(LIBX) - -# determine BUILD -ifeq (,$(BUILD)) - BUILD = dbg -endif - -# some rules are sensitive to the type of build -BUILDTYPE = $(BUILD) - -# adjust settings for build -ifeq (dbg,$(BUILD)) - DEBUG := -D_DEBUGGING -endif -ifeq (prof,$(BUILD)) - DEBUG := -D_PROFILING -endif -ifeq (pur,$(BUILD)) - DEBUG := -D_DEBUGGING - LD_PRE := purify - LNKG = stat -endif -ifeq (pcov,$(BUILD)) - DEBUG := -D_DEBUGGING - LD_PRE := purecov - LNKG = stat +CONFIG_FILE = $(TOP)/build/Makefile.config +ifeq (no, $(shell test -f $(CONFIG_FILE) && echo yes || echo no)) + $(error "*** File '$(CONFIG_FILE)' is missing. Please run $(TOP)/build/configure") endif -ifeq (scm,$(BUILD)) - BUILDTYPE = rel - CHECKSUM := --checksum -endif - -ifeq (yes,$(HAS_RHOST)) - LOCAL_OR_REMOTE = remote -else - LOCAL_OR_REMOTE = local -endif - -# pre-built sra-tools are static -ifeq (1,$(WANTS_STATIC)) - STATIC = --static - STATICSYSLIBS = --static-system-libs -endif - -# drop all suffix rules -.SUFFIXES: - -# load OS and COMP specific files -include $(TOP)/build/Makefile.$(OS) -include $(TOP)/build/Makefile.$(COMP) -include $(TOP)/build/Makefile.rules - -# external schema modules -EXT_SCHEMA_MODULES = axf sraxf wgsxf vxf -UPDATE_SCHEMA_LIBS := $(addprefix -lw,$(EXT_SCHEMA_MODULES)) -READONLY_SCHEMA_LIBS = $(addprefix -l,$(EXT_SCHEMA_MODULES)) -ALWAYS_STATIC_SCHEMA_LIBS = $(addprefix -s,$(EXT_SCHEMA_MODULES)) - -# full directory paths -TARGDIR ?= $(OUTDIR)/$(OS)/$(TOOLSET)/$(ARCH)/$(BUILD) -BINDIR ?= $(TARGDIR)/bin -ifeq (win,$(OS)) - # on Windows, place test executables next to .dlls - TEST_BINDIR = $(BINDIR) -else - TEST_BINDIR = $(TARGDIR)/test-bin -endif -ILIBDIR = $(TARGDIR)/ilib -LIBDIR = $(TARGDIR)/lib -OBJDIR = $(TARGDIR)/obj/$(MODULE) - -CLSPATH ?= $(TARGDIR)/java -CLASSPATH ?= $(CLSPATH) -CLASSDIR ?= $(TARGDIR)/$(MODULE) -TEST_CLSPATH ?= $(OUTDIR)/test/java -JAVASOURCEPATH ?= $(TOP)/java -# path to the ncbi sub-directory -# this is where modules and installed schema files are kept -ifeq (win,$(OS)) - # under Windows, we are always relative to binary path - NCBIDIR = $(BINDIR)/ncbi +# determine SRCDIR +ifdef MODULE + SRCDIR=$(TOP)/$(MODULE) else - # under Linux and Mac, it can be binary or library - NCBIDIR = $(LIBDIR)/ncbi $(BINDIR)/ncbi + SRCDIR=$(TOP)/ endif -DEFAULT_CRT = $(VDB_SRCDIR)/libs/kfg/certs.kfg -DEFAULT_KFG = $(VDB_SRCDIR)/libs/kfg/default.kfg - -# make reissue command -MAKE_CMD = $(MAKE) BUILD=$(BUILD) TOOLSET=$(TOOLSET) COMP=$(COMP) LNKG=$(LNKG) \ - TOP=$(TOP) SRCDIR=$(SRCDIR) OUTDIR=$(OUTDIR) -C $(OBJDIR) -f $(SRCDIR)/Makefile - -JMAKE_CMD = $(MAKE) BUILD=$(BUILD) TOOLSET=$(TOOLSET) COMP=$(COMP) LNKG=$(LNKG) \ - TOP=$(TOP) SRCDIR=$(SRCDIR) OUTDIR=$(OUTDIR) -C $(CLASSDIR) -f $(SRCDIR)/Makefile +# load build configuration +CURDIR = $(SRCDIR) +include $(CONFIG_FILE) -# directory and link creation -SUBDIRS = bin test-bin ilib lib -OUTDIRS = schema +TEST_BINDIR = $(TARGDIR)/test-bin # clean rules -stdclean: - @ -rm -rf $(OBJDIR) - @ -rm -rf $(addsuffix .*,$(addprefix $(ILIBDIR)/,$(ALL_LIBS))) \ - $(addsuffix .*,$(addprefix $(LIBDIR)/,$(ALL_LIBS))) \ - $(addsuffix -static.*,$(addprefix $(LIBDIR)/,$(ALL_LIBS))) \ - $(addsuffix *,$(addprefix $(BINDIR)/,$(ALL_TOOLS) $(ALL_LIBS))) \ - $(addsuffix *,$(addprefix $(TEST_BINDIR)/,$(ALL_TOOLS) $(TEST_TOOLS))) - -stdjclean: - @ -rm -rf $(CLSPATH) $(CLSDIR) - -# removing symbolic links that point to specific builds -removelinks: - @ test ! -h $(OUTDIR)/schema && rm -rf $(OUTDIR)/schema || true - @ rm -f $(addprefix $(OUTDIR)/,$(addsuffix $(BITS),$(SUBDIRS))) - @ rm -f $(addprefix $(OUTDIR)/,$(OUTDIRS)) - -$(BINDIR)/ncbi/certs.kfg: $(DEFAULT_CRT) - @ mkdir -p $(NCBIDIR) - @ cp -v $(DEFAULT_CRT) $@ - -$(BINDIR)/ncbi/default.kfg: $(DEFAULT_KFG) - @ mkdir -p $(NCBIDIR) - @ cp -v $(DEFAULT_KFG) $@ - -# create all required output directories -makedirs: $(BINDIR)/ncbi/certs.kfg $(BINDIR)/ncbi/default.kfg - @ mkdir -p $(addprefix $(TARGDIR)/,$(SUBDIRS) obj/$(MODULE)) $(NCBIDIR) - -makejdirs: - @ mkdir -p $(CLASSDIR) $(CLSDIR) - -# build version include files -vers-includes: makedirs - @ $(MAKE_CMD) -s $(TARGDIR)/$@ - -ifeq (win,$(OS)) - -# Windows doesn't really support symbolic links -# we may add them back in when our toolkit is able to create them -rebuild-dirlinks: makedirs - @ true -else - -LNDIRS = $(addprefix ln_,$(SUBDIRS)) -$(LNDIRS): - @ ln -s $(TARGDIR)/$(subst ln_,,$@) $(OUTDIR)/$(subst ln_,,$@)$(BITS) - -ifdef NOREBUILD_LINKS -rebuild-dirlinks: - @ true -else -rebuild-dirlinks: removelinks makedirs $(LNDIRS) - @ ln -s $(VDB_INCDIR) $(OUTDIR)/schema -endif - -endif - -.PHONY: stdclean removelinks makedirs vers-includes rebuild-dirlinks -.PHONY: stdjclean makejdirs - -# configuration targets -out: - @ echo $(OUTDIR) > $(TOP)/build/OUTDIR.$(BUILD_OS) - @ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks - -$(RHOSTS): - @ cat $(TOP)/rhosts/$@ >> $(TOP)/build/RHOST.$(HOST_OS) - -require-proxy-exec: - @ $(MAKE) -C $(TOP)/test/proxy_exec proxy-exec - @ echo "PROXY_TOOL := $(BINDIR)/proxy-exec" > $(TOP)/build/RHOST.$(HOST_OS) - -local: - @ rm -f $(TOP)/build/RHOST.$(HOST_OS) - -CC: - @ echo cc > $(TOP)/build/COMP.$(OS) - -GCC: - @ echo gcc > $(TOP)/build/COMP.$(OS) - -ICC: - @ echo icc > $(TOP)/build/COMP.$(OS) - -VC++: - @ echo vc++ > $(TOP)/build/COMP.$(OS) - -CLANG: - @ echo clang > $(TOP)/build/COMP.$(OS) - -static dynamic: - @ echo "there is no longer any difference between static and dynamic builds" - -debug: - @ echo dbg > $(TOP)/build/BUILD.$(OS) - -profile: - @ echo prof > $(TOP)/build/BUILD.$(OS) - -release: - @ echo rel > $(TOP)/build/BUILD.$(OS) - -scm: - @ echo scm > $(TOP)/build/BUILD.$(OS) - -pubtools: release - -bindir: - @ echo "$(BINDIR)" - -targdir: - @ echo "$(TARGDIR)" - -osdir: - @ echo "$(OUTDIR)/$(OS)" - -compilers: - @ echo "$(COMPILERS)" - -architectures: - @ echo "$(ARCHITECTURES)" - -architecture: - @ echo "$(ARCH)" +clean: + -rm -rf $(OBJDIR) $(ILIBDIR) $(LIBDIR) $(BINDIR) $(TEST_BINDIR) config: - @ echo " current build is $(LOCAL_OR_REMOTE) $(BUILD_OS) $(BUILD) $(ARCH) build using $(TOOLSET) tools" - @ echo " output target directory is '$(TARGDIR)'" + @ echo "Current configuration: $(CONFIGURED)" + @ echo "CMake build directory: '$(TARGDIR)/obj'" + @ echo "Output target directory: '$(TARGDIR)'" + @ echo "Installation target directory: '$(INST_LIBDIR)'" @ echo -purify: - @ echo pur > $(TOP)/build/BUILD.$(OS) - -purecov: - @ echo pcov > $(TOP)/build/BUILD.$(OS) - -.PHONY: out CC GCC ICC debug profile release scm purify purecov local local require-proxy-exec $(RHOSTS) bindir report_config - -# includes based upon build -ITF = $(VDB_INCDIR)/ -OSINC = $(VDB_INCDIR)/os -CCINC = $(VDB_INCDIR)/cc -XTINC = $(VDB_INCDIR)/ext -NGSINC = $(NGS_INCDIR) -OVERRIDEINC = $(TOP)/interfaces/override - -# OS specific source and include dirs -SRCDIRS_OS = $(SRCDIR)/$(OS) -INCDIRS_OS = $(OSINC)/$(OS) - -# most OS' have a parent type -ifdef OS_DAD - -SRCDIRS_OS += $(SRCDIR)/$(OS_DAD) -INCDIRS_OS += $(OSINC)/$(OS_DAD) - -# some OS' have a grandparent -ifdef OS_GDAD -SRCDIRS_OS += $(SRCDIR)/$(OS_GDAD) -INCDIRS_OS += $(OSINC)/$(OS_GDAD) -endif +#------------------------------------------------------------------------------- +# CMake bridge +# +ifeq (dbg,$(BUILD)) + CMAKE_BUILD = Debug +else + CMAKE_BUILD = Release endif -# compiler specific includes -INCDIRS_COMP = \ - $(CCINC)/$(COMP)/$(ARCH) \ - $(CCINC)/$(COMP) +unexport TOP SRCDIR -# some compilers have a parent type -ifdef COMP_DAD +# CPP comes from Makefile.config.$(OS_ARCH) +# TODO: simplify Makefile.config.$(OS_ARCH) generated by ./configure - switch from using LD to a new variable +CMAKEFLAGS = \ + -DTARGDIR=$(TARGDIR) \ + -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=$(ILIBDIR) \ + -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$(LIBDIR) \ + -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=$(BINDIR) \ + -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD) \ + -DCMAKE_INSTALL_PREFIX=$(INST_BINDIR)/.. \ + -DCMAKE_C_COMPILER=$(shell which $(LD)) \ + -DCMAKE_CXX_COMPILER=$(shell which $(CPP)) \ + -DVDB_BINDIR=$(VDB_LIBDIR)/.. \ + -DPYTHON_PATH=$(PYTHON) -INCDIRS_COMP += \ - $(CCINC)/$(COMP_DAD)/$(ARCH) \ - $(CCINC)/$(COMP_DAD) +makedirs: + mkdir -p $(TARGDIR)/obj -endif +cmake_only: + cd $(TARGDIR)/obj; cmake $(CMAKEFLAGS) $(TOP) -VPATH = \ - $(SRCDIR)/$(COMP)/$(ARCH) \ - $(SRCDIR)/$(COMP) \ - $(SRCDIRS_OS) \ - $(SRCDIR) +cmake: makedirs cmake_only + + make -C $(OBJDIR) --no-print-directory -INCDIRS = \ - $(addprefix -I,$(OVERRIDEINC)) \ - $(addprefix -I,$(SRCDIRS_OS)) \ - $(addprefix -I,$(SRCDIR) $(ITF)) \ - $(addprefix -I,$(INCDIRS_COMP)) \ - $(addprefix -I,$(INCDIRS_OS)) \ - $(addprefix -I,$(XTINC) $(NGSINC)) \ - -I. +ctest: cmake + cd $(OBJDIR); ctest $(CMAKEFLAGS) --build-exe-dir $(BINDIR) $(CTESTARGS) -E "^SlowTest_" --verbose +ctestall: cmake + cd $(OBJDIR); ctest $(CMAKEFLAGS) --build-exe-dir $(BINDIR) $(CTESTARGS) --verbose -# linker paths -LDPATHS = +cinstall: cmake + + make -C $(TARGDIR)/obj install -ifneq (,$(HDF5_LIBDIR)) - LDPATHS += -L$(HDF5_LIBDIR) -endif -ifneq (,$(XML2_LIBDIR)) - LDPATHS += -L$(XML2_LIBDIR) -endif -ifneq (,$(MAGIC_LIBDIR)) - LDPATHS += -L$(MAGIC_LIBDIR) -endif -ifneq (,$(FUSE_LIBDIR)) - LDPATHS += -L$(FUSE_LIBDIR) -endif +test runtests: ctest +slowtests: ctestall -# defines that describe os & architecture -DLLX ?= $(SHLX) -ARCHDEFS = -D_ARCH_BITS=__SIZEOF_POINTER__*__CHAR_BIT__ -DLIBPREFIX=$(LPFX) -DSHLIBEXT=$(DLLX) - -# default tool parameters -CFLAGS = -std=c11 $(DEBUG) $(DBG) $(CARCH) $(PROF) $(PED) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS) -CPFLAGS = -std=c++11 $(DEBUG) $(DBG) $(CARCH) $(PROF) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS) -LDFLAGS = $(DBG) $(PROF) $(CARCH) $(MIN_DEPLOY_OS_OPT) $(LDPATHS) +.PHONY: cmake_only cmake ctest ctestall test runtests slowtests #------------------------------------------------------------------------------- -# runtests -# -# MallocScribble=1 is for catching allocation problems on Mac +# install # -HOSTNAME = $(shell hostname) -WHICHASCP = $(shell which ascp 2> /dev/null) -HAVE_NCBI_ASCP=1 -ifeq (,${WHICHASCP}) - HAVE_NCBI_ASCP= -endif -ifeq (iebdev21,${HOSTNAME}) - HAVE_NCBI_ASCP= -endif - -ifeq ($(RUNTESTS_OVERRIDE),) -runtests: all $(TEST_TOOLS) - @ export VDB_CONFIG=$(VDB_CONFIG);export LD_LIBRARY_PATH=$(LIBDIR):$$LD_LIBRARY_PATH;export MallocScribble=1;\ - for i in $(TEST_TOOLS);\ - do\ - echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++;\ - echo Run VDB_CONFIG=$$VDB_CONFIG $(TEST_BINDIR)/$$i;eval $(RUN_REMOTELY) $(TEST_BINDIR)/$$i;r=$$?; \ - if [ "$$r" != "0" ] ; then exit $$r; fi; \ - done +install: cinstall -.PHONY: runtests -endif +.PHONY: install #------------------------------------------------------------------------------- -# slowtests +# help # -# $(SLOWTESTSDATADIR) should be used to create temporary test files -SLOWTESTSDATADIR ?= /panfs/pan1.be-md.ncbi.nlm.nih.gov/sra-test/slowtests/$(shell whoami) - -slowtests: all $(SLOW_TEST_TOOLS) - @ export LD_LIBRARY_PATH=$(LIBDIR):$$LD_LIBRARY_PATH;\ - for i in $(SLOW_TEST_TOOLS);\ - do\ - echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++;\ - echo Run $(TEST_BINDIR)/$$i;eval $(RUN_REMOTELY) $(TEST_BINDIR)/$$i;r=$$?; \ - if [ "$$r" != "0" ] ; then exit $$r; fi; \ - done +# TODO: +help: + @ echo + @ echo "Before initial build, run './configure --build-prefix=' from" + @ echo "the project root to set the output directory of your builds and" + @ echo "other parameters." + @ echo "Run ./configure -h for full description." + @ echo + @ echo "Make targets:" + @ echo " help : this text" + @ echo " config : print a summary of current configuration" + @ echo " all, std : full build" + @ echo " clean : remove build results, including CMake-generated files" + @ echo " test, runtests : build and run fast tests" + @ echo " slowtests : build and run all (fast and slow) tests" + @ echo " install : build, install to $(INST_LIBDIR)" + @ echo + @ echo The build uses CMake. CMake-generated files are in $(OBJDIR) + @ echo + @ echo It is recommended to use 'make -j' for quicker builds. + @ echo -.PHONY: slowtests +.PHONY: help configure #------------------------------------------------------------------------------- -# all-cmn -# -# Common target to trigger build of all tools -# -$(TARGDIR)/all-cmn: $(addprefix $(BINDIR)/,$(ALL_TOOLS)) -.PHONY: $(TARGDIR)/all-cmn +.PHONY: default all std -#------------------------------------------------------------------------------- -# std-cmn -# -# Common target to trigger build of external visibility tools -# -$(TARGDIR)/std-cmn: $(addprefix $(BINDIR)/,$(EXT_TOOLS)) -.PHONY: $(TARGDIR)/std-cmn +# TODO: add support for fuzz testing +FLIBDIR = $(TARGDIR)/fuzz + +$(FLIBDIR): + mkdir -p $@ + +fuzz: makedirs diff --git a/build/Makefile.env.old b/build/Makefile.env.old new file mode 100644 index 000000000..af853be38 --- /dev/null +++ b/build/Makefile.env.old @@ -0,0 +1,424 @@ +# =========================================================================== +# +# PUBLIC DOMAIN NOTICE +# National Center for Biotechnology Information +# +# This software/database is a "United States Government Work" under the +# terms of the United States Copyright Act. It was written as part of +# the author's official duties as a United States Government employee and +# thus cannot be copyrighted. This software/database is freely available +# to the public for use. The National Library of Medicine and the U.S. +# Government have not placed any restriction on its use or reproduction. +# +# Although all reasonable efforts have been taken to ensure the accuracy +# and reliability of the software and data, the NLM and the U.S. +# Government do not and cannot warrant the performance or results that +# may be obtained by using this software or data. The NLM and the U.S. +# Government disclaim all warranties, express or implied, including +# warranties of performance, merchantability or fitness for any particular +# purpose. +# +# Please cite the author in any work or product based on this material. +# +# =========================================================================== + +# pick up dependencies from object directory +ifdef SRCDIR + include $(wildcard *.d) +endif + +# determine shell environment +include $(TOP)/build/Makefile.shell + +# load build configuration +include $(CONFIG_FILE) + +# normally build shared and static external libs +LIBEXT = $(LIBX) $(SHLX) + +# normally build static intermediate libs +ILIBEXT = $(LIBX) + +# determine BUILD +ifeq (,$(BUILD)) + BUILD = dbg +endif + +# some rules are sensitive to the type of build +BUILDTYPE = $(BUILD) + +# adjust settings for build +ifeq (dbg,$(BUILD)) + DEBUG := -D_DEBUGGING +endif +ifeq (prof,$(BUILD)) + DEBUG := -D_PROFILING +endif +ifeq (pur,$(BUILD)) + DEBUG := -D_DEBUGGING + LD_PRE := purify + LNKG = stat +endif +ifeq (pcov,$(BUILD)) + DEBUG := -D_DEBUGGING + LD_PRE := purecov + LNKG = stat +endif +ifeq (scm,$(BUILD)) + BUILDTYPE = rel + CHECKSUM := --checksum +endif + +ifeq (yes,$(HAS_RHOST)) + LOCAL_OR_REMOTE = remote +else + LOCAL_OR_REMOTE = local +endif + +# pre-built sra-tools are static +ifeq (1,$(WANTS_STATIC)) + STATIC = --static + STATICSYSLIBS = --static-system-libs +endif + +# drop all suffix rules +.SUFFIXES: + +# load OS and COMP specific files +include $(TOP)/build/Makefile.$(OS) +include $(TOP)/build/Makefile.$(COMP) +include $(TOP)/build/Makefile.rules + +# external schema modules +EXT_SCHEMA_MODULES = axf sraxf wgsxf vxf +UPDATE_SCHEMA_LIBS := $(addprefix -lw,$(EXT_SCHEMA_MODULES)) +READONLY_SCHEMA_LIBS = $(addprefix -l,$(EXT_SCHEMA_MODULES)) +ALWAYS_STATIC_SCHEMA_LIBS = $(addprefix -s,$(EXT_SCHEMA_MODULES)) + +# full directory paths +TARGDIR ?= $(OUTDIR)/$(OS)/$(TOOLSET)/$(ARCH)/$(BUILD) +BINDIR ?= $(TARGDIR)/bin +ifeq (win,$(OS)) + # on Windows, place test executables next to .dlls + TEST_BINDIR = $(BINDIR) +else + TEST_BINDIR = $(TARGDIR)/test-bin +endif +ILIBDIR = $(TARGDIR)/ilib +LIBDIR = $(TARGDIR)/lib +OBJDIR = $(TARGDIR)/obj/$(MODULE) + +CLSPATH ?= $(TARGDIR)/java +CLASSPATH ?= $(CLSPATH) +CLASSDIR ?= $(TARGDIR)/$(MODULE) +TEST_CLSPATH ?= $(OUTDIR)/test/java +JAVASOURCEPATH ?= $(TOP)/java + +# path to the ncbi sub-directory +# this is where modules and installed schema files are kept +ifeq (win,$(OS)) + # under Windows, we are always relative to binary path + NCBIDIR = $(BINDIR)/ncbi +else + # under Linux and Mac, it can be binary or library + NCBIDIR = $(LIBDIR)/ncbi $(BINDIR)/ncbi +endif + +DEFAULT_CRT = $(VDB_SRCDIR)/libs/kfg/certs.kfg +DEFAULT_KFG = $(VDB_SRCDIR)/libs/kfg/default.kfg + +# make reissue command +MAKE_CMD = $(MAKE) BUILD=$(BUILD) TOOLSET=$(TOOLSET) COMP=$(COMP) LNKG=$(LNKG) \ + TOP=$(TOP) SRCDIR=$(SRCDIR) OUTDIR=$(OUTDIR) -C $(OBJDIR) -f $(SRCDIR)/Makefile + +JMAKE_CMD = $(MAKE) BUILD=$(BUILD) TOOLSET=$(TOOLSET) COMP=$(COMP) LNKG=$(LNKG) \ + TOP=$(TOP) SRCDIR=$(SRCDIR) OUTDIR=$(OUTDIR) -C $(CLASSDIR) -f $(SRCDIR)/Makefile + +# directory and link creation +SUBDIRS = bin test-bin ilib lib +OUTDIRS = schema + +# clean rules +stdclean: + @ -rm -rf $(OBJDIR) + @ -rm -rf $(addsuffix .*,$(addprefix $(ILIBDIR)/,$(ALL_LIBS))) \ + $(addsuffix .*,$(addprefix $(LIBDIR)/,$(ALL_LIBS))) \ + $(addsuffix -static.*,$(addprefix $(LIBDIR)/,$(ALL_LIBS))) \ + $(addsuffix *,$(addprefix $(BINDIR)/,$(ALL_TOOLS) $(ALL_LIBS))) \ + $(addsuffix *,$(addprefix $(TEST_BINDIR)/,$(ALL_TOOLS) $(TEST_TOOLS))) + +stdjclean: + @ -rm -rf $(CLSPATH) $(CLSDIR) + +# removing symbolic links that point to specific builds +removelinks: + @ test ! -h $(OUTDIR)/schema && rm -rf $(OUTDIR)/schema || true + @ rm -f $(addprefix $(OUTDIR)/,$(addsuffix $(BITS),$(SUBDIRS))) + @ rm -f $(addprefix $(OUTDIR)/,$(OUTDIRS)) + +$(BINDIR)/ncbi/certs.kfg: $(DEFAULT_CRT) + @ mkdir -p $(NCBIDIR) + @ cp -v $(DEFAULT_CRT) $@ + +$(BINDIR)/ncbi/default.kfg: $(DEFAULT_KFG) + @ mkdir -p $(NCBIDIR) + @ cp -v $(DEFAULT_KFG) $@ + +# create all required output directories +makedirs: $(BINDIR)/ncbi/certs.kfg $(BINDIR)/ncbi/default.kfg + @ mkdir -p $(addprefix $(TARGDIR)/,$(SUBDIRS) obj/$(MODULE)) $(NCBIDIR) + +makejdirs: + @ mkdir -p $(CLASSDIR) $(CLSDIR) + +# build version include files +vers-includes: makedirs + @ $(MAKE_CMD) -s $(TARGDIR)/$@ + +ifeq (win,$(OS)) + +# Windows doesn't really support symbolic links +# we may add them back in when our toolkit is able to create them +rebuild-dirlinks: makedirs + @ true +else + +LNDIRS = $(addprefix ln_,$(SUBDIRS)) +$(LNDIRS): + @ ln -s $(TARGDIR)/$(subst ln_,,$@) $(OUTDIR)/$(subst ln_,,$@)$(BITS) + +ifdef NOREBUILD_LINKS +rebuild-dirlinks: + @ true +else +rebuild-dirlinks: removelinks makedirs $(LNDIRS) + @ ln -s $(VDB_INCDIR) $(OUTDIR)/schema +endif + +endif + +.PHONY: stdclean removelinks makedirs vers-includes rebuild-dirlinks +.PHONY: stdjclean makejdirs + +# configuration targets +out: + @ echo $(OUTDIR) > $(TOP)/build/OUTDIR.$(BUILD_OS) + @ $(MAKE) TOP=$(TOP) -f $(TOP)/build/Makefile.env rebuild-dirlinks + +$(RHOSTS): + @ cat $(TOP)/rhosts/$@ >> $(TOP)/build/RHOST.$(HOST_OS) + +require-proxy-exec: + @ $(MAKE) -C $(TOP)/test/proxy_exec proxy-exec + @ echo "PROXY_TOOL := $(BINDIR)/proxy-exec" > $(TOP)/build/RHOST.$(HOST_OS) + +local: + @ rm -f $(TOP)/build/RHOST.$(HOST_OS) + +CC: + @ echo cc > $(TOP)/build/COMP.$(OS) + +GCC: + @ echo gcc > $(TOP)/build/COMP.$(OS) + +ICC: + @ echo icc > $(TOP)/build/COMP.$(OS) + +VC++: + @ echo vc++ > $(TOP)/build/COMP.$(OS) + +CLANG: + @ echo clang > $(TOP)/build/COMP.$(OS) + +static dynamic: + @ echo "there is no longer any difference between static and dynamic builds" + +debug: + @ echo dbg > $(TOP)/build/BUILD.$(OS) + +profile: + @ echo prof > $(TOP)/build/BUILD.$(OS) + +release: + @ echo rel > $(TOP)/build/BUILD.$(OS) + +scm: + @ echo scm > $(TOP)/build/BUILD.$(OS) + +pubtools: release + +bindir: + @ echo "$(BINDIR)" + +targdir: + @ echo "$(TARGDIR)" + +osdir: + @ echo "$(OUTDIR)/$(OS)" + +compilers: + @ echo "$(COMPILERS)" + +architectures: + @ echo "$(ARCHITECTURES)" + +architecture: + @ echo "$(ARCH)" + +config: + @ echo " current build is $(LOCAL_OR_REMOTE) $(BUILD_OS) $(BUILD) $(ARCH) build using $(TOOLSET) tools" + @ echo " output target directory is '$(TARGDIR)'" + @ echo + +purify: + @ echo pur > $(TOP)/build/BUILD.$(OS) + +purecov: + @ echo pcov > $(TOP)/build/BUILD.$(OS) + +.PHONY: out CC GCC ICC debug profile release scm purify purecov local local require-proxy-exec $(RHOSTS) bindir report_config + +# includes based upon build +ITF = $(VDB_INCDIR)/ +OSINC = $(VDB_INCDIR)/os +CCINC = $(VDB_INCDIR)/cc +XTINC = $(VDB_INCDIR)/ext +NGSINC = $(NGS_INCDIR) +OVERRIDEINC = $(TOP)/interfaces/override + +# OS specific source and include dirs +SRCDIRS_OS = $(SRCDIR)/$(OS) +INCDIRS_OS = $(OSINC)/$(OS) + +# most OS' have a parent type +ifdef OS_DAD + +SRCDIRS_OS += $(SRCDIR)/$(OS_DAD) +INCDIRS_OS += $(OSINC)/$(OS_DAD) + +# some OS' have a grandparent +ifdef OS_GDAD +SRCDIRS_OS += $(SRCDIR)/$(OS_GDAD) +INCDIRS_OS += $(OSINC)/$(OS_GDAD) +endif + +endif + +# compiler specific includes +INCDIRS_COMP = \ + $(CCINC)/$(COMP)/$(ARCH) \ + $(CCINC)/$(COMP) + +# some compilers have a parent type +ifdef COMP_DAD + +INCDIRS_COMP += \ + $(CCINC)/$(COMP_DAD)/$(ARCH) \ + $(CCINC)/$(COMP_DAD) + +endif + +VPATH = \ + $(SRCDIR)/$(COMP)/$(ARCH) \ + $(SRCDIR)/$(COMP) \ + $(SRCDIRS_OS) \ + $(SRCDIR) + +INCDIRS = \ + $(addprefix -I,$(OVERRIDEINC)) \ + $(addprefix -I,$(SRCDIRS_OS)) \ + $(addprefix -I,$(SRCDIR) $(ITF)) \ + $(addprefix -I,$(INCDIRS_COMP)) \ + $(addprefix -I,$(INCDIRS_OS)) \ + $(addprefix -I,$(XTINC) $(NGSINC)) \ + -I. + + +# linker paths +LDPATHS = + +ifneq (,$(HDF5_LIBDIR)) + LDPATHS += -L$(HDF5_LIBDIR) +endif +ifneq (,$(XML2_LIBDIR)) + LDPATHS += -L$(XML2_LIBDIR) +endif +ifneq (,$(MAGIC_LIBDIR)) + LDPATHS += -L$(MAGIC_LIBDIR) +endif +ifneq (,$(FUSE_LIBDIR)) + LDPATHS += -L$(FUSE_LIBDIR) +endif + + +# defines that describe os & architecture +DLLX ?= $(SHLX) +ARCHDEFS = -D_ARCH_BITS=__SIZEOF_POINTER__*__CHAR_BIT__ -DLIBPREFIX=$(LPFX) -DSHLIBEXT=$(DLLX) + +# default tool parameters +CFLAGS = -std=c11 $(DEBUG) $(DBG) $(CARCH) $(PROF) $(PED) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS) +CPFLAGS = -std=c++11 $(DEBUG) $(DBG) $(CARCH) $(PROF) $(DEFINES) $(ARCHDEFS) $(MIN_DEPLOY_OS_OPT) $(INCDIRS) +LDFLAGS = $(DBG) $(PROF) $(CARCH) $(MIN_DEPLOY_OS_OPT) $(LDPATHS) + +#------------------------------------------------------------------------------- +# runtests +# +# MallocScribble=1 is for catching allocation problems on Mac +# +HOSTNAME = $(shell hostname) +WHICHASCP = $(shell which ascp 2> /dev/null) +HAVE_NCBI_ASCP=1 +ifeq (,${WHICHASCP}) + HAVE_NCBI_ASCP= +endif +ifeq (iebdev21,${HOSTNAME}) + HAVE_NCBI_ASCP= +endif + +ifeq ($(RUNTESTS_OVERRIDE),) +runtests: all $(TEST_TOOLS) + @ export VDB_CONFIG=$(VDB_CONFIG);export LD_LIBRARY_PATH=$(LIBDIR):$$LD_LIBRARY_PATH;export MallocScribble=1;\ + for i in $(TEST_TOOLS);\ + do\ + echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++;\ + echo Run VDB_CONFIG=$$VDB_CONFIG $(TEST_BINDIR)/$$i;eval $(RUN_REMOTELY) $(TEST_BINDIR)/$$i;r=$$?; \ + if [ "$$r" != "0" ] ; then exit $$r; fi; \ + done + +.PHONY: runtests +endif + +#------------------------------------------------------------------------------- +# slowtests +# +# $(SLOWTESTSDATADIR) should be used to create temporary test files +SLOWTESTSDATADIR ?= /panfs/pan1.be-md.ncbi.nlm.nih.gov/sra-test/slowtests/$(shell whoami) + +slowtests: all $(SLOW_TEST_TOOLS) + @ export LD_LIBRARY_PATH=$(LIBDIR):$$LD_LIBRARY_PATH;\ + for i in $(SLOW_TEST_TOOLS);\ + do\ + echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++;\ + echo Run $(TEST_BINDIR)/$$i;eval $(RUN_REMOTELY) $(TEST_BINDIR)/$$i;r=$$?; \ + if [ "$$r" != "0" ] ; then exit $$r; fi; \ + done + +.PHONY: slowtests + +#------------------------------------------------------------------------------- +# all-cmn +# +# Common target to trigger build of all tools +# +$(TARGDIR)/all-cmn: $(addprefix $(BINDIR)/,$(ALL_TOOLS)) + +.PHONY: $(TARGDIR)/all-cmn + +#------------------------------------------------------------------------------- +# std-cmn +# +# Common target to trigger build of external visibility tools +# +$(TARGDIR)/std-cmn: $(addprefix $(BINDIR)/,$(EXT_TOOLS)) + +.PHONY: $(TARGDIR)/std-cmn diff --git a/build/env.cmake b/build/env.cmake index a227710d0..e0e7a1f78 100755 --- a/build/env.cmake +++ b/build/env.cmake @@ -196,6 +196,10 @@ function(SetAndCreate var path ) file(MAKE_DIRECTORY ${path} ) endfunction() +if( NOT TARGDIR ) + set( TARGDIR ${CMAKE_BINARY_DIR} ) +endif() + if ( ${CMAKE_GENERATOR} MATCHES "Visual Studio.*" OR ${CMAKE_GENERATOR} STREQUAL "Xcode" ) set( SINGLE_CONFIG false ) @@ -213,10 +217,12 @@ if ( ${CMAKE_GENERATOR} MATCHES "Visual Studio.*" OR set( NCBI_VDB_ILIBDIR_DEBUG ${VDB_BINDIR}/Debug/ilib ) set( NCBI_VDB_ILIBDIR_RELEASE ${VDB_BINDIR}/Release/ilib ) - SetAndCreate( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug/bin ) - SetAndCreate( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Release/bin ) - SetAndCreate( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/Debug/lib ) - SetAndCreate( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/Release/lib ) + SetAndCreate( CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${TARGDIR}/Debug/bin ) + SetAndCreate( CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${TARGDIR}/Release/bin ) + SetAndCreate( TEST_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${TARGDIR}/Debug/test-bin ) + SetAndCreate( TEST_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${TARGDIR}/Release/test-bin ) + SetAndCreate( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${TARGDIR}/Debug/lib ) + SetAndCreate( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${TARGDIR}/Release/lib ) set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG} ) set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE} ) set( CMAKE_JAR_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG} ) # both Debug and Release share this @@ -224,6 +230,7 @@ if ( ${CMAKE_GENERATOR} MATCHES "Visual Studio.*" OR # to be used in add-test() as the location of executables. # NOTE: always use the COMMAND_EXPAND_LISTS option of add_test set( BINDIR "$<$:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}>" ) + set( TESTBINDIR "$<$:${TEST_RUNTIME_OUTPUT_DIRECTORY_DEBUG}>$<$:${TEST_RUNTIME_OUTPUT_DIRECTORY_RELEASE}>" ) link_directories( $<$:${NCBI_VDB_LIBDIR_DEBUG}> $<$:${NCBI_VDB_LIBDIR_RELEASE}> ) link_directories( $<$:${NCBI_VDB_ILIBDIR_DEBUG}> $<$:${NCBI_VDB_ILIBDIR_RELEASE}> ) @@ -239,14 +246,15 @@ else() # assume a single-config generator set( NCBI_VDB_LIBDIR ${VDB_BINDIR}/lib ) set( NCBI_VDB_ILIBDIR ${VDB_BINDIR}/ilib ) - SetAndCreate( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) - SetAndCreate( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib ) + SetAndCreate( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${TARGDIR}/bin ) + SetAndCreate( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${TARGDIR}/lib ) set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} ) set( CMAKE_JAR_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} ) # to be used in add-test() as the location of executables. # NOTE: always use the COMMAND_EXPAND_LISTS option of add_test - set( BINDIR "${CMAKE_BINARY_DIR}/bin" ) + set( BINDIR "${TARGDIR}/bin" ) + set( TESTBINDIR "${TARGDIR}/test-bin" ) link_directories( ${NCBI_VDB_LIBDIR} ) link_directories( ${NCBI_VDB_ILIBDIR} ) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5a538df4e..685e3a910 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,10 +1,6 @@ -if(NOT CMAKE_TEST_OUTPUT_DIRECTORY) - set(CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/test-bin) -endif() - # this is where test executables will be created -# to access tools themselves, use ${CMAKE_BINARY_DIR}/bin -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_TEST_OUTPUT_DIRECTORY} ) +# to access tools themselves, use ${BINDIR} +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${TESTBINDIR} ) set( COMMON_LINK_LIBRARIES ${COMMON_LINK_LIBRARIES} ktst ) link_libraries( ${COMMON_LINK_LIBRARIES} ) diff --git a/test/vcf-loader/CMakeLists.txt b/test/vcf-loader/CMakeLists.txt index dd5bd79bf..6bb02d77c 100644 --- a/test/vcf-loader/CMakeLists.txt +++ b/test/vcf-loader/CMakeLists.txt @@ -5,6 +5,6 @@ if ( NOT WIN32 ) target_link_libraries( test-vcf-loader ${COMMON_LINK_LIBRARIES} ncbi-wvdb vcfloader ) add_test( NAME Test_Vcf_loader - COMMAND vcf-loader.sh ${CMAKE_BINARY_DIR}/test-bin/test-vdb-config-model "${VDB_SRCDIR}/interfaces" + COMMAND vcf-loader.sh ${TESTBINDIR}/test-vdb-config-model "${VDB_SRCDIR}/interfaces" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) endif() \ No newline at end of file diff --git a/test/vdb-config/CMakeLists.txt b/test/vdb-config/CMakeLists.txt index e9db7d626..b5a097558 100644 --- a/test/vdb-config/CMakeLists.txt +++ b/test/vdb-config/CMakeLists.txt @@ -5,7 +5,7 @@ if ( NOT WIN32 ) target_link_libraries( test-vdb-config-model ${COMMON_LINK_LIBRARIES} ncbi-vdb ) add_test( NAME Test_VDB_Config_model - COMMAND model.sh ${CMAKE_BINARY_DIR}/test-bin/test-vdb-config-model + COMMAND model.sh ${TESTBINDIR}/test-vdb-config-model WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) add_test( NAME Test_VDB_Config diff --git a/test/vdb-dump/CMakeLists.txt b/test/vdb-dump/CMakeLists.txt index 772c5b90a..63f1e6e81 100644 --- a/test/vdb-dump/CMakeLists.txt +++ b/test/vdb-dump/CMakeLists.txt @@ -11,6 +11,6 @@ if ( NOT WIN32 ) target_link_libraries( vdb-dump-makedb ${COMMON_LINK_LIBRARIES} ncbi-wvdb ) add_test( NAME Test_Vdb_dump - COMMAND vdb_dump.sh "${CMAKE_BINARY_DIR}/test-bin/vdb-dump-makedb" "${BINDIR}" + COMMAND vdb_dump.sh "${TESTBINDIR}/vdb-dump-makedb" "${BINDIR}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) endif() \ No newline at end of file diff --git a/test/vdb-dump/vdb_dump.sh b/test/vdb-dump/vdb_dump.sh index 7a9b7b6d3..4c40cae06 100755 --- a/test/vdb-dump/vdb_dump.sh +++ b/test/vdb-dump/vdb_dump.sh @@ -4,7 +4,6 @@ vdb_dump_makedb=$1 bin_dir=$2 echo vdb-dump-makedb: ${vdb_dump_makedb} -echo cmake_source_dir: ${cmake_source_dir} echo "testing vdb_dump"