Some checks are pending
Bin2CPP / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Waiting to run
Bin2CPP / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Waiting to run
Bin2CPP / Build & Test Debug with ./ConanProfiles/clangd (Unity Build: OFF) (push) Waiting to run
Bin2CPP / Build & Test Debug with ./ConanProfiles/clangd (Unity Build: ON) (push) Waiting to run
Bin2CPP / Build & Test Debug with ./ConanProfiles/clangd_asan (Unity Build: OFF) (push) Waiting to run
Bin2CPP / Build & Test Debug with ./ConanProfiles/clangd_asan (Unity Build: ON) (push) Waiting to run
Bin2CPP / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Waiting to run
Bin2CPP / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Waiting to run
Bin2CPP / Build & Test RelWithDebInfo with ./ConanProfiles/clangd (Unity Build: OFF) (push) Waiting to run
Bin2CPP / Build & Test RelWithDebInfo with ./ConanProfiles/clangd (Unity Build: ON) (push) Waiting to run
Bin2CPP / Build & Test RelWithDebInfo with ./ConanProfiles/clangd_asan (Unity Build: OFF) (push) Waiting to run
Bin2CPP / Build & Test RelWithDebInfo with ./ConanProfiles/clangd_asan (Unity Build: ON) (push) Waiting to run
Bin2CPP / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Waiting to run
Bin2CPP / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Waiting to run
Bin2CPP / Build & Test Release with ./ConanProfiles/clangd (Unity Build: OFF) (push) Waiting to run
Bin2CPP / Build & Test Release with ./ConanProfiles/clangd (Unity Build: ON) (push) Waiting to run
Bin2CPP / Build & Test Release with ./ConanProfiles/clangd_asan (Unity Build: OFF) (push) Waiting to run
Bin2CPP / Build & Test Release with ./ConanProfiles/clangd_asan (Unity Build: ON) (push) Waiting to run
Bin2CPP / Clang Format Checks (push) Waiting to run
Conan Packaging / Package Bin2CPP/1.0.0 (push) Waiting to run
Bin2CPP / Sonarqube (push) Waiting to run
Overkill for what we do Reviewed-on: #6
86 lines
2.6 KiB
Python
86 lines
2.6 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 export_sources(self):
|
|
copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder)
|
|
copy(self, os.path.join("Bin2CPP", "*"), self.recipe_folder, self.export_sources_folder)
|
|
copy(self, os.path.join("CMake", "*"), self.recipe_folder, self.export_sources_folder)
|
|
|
|
def layout(self):
|
|
cmake_layout(self)
|
|
|
|
def configure(self):
|
|
if self.settings.os == "Windows":
|
|
del self.options.fPIC
|
|
|
|
def requirements(self):
|
|
self.requires("quill/11.0.2", transitive_headers=True)
|
|
self.requires("magic_enum/0.9.7", transitive_headers=True)
|
|
self.requires("cli11/2.6.1@bigfootdev/main")
|
|
|
|
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()
|
|
|
|
def package(self):
|
|
copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
|
|
cmake = CMake(self)
|
|
cmake.install()
|
|
|
|
copy(self, "Bin2CPPTargets.cmake",
|
|
src=os.path.join(self.source_folder, "CMake"),
|
|
dst=os.path.join(self.package_folder, "bin"))
|
|
|
|
@property
|
|
def _module_path(self):
|
|
return os.path.join("bin", "Bin2CPPTargets.cmake")
|
|
|
|
def package_info(self):
|
|
self.cpp_info.set_property("cmake_build_modules", [self._module_path]) |