Skip to content

Commit

Permalink
compile on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
gcxfd committed Nov 20, 2021
1 parent 1150caf commit 87eff90
Show file tree
Hide file tree
Showing 27 changed files with 889 additions and 1,114 deletions.
2 changes: 2 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
edition = "2021"
tab_spaces = 4
23 changes: 11 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,21 @@ name = "mdbx"
members = ["mdbx-sys"]

[dependencies]
bitflags = "1"
byteorder = "1"
derive_more = "0.99"
indexmap = "1"
libc = "0.2"
byteorder = "1.4.3"
derive_more = "0.99.16"
indexmap = "1.7.0"
libc = "0.2.107"
lifetimed-bytes = { git = "https://github.com/vorot93/lifetimed-bytes" }
parking_lot = "0.11"
thiserror = "1"

parking_lot = "0.11.2"
thiserror = "1.0.30"
ffi = { package = "mdbx-sys", path = "./mdbx-sys" }
os_str_bytes = "5.0.0"

[dev-dependencies]
criterion = "0.3"
rand = "0.8"
rand_xorshift = "0.3"
tempfile = "3"
criterion = "0.3.5"
rand = "0.8.4"
rand_xorshift = "0.3.0"
tempfile = "3.2.0"

[[bench]]
name = "cursor"
Expand Down
6 changes: 3 additions & 3 deletions mdbx-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ categories = ["database", "external-ffi-bindings"]
name = "mdbx_sys"

[dependencies]
libc = "0.2"
libc = "0.2.107"

[build-dependencies]
cc = "1.0"
bindgen = { version = "0.59", default-features = false, features = ["runtime"] }
cc = "1.0.72"
bindgen = { version = "0.59.1", default-features = false, features = ["runtime"] }
2 changes: 2 additions & 0 deletions mdbx-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ fn main() {
.allowlist_var("^(MDBX|mdbx)_.*")
.allowlist_type("^(MDBX|mdbx)_.*")
.allowlist_function("^(MDBX|mdbx)_.*")
.rustified_enum("^(MDBX_option_t|MDBX_cursor_op)")
.bitfield_enum("^(MDBX_constants|MDBX_log_level_t|MDBX_debug_flags_t|MDBX_env_flags_t|MDBX_txn_flags_t|MDBX_db_flags_t|MDBX_put_flags_t|MDBX_copy_flags_t|MDBX_env_delete_mode_t|MDBX_dbi_state_t|MDBX_page_type_t|MDBX_error_t)")
.size_t_is_usize(true)
.ctypes_prefix("::libc")
.parse_callbacks(Box::new(Callbacks))
Expand Down
7 changes: 7 additions & 0 deletions mdbx-sys/libmdbx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,16 @@ list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_11 HAS_CXX11)
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_14 HAS_CXX14)
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_17 HAS_CXX17)
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_20 HAS_CXX20)
list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_23 HAS_CXX23)
if(NOT DEFINED MDBX_CXX_STANDARD)
if(DEFINED ENV{CMAKE_CXX_STANDARD})
set(CMAKE_CXX_STANDARD $ENV{CMAKE_CXX_STANDARD})
endif()
if(DEFINED CMAKE_CXX_STANDARD)
set(MDBX_CXX_STANDARD ${CMAKE_CXX_STANDARD})
elseif(NOT HAS_CXX23 LESS 0
AND NOT (CMAKE_COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 12))
set(MDBX_CXX_STANDARD 23)
elseif(NOT HAS_CXX20 LESS 0
AND NOT (CMAKE_COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9))
set(MDBX_CXX_STANDARD 20)
Expand Down
16 changes: 15 additions & 1 deletion mdbx-sys/libmdbx/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,24 @@ ChangeLog
- [Support for RAW devices](https://github.com/erthink/libmdbx/issues/124).
- [Support MessagePack for Keys & Values](https://github.com/erthink/libmdbx/issues/115).
- [Engage new terminology](https://github.com/erthink/libmdbx/issues/137).
- Finalize C++ API (few typos and bugs are still maybe for now).
- Finalize C++ API (there is still a small chance for a few typos and bugs).
- Packages for [Astra Linux](https://astralinux.ru/), [ALT Linux](https://www.altlinux.org/), [ROSA Linux](https://www.rosalinux.ru/), etc.


## v0.11.2 (underway)

Acknowledgements:

- [장세연 (Чан Се Ен)](https://github.com/sasgas) for contributing to C++ API.

Minors:

- Fixed `constexpr`-related macros for legacy compilers.
- Allowed to define 'CMAKE_CXX_STANDARD` using an environment variable.
- Simplified collection statistics of page operation .
- [Fixed](https://github.com/erthink/libmdbx/pull/239) compilation with devtoolset-9 on CentOS/RHEL 7.


## v0.11.1 at 2021-10-23

### Backward compatibility break:
Expand Down
2 changes: 1 addition & 1 deletion mdbx-sys/libmdbx/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ CFLAGS ?= -std=gnu11 -O2 -g -Wall -Werror -Wextra -Wpedantic -ffunction-section
# -Wno-tautological-compare
CXX ?= g++
# Choosing C++ standard with deferred simple variable expansion trick
CXXSTD ?= $(eval CXXSTD := $$(shell PROBE=$$$$([ -f mdbx.c++ ] && echo mdbx.c++ || echo src/mdbx.c++); for std in gnu++20 c++20 gnu++2a c++2a gnu++17 c++17 gnu++14 c++14 gnu+11 c++11; do $(CXX) -std=$$$${std} -c $$$${PROBE} -o /dev/null 2>/dev/null >/dev/null && echo "-std=$$$${std}" && exit; done))$(CXXSTD)
CXXSTD ?= $(eval CXXSTD := $$(shell PROBE=$$$$([ -f mdbx.c++ ] && echo mdbx.c++ || echo src/mdbx.c++); for std in gnu++23 c++23 gnu++2b c++2b gnu++20 c++20 gnu++2a c++2a gnu++17 c++17 gnu++1z c++1z gnu++14 c++14 gnu++1y c++1y gnu+11 c++11 gnu++0x c++0x; do $(CXX) -std=$$$${std} -c $$$${PROBE} -o /dev/null 2>std-$$$${std}.err >/dev/null && echo "-std=$$$${std}" && exit; done))$(CXXSTD)
CXXFLAGS = $(CXXSTD) $(filter-out -std=gnu11,$(CFLAGS))

# TIP: Try append '--no-as-needed,-lrt' for ability to built with modern glibc, but then use with the old.
Expand Down
2 changes: 1 addition & 1 deletion mdbx-sys/libmdbx/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11.1.0
0.11.1.21
Loading

0 comments on commit 87eff90

Please sign in to comment.