forked from nickbruun/hayai
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconanfile.py
37 lines (32 loc) · 1.48 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
from conans import ConanFile, CMake, tools
import os
class HayaiConan(ConanFile):
name = "Hayai"
version = "1.0.1"
license = "LICENSE.md"
url = "https://github.com/ebostijancic/hayai.git"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = "shared=False"
generators = "cmake"
def source(self):
self.run("git clone https://github.com/ebostijancic/hayai.git")
self.run("cd hayai && git checkout v1.0.1")
# This small hack might be useful to guarantee proper /MT /MD linkage in MSVC
# if the packaged project doesn't have variables to set it properly
tools.replace_in_file("hayai/CMakeLists.txt", "PROJECT(hayai)", '''PROJECT(hayai)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()''')
def build(self):
cmake = CMake(self.settings)
shared = "-DBUILD_SHARED_LIBS=ON" if self.options.shared else ""
self.run('cmake hayai %s %s' % (cmake.command_line, shared))
self.run("cmake --build . %s" % cmake.build_config)
def package(self):
self.copy("*.h", dst="include/hayai", src="hayai/src")
self.copy("*.hpp", dst="include/hayai", src="hayai/src", keep_path=False)
self.copy("*.dll", dst="bin", keep_path=False)
self.copy("*.so", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", src="src", keep_path=False)
def package_info(self):
self.cpp_info.libs = ["hayai", "hayai_main"]