Skip to content

Commit 9119b13

Browse files
committed
Enable OLP_SDK_ENABLE_DEFAULT_CACHE_LMDB flag
lmdb is added to external libraries. CMakeLists.txt.lmdb.in and lmdbConfig.cmake.in was created for lmdb. Changes in olp-cpp-sdk-core and external CMakeLists.txt was made. Added OLP_SDK_ENABLE_DEFAULT_CACHE_LMDB option to be able to enable/disable build of lmdb. README.md was changed with description of a new flag. Relates-To: OLPEDGE-2645 Signed-off-by: Yevhen Krasilnyk <ext-yevhen.krasilnyk@here.com>
1 parent 6c08481 commit 9119b13

File tree

7 files changed

+20
-3
lines changed

7 files changed

+20
-3
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ option(OLP_SDK_BUILD_EXTERNAL_DEPS "Download and build external dependencies" ON
4242
option(OLP_SDK_BUILD_EXAMPLES "Enable examples targets" OFF)
4343
option(OLP_SDK_MSVC_PARALLEL_BUILD_ENABLE "Enable parallel build on MSVC" ON)
4444
option(OLP_SDK_DISABLE_DEBUG_LOGGING "Disable debug and trace level logging" OFF)
45-
option(OLP_SDK_ENABLE_DEFAULT_CACHE "Enable default cache implementation" ON)
46-
option(OLP_SDK_ENABLE_DEFAULT_CACHE_LMDB "Enable default cache implementation based on LMDB" OFF)
45+
option(OLP_SDK_ENABLE_DEFAULT_CACHE "Enable default cache implementation based on LevelDB" OFF)
46+
option(OLP_SDK_ENABLE_DEFAULT_CACHE_LMDB "Enable default cache implementation based on LMDB" ON)
4747

4848
# C++ standard version. Minimum supported version is 11.
4949
set(CMAKE_CXX_STANDARD 11)

examples/android/app/CMakeLists.txt.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ find_package(olp-cpp-sdk-dataservice-write REQUIRED)
4040
find_package(leveldb REQUIRED)
4141
find_package(Threads REQUIRED)
4242

43+
if(OLP_SDK_ENABLE_DEFAULT_CACHE_LMDB)
44+
find_package(lmdb REQUIRED)
45+
endif()
46+
4347
add_library(@OLP_SDK_EXAMPLE_TARGET_NAME@ SHARED
4448
${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/Examples.h
4549
${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/ReadExample.h

examples/android/app/build.gradle.in

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ android {
2121
// 2. OLP_SDK_HTTP_CLIENT_JAR - path to the OlpHttpClient.jar file; usually it stored in the <olp-build-folder>/olp-cpp-sdk-core/
2222
// 3. (If not installed to the sysroot) path to the levelDB library:
2323
// - leveldb_DIR;
24-
// 4. (If not installed to the sysroot) - path to the OLP SDK cmake config files:
24+
// 4. (If not installed to the sysroot) path to the lmdb library:
25+
// - lmdb_DIR;
26+
// 5. (If not installed to the sysroot) - path to the OLP SDK cmake config files:
2527
// - olp-cpp-sdk-core_DIR;
2628
// - olp-cpp-sdk-dataservice-write_DIR;
2729
// - olp-cpp-sdk-authentication_DIR
2830
arguments "@OLP_SDK_EXAMPLE_ANDROID_TOOLCHAIN_FILE@",
2931
"@OLP_SDK_EXAMPLE_HTTP_CLIENT_JAR@",
3032
"@OLP_SDK_EXAMPLE_LEVELDB_DIR@",
33+
"@OLP_SDK_EXAMPLE_LMDB_DIR@",
3134
// required for finding installed packages in sysroot
3235
"-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH",
3336
"-DBOOST_ROOT=@BOOST_ROOT@",

examples/cmake/gen_android_example.cmake.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ function(gen_android_example_application
6060
if (DEFINED leveldb_DIR)
6161
set(OLP_SDK_EXAMPLE_LEVELDB_DIR "-Dleveldb_DIR=${leveldb_DIR}")
6262
endif()
63+
64+
if(OLP_SDK_ENABLE_DEFAULT_CACHE_LMDB)
65+
set(OLP_SDK_EXAMPLE_LMDB_DIR "-Dlmdb_DIR='path to the directory which contains LMDB cmake config files'")
66+
if (DEFINED lmdb_DIR)
67+
set(OLP_SDK_EXAMPLE_LMDB_DIR "-Dlmdb_DIR=${lmdb_DIR}")
68+
endif()
69+
endif()
6370

6471
configure_file(
6572
${CMAKE_CURRENT_SOURCE_DIR}/android/app/build.gradle.in

external/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ if(OLP_SDK_ENABLE_DEFAULT_CACHE_LMDB)
8282
find_package(lmdb QUIET)
8383
if(NOT TARGET lmdb AND NOT lmdb_FOUND)
8484
add_subdirectory(lmdb)
85+
set(lmdb_DIR ${EXTERNAL_lmdb_DIR} PARENT_SCOPE)
8586
set(lmdb_INCLUDE_DIR ${EXTERNAL_lmdb_INCLUDE_DIR} PARENT_SCOPE)
8687
endif()
8788
endif()

external/lmdb/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,5 @@ if(result)
4545
endif()
4646

4747
# Provide the dir to the lmdb cmake configuration files
48+
set(EXTERNAL_lmdb_DIR ${EXTERNAL_BINARY_INSTALL_DIR}/lib/cmake/lmdb PARENT_SCOPE)
4849
set(EXTERNAL_lmdb_INCLUDE_DIR ${EXTERNAL_BINARY_INSTALL_DIR}/include PARENT_SCOPE)

scripts/linux/psv/build_psv_no_cache.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ cd build
2323
cmake \
2424
-DOLP_SDK_ENABLE_TESTING=OFF \
2525
-DOLP_SDK_ENABLE_DEFAULT_CACHE=OFF \
26+
-DOLP_SDK_ENABLE_DEFAULT_CACHE_LMDB=OFF \
2627
-DBUILD_SHARED_LIBS=ON \
2728
..
2829

0 commit comments

Comments
 (0)