|
| 1 | +from conans import ConanFile, CMake |
| 2 | + |
| 3 | +##################################################### |
| 4 | +# Temporarily using nlohmann_json until we can make # |
| 5 | +# our own parser # |
| 6 | +##################################################### |
| 7 | + |
| 8 | +class ReplAPIItConan(ConanFile): |
| 9 | + name = "ReplAPI.it" |
| 10 | + version = "0.1" |
| 11 | + license = "GPL 3.0" |
| 12 | + author = "<Put your name here> <And your email here>" |
| 13 | + url = "https://github.com/ReplAPI-it/ReplAPI.it-C" |
| 14 | + description = "Wrapper for Repl.it APIs for C++" |
| 15 | + topics = ("replit", "graphql", "api") |
| 16 | + settings = "os", "compiler", "build_type", "arch" |
| 17 | + options = {"shared": [True, False], "fPIC": [True, False]} |
| 18 | + default_options = {"shared": False, "fPIC": True} |
| 19 | + generators = "cmake" |
| 20 | + exports_sources = "src/*" |
| 21 | + requires = ("cpr/1.6.2", "nlohmann_json/3.9.1") |
| 22 | + |
| 23 | + def config_options(self): |
| 24 | + if self.settings.os == "Windows": |
| 25 | + del self.options.fPIC |
| 26 | + |
| 27 | + def build(self): |
| 28 | + cmake = CMake(self) |
| 29 | + cmake.configure(source_folder="src") |
| 30 | + cmake.build() |
| 31 | + |
| 32 | + # Explicit way: |
| 33 | + # self.run('cmake %s/hello %s' |
| 34 | + # % (self.source_folder, cmake.command_line)) |
| 35 | + # self.run("cmake --build . %s" % cmake.build_config) |
| 36 | + |
| 37 | + def package(self): |
| 38 | + self.copy("*.h", dst="include", src="src") |
| 39 | + self.copy("*.lib", dst="lib", keep_path=False) |
| 40 | + self.copy("*.dll", dst="bin", keep_path=False) |
| 41 | + self.copy("*.dylib*", dst="lib", keep_path=False) |
| 42 | + self.copy("*.so", dst="lib", keep_path=False) |
| 43 | + self.copy("*.a", dst="lib", keep_path=False) |
| 44 | + |
| 45 | + def package_info(self): |
| 46 | + self.cpp_info.libs = ["ReplAPIit"] |
0 commit comments