This repository has been archived by the owner on Jan 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
60 lines (52 loc) · 2.56 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from conans import ConanFile, CMake, tools
from conans.tools import download, unzip, os_info
import os
class NanaConan(ConanFile):
name = "Nana"
version = "1.5.1"
license = "MIT"
url = "https://github.com/jacmoe/conan-nana"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "png": [True, False], "jpeg": [True, False]}
default_options = "shared=False", "png=False", "jpeg=False"
generators = "cmake"
def system_requirements(self):
if self.settings.os == "Linux":
self.run('sudo apt-get install -y xorg-dev libboost-system-dev libboost-filesystem-dev libboost-thread-dev libstdc++-4.8-dev')
def source(self):
self.run("git clone https://github.com/cnjinhao/nana.git")
self.run("cd nana && git checkout v1.5.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("nana/CMakeLists.txt", "project(nana)", '''project(nana)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()''')
def build(self):
cmake = CMake(self)
shared = "-DBUILD_SHARED_LIBS=ON" if self.options.shared else ""
png = "-DNANA_CMAKE_ENABLE_PNG:BOOL=ON" if self.options.png else ""
jpeg = "-DNANA_CMAKE_ENABLE_JPEG:BOOL=ON" if self.options.jpeg else ""
self.run('cmake nana %s %s %s %s' % (cmake.command_line, shared, png, jpeg))
self.run("cmake --build . %s" % cmake.build_config)
def package(self):
self.copy("*", dst="include", src="nana/include")
self.copy("*nana.lib", dst="lib", keep_path=False)
self.copy("*.dll", dst="bin", 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 = ["nana"]
self.cpp_info.cppflags = ["-std=c++11"]
if os_info.is_linux:
self.cpp_info.libs.append("pthread")
self.cpp_info.libs.append("X11")
self.cpp_info.libs.append("boost_system")
self.cpp_info.libs.append("boost_filesystem")
self.cpp_info.libs.append("boost_thread")
self.cpp_info.libs.append("Xft")
self.cpp_info.libs.append("fontconfig")
self.cpp_info.libs.append("stdc++fs")
if os_info.is_linux and self.options.png:
self.cpp_info.libs.append("png")
if os_info.is_linux and self.options.jpeg:
self.cpp_info.libs.append("jpeg")