diff options
author | Luke Chen <luke.chen@mongodb.com> | 2022-04-04 13:29:16 +1000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-04-04 03:56:20 +0000 |
commit | 053f9a6ec06f7b1d6479dcb702226b91bb6a10d4 (patch) | |
tree | 7bb133437b6607eca42ce81ef7b94ba6c81365b3 | |
parent | bd0be154aa5f1d04136efc8cb0bd2d40fac3f0ab (diff) | |
download | mongo-053f9a6ec06f7b1d6479dcb702226b91bb6a10d4.tar.gz |
Import wiredtiger: ae8df82bdd2eb99987da8f4ee19aaf748ff91d35 from branch mongodb-master
ref: b838e67911..ae8df82bdd
for: 6.0.0-rc0
WT-8936 Update CMake files to be able to use the Memkind library
7 files changed, 49 insertions, 1 deletions
diff --git a/src/third_party/wiredtiger/cmake/configs/auto.cmake b/src/third_party/wiredtiger/cmake/configs/auto.cmake index fec091a6cf5..ac877698920 100644 --- a/src/third_party/wiredtiger/cmake/configs/auto.cmake +++ b/src/third_party/wiredtiger/cmake/configs/auto.cmake @@ -218,6 +218,13 @@ config_func( ) config_lib( + HAVE_LIBMEMKIND + "memkind library exists." + LIB "memkind" + HEADER "memkind.h" +) + +config_lib( HAVE_LIBPTHREAD "Pthread library exists." LIB "pthread" diff --git a/src/third_party/wiredtiger/cmake/configs/base.cmake b/src/third_party/wiredtiger/cmake/configs/base.cmake index 6a02b121308..d3df936e5b8 100644 --- a/src/third_party/wiredtiger/cmake/configs/base.cmake +++ b/src/third_party/wiredtiger/cmake/configs/base.cmake @@ -141,6 +141,16 @@ config_bool( ) config_bool( + ENABLE_MEMKIND + "Enable the memkind library, needed for NVRAM or SSD block caches" + DEFAULT OFF + DEPENDS "HAVE_LIBMEMKIND" + # Specifically throw a fatal error if a user tries to enable the memkind allocator without + # actually having the library available (as opposed to silently defaulting to OFF). + DEPENDS_ERROR ON "Failed to find memkind library" +) + +config_bool( ENABLE_SNAPPY "Build the snappy compressor extension" DEFAULT OFF diff --git a/src/third_party/wiredtiger/cmake/configs/wiredtiger_config.h.in b/src/third_party/wiredtiger/cmake/configs/wiredtiger_config.h.in index 4072a12e8f9..33c96af6543 100644 --- a/src/third_party/wiredtiger/cmake/configs/wiredtiger_config.h.in +++ b/src/third_party/wiredtiger/cmake/configs/wiredtiger_config.h.in @@ -63,6 +63,9 @@ /* Define to 1 if you have the `lz4' library (-llz4). */ #cmakedefine HAVE_LIBLZ4 1 +/* Define to 1 if you have the `memkind' library (-lmemkind). */ +#cmakedefine HAVE_LIBMEMKIND 1 + /* Define to 1 if you have the `pthread' library (-lpthread). */ #cmakedefine HAVE_LIBPTHREAD 1 diff --git a/src/third_party/wiredtiger/cmake/define_libwiredtiger.cmake b/src/third_party/wiredtiger/cmake/define_libwiredtiger.cmake index e7948d517ca..85b81e6cb50 100644 --- a/src/third_party/wiredtiger/cmake/define_libwiredtiger.cmake +++ b/src/third_party/wiredtiger/cmake/define_libwiredtiger.cmake @@ -67,6 +67,9 @@ macro(define_wiredtiger_library target type) target_include_directories(${target} PUBLIC ${HAVE_LIBDL_INCLUDES}) endif() endif() + if(ENABLE_MEMKIND) + target_link_libraries(${target} PRIVATE wt::memkind) + endif() if(ENABLE_TCMALLOC) target_link_libraries(${target} PRIVATE wt::tcmalloc) endif() diff --git a/src/third_party/wiredtiger/cmake/install/install.cmake b/src/third_party/wiredtiger/cmake/install/install.cmake index 9944e390473..eae761f229d 100644 --- a/src/third_party/wiredtiger/cmake/install/install.cmake +++ b/src/third_party/wiredtiger/cmake/install/install.cmake @@ -37,6 +37,9 @@ if(WT_POSIX) if(HAVE_LIBDL) set(private_libs "${private_libs} -ldl") endif() + if(ENABLE_MEMKIND) + set(private_libs "${private_libs} -lmemkind") + endif() if(ENABLE_TCMALLOC) set(private_libs "${private_libs} -ltcmalloc") endif() diff --git a/src/third_party/wiredtiger/cmake/third_party/memkind.cmake b/src/third_party/wiredtiger/cmake/third_party/memkind.cmake new file mode 100644 index 00000000000..2f621a4f741 --- /dev/null +++ b/src/third_party/wiredtiger/cmake/third_party/memkind.cmake @@ -0,0 +1,22 @@ +if(NOT HAVE_LIBMEMKIND) + # We don't need to construct a memkind library target. + return() +endif() + +if(TARGET wt::memkind) + # Avoid redefining the imported library. + return() +endif() + +# Define the imported memkind library target that can be subsequently linked across the build system. +# We use the double colons (::) as a convention to tell CMake that the target name is associated +# with an IMPORTED target (which allows CMake to issue a diagnostic message if the library wasn't found). +add_library(wt::memkind SHARED IMPORTED GLOBAL) +set_target_properties(wt::memkind PROPERTIES + IMPORTED_LOCATION ${HAVE_LIBMEMKIND} +) +if (HAVE_LIBMEMKIND_INCLUDES) + set_target_properties(wt::memkind PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${HAVE_LIBMEMKIND_INCLUDES} + ) +endif() diff --git a/src/third_party/wiredtiger/import.data b/src/third_party/wiredtiger/import.data index fc8728340c7..979075a6d35 100644 --- a/src/third_party/wiredtiger/import.data +++ b/src/third_party/wiredtiger/import.data @@ -2,5 +2,5 @@ "vendor": "wiredtiger", "github": "wiredtiger/wiredtiger.git", "branch": "mongodb-master", - "commit": "b838e67911994b2f97abe8270a7cfd4d05a62adc" + "commit": "ae8df82bdd2eb99987da8f4ee19aaf748ff91d35" } |