-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconanfile.py
61 lines (46 loc) · 1.92 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 conan import ConanFile
from conan.errors import ConanException
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain
from conan.tools.scm import Git
import os
class PBNIFrameworkRecipe(ConanFile):
name = "lib.cpp.base.pbni-framework"
package_type = "static-library"
license = "MIT"
author = "[email protected]"
url = "https://github.com/informaticon/lib.cpp.base.pbni-framework"
description = "Framework for creating PowerBuilder Extensions using PBNI"
settings = "os", "compiler", "build_type", "arch"
exports_sources = "CMakeLists.txt", "src/**"
options = { "pb_version": ["ANY"] }
generators = "CMakeDeps", "CMakeToolchain"
def requirements(self):
self.requires("boost/1.85.0", transitive_headers=True)
def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, 20)
def set_version(self):
if not self.version:
try:
git = Git(self)
tag = git.run("describe --tags")
self.version = tag.lstrip('v')
except ConanException:
self.version = "0.0.0-trunk"
def layout(self):
cmake_layout(self)
def build(self):
pbni_dir = f"C:/Program Files (x86)/Appeon/PowerBuilder {self.options.pb_version}/SDK/PBNI/"
assert os.path.exists(pbni_dir)
cmake = CMake(self)
cmake.configure({ "PBNI_SDK_DIRECTORY": pbni_dir })
cmake.build()
def package(self):
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.objects = [f"lib/objects-{self.settings.build_type}/lib.cpp.base.pbni-framework/*.obj"]
self.cpp_info.defines = ["UNICODE", "_UNICODE", "WIN32_LEAN_AND_MEAN", "NOMINMAX"]
if self.settings.compiler == "msvc":
self.cpp_info.cxxflags = ["/Zc:preprocessor"]