mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-28 02:58:49 +08:00
mdbx-build: добавление build-metadata и опции сборки MDBX_BUILD_METADATA
.
This commit is contained in:
parent
2b71df417e
commit
881d4d4207
@ -648,6 +648,10 @@ endif()
|
||||
# ~~~
|
||||
# ##############################################################################
|
||||
|
||||
set(MDBX_BUILD_METADATA
|
||||
""
|
||||
CACHE STRING "An extra/custom information provided during libmdbx build")
|
||||
|
||||
set(MDBX_BUILD_OPTIONS ENABLE_UBSAN ENABLE_ASAN ENABLE_MEMCHECK ENABLE_GPROF
|
||||
ENABLE_GCOV)
|
||||
macro(add_mdbx_option NAME DESCRIPTION DEFAULT)
|
||||
@ -663,7 +667,7 @@ if(IOS)
|
||||
set(MDBX_BUILD_TOOLS_DEFAULT OFF)
|
||||
if(NOT_SUBPROJECT)
|
||||
cmake_policy(SET CMP0006 OLD)
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "NO")
|
||||
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO)
|
||||
endif()
|
||||
else()
|
||||
set(MDBX_BUILD_TOOLS_DEFAULT ON)
|
||||
|
@ -58,6 +58,7 @@ CMAKE_OPT ?=
|
||||
MDBX_BUILD_OPTIONS ?=-DNDEBUG=1
|
||||
MDBX_BUILD_TIMESTAMP ?=$(shell date +%Y-%m-%dT%H:%M:%S%z)
|
||||
MDBX_BUILD_CXX ?= YES
|
||||
MDBX_BUILD_METADATA ?= ""
|
||||
|
||||
# probe and compose common compiler flags with variable expansion trick (seems this work two times per session for GNU Make 3.81)
|
||||
CFLAGS ?= $(strip $(eval CFLAGS := -std=gnu11 -O2 -g -Wall -Werror -Wextra -Wpedantic -ffunction-sections -fPIC -fvisibility=hidden -pthread -Wno-error=attributes $$(shell for opt in -fno-semantic-interposition -Wno-unused-command-line-argument -Wno-tautological-compare; do [ -z "$$$$($(CC) '-DMDBX_BUILD_FLAGS="probe"' $$$${opt} -c $(SRC_PROBE_C) -o /dev/null >/dev/null 2>&1 || echo failed)" ] && echo "$$$${opt} "; done)$(CFLAGS_EXTRA))$(CFLAGS))
|
||||
@ -203,6 +204,7 @@ show-options:
|
||||
@echo " MDBX_BUILD_OPTIONS = $(MDBX_BUILD_OPTIONS)"
|
||||
@echo " MDBX_BUILD_CXX = $(MDBX_BUILD_CXX)"
|
||||
@echo " MDBX_BUILD_TIMESTAMP = $(MDBX_BUILD_TIMESTAMP)"
|
||||
@echo " MDBX_BUILD_METADATA = $(MDBX_BUILD_METADATA)"
|
||||
@echo '$(TIP) Use `make options` to listing available build options.'
|
||||
@echo $(call select_by,MDBX_BUILD_CXX," CXX =`which $(CXX)` | `$(CXX) --version | head -1`"," CC =`which $(CC)` | `$(CC) --version | head -1`")
|
||||
@echo $(call select_by,MDBX_BUILD_CXX," CXXFLAGS =$(CXXFLAGS)"," CFLAGS =$(CFLAGS)")
|
||||
@ -230,6 +232,7 @@ options:
|
||||
@echo ""
|
||||
@echo " MDBX_BUILD_OPTIONS = $(MDBX_BUILD_OPTIONS)"
|
||||
@echo " MDBX_BUILD_TIMESTAMP = $(MDBX_BUILD_TIMESTAMP)"
|
||||
@echo " MDBX_BUILD_METADATA = $(MDBX_BUILD_METADATA)"
|
||||
@echo ""
|
||||
@echo "## Assortment items for MDBX_BUILD_OPTIONS:"
|
||||
@echo "## Note that the defaults should already be correct for most platforms;"
|
||||
@ -300,6 +303,7 @@ config.h: @buildflags.tag mdbx.c $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE
|
||||
&& echo '#define MDBX_BUILD_COMPILER "$(shell (LC_ALL=C $(CC) --version || echo 'Please use GCC or CLANG compatible compiler') | head -1)"' \
|
||||
&& echo '#define MDBX_BUILD_TARGET "$(shell set -o pipefail; (LC_ALL=C $(CC) -v 2>&1 | grep -i '^Target:' | cut -d ' ' -f 2- || (LC_ALL=C $(CC) --version | grep -qi e2k && echo E2K) || echo 'Please use GCC or CLANG compatible compiler') | head -1)"' \
|
||||
&& echo '#define MDBX_BUILD_CXX $(call select_by,MDBX_BUILD_CXX,1,0)' \
|
||||
&& echo '#define MDBX_BUILD_METADATA "$(MDBX_BUILD_METADATA)"' \
|
||||
) >$@
|
||||
|
||||
mdbx-dylib.o: config.h mdbx.c mdbx.h $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE
|
||||
@ -548,6 +552,7 @@ src/config.h: @buildflags.tag src/version.c $(lastword $(MAKEFILE_LIST)) LICENSE
|
||||
&& echo '#define MDBX_BUILD_TARGET "$(shell set -o pipefail; (LC_ALL=C $(CC) -v 2>&1 | grep -i '^Target:' | cut -d ' ' -f 2- || (LC_ALL=C $(CC) --version | grep -qi e2k && echo E2K) || echo 'Please use GCC or CLANG compatible compiler') | head -1)"' \
|
||||
&& echo '#define MDBX_BUILD_SOURCERY $(MDBX_BUILD_SOURCERY)' \
|
||||
&& echo '#define MDBX_BUILD_CXX $(call select_by,MDBX_BUILD_CXX,1,0)' \
|
||||
&& echo '#define MDBX_BUILD_METADATA "$(MDBX_BUILD_METADATA)"' \
|
||||
) >$@
|
||||
|
||||
mdbx-dylib.o: src/config.h src/version.c src/alloy.c $(ALLOY_DEPS) $(lastword $(MAKEFILE_LIST)) LICENSE NOTICE
|
||||
|
3
mdbx.h
3
mdbx.h
@ -682,6 +682,9 @@ extern LIBMDBX_VERINFO_API const struct MDBX_build_info {
|
||||
const char *options; /**< mdbx-related options */
|
||||
const char *compiler; /**< compiler */
|
||||
const char *flags; /**< CFLAGS and CXXFLAGS */
|
||||
const char *metadata; /**< an extra/custom information provided via
|
||||
the MDBX_BUILD_METADATA definition
|
||||
during library build */
|
||||
} /** \brief libmdbx build information */ mdbx_build;
|
||||
|
||||
#if (defined(_WIN32) || defined(_WIN64)) && !MDBX_BUILD_SHARED_LIBRARY
|
||||
|
@ -70,6 +70,9 @@
|
||||
#ifndef MDBX_BUILD_FLAGS
|
||||
#cmakedefine MDBX_BUILD_FLAGS "@MDBX_BUILD_FLAGS@"
|
||||
#endif
|
||||
#ifndef MDBX_BUILD_METADATA
|
||||
#cmakedefine MDBX_BUILD_METADATA "@MDBX_BUILD_METADATA@"
|
||||
#endif
|
||||
#cmakedefine MDBX_BUILD_SOURCERY @MDBX_BUILD_SOURCERY@
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
@ -441,6 +441,7 @@ __dll_export
|
||||
#warning "Build flags undefined. Please use correct build script"
|
||||
#endif // _MSC_VER
|
||||
#endif
|
||||
, MDBX_BUILD_METADATA
|
||||
};
|
||||
|
||||
#ifdef __SANITIZE_ADDRESS__
|
||||
|
@ -513,6 +513,10 @@
|
||||
#define MDBX_AUXILARY_IOV_MAX IOV_MAX
|
||||
#endif /* MDBX_AUXILARY_IOV_MAX */
|
||||
|
||||
/* An extra/custom information provided during library build */
|
||||
#ifndef MDBX_BUILD_METADATA
|
||||
#define MDBX_BUILD_METADATA ""
|
||||
#endif /* MDBX_BUILD_METADATA */
|
||||
/** @} end of build options */
|
||||
/*******************************************************************************
|
||||
*******************************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user