-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
conan 2 support (and the removal of ctti
- Loading branch information
Showing
23 changed files
with
173 additions
and
173 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 |
---|---|---|
@@ -1,29 +1,54 @@ | ||
from conan import ConanFile, tools | ||
from conan.tools.layout import basic_layout | ||
from conan.tools.files import copy | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.build import check_min_cppstd | ||
import os | ||
|
||
from conans import ConanFile, tools | ||
|
||
|
||
class CxxmetricsConan(ConanFile): | ||
name = "cxxmetrics" | ||
version = "0.0.8" | ||
description = ( | ||
"A smallish header-only C++14 library inspired by dropwizard metrics (codahale)" | ||
) | ||
license = "Apache 2.0" | ||
settings = "os" | ||
url = "https://github.com/kmaragon/cxxmetrics" | ||
description = "A smallish header-only C++14 library inspired by dropwizard metrics (codahale)" | ||
requires = "ctti/0.0.1@manu343726/testing" | ||
options = { "prometheus": [True, False] } | ||
default_options = "prometheus=True" | ||
exports_sources = "cxxmetrics*" | ||
settings = ("compiler", "os") | ||
options = { "with_prometheus": [True, False] } | ||
default_options = { "with_prometheus": True } | ||
package_type = "header-library" | ||
exports_sources = "CMakeLists.txt", "cxxmetrics*" | ||
no_copy_source = True | ||
# No settings/options are necessary, this is header only | ||
|
||
@property | ||
def _min_cppstd(self): | ||
return "14" | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder=".") | ||
|
||
def validate(self): | ||
if self.settings.compiler.get_safe("cppstd"): | ||
check_min_cppstd(self, self._min_cppstd) | ||
|
||
def requirements(self): | ||
pass | ||
|
||
def package(self): | ||
self.copy("*.hpp", src="cxxmetrics", dst="include/cxxmetrics") | ||
if self.options.prometheus: | ||
self.copy("*.hpp", src="cxxmetrics_prometheus", dst="include/cxxmetrics_prometheus") | ||
copy(self, | ||
"*.hpp", | ||
os.path.join(self.source_folder, "cxxmetrics"), | ||
os.path.join(self.package_folder, "include/cxxmetrics")) | ||
if self.options.with_prometheus: | ||
copy(self, | ||
"*.hpp", | ||
os.path.join(self.source_folder, "cxxmetrics_prometheus"), | ||
os.path.join(self.package_folder, "include/cxxmetrics_prometheus")) | ||
|
||
def package_info(self): | ||
self.cpp_info.includedirs = ['include'] | ||
self.cpp_info.set_property("cmake_file_name", "cxxmetrics") | ||
self.cpp_info.components["cxxmetrics"].names["cmake_find_package"] = "cxxmetrics" | ||
self.cpp_info.components["cxxmetrics"].includedirs = ['include'] | ||
|
||
if self.settings.os == 'Linux': | ||
self.cpp_info.libs = ["atomic"] | ||
self.cpp_info.components["cxxmetrics"].system_libs = ["atomic"] | ||
|
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
Empty file.
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
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 |
---|---|---|
@@ -1,30 +1,27 @@ | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
|
||
class CxxmetricsTestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
exports = "CMakeLists.txt", "../test*" | ||
build_requires = "catch2/2.13.9" | ||
generators = "CMakeDeps", "CMakeToolchain" | ||
|
||
def source(self): | ||
tools.replace_in_file("CMakeLists.txt", "project(\"cxxmetrics_test\" CXX)", '''project("cxxmetrics_test" CXX) | ||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS NO_OUTPUT_DIRS)''') | ||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
self.requires("catch2/3.7.1") | ||
|
||
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 layout(self): | ||
cmake_layout(self) | ||
|
||
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 build(self): | ||
if can_run(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
self.run(".%scxxmetrics_test" % os.sep) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindir, "cxxmetrics_test") | ||
self.run(bin_path, env="conanrun") |
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
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
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.