-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconanfile.py
More file actions
59 lines (50 loc) · 2.12 KB
/
conanfile.py
File metadata and controls
59 lines (50 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import os
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.files import replace_in_file, rm
from conan.tools.gnu import Autotools
class StringUtilConan(ConanFile):
name = "libstring_util"
license = "GPLv3"
url = f"https://rmc-github.robotic.dlr.de/common/{name}"
author = "Florian Schmidt <florian.schmidt@dlr.de>"
description = "simple string operations"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
exports_sources = ["*", "!.gitignore"]
generators = "AutotoolsToolchain"
def build(self):
replace_in_file(
self, "project.properties", "VERSION=1.1.7", f"VERSION={self.version.replace('.', ':').replace('-', '')}"
)
self.run("autoreconf -if")
autotools = Autotools(self)
autotools.fpic = self.options.fPIC
if self.options.shared:
args = ["--enable-shared", "--disable-static"]
else:
args = ["--disable-shared", "--enable-static"]
autotools.configure(args=args)
autotools.make(args=["V=1"])
if not can_run(self):
# we are cross compiling,
# just test whether test-program compiles
not_working = (
"x86_64-w64-mingw32",
"i686-w64-mingw32",
) # those are hosts where somehow autotools fails to provide include path as requested in Makefile.am
if os.getenv("CHOST") not in not_working:
autotools.make(target="example", args=["-C", "test/example", "V=1"])
else:
autotools.make(target="check", args=["VERBOSE=1"])
def package(self):
autotools = Autotools(self)
autotools.install()
for file in os.listdir(self.package_folder):
if file.endswith(".la"):
rm(self, os.path.join(self.package_folder, file))
def package_info(self):
self.cpp_info.includedirs = ["include"]
self.cpp_info.libdirs = ["lib", "lib64"]
self.cpp_info.libs = ["string_util"]