Files
toge 0b597cc868 (#20775) kaitai_struct_cpp_stl_runtime: add version 0.10.1
* kaitai_struct_cpp_stl_runtime: add version 0.10.1

* link math lib

* add patch_source
2023-11-02 17:15:00 +01:00

69 lines
2.1 KiB
Python

from conan import ConanFile
from conan.tools.files import get, copy, export_conandata_patches, apply_conandata_patches
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
import os
required_conan_version = ">=1.53.0"
class KaitaiStructCppStlRuntimeConan(ConanFile):
name = "kaitai_struct_cpp_stl_runtime"
description = "kaitai struct c++ runtime library"
license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://kaitai.io/"
topics = ("parsers", "streams", "dsl", "kaitai struct")
package_type = "shared-library"
settings = "os", "arch", "compiler", "build_type"
options = {
"with_zlib": [True, False],
"with_iconv": [True, False],
}
default_options = {
"with_zlib": False,
"with_iconv": False,
}
short_paths = True
def export_sources(self):
export_conandata_patches(self)
def layout(self):
cmake_layout(self, src_folder="src")
def requirements(self):
if self.options.with_zlib:
self.requires("zlib/[>=1.2.11 <2]")
if self.options.with_iconv:
self.requires("libiconv/1.17")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
if self.options.with_iconv:
tc.variables["STRING_ENCODING_TYPE"] = "ICONV"
else:
tc.variables["STRING_ENCODING_TYPE"] = "NONE"
tc.variables["BUILD_TESTS"] = False
tc.generate()
deps = CMakeDeps(self)
deps.generate()
def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.libs = ["kaitai_struct_cpp_stl_runtime"]
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("m")