mirror of
https://github.com/isar/libmdbx.git
synced 2025-10-06 13:12:19 +08:00
mdbx-build: rearrange source files, rework CMakeLists.txt and refine GNUMakefile (squashed).
Change-Id: Id73d346695011dab2f670bb9e6293a1e5a1835ca
This commit is contained in:
@@ -1,9 +1,3 @@
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
set(TEST_OSAL windows)
|
||||
else()
|
||||
set(TEST_OSAL unix)
|
||||
endif()
|
||||
|
||||
add_executable(mdbx_test
|
||||
base.h
|
||||
cases.cc
|
||||
@@ -21,7 +15,8 @@ add_executable(mdbx_test
|
||||
log.h
|
||||
main.cc
|
||||
osal.h
|
||||
osal-${TEST_OSAL}.cc
|
||||
osal-unix.cc
|
||||
osal-windows.cc
|
||||
test.cc
|
||||
test.h
|
||||
try.cc
|
||||
@@ -35,19 +30,15 @@ add_executable(mdbx_test
|
||||
set_target_properties(mdbx_test PROPERTIES
|
||||
INTERPROCEDURAL_OPTIMIZATION $<BOOL:${INTERPROCEDURAL_OPTIMIZATION}>
|
||||
CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON)
|
||||
target_setup_options(mdbx_test)
|
||||
|
||||
if(CC_HAS_FASTMATH)
|
||||
target_compile_options(mdbx_test PRIVATE "-ffast-math")
|
||||
endif()
|
||||
if(CC_HAS_VISIBILITY AND (LTO_ENABLED OR INTERPROCEDURAL_OPTIMIZATION))
|
||||
set_target_properties(mdbx_test PROPERTIES LINK_FLAGS "-fvisibility=hidden")
|
||||
endif()
|
||||
|
||||
target_link_libraries(mdbx_test mdbx ${LIB_MATH} ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries(mdbx_test ${TOOL_MDBX_LIB} ${LIB_MATH} ${CMAKE_THREAD_LIBS_INIT})
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
||||
target_link_libraries(mdbx_test winmm.lib)
|
||||
endif()
|
||||
|
||||
if(UNIX AND NOT SUBPROJECT)
|
||||
add_subdirectory(pcrf)
|
||||
add_executable(pcrf_test pcrf/pcrf_test.c)
|
||||
target_include_directories(pcrf_test PRIVATE "${PROJECT_SOURCE_DIR}")
|
||||
target_link_libraries(pcrf_test ${TOOL_MDBX_LIB})
|
||||
endif()
|
||||
|
@@ -84,14 +84,14 @@
|
||||
#define MDBX_INTERNAL_VAR extern
|
||||
#define MDBX_TOOLS /* Avoid using internal mdbx_assert() */
|
||||
#include "../mdbx.h"
|
||||
#include "../src/elements/defs.h"
|
||||
#include "../src/elements/osal.h"
|
||||
#include "../src/defs.h"
|
||||
#include "../src/osal.h"
|
||||
|
||||
#if !defined(__thread) && (defined(_MSC_VER) || defined(__DMC__))
|
||||
#define __thread __declspec(thread)
|
||||
#endif /* __thread */
|
||||
|
||||
#include "../src/elements/options.h"
|
||||
#include "../src/options.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#if !(defined(_WIN32) || defined(_WIN64))
|
||||
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include <sys/mman.h>
|
||||
@@ -529,3 +531,5 @@ std::string osal_tempdir(void) {
|
||||
int osal_removefile(const std::string &pathname) {
|
||||
return unlink(pathname.c_str()) ? errno : MDBX_SUCCESS;
|
||||
}
|
||||
|
||||
#endif /* !Windows */
|
||||
|
@@ -14,6 +14,8 @@
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
|
||||
static std::unordered_map<unsigned, HANDLE> events;
|
||||
static HANDLE hBarrierSemaphore, hBarrierEvent;
|
||||
static HANDLE hProgressActiveEvent, hProgressPassiveEvent;
|
||||
@@ -459,3 +461,5 @@ std::string osal_tempdir(void) {
|
||||
int osal_removefile(const std::string &pathname) {
|
||||
return DeleteFileA(pathname.c_str()) ? MDBX_SUCCESS : GetLastError();
|
||||
}
|
||||
|
||||
#endif /* Windows */
|
||||
|
@@ -1,5 +0,0 @@
|
||||
set(TARGET pcrf_test)
|
||||
add_executable(${TARGET} pcrf_test.c)
|
||||
target_include_directories(${TARGET} PRIVATE "${PROJECT_SOURCE_DIR}")
|
||||
target_link_libraries(${TARGET} mdbx)
|
||||
|
Reference in New Issue
Block a user