forked from yandex/ozo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add basic conan file - emulate cmake_find_package behaviour - use dynamic version for now - update resource_pool with latest conan updates - hotfix for yandex#281
- Loading branch information
1 parent
8a65976
commit 5d859ca
Showing
8 changed files
with
150 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from conans import ConanFile, CMake | ||
from conans.tools import load | ||
import re | ||
|
||
|
||
def get_version(): | ||
try: | ||
content = load("CMakeLists.txt") | ||
version = re.search(r"^\s*project\(ozo\s+VERSION\s+([^\s)]+)", content, re.M).group(1) | ||
return version.strip() | ||
except Exception: | ||
return None | ||
|
||
|
||
class Ozo(ConanFile): | ||
name = 'ozo' | ||
version = get_version() | ||
license = 'MIT' | ||
url = 'https://github.com/yandex/ozo' | ||
description = 'Conan package for yandex ozo' | ||
|
||
exports_sources = 'include/*', 'CMakeLists.txt', 'cmake/*', 'LICENCE', 'AUTHORS' | ||
|
||
generators = 'cmake_find_package' | ||
requires = ('boost/1.74.0', 'resource_pool/0.1.0', 'libpq/13.1') | ||
|
||
def _configure_cmake(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
return cmake | ||
|
||
def build(self): | ||
cmake = self._configure_cmake() | ||
cmake.build() | ||
|
||
def package(self): | ||
cmake = self._configure_cmake() | ||
cmake.install() | ||
|
||
def package_id(self): | ||
self.info.header_only() | ||
|
||
def package_info(self): | ||
self.cpp_info.components["_ozo"].includedirs = ["include"] | ||
self.cpp_info.components["_ozo"].requires = ["boost::boost", "boost::system", "boost::thread", "boost::coroutine", | ||
"resource_pool::resource_pool", # == elsid::resource_pool in cmake | ||
"libpq::pq", # == PostgreSQL::PostgreSQL in cmake | ||
] | ||
self.cpp_info.components["_ozo"].defines = ["BOOST_COROUTINES_NO_DEPRECATION_WARNING", "BOOST_HANA_CONFIG_ENABLE_STRING_UDL", "BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT"] | ||
|
||
self.cpp_info.filenames["cmake_find_package"] = "ozo" | ||
self.cpp_info.filenames["cmake_find_package_multi"] = "ozo" | ||
self.cpp_info.names["cmake_find_package"] = "yandex" | ||
self.cpp_info.names["cmake_find_package_multi"] = "yandex" | ||
self.cpp_info.components["_ozo"].names["cmake_find_package"] = "ozo" | ||
self.cpp_info.components["_ozo"].names["cmake_find_package_multi"] = "ozo" |
Submodule resource_pool
updated
16 files
+21 −8 | .travis.yml | |
+18 −0 | README.md | |
+12 −3 | conanfile.py | |
+1 −0 | include/CMakeLists.txt | |
+11 −0 | include/yamail/resource_pool/async/detail/pool_impl.hpp | |
+4 −0 | include/yamail/resource_pool/async/pool.hpp | |
+1 −0 | include/yamail/resource_pool/detail/idle.hpp | |
+33 −0 | include/yamail/resource_pool/detail/storage.hpp | |
+18 −3 | include/yamail/resource_pool/sync/detail/pool_impl.hpp | |
+4 −0 | include/yamail/resource_pool/sync/pool.hpp | |
+3 −3 | scripts/travis/conan.sh | |
+2 −2 | test_package/CMakeLists.txt | |
+1 −1 | test_package/conanfile.py | |
+1 −1 | tests/CMakeLists.txt | |
+103 −22 | tests/async/pool_impl.cc | |
+69 −0 | tests/sync/pool_impl.cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
FROM ubuntu:18.04 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y apt-transport-https ca-certificates gnupg software-properties-common wget | ||
|
||
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add - | ||
|
||
RUN apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
ccache \ | ||
clang-10 \ | ||
cmake \ | ||
python3-pip \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& pip3 install conan | ||
|
||
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-10 100 \ | ||
&& update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-10 100 \ | ||
&& CC=clang CXX=clang++ conan profile new default --detect | ||
|
||
VOLUME /ccache | ||
VOLUME /code | ||
|
||
WORKDIR /code | ||
|
||
ENV CCACHE_DIR=/ccache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
project(PackageTest CXX) | ||
|
||
find_package(ozo REQUIRED) | ||
|
||
add_executable(example ../examples/connection_pool.cpp) | ||
target_compile_features(example PRIVATE cxx_std_17) | ||
target_link_libraries(example PRIVATE yandex::ozo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from conans import ConanFile, CMake | ||
|
||
|
||
class OzoTestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake_find_package" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
# Current dir is "test_package/build/<build_id>" and CMakeLists.txt is | ||
# in "test_package" | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def imports(self): | ||
self.copy("*.dll", dst="bin", src="bin") | ||
self.copy("*.dylib*", dst="bin", src="lib") | ||
self.copy('*.so*', dst='bin', src='lib') | ||
|
||
def test(self): | ||
pass # Building alone is sufficient |