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:
8
LevelDB/test_package/CMakeLists.txt
Normal file
8
LevelDB/test_package/CMakeLists.txt
Normal 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})
|
31
LevelDB/test_package/conanfile.py
Normal file
31
LevelDB/test_package/conanfile.py
Normal 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)
|
13
LevelDB/test_package/example.cpp
Normal file
13
LevelDB/test_package/example.cpp
Normal 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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user