7
0
mirror of https://github.com/Minres/conan-recipes.git synced 2025-07-01 23:43:25 +02:00

Added LevelDB package

This commit is contained in:
2018-10-30 17:29:48 +01:00
parent f5b39e0678
commit a7a465e69c
6 changed files with 126 additions and 0 deletions

View File

@ -0,0 +1,8 @@
PROJECT(PackageTest)
cmake_minimum_required(VERSION 2.8.12)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
ADD_EXECUTABLE(example example.cpp)
TARGET_LINK_LIBRARIES(example ${CONAN_LIBS})

View File

@ -0,0 +1,31 @@
from conans import ConanFile, CMake
import os
channel = os.getenv("CONAN_CHANNEL", "stable")
username = os.getenv("CONAN_USERNAME", "minres")
class LeveldbTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = "shared=True"
requires = "LevelDB/1.20@%s/%s" % (username, channel)
generators = "cmake"
def configure(self):
self.options["LevelDB"].shared = self.options.shared
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def imports(self):
self.copy("*.dll", "bin", "bin")
self.copy("*.so", "lib", "bin")
self.copy("*.dylib", "lib", "bin")
def test(self):
os.chdir("bin")
self.run("LD_LIBRARY_PATH=$(pwd) && .%sexample" % os.sep)

View File

@ -0,0 +1,13 @@
#include "leveldb/db.h"
int main() {
leveldb::DB* db;
leveldb::Options options;
options.create_if_missing = true;
leveldb::Status status = leveldb::DB::Open(options, "/tmp/testdb", &db);
if(status.ok()){
return 0;
}
return -1;
}