mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-28 04:09:00 +08:00
LMDB port
This commit is contained in:
parent
3eccec7231
commit
1f63deb204
3
ports/lmdb/CONTROL
Normal file
3
ports/lmdb/CONTROL
Normal file
@ -0,0 +1,3 @@
|
||||
Source: lmdb
|
||||
Version: 0.9.18-1
|
||||
Description: LMDB is an extraordinarily fast, memory-efficient database
|
80
ports/lmdb/cmake/CMakeLists.txt
Normal file
80
ports/lmdb/cmake/CMakeLists.txt
Normal file
@ -0,0 +1,80 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/lmdb.h" VERSION_HEADER)
|
||||
string(REGEX MATCH ".*MDB_VERSION_MAJOR[ \t]+([0-9])" MAJOR_VERSION_MATCH "${VERSION_HEADER}")
|
||||
set(LMDB_MAJOR_VERSION ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH ".*MDB_VERSION_MINOR[ \t]+([0-9])" MINOR_VERSION_MATCH "${VERSION_HEADER}")
|
||||
set(LMDB_MINOR_VERSION ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH ".*MDB_VERSION_PATCH[ \t]+([0-9]+)" PATCH_VERSION_MATCH "${VERSION_HEADER}")
|
||||
set(LMDB_PATCH_VERSION ${CMAKE_MATCH_1})
|
||||
|
||||
set(LMDB_VERSION "${LMDB_MAJOR_VERSION}.${LMDB_MINOR_VERSION}.${LMDB_PATCH_VERSION}")
|
||||
|
||||
project(lmdb)
|
||||
|
||||
option(LMDB_BUILD_TOOLS "Build lmdb tools" OFF)
|
||||
option(LMDB_BUILD_TESTS "Build lmdb tests" OFF)
|
||||
option(LMDB_INSTALL_HEADERS "Install LMDB header files" ON)
|
||||
set(LMDB_INCLUDE_INSTALL_DIR include CACHE PATH "Install directory for headers")
|
||||
set(LMDB_LIBRARY_INSTALL_DIR lib CACHE PATH "Install directory for library")
|
||||
set(LMDB_RUNTIME_INSTALL_DIR bin CACHE PATH "Install directory for binaries/dlls")
|
||||
set(LMDB_CONFIG_INSTALL_DIR share/lmdb CACHE PATH "Install directory for cmake config files")
|
||||
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DEF:${CMAKE_CURRENT_SOURCE_DIR}/lmdbd.def")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} /DEF:${CMAKE_CURRENT_SOURCE_DIR}/lmdb.def")
|
||||
endif()
|
||||
|
||||
set(SRCS lmdb mdb.c lmdb.h midl.c midl.h )
|
||||
add_library(lmdb ${SRCS})
|
||||
set_target_properties(lmdb PROPERTIES DEBUG_POSTFIX d)
|
||||
target_link_libraries(lmdb PRIVATE ntdll.lib)
|
||||
|
||||
install(TARGETS lmdb DESTINATION lib
|
||||
EXPORT lmdb-targets
|
||||
RUNTIME DESTINATION ${LMDB_RUNTIME_INSTALL_DIR}
|
||||
LIBRARY DESTINATION ${LMDB_LIBRARY_INSTALL_DIR}
|
||||
ARCHIVE DESTINATION ${LMDB_LIBRARY_INSTALL_DIR}
|
||||
)
|
||||
|
||||
if(LMDB_INSTALL_HEADERS)
|
||||
install(FILES lmdb.h midl.h DESTINATION ${LMDB_INCLUDE_INSTALL_DIR})
|
||||
endif()
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
set(INSTALL_INCLUDE_DIR ${LMDB_INCLUDE_INSTALL_DIR})
|
||||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/package-config.cmakein ${CMAKE_CURRENT_BINARY_DIR}/lmdb-config.cmake
|
||||
INSTALL_DESTINATION ${LMDB_CONFIG_INSTALL_DIR}
|
||||
PATH_VARS INSTALL_INCLUDE_DIR
|
||||
)
|
||||
|
||||
write_basic_package_version_file( ${CMAKE_CURRENT_BINARY_DIR}/lmdb-config-version.cmake VERSION ${LMDB_VERSION} COMPATIBILITY SameMajorVersion )
|
||||
|
||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lmdb-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/lmdb-config-version.cmake
|
||||
DESTINATION ${LMDB_CONFIG_INSTALL_DIR} )
|
||||
|
||||
|
||||
install(EXPORT lmdb-targets DESTINATION ${LMDB_CONFIG_INSTALL_DIR})
|
||||
|
||||
if(LMDB_BUILD_TOOLS)
|
||||
# don't build mdb_dump/load/stat since they will
|
||||
# not build on windows
|
||||
foreach(_tool mdb_copy)
|
||||
add_executable(${_tool} ${_tool}.c)
|
||||
target_link_libraries(${_tool} lmdb)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(LMDB_BUILD_TESTS)
|
||||
enable_testing()
|
||||
# don't use mtest6 since it will only build in static
|
||||
# build
|
||||
foreach(_test mtest mtest2 mtest3 mtest4 mtest5)
|
||||
add_executable(${_test} ${_test}.c)
|
||||
target_link_libraries(${_test} lmdb)
|
||||
add_test(NAME ${_test}
|
||||
COMMAND ${CMAKE_COMMAND} -DTEST=$<TARGET_FILE:"${_test}" -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/runtest.cmake)
|
||||
endforeach()
|
||||
endif()
|
13
ports/lmdb/cmake/cmake/package-config.cmakein
Normal file
13
ports/lmdb/cmake/cmake/package-config.cmakein
Normal file
@ -0,0 +1,13 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/lmdb-targets.cmake")
|
||||
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR @PACKAGE_INSTALL_INCLUDE_DIR@)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS @PACKAGE_INSTALL_INCLUDE_DIR@)
|
||||
set(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES lmdb)
|
||||
|
||||
string(TOUPPER "${CMAKE_FIND_PACKAGE_NAME}" UPPER_PACKAGE_NAME)
|
||||
|
||||
set(${UPPER_PACKAGE_NAME}_INCLUDE_DIR @PACKAGE_INSTALL_INCLUDE_DIR@)
|
||||
set(${UPPER_PACKAGE_NAME}_INCLUDE_DIRS @PACKAGE_INSTALL_INCLUDE_DIR@)
|
||||
set(${UPPER_PACKAGE_NAME}_LIBRARIES lmdb)
|
3
ports/lmdb/cmake/cmake/runtest.cmake
Normal file
3
ports/lmdb/cmake/cmake/runtest.cmake
Normal file
@ -0,0 +1,3 @@
|
||||
file(MAKE_DIRECTORY testb)
|
||||
execute_process(COMMAND ${TEST})
|
||||
file(REMOVE_RECURSE testdb)
|
58
ports/lmdb/cmake/lmdb.def
Normal file
58
ports/lmdb/cmake/lmdb.def
Normal file
@ -0,0 +1,58 @@
|
||||
LIBRARY lmdb
|
||||
EXPORTS
|
||||
mdb_version
|
||||
mdb_strerror
|
||||
mdb_env_create
|
||||
mdb_env_open
|
||||
mdb_env_copy
|
||||
mdb_env_copyfd
|
||||
mdb_env_copy2
|
||||
mdb_env_copyfd2
|
||||
mdb_env_stat
|
||||
mdb_env_info
|
||||
mdb_env_sync
|
||||
mdb_env_close
|
||||
mdb_env_set_flags
|
||||
mdb_env_get_flags
|
||||
mdb_env_get_path
|
||||
mdb_env_get_fd
|
||||
mdb_env_set_mapsize
|
||||
mdb_env_set_maxreaders
|
||||
mdb_env_get_maxreaders
|
||||
mdb_env_set_maxdbs
|
||||
mdb_env_get_maxkeysize
|
||||
mdb_env_set_userctx
|
||||
mdb_env_get_userctx
|
||||
mdb_env_set_assert
|
||||
mdb_txn_begin
|
||||
mdb_txn_env
|
||||
mdb_txn_id
|
||||
mdb_txn_commit
|
||||
mdb_txn_abort
|
||||
mdb_txn_reset
|
||||
mdb_txn_renew
|
||||
mdb_dbi_open
|
||||
mdb_stat
|
||||
mdb_dbi_flags
|
||||
mdb_dbi_close
|
||||
mdb_drop
|
||||
mdb_set_compare
|
||||
mdb_set_dupsort
|
||||
mdb_set_relfunc
|
||||
mdb_set_relctx
|
||||
mdb_get
|
||||
mdb_put
|
||||
mdb_del
|
||||
mdb_cursor_open
|
||||
mdb_cursor_close
|
||||
mdb_cursor_renew
|
||||
mdb_cursor_txn
|
||||
mdb_cursor_dbi
|
||||
mdb_cursor_get
|
||||
mdb_cursor_put
|
||||
mdb_cursor_del
|
||||
mdb_cursor_count
|
||||
mdb_cmp
|
||||
mdb_dcmp
|
||||
mdb_reader_list
|
||||
mdb_reader_check
|
58
ports/lmdb/cmake/lmdbd.def
Normal file
58
ports/lmdb/cmake/lmdbd.def
Normal file
@ -0,0 +1,58 @@
|
||||
LIBRARY lmdbd
|
||||
EXPORTS
|
||||
mdb_version
|
||||
mdb_strerror
|
||||
mdb_env_create
|
||||
mdb_env_open
|
||||
mdb_env_copy
|
||||
mdb_env_copyfd
|
||||
mdb_env_copy2
|
||||
mdb_env_copyfd2
|
||||
mdb_env_stat
|
||||
mdb_env_info
|
||||
mdb_env_sync
|
||||
mdb_env_close
|
||||
mdb_env_set_flags
|
||||
mdb_env_get_flags
|
||||
mdb_env_get_path
|
||||
mdb_env_get_fd
|
||||
mdb_env_set_mapsize
|
||||
mdb_env_set_maxreaders
|
||||
mdb_env_get_maxreaders
|
||||
mdb_env_set_maxdbs
|
||||
mdb_env_get_maxkeysize
|
||||
mdb_env_set_userctx
|
||||
mdb_env_get_userctx
|
||||
mdb_env_set_assert
|
||||
mdb_txn_begin
|
||||
mdb_txn_env
|
||||
mdb_txn_id
|
||||
mdb_txn_commit
|
||||
mdb_txn_abort
|
||||
mdb_txn_reset
|
||||
mdb_txn_renew
|
||||
mdb_dbi_open
|
||||
mdb_stat
|
||||
mdb_dbi_flags
|
||||
mdb_dbi_close
|
||||
mdb_drop
|
||||
mdb_set_compare
|
||||
mdb_set_dupsort
|
||||
mdb_set_relfunc
|
||||
mdb_set_relctx
|
||||
mdb_get
|
||||
mdb_put
|
||||
mdb_del
|
||||
mdb_cursor_open
|
||||
mdb_cursor_close
|
||||
mdb_cursor_renew
|
||||
mdb_cursor_txn
|
||||
mdb_cursor_dbi
|
||||
mdb_cursor_get
|
||||
mdb_cursor_put
|
||||
mdb_cursor_del
|
||||
mdb_cursor_count
|
||||
mdb_cmp
|
||||
mdb_dcmp
|
||||
mdb_reader_list
|
||||
mdb_reader_check
|
3932
ports/lmdb/lmdb_45a88275d2a410e683bae4ef44881e0f55fa3c4d.patch
Normal file
3932
ports/lmdb/lmdb_45a88275d2a410e683bae4ef44881e0f55fa3c4d.patch
Normal file
File diff suppressed because it is too large
Load Diff
33
ports/lmdb/portfile.cmake
Normal file
33
ports/lmdb/portfile.cmake
Normal file
@ -0,0 +1,33 @@
|
||||
include(vcpkg_common_functions)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lmdb-LMDB_0.9.18/libraries/liblmdb)
|
||||
vcpkg_download_distfile(ARCHIVE_FILE
|
||||
URLS "https://github.com/LMDB/lmdb/archive/LMDB_0.9.18.zip"
|
||||
FILENAME "LMDB_0.9.18.zip"
|
||||
SHA512 46d7ba226af05443c871f83c6ae0ab2ddbeecd289df59c082e806e135fcaa69d9d9060a19a4a907c4f7046de30871126e91e540eca27fc94446e95ba5616155b
|
||||
)
|
||||
vcpkg_extract_source_archive(${ARCHIVE_FILE})
|
||||
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/lmdb-LMDB_0.9.18
|
||||
PATCHES ${CMAKE_CURRENT_LIST_DIR}/lmdb_45a88275d2a410e683bae4ef44881e0f55fa3c4d.patch
|
||||
)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/cmake/ DESTINATION ${SOURCE_PATH})
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
OPTIONS_DEBUG
|
||||
-DLMDB_INSTALL_HEADERS=OFF
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/debug/share/lmdb/lmdb-targets-debug.cmake LMDB_DEBUG_MODULE)
|
||||
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" LMDB_DEBUG_MODULE "${LMDB_DEBUG_MODULE}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/lmdb/lmdb-targets-debug.cmake "${LMDB_DEBUG_MODULE}")
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
|
||||
file(INSTALL ${SOURCE_PATH}/COPYRIGHT DESTINATION ${CURRENT_PACKAGES_DIR}/share/lmdb RENAME copyright)
|
||||
|
||||
vcpkg_copy_pdbs()
|
Loading…
Reference in New Issue
Block a user