Move remaining examples from top-level to example folder and build-system
This commit is contained in:
parent
2e7d278c9b
commit
d27b737234
|
@ -58,6 +58,9 @@ use_package(TARGET_NAME Boost::serialization PACKAGE_NAME Boost PACKAGE_ARGS "${
|
|||
# find catch2 (required by tests)
|
||||
use_package(TARGET_NAME Catch2::Catch2 PACKAGE_NAME Catch2 LIBRARIES_VARIABLE "TEST_LIBRARIES")
|
||||
|
||||
# find threading library (required by examples)
|
||||
use_package(TARGET_NAME Threads::Threads PACKAGE_NAME Threads LIBRARIES_VARIABLE "TEST_LIBRARIES")
|
||||
|
||||
# include modules to apply configuration
|
||||
include(BasicConfig)
|
||||
include(WindowsResources)
|
||||
|
@ -72,7 +75,7 @@ set(TESTS basic typed)
|
|||
foreach (TEST ${TESTS})
|
||||
configure_test_target(TEST_NAME "${TEST}_tests" SRC_FILES "tests/${TEST}.cc" LIBRARIES "${TEST_LIBRARIES}")
|
||||
endforeach ()
|
||||
set(EXAMPLES multi rel resize scale typed)
|
||||
set(EXAMPLES basic multi rel resize scale typed view)
|
||||
foreach (EXAMPLE ${EXAMPLES})
|
||||
configure_test_target(TEST_NAME "${EXAMPLE}_example" SRC_FILES "examples/${EXAMPLE}.cc" LIBRARIES "${TEST_LIBRARIES}")
|
||||
endforeach ()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "lmdb-safe.hh"
|
||||
#include "../lmdb-safe.hh"
|
||||
|
||||
using namespace std;
|
||||
using namespace LMDBSafe;
|
||||
|
@ -16,7 +16,7 @@ void checkLMDB(MDBEnv* env, MDBDbi dbi)
|
|||
|
||||
int main()
|
||||
{
|
||||
auto env = getMDBEnv("./database", 0, 0600);
|
||||
auto env = getMDBEnv("./database", MDB_NOSUBDIR, 0600);
|
||||
auto dbi = env->openDB("example", MDB_CREATE);
|
||||
|
||||
auto txn = env->getRWTransaction();
|
|
@ -1,4 +1,6 @@
|
|||
#include "lmdb-safe.hh"
|
||||
#include "../lmdb-safe.hh"
|
||||
|
||||
#include <c++utilities/application/global.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
@ -7,6 +9,7 @@ using namespace LMDBSafe;
|
|||
|
||||
void countDB(MDBEnv& env, MDBROTransaction& txn, const std::string& dbname)
|
||||
{
|
||||
CPP_UTILITIES_UNUSED(env)
|
||||
auto db = txn->openDB(dbname, 0);
|
||||
auto cursor = txn->getCursor(db);
|
||||
uint32_t count = 0;
|
||||
|
@ -25,7 +28,7 @@ void countDB(MDBEnv& env, MDBROTransaction& txn, const std::string& dbname)
|
|||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
MDBEnv env(argv[1], MDB_RDONLY | MDB_NOSUBDIR, 0600);
|
||||
MDBEnv env(argc >= 2 ? argv[1] : "./database", MDB_RDONLY | MDB_NOSUBDIR, 0600);
|
||||
auto main = env.openDB("", 0);
|
||||
auto txn = env.getROTransaction();
|
||||
|
Loading…
Reference in New Issue