2020-08-24 08:51:00 +00:00
|
|
|
from conans import ConanFile, CMake, tools
|
2020-09-30 03:43:43 +00:00
|
|
|
from conans import tools
|
2020-08-24 08:51:00 +00:00
|
|
|
|
|
|
|
class GenerallibConan(ConanFile):
|
2020-10-10 04:24:12 +00:00
|
|
|
source_folder = "pkgsrc"
|
2020-08-24 08:51:00 +00:00
|
|
|
name = "generallib"
|
|
|
|
version = "1.0"
|
|
|
|
license = "GPL"
|
|
|
|
author = "caiyuzheng"
|
|
|
|
url = "https://gitee.com/290198252/generallib"
|
|
|
|
description = "a simple cpp basic library"
|
|
|
|
exports_sources = "general*", "test*"
|
2020-09-30 03:43:43 +00:00
|
|
|
def source(self):
|
2020-10-10 04:24:12 +00:00
|
|
|
tools.rmdir("pkgsrc")
|
2020-11-02 12:04:08 +00:00
|
|
|
git = tools.Git(folder=self.source_folder + "/pkgsrc")
|
2020-10-10 04:24:12 +00:00
|
|
|
git.clone("https://gitee.com/290198252/generallib.git")
|
2020-09-30 03:43:43 +00:00
|
|
|
|
2020-08-24 08:51:00 +00:00
|
|
|
def package(self):
|
|
|
|
self.copy(pattern ="*.h", dst="include", src="general",keep_path=True)
|
|
|
|
self.copy(pattern ="*.hpp", dst="include", src="general",keep_path=True)
|
|
|
|
|
|
|
|
def build(self):
|
2020-10-10 04:24:12 +00:00
|
|
|
cmake = CMake(self)
|
2020-11-02 12:04:08 +00:00
|
|
|
print("path " + self.source_folder + " is where the package built")
|
|
|
|
print("build env is ",tools.get_env("BUILD_ENV"))
|
|
|
|
tools.rmdir(tools.unix_path(self.package_folder)+"/build")
|
|
|
|
tools.mkdir(tools.unix_path(self.package_folder)+"/build")
|
|
|
|
if tools.os_info.is_windows:
|
|
|
|
print("current os windows")
|
|
|
|
if tools.os_info.is_cygwin:
|
|
|
|
print("cygwin build")
|
|
|
|
if tools.get_env("BUILD_ENV")=="msys":
|
|
|
|
print("msys build")
|
|
|
|
tools.run_in_windows_bash(self, subsystem="msys",cwd="pkgsrc",msys_mingw=True,bashcmd="cmake build -G\"MinGW Makefiles\" " + tools.unix_path(self.source_folder + "/pkgsrc"))
|
|
|
|
tools.run_in_windows_bash(self, subsystem="msys",cwd="pkgsrc",msys_mingw=True,bashcmd="cmake --build . ")
|
|
|
|
|
2020-10-10 04:24:12 +00:00
|
|
|
def requirements(self):
|
2020-11-02 12:04:08 +00:00
|
|
|
self.requires("libevent/2.1.2", private=True, override=False)
|