1
0
Fork 0
forked from lthn/blockchain
blockchain/conanfile.py
Snider c9c2391d81 Add CMake and Conan presets, update build config
Introduces CMakePresets.json and ConanPresets.json for standardized build configuration. Updates Makefile to use CMake presets, modifies .gitignore for IDE files, and refines conanfile.py to support CI option and preset integration.
2025-10-08 21:55:39 +01:00

61 lines
1.9 KiB
Python

import os
from conan import ConanFile
from conan.tools.cmake import CMakeDeps, CMakeToolchain, CMake
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]
}
default_options = {
"static": False,
"testnet": False,
"ci": False,
"boost/*:without_test": True
}
requires = [
"zlib/1.3.1",
"boost/1.85.0",
"openssl/3.2.0",
"miniupnpc/2.2.5",
"jwt-cpp/0.7.1"
]
def generate(self):
tc = CMakeToolchain(self)
# When conan-default / conan-release becomes an issue the blow adds OS, ARCH and Compiler to the preset name
# if self.options.__contains__("CI"):
# 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}-{arch_val}-{compiler_val}"
tc.user_presets_path = "ConanPresets.json"
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):
self.folders.generators = os.path.join("build", str(self.settings.build_type).lower(), "generators")
self.folders.build = os.path.join("build", str(self.settings.build_type).lower())
# self.folders.build_folder_vars = ["settings.os", "settings.arch", "settings.compiler", "settings.build_type"]
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()