SimCenterCommon
Common functionality used within different SimCenter projects
conanfile.py
Go to the documentation of this file.
1 from conans import ConanFile, tools, VisualStudioBuildEnvironment
2 
3 class CommonConan(ConanFile):
4  name = "SimCenterCommonQt"
5  version = "0.1.10"
6  license = "BSD"
7  author = "Wael Elhaddad (elhaddad@berkeley.edu)"
8  url = "https://github.com/NHERI-SimCenter/SimCenterCommon.git"
9  description = "SimCenter Common Qt Library"
10  settings = "os", "compiler", "build_type", "arch"
11  generators = "qmake", "cmake"
12  requires = "jansson/2.11@bincrafters/stable", "libcurl/7.64.1@bincrafters/stable"
13  build_policy = "missing"
14 
15  options = {
16  "MDOFwithQt3D": [True, False],
17  "withQt":[True, False]
18  }
19 
20 
21  default_options = {"MDOFwithQt3D": False, "withQt": False}
22 
23  scm = {
24  "type": "git",
25  "url": "auto",
26  "revision": "auto"
27  }
28 
29 
30  def configure(self):
31  if self.settings.os == "Windows":
32  self.options["libcurl"].with_winssl = True
33  self.options["libcurl"].with_openssl = False
34 
35  if self.options.withQt:
36  self.options["qt"].qtcharts = True
37  self.options["qt"].qt3d = True
38 
39 
40  def build_requirements(self):
41  if self.settings.os == "Windows":
42  self.build_requires("jom_installer/1.1.2@bincrafters/stable")
43 
44  if self.options.withQt:
45  self.build_requires("qt/5.11.3@bincrafters/stable")
46 
47 
48  def package_id(self):
49  del self.info.options.withQt
50 
51 
52  def build(self):
53  if self.settings.os == "Windows":
54  env_build = VisualStudioBuildEnvironment(self)
55  with tools.environment_append(env_build.vars):
56  vcvars = tools.vcvars_command(self.settings)
57 
58  qmake = "%s && qmake" % (vcvars)
59  makeCommand = "%s && jom" % (vcvars)
60  else:
61  qmake = 'qmake'
62  makeCommand = 'make -j'
63 
64  qmakeCommand = '%s "CONFIG+=%s" %s/SimCenterCommonQt.pro' % (qmake, str(self.settings.build_type).lower(), self.source_folder)
65  if(self.options.MDOFwithQt3D):
66  qmakeCommand += ' "DEFINES+=_GRAPHICS_Qt3D"'
67 
68  self.run(qmakeCommand, run_environment=True)
69  self.run(makeCommand, run_environment=True)
70 
71 
72  def package(self):
73  self.copy("*.h", src="Common", dst="include", keep_path=False)
74  self.copy("*.h", src="InputSheetBM", dst="include", keep_path=False)
75  self.copy("*.h", src="RandomVariables", dst="include", keep_path=False)
76  self.copy("*/*.h", src="Workflow", dst="include", keep_path=False)
77  self.copy("*SimCenterCommonQt.lib", dst="lib", keep_path=False)
78  self.copy("*SimCenterCommonQt.a", dst="lib", keep_path=False)
79 
80 
81  def package_info(self):
82  self.cpp_info.libs = ["SimCenterCommonQt"]
def package_info(self)
Definition: conanfile.py:81
dictionary options
Definition: conanfile.py:15
def configure(self)
Definition: conanfile.py:30
def package_id(self)
Definition: conanfile.py:48
def build_requirements(self)
Definition: conanfile.py:40