70 lines
2.0 KiB
Python
70 lines
2.0 KiB
Python
from conan import ConanFile
|
|
from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout
|
|
from conan.tools.files import copy
|
|
import os
|
|
|
|
required_conan_version = ">=1.33.0"
|
|
|
|
class Bin2CPP(ConanFile):
|
|
name = "Bin2CPP"
|
|
homepage = "https://git.romainboullard.com/rboullard/Bin2CPP"
|
|
description = "A utility that converts files to CPP headers"
|
|
topics = ("utility")
|
|
license = "MIT"
|
|
version = "1.0.0"
|
|
package_type = "application"
|
|
|
|
# Binary configuration
|
|
settings = "os", "compiler", "build_type", "arch"
|
|
options = {
|
|
"shared": [True, False],
|
|
"fPIC": [True, False],
|
|
"build_tests": [True, False],
|
|
"asan": [True, False],
|
|
"coverage": [True, False]
|
|
}
|
|
default_options = {
|
|
"shared": False,
|
|
"fPIC": True,
|
|
"build_tests": False,
|
|
"asan": False,
|
|
"coverage": False
|
|
}
|
|
|
|
generators = "CMakeDeps"
|
|
|
|
def layout(self):
|
|
cmake_layout(self)
|
|
|
|
def configure(self):
|
|
if self.settings.os == "Windows":
|
|
del self.options.fPIC
|
|
|
|
if(self.options.asan):
|
|
self.options["mimalloc"].asan = True
|
|
|
|
def requirements(self):
|
|
self.requires("quill/11.0.2", transitive_headers=True)
|
|
self.requires("magic_enum/0.9.7", transitive_headers=True)
|
|
self.requires("mimalloc/3.2.8@bigfootdev/main", transitive_headers=True)
|
|
self.requires("cli11/2.6.1@bigfootdev/main")
|
|
|
|
if(self.settings.build_type == "RelWithDebInfo" or self.settings.build_type == "Debug"):
|
|
self.requires("cpptrace/1.0.4", transitive_headers=True)
|
|
|
|
if(self.options.build_tests):
|
|
self.test_requires("gtest/1.17.0")
|
|
|
|
def generate(self):
|
|
tc = CMakeToolchain(self)
|
|
|
|
tc.variables["BUILD_TESTS"] = self.options.build_tests
|
|
tc.variables["ASAN"] = self.options.asan
|
|
tc.variables["COVERAGE"] = self.options.coverage
|
|
|
|
tc.generate()
|
|
|
|
def build(self):
|
|
cmake = CMake(self)
|
|
cmake.configure()
|
|
cmake.build() |