1
0
Fork 0
forked from lthn/blockchain
blockchain/conanfile.py
Snider ba3296cec6 Customize build folder layout based on compiler
Updated the layout method to set different build and generator folder paths depending on whether the compiler is MSVC or not. This improves compatibility with multi-configuration generators on MSVC and single-configuration generators on other platforms.
2025-10-01 18:15:27 +01:00

53 lines
No EOL
1.5 KiB
Python

import os
from conan import ConanFile
from conan.tools.cmake import cmake_layout, 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]
}
default_options = {
"static": False,
"testnet": False
}
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)
tc.user_presets_path = False
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):
multi = True if self.settings.get_safe("compiler") == "msvc" else False
if multi:
self.folders.generators = os.path.join("build", "generators")
self.folders.build = "build"
else:
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())
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()