File tree Expand file tree Collapse file tree 7 files changed +20
-3
lines changed Expand file tree Collapse file tree 7 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -42,8 +42,8 @@ option(OLP_SDK_BUILD_EXTERNAL_DEPS "Download and build external dependencies" ON
4242option (OLP_SDK_BUILD_EXAMPLES "Enable examples targets" OFF )
4343option (OLP_SDK_MSVC_PARALLEL_BUILD_ENABLE "Enable parallel build on MSVC" ON )
4444option (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.
4949set (CMAKE_CXX_STANDARD 11)
Original file line number Diff line number Diff line change @@ -40,6 +40,10 @@ find_package(olp-cpp-sdk-dataservice-write REQUIRED)
4040find_package(leveldb REQUIRED)
4141find_package(Threads REQUIRED)
4242
43+ if(OLP_SDK_ENABLE_DEFAULT_CACHE_LMDB)
44+ find_package(lmdb REQUIRED)
45+ endif()
46+
4347add_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
Original file line number Diff line number Diff 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@",
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ()
8788endif ()
Original file line number Diff line number Diff line change @@ -45,4 +45,5 @@ if(result)
4545endif ()
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)
4849set (EXTERNAL_lmdb_INCLUDE_DIR ${EXTERNAL_BINARY_INSTALL_DIR} /include PARENT_SCOPE)
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ cd build
2323cmake \
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
You can’t perform that action at this time.
0 commit comments