|
| 1 | +from pathlib import Path |
| 2 | + |
| 3 | +from conans import CMake, ConanFile, tools |
| 4 | +from conans.errors import ConanInvalidConfiguration |
| 5 | + |
| 6 | + |
| 7 | +class VtdApiConan(ConanFile): |
| 8 | + name = "vtd-api" |
| 9 | + version = "2022.3" |
| 10 | + license = "Proprietary" |
| 11 | + url = "https://vires.mscsoftware.com" |
| 12 | + no_copy_source = False |
| 13 | + description = "Include binary files in C/C++" |
| 14 | + topics = ("simulator", "vires") |
| 15 | + settings = "os", "compiler", "build_type", "arch" |
| 16 | + keep_imports = True |
| 17 | + exports_sources = [ |
| 18 | + "CMakeLists.txt", |
| 19 | + ] |
| 20 | + options = { |
| 21 | + "shared": [True, False], |
| 22 | + "fPIC": [True, False], |
| 23 | + } |
| 24 | + default_options = { |
| 25 | + "shared": False, |
| 26 | + "fPIC": True, |
| 27 | + } |
| 28 | + build_requires = [ |
| 29 | + "vtd/2022.3@cloe-restricted/stable", |
| 30 | + ] |
| 31 | + generators = "cmake" |
| 32 | + |
| 33 | + _cmake = None |
| 34 | + |
| 35 | + def configure(self): |
| 36 | + if self.settings.os == "Windows": |
| 37 | + raise ConanInvalidConfiguration("VTD binaries do not exist for Windows") |
| 38 | + |
| 39 | + def imports(self): |
| 40 | + self.copy("*", dst="src/Develop", src="Develop", root_package="vtd") |
| 41 | + |
| 42 | + def _configure_cmake(self): |
| 43 | + if self._cmake: |
| 44 | + return self._cmake |
| 45 | + self._cmake = CMake(self) |
| 46 | + self._cmake.definitions["CMAKE_EXPORT_COMPILE_COMMANDS"] = True |
| 47 | + #TODO VTD project version, shared-lib.... |
| 48 | + self._cmake.configure() |
| 49 | + return self._cmake |
| 50 | + |
| 51 | + def build(self): |
| 52 | + cmake = self._configure_cmake() |
| 53 | + cmake.build() |
| 54 | + |
| 55 | + def package(self): |
| 56 | + cmake = self._configure_cmake() |
| 57 | + cmake.install() |
| 58 | + self.copy("Develop", src="src", symlinks=True) |
| 59 | + |
| 60 | + def package_info(self): |
| 61 | + if self.in_local_cache: |
| 62 | + self.cpp_info.libs = tools.collect_libs(self) |
| 63 | + else: |
| 64 | + self.cpp_info.libs = ["vtd_api"] |
0 commit comments