Skip to content

Commit

Permalink
conan: Editable packages for all libs
Browse files Browse the repository at this point in the history
  • Loading branch information
KristianJerpetjon committed Feb 18, 2019
1 parent 6b71725 commit c8fe3f7
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 11 deletions.
6 changes: 2 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ set(CMAKE_CXX_EXTENSIONS OFF)
option(LIVEUPDATE "Enable liveupdate" ON)
option(TLS "Enable secure connections" ON)

if(CONAN_EXPORTED) # in conan local cache
# standard conan installation, deps will be defined in conanfile.py
# and not necessary to call conan again, conan is already running
include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
endif()
include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_definitions(-DARCH_${ARCH})
add_definitions(-DARCH="${ARCH}")
Expand Down
72 changes: 72 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#README to build botan 2.8.0 use conan create (botan/2.8.0@user/channel) path to this file
import shutil

from conans import ConanFile,tools,CMake

class MicroLBConan(ConanFile):
settings= "os","arch","build_type","compiler"
name = "microlb"
license = 'Apache-2.0'
description = 'Run your application with zero overhead'
generators = 'cmake'
url = "http://www.includeos.org/"
version='0.13.0'

default_user="includeos"
default_channel="test"

options={
"liveupdate":[True,False],
"tls": [True,False]
}
default_options={
"liveupdate":True,
"tls":True
}
def requirements(self):
if (self.options.liveupdate):
self.requires("liveupdate/{}@{}/{}".format(self.version,self.user,self.channel))
if (self.options.tls):
#this will put a dependency requirement on openssl
self.requires("s2n/1.1.1@{}/{}".format(self.user,self.channel))

def build_requirements(self):
#these are header only so we dont need them down the value chain
self.build_requires("rapidjson/1.1.0@{}/{}".format(self.user,self.channel))
self.build_requires("GSL/2.0.0@{}/{}".format(self.user,self.channel))

def source(self):
repo = tools.Git(folder="includeos")
repo.clone("https://github.com/hioa-cs/IncludeOS.git",branch="conan")

def _arch(self):
return {
"x86":"i686",
"x86_64":"x86_64"
}.get(str(self.settings.arch))
def _cmake_configure(self):
cmake = CMake(self)
cmake.definitions['ARCH']=self._arch()
cmake.definitions['LIVEUPDATE']=self.options.liveupdate
cmake.definitions['TLS']=self.options.tls
cmake.configure(source_folder=self.source_folder+"/includeos/lib/microLB")
return cmake

def build(self):
cmake = self._cmake_configure()
cmake.build()

def package(self):
cmake = self._cmake_configure()
cmake.install()

def package_info(self):
self.cpp_info.libs=['microlb']

def deploy(self):
#for editable we need the 2 first
self.copy("*.a",dst="lib",src="build/lib")
self.copy("*.hpp",dst="include",src="micro_lb")

self.copy("*.a",dst="lib",src="lib")
self.copy("*",dst="include",src="include")
5 changes: 5 additions & 0 deletions layout.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[includedirs]
micro_lb

[libdirs]
build/lib
11 changes: 4 additions & 7 deletions micro_lb/balancer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,9 @@ namespace microLB
struct Session {
Session(Nodes&, int idx, net::Stream_ptr in, net::Stream_ptr out);
bool is_alive() const;
<<<<<<< HEAD
void handle_timeout();
void timeout(Nodes&);
#if defined(LIVEUPDATE)
=======
>>>>>>> ps3
void serialize(liu::Storage&);
#endif
Nodes& parent;
Expand Down Expand Up @@ -114,7 +111,7 @@ namespace microLB
void close_all_sessions();
#if defined(LIVEUPDATE)
void serialize(liu::Storage&);
void deserialize(netstack_t& in, netstack_t& out, liu::Restore&);
void deserialize(liu::Restore&, DeserializationHelper&);
#endif
// make the microLB more testable
delegate<void(int idx, int current, int total)> on_session_close = nullptr;
Expand Down Expand Up @@ -147,14 +144,15 @@ namespace microLB
static node_connect_function_t connect_with_tcp(netstack_t& interface, net::Socket);
// Setup and automatic resume (if applicable)
// NOTE: Be sure to have configured it properly BEFORE calling this
void init_liveupdate();

int wait_queue() const;
int connect_throws() const;
// add a client stream to the load balancer
// NOTE: the stream must be connected prior to calling this function
void incoming(net::Stream_ptr);

#if defined(LIVEUPDATE)
void init_liveupdate();
void serialize(liu::Storage&, const liu::buffer_t*);
void resume_callback(liu::Restore&);
#endif
Expand All @@ -167,8 +165,7 @@ namespace microLB
void handle_connections();
void handle_queue();
#if defined(LIVEUPDATE)
void init_liveupdate();
void deserialize(liu::Restore&);
void deserialize(liu::Restore&);
#endif
std::vector<net::Socket> parse_node_confg();

Expand Down

0 comments on commit c8fe3f7

Please sign in to comment.