mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-30 01:44:13 +08:00
mdbx-cmake: #if/#endif instead of cmake-conditions for posix/windows sources.
Change-Id: Ic95bd3ba345160cf1d68c79f11d6560d4c41cb2b
This commit is contained in:
parent
6248b67f75
commit
63449a44c5
@ -236,10 +236,7 @@ dist/@tmp-shared_internals.inc: src/elements/version.c $(ALLOY_DEPS) $(lastword
|
|||||||
|
|
||||||
dist/mdbx.c: dist/@tmp-shared_internals.inc $(lastword $(MAKEFILE_LIST))
|
dist/mdbx.c: dist/@tmp-shared_internals.inc $(lastword $(MAKEFILE_LIST))
|
||||||
mkdir -p dist && (cat dist/@tmp-shared_internals.inc \
|
mkdir -p dist && (cat dist/@tmp-shared_internals.inc \
|
||||||
&& cat src/elements/core.c src/elements/osal.c src/elements/version.c \
|
&& cat src/elements/core.c src/elements/osal.c src/elements/version.c src/elements/lck-windows.c src/elements/lck-posix.c \
|
||||||
&& echo '#if defined(_WIN32) || defined(_WIN64)' \
|
|
||||||
&& cat src/elements/lck-windows.c && echo '#else /* LCK-implementation */' \
|
|
||||||
&& cat src/elements/lck-posix.c && echo '#endif /* LCK-implementation */' \
|
|
||||||
) | grep -v -e '#include "' -e '#pragma once' | sed 's|@INCLUDE|#include|' > $@
|
) | grep -v -e '#include "' -e '#pragma once' | sed 's|@INCLUDE|#include|' > $@
|
||||||
|
|
||||||
define dist-tool-rule
|
define dist-tool-rule
|
||||||
|
@ -19,14 +19,9 @@ message(STATUS "libmdbx version is ${MDBX_VERSION}")
|
|||||||
if(MDBX_ALLOY_MODE)
|
if(MDBX_ALLOY_MODE)
|
||||||
set(LIBMDBX_SOURCES alloy.c)
|
set(LIBMDBX_SOURCES alloy.c)
|
||||||
else()
|
else()
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|
||||||
set(LIBMDBX_OSAL windows)
|
|
||||||
else()
|
|
||||||
set(LIBMDBX_OSAL posix)
|
|
||||||
endif()
|
|
||||||
set(LIBMDBX_SOURCES
|
set(LIBMDBX_SOURCES
|
||||||
elements/options.h elements/defs.h elements/internals.h elements/osal.h
|
elements/options.h elements/defs.h elements/internals.h elements/osal.h
|
||||||
elements/core.c elements/osal.c elements/lck-${LIBMDBX_OSAL}.c)
|
elements/core.c elements/osal.c elements/lck-posix.c elements/lck-windows.c)
|
||||||
endif()
|
endif()
|
||||||
list(APPEND LIBMDBX_SOURCES ../mdbx.h
|
list(APPEND LIBMDBX_SOURCES ../mdbx.h
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}/elements/version.c"
|
"${CMAKE_CURRENT_SOURCE_DIR}/elements/version.c"
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
* <http://www.OpenLDAP.org/license.html>.
|
* <http://www.OpenLDAP.org/license.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if !(defined(_WIN32) || defined(_WIN64)) /* !Windows LCK-implementation */
|
||||||
|
|
||||||
#include "internals.h"
|
#include "internals.h"
|
||||||
#include <sys/sem.h>
|
#include <sys/sem.h>
|
||||||
|
|
||||||
@ -803,3 +805,10 @@ void mdbx_txn_unlock(MDBX_env *env) {
|
|||||||
mdbx_panic("%s() failed: err %d\n", __func__, rc);
|
mdbx_panic("%s() failed: err %d\n", __func__, rc);
|
||||||
mdbx_jitter4testing(true);
|
mdbx_jitter4testing(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(disable : 4206) /* nonstandard extension used: translation \
|
||||||
|
unit is empty */
|
||||||
|
#endif /* _MSC_VER (warnings) */
|
||||||
|
#endif /* !Windows LCK-implementation */
|
||||||
|
@ -12,17 +12,15 @@
|
|||||||
* <http://www.OpenLDAP.org/license.html>.
|
* <http://www.OpenLDAP.org/license.html>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "internals.h"
|
#if defined(_WIN32) || defined(_WIN64) /* Windows LCK-implementation */
|
||||||
|
|
||||||
/* PREAMBLE FOR WINDOWS:
|
/* PREAMBLE FOR WINDOWS:
|
||||||
*
|
*
|
||||||
* We are not concerned for performance here.
|
* We are not concerned for performance here.
|
||||||
* If you are running Windows a performance could NOT be the goal.
|
* If you are running Windows a performance could NOT be the goal.
|
||||||
* Otherwise please use Linux.
|
* Otherwise please use Linux. */
|
||||||
*
|
|
||||||
* Regards,
|
#include "internals.h"
|
||||||
* LY
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void mdbx_winnt_import(void);
|
static void mdbx_winnt_import(void);
|
||||||
|
|
||||||
@ -799,3 +797,5 @@ static void mdbx_winnt_import(void) {
|
|||||||
mdbx_srwlock_ReleaseExclusive = stub_srwlock_ReleaseExclusive;
|
mdbx_srwlock_ReleaseExclusive = stub_srwlock_ReleaseExclusive;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* Windows LCK-implementation */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user