forked from sdukshis/otus-cpp-ci-cd
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconanfile.py
43 lines (36 loc) · 1.51 KB
/
conanfile.py
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
from conans import ConanFile, CMake
class HelloConan(ConanFile):
name = "hello"
version = "0.1"
license = "None"
author = "Pavel Filonov [email protected]"
url = "https://github.com/sdukshis/otus-cpp-ci-cd"
description = "C++ course CI/CD example"
topics = ("<Put some tag here>", "<here>", "<and here>")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
generators = "cmake"
exports_sources = "src/*", "CMakeLists.txt", "version.h.in", "cmake/*"
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
# Explicit way:
# self.run('cmake %s/hello %s'
# % (self.source_folder, cmake.command_line))
# self.run("cmake --build . %s" % cmake.build_config)
def package(self):
self.copy("*.h", dst="include", src="src")
self.copy("*.lib", dst="lib", keep_path=False)
self.copy("*.dll", dst="bin", keep_path=False)
self.copy("*.dylib*", dst="lib", keep_path=False)
self.copy("*.so", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.libs = ["hello"]
if self.settings.compiler in ["gcc", "clang", "apple-clang"]:
self.cpp_info.cxxflags = ["-std=c++17"]