1
0
Fork 0
forked from lthn/blockchain
blockchain/conanfile.py

71 lines
2 KiB
Python
Raw Normal View History

2025-10-05 14:00:36 +01:00
import os
from conan import ConanFile
2025-10-06 22:38:29 +01:00
from conan.tools.cmake import CMakeDeps, CMakeToolchain, CMake
2025-10-05 14:00:36 +01:00
class BlockchainConan(ConanFile):
name = "blockchain"
version = "6.0.1"
settings = "os", "compiler", "build_type", "arch"
options = {
"static": [True, False],
"testnet": [True, False],
"ci": [True, False]
2025-10-05 14:00:36 +01:00
}
default_options = {
"static": False,
2025-10-06 22:38:29 +01:00
"testnet": False,
"ci": False,
2025-10-06 22:38:29 +01:00
"boost/*:without_test": True
2025-10-05 14:00:36 +01:00
}
tool_requires = [
"cmake/3.31.9"
]
2025-10-05 14:00:36 +01:00
requires = [
"zlib/1.3.1",
"boost/1.85.0",
"openssl/3.2.0",
"miniupnpc/2.2.5",
"jwt-cpp/0.7.1",
"oatpp/1.3.0.latest",
"oatpp-swagger/1.3.0.latest"
2025-10-05 14:00:36 +01:00
]
def generate(self):
tc = CMakeToolchain(self)
os_val = str(self.settings.os).lower()
# arch_val = str(self.settings.arch).lower()
# compiler_val = str(self.settings.compiler).lower()
# tc.presets_prefix = f"{os_val}"
tc.user_presets_path = "ConanPresets.json"
2025-10-05 14:00:36 +01:00
tc.variables["STATIC"] = self.options.static
tc.variables["TESTNET"] = self.options.testnet
# tc.preprocessor_definitions["TESTNET"] = None
# tc.variables["BUILD_VERSION"] = self.options.build_version
tc.generate()
deps = CMakeDeps(self)
deps.generate()
def layout(self):
if self.settings.compiler == "msvc":
# For multi-config, all configurations go into the same "build" folder.
self.folders.build = "build/release"
self.folders.generators = "build/release/generators"
else:
# For single-config, we create a subfolder for each build type.
build_type_str = str(self.settings.build_type).lower()
self.folders.build = os.path.join("build", build_type_str)
self.folders.generators = os.path.join(self.folders.build, "generators")
2025-10-05 14:00:36 +01:00
def build(self):
cmake = CMake(self)
cmake.configure()
2025-10-07 02:28:22 +01:00
cmake.build()