|
| 1 | +from conans import ConanFile, CMake, tools |
| 2 | + |
| 3 | + |
| 4 | +class FixedStringConan(ConanFile): |
| 5 | + name = "fixed_string" |
| 6 | + version = "1.0" |
| 7 | + license = "MIT License" |
| 8 | + author = "Daniil Dudkin" |
| 9 | + url = "https://github.com/unterumarmung/fixed_string" |
| 10 | + description = "C++ library that provides a basic_fixed_string template that combines std::array fixed-size semantic and std::string semantic together" |
| 11 | + topics = ("cpp17", "string", "constexpr") |
| 12 | + settings = "os", "compiler", "build_type", "arch" |
| 13 | + options = {"build_tests": [True, False],"build_examples":[True,False]} |
| 14 | + default_options = {"build_tests": False,"build_examples":False} |
| 15 | + generators = "cmake" |
| 16 | + |
| 17 | + def source(self): |
| 18 | + self.run("git clone https://github.com/unterumarmung/fixed_string.git") |
| 19 | + |
| 20 | + def build(self): |
| 21 | + cmake = CMake(self) |
| 22 | + cmake.verbose = True |
| 23 | + cmake.definitions["FIXED_STRING_OPT_BUILD_EXAMPLES"] = self.options.build_examples |
| 24 | + cmake.definitions["FIXED_STRING_OPT_BUILD_TESTS"] = self.options.build_tests |
| 25 | + |
| 26 | + cmake.configure(source_folder="fixed_string") |
| 27 | + cmake.build() |
| 28 | + if self.options.build_tests: |
| 29 | + print("Running tests...") |
| 30 | + cmake.test() |
| 31 | + |
| 32 | + |
| 33 | + def package(self): |
| 34 | + self.copy("*.h", dst="include", src="fixed_string/include") |
| 35 | + self.copy("*.hpp", dst="include", src="fixed_string/include") |
| 36 | + |
| 37 | + def package_info(self): |
| 38 | + self.cpp_info.libs = ["fixed_string"] |
| 39 | + |
0 commit comments