Fully embrace profiles
All checks were successful
Bigfoot / Build & Test Debug (push) Successful in 59s
Bigfoot / Build & Test RelWithDebInfo (push) Successful in 1m13s
Bigfoot / Clang Format Checks (push) Successful in 9s
Bigfoot / Build & Test Release (push) Successful in 38s

This commit is contained in:
2026-02-22 00:20:45 +01:00
parent 9b6ab354f3
commit 766b44ac72
13 changed files with 85 additions and 89 deletions

View File

@@ -19,9 +19,6 @@ target_sources(${PROJECT_NAME}
${SOURCES}
)
target_compile_options(${PROJECT_NAME} PRIVATE ${BIN2CPP_CXX_FLAGS})
target_link_options(${PROJECT_NAME} PRIVATE ${BIN2CPP_EXE_LINK_FLAGS})
target_link_libraries(${PROJECT_NAME} PUBLIC CLI11::CLI11 Bin2CPPLib)
target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_DL_LIBS})
@@ -31,7 +28,8 @@ set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Bin2CPP/${ParentFolder})
##################ASAN SETUP###################
if (MSVC)
if(${ASAN})
if (MSVC)
get_filename_component(MSVC_BIN_DIR "${CMAKE_CXX_COMPILER}" DIRECTORY)
set(ASAN_DLL "${MSVC_BIN_DIR}/clang_rt.asan_dynamic-x86_64.dll")
@@ -41,4 +39,5 @@ if (MSVC)
"${ASAN_DLL}"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
)
endif()
endif()

View File

@@ -20,12 +20,9 @@ target_sources(${PROJECT_NAME}
${SOURCES}
)
target_compile_options(${PROJECT_NAME} PRIVATE ${BINN2CPP_CXX_FLAGS})
target_link_libraries(${PROJECT_NAME} PUBLIC
EASTL::EASTL
$<$<CONFIG:Debug,RelWithDebInfo>:mimalloc-asan>
$<$<CONFIG:Release>:mimalloc-static>
$<IF:$<BOOL:${ASAN}>,mimalloc-asan,mimalloc-static>
quill::quill
$<$<CONFIG:Debug,RelWithDebInfo>:cpptrace::cpptrace>)

View File

@@ -18,9 +18,6 @@ target_sources(${PROJECT_NAME}
${TEST_SOURCES}
)
target_compile_options(${PROJECT_NAME} PRIVATE ${BIN2CPP_CXX_FLAGS})
target_link_options(${PROJECT_NAME} PRIVATE ${BIN2CPP_EXE_LINK_FLAGS})
target_link_libraries(${PROJECT_NAME} PRIVATE gtest::gtest Bin2CPPLib)
include(GoogleTest)
@@ -32,7 +29,8 @@ set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Tests/Bin2CPP/${ParentFo
##################ASAN SETUP###################
if (MSVC)
if(${ASAN})
if (MSVC)
get_filename_component(MSVC_BIN_DIR "${CMAKE_CXX_COMPILER}" DIRECTORY)
set(ASAN_DLL "${MSVC_BIN_DIR}/clang_rt.asan_dynamic-x86_64.dll")
@@ -42,6 +40,7 @@ if (MSVC)
"${ASAN_DLL}"
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
)
endif()
endif()
##################COPY FIXTURE FOLDER###################
@@ -50,19 +49,7 @@ if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/Fixture)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Fixture)
endif()
# Track all fixture files
file(GLOB_RECURSE FIXTURE_FILES
CONFIGURE_DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/Fixture/*
)
add_custom_target(${PROJECT_NAME}Fixture
COMMAND ${CMAKE_COMMAND} -E remove_directory $<TARGET_FILE_DIR:${PROJECT_NAME}>/Fixture
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Fixture $<TARGET_FILE_DIR:${PROJECT_NAME}>/Fixture
DEPENDS ${FIXTURE_FILES}
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/Fixture $<TARGET_FILE_DIR:${PROJECT_NAME}>/Fixture
COMMENT "Copying Fixture folder ${CMAKE_CURRENT_SOURCE_DIR}/Fixture to $<TARGET_FILE_DIR:${PROJECT_NAME}>/Fixture"
)
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}Fixture)
set_target_properties(${PROJECT_NAME}Fixture PROPERTIES FOLDER UtilityTargets/Tests/Bin2CPP/${ParentFolder})

View File

@@ -9,14 +9,13 @@ find_package(EASTL REQUIRED)
find_package(CLI11 REQUIRED)
find_package(quill REQUIRED)
if(${IS_MULTI_CONFIG})
find_package(mimalloc REQUIRED)
if(${ASAN})
find_package(mimalloc-asan REQUIRED)
find_package(cpptrace REQUIRED)
elseif(${CMAKE_BUILD_TYPE} STREQUAL "Release")
else()
find_package(mimalloc REQUIRED)
elseif(${CMAKE_BUILD_TYPE} STREQUAL "Debug" OR ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
find_package(mimalloc-asan REQUIRED)
endif()
if(${IS_MULTI_CONFIG} OR ${CMAKE_BUILD_TYPE} STREQUAL "Debug" OR ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
find_package(cpptrace REQUIRED)
endif()

View File

@@ -1,14 +1,4 @@
cmake_minimum_required(VERSION 3.24)
foreach(config DEBUG RELWITHDEBINFO)
foreach(lang EXE SHARED MODULE)
if("${CMAKE_${lang}_LINKER_FLAGS_${config}}" MATCHES "/INCREMENTAL:NO")
string(REGEX REPLACE "/INCREMENTAL([^:]|$)" ""
CMAKE_${lang}_LINKER_FLAGS_${config}
"${CMAKE_${lang}_LINKER_FLAGS_${config}}")
endif()
endforeach()
endforeach()
cmake_minimum_required(VERSION 3.26)
project(Bin2CPP VERSION 0.1.0
DESCRIPTION "Bin2CPP"
@@ -23,12 +13,24 @@ get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
set(CMAKE_CONFIGURATION_TYPES "Release;RelWithDebInfo;Debug" CACHE STRING "" FORCE)
option(BUILD_TESTS OFF)
option(ASAN OFF)
include(${CMAKE_SOURCE_DIR}/CMake/FindDependencies.cmake)
foreach(CONFIG DEBUG RELWITHDEBINFO)
if("${CMAKE_EXE_LINKER_FLAGS_${CONFIG}}" MATCHES "/INCREMENTAL:NO")
string(REGEX REPLACE "/INCREMENTAL([^:]|$)" ""
CMAKE_EXE_LINKER_FLAGS_${CONFIG}
"${CMAKE_EXE_LINKER_FLAGS_${CONFIG}}")
endif()
endforeach()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_OPTIMIZE_DEPENDENCIES 1)
add_compile_options(${BIN2CPP_CXX_FLAGS})
add_link_options(${BIN2CPP_EXE_LINK_FLAGS})
add_compile_definitions(
$<$<CONFIG:Release>:BIN2CPP_OPTIMIZED>
$<$<CONFIG:Debug,RelWithDebInfo>:BIN2CPP_NOT_OPTIMIZED>

View File

@@ -12,7 +12,6 @@ build_type=Release
[conf]
tools.cmake.cmaketoolchain:extra_variables={'CMAKE_CXX_COMPILER_LAUNCHER': 'ccache', 'CMAKE_C_COMPILER_LAUNCHER': 'ccache'}
tools.cmake.cmaketoolchain:extra_variables*={'BIN2CPP_CXX_FLAGS': {'value': '-Wall;-Wextra;-Wpedantic;-Werror', 'cache': True, 'type': 'STRING', 'docstring': 'CXX flags for Bigfoot', 'force': True}}
tools.cmake.cmaketoolchain:extra_variables*={'BIN2CPP_C_FLAGS': {'value': '-Wall;-Wextra;-Wpedantic;-Werror', 'cache': True, 'type': 'STRING', 'docstring': 'C flags for Bigfoot', 'force': True}}
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=True
@@ -29,3 +28,6 @@ tools.cmake.cmaketoolchain:generator=Ninja
[tool_requires]
!cmake/*: cmake/[>=4.2]
[options]
Bin2CPP/*:build_tests=True

View File

@@ -12,8 +12,6 @@ build_type=Debug
[conf]
tools.cmake.cmaketoolchain:extra_variables={'CMAKE_CXX_COMPILER_LAUNCHER': 'ccache', 'CMAKE_C_COMPILER_LAUNCHER': 'ccache'}
tools.cmake.cmaketoolchain:extra_variables*={'BIN2CPP_CXX_FLAGS': {'value': '-Wall;-Wextra;-Wpedantic;-Werror;-fprofile-instr-generate;-fcoverage-mapping', 'cache': True, 'type': 'STRING', 'docstring': 'CXX flags for Bigfoot', 'force': True}}
tools.cmake.cmaketoolchain:extra_variables*={'BIN2CPP_C_FLAGS': {'value': '-Wall;-Wextra;-Wpedantic;-Werror;-fprofile-instr-generate;-fcoverage-mapping', 'cache': True, 'type': 'STRING', 'docstring': 'C flags for Bigfoot', 'force': True}}
tools.cmake.cmaketoolchain:extra_variables*={'BIN2CPP_SHARED_LINK_FLAGS': {'value': '-fprofile-instr-generate', 'cache': True, 'type': 'STRING', 'docstring': 'SHARED link flags for Bigfoot', 'force': True}}
tools.cmake.cmaketoolchain:extra_variables*={'BIN2CPP_EXE_LINK_FLAGS': {'value': '-fprofile-instr-generate', 'cache': True, 'type': 'STRING', 'docstring': 'EXE link flags for Bigfoot', 'force': True}}
tools.system.package_manager:mode=install
@@ -28,3 +26,6 @@ tools.cmake.cmaketoolchain:generator=Ninja
[tool_requires]
!cmake/*: cmake/[>=4.2]
[options]
Bin2CPP/*:build_tests=True

View File

@@ -12,8 +12,6 @@ build_type=Debug
[conf]
tools.cmake.cmaketoolchain:extra_variables={'CMAKE_CXX_COMPILER_LAUNCHER': 'ccache', 'CMAKE_C_COMPILER_LAUNCHER': 'ccache'}
tools.cmake.cmaketoolchain:extra_variables*={'BIN2CPP_CXX_FLAGS': {'value': '-Wall;-Wextra;-Wpedantic;-Werror;-fsanitize=address,undefined;-fno-sanitize-recover=all', 'cache': True, 'type': 'STRING', 'docstring': 'CXX flags for Bigfoot', 'force': True}}
tools.cmake.cmaketoolchain:extra_variables*={'BIN2CPP_C_FLAGS': {'value': '-Wall;-Wextra;-Wpedantic;-Werror;-fsanitize=address,undefined;-fno-sanitize-recover=all', 'cache': True, 'type': 'STRING', 'docstring': 'C flags for Bigfoot', 'force': True}}
tools.cmake.cmaketoolchain:extra_variables*={'BIN2CPP_SHARED_LINK_FLAGS': {'value': '-fsanitize=address,undefined', 'cache': True, 'type': 'STRING', 'docstring': 'SHARED link flags for Bigfoot', 'force': True}}
tools.cmake.cmaketoolchain:extra_variables*={'BIN2CPP_EXE_LINK_FLAGS': {'value': '-fsanitize=address,undefined', 'cache': True, 'type': 'STRING', 'docstring': 'EXE link flags for Bigfoot', 'force': True}}
tools.system.package_manager:mode=install
@@ -28,3 +26,7 @@ tools.build:compiler_executables={"c": "clang", "cpp": "clang++"}
[tool_requires]
!cmake/*: cmake/[>=4.2]
[options]
Bin2CPP/*:asan=True
Bin2CPP/*:build_tests=True

View File

@@ -10,14 +10,15 @@ build_type=Release
[conf]
tools.cmake.cmaketoolchain:extra_variables={'BIN2CPP_CXX_FLAGS': {'value': '/W4;/WX;', 'cache': True, 'type': 'STRING', 'docstring': 'CXX flags for Bigfoot', 'force': True}}
tools.cmake.cmaketoolchain:extra_variables*={'BIN2CPP_C_FLAGS': {'value': '/W4;/WX;', 'cache': True, 'type': 'STRING', 'docstring': 'C flags for Bigfoot', 'force': True}}
tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/msvc_ccache.cmake
tools.build:exelinkflags=["/LTCG", "/INCREMENTAL:NO"]
tools.build:sharedlinkflags=["/LTCG", "/INCREMENTAL:NO"]
tools.build:cflags=["/Zc:preprocessor", "/Zc:__STDC__", "/D_CRT_DECLARE_NONSTDC_NAMES=1", "/GL"]
tools.build:cxxflags=["/Zc:preprocessor", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope", "/Zc:strictStrings", "/Zc:rvalueCast", "/Zc:hiddenFriend", "/Zc:externConstexpr", "/Zc:ternary", "/GL"]
[tool_requires]
!cmake/*: cmake/[>=4.2]
[options]
Bin2CPP/*:build_tests=True

View File

@@ -10,14 +10,16 @@ build_type=Debug
[conf]
tools.cmake.cmaketoolchain:extra_variables={'BIN2CPP_CXX_FLAGS': {'value': '/W4;/WX', 'cache': True, 'type': 'STRING', 'docstring': 'CXX flags for Bigfoot', 'force': True}}
tools.cmake.cmaketoolchain:extra_variables*={'BIN2CPP_C_FLAGS': {'value': '/W4;/WX', 'cache': True, 'type': 'STRING', 'docstring': 'C flags for Bigfoot', 'force': True}}
tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/msvc_ccache.cmake
tools.build:exelinkflags=["/INCREMENTAL:NO"]
tools.build:sharedlinkflags=["/INCREMENTAL:NO"]
tools.build:cflags=["/Zc:preprocessor", "/Zc:__STDC__", "/D_CRT_DECLARE_NONSTDC_NAMES=1", "/fsanitize=address"]
tools.build:cxxflags=["/Zc:preprocessor", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope", "/Zc:strictStrings", "/Zc:rvalueCast", "/Zc:hiddenFriend", "/Zc:externConstexpr", "/Zc:ternary", "/fsanitize=address"]
[tool_requires]
!cmake/*: cmake/[>=4.2]
[options]
Bin2CPP/*:asan=True
Bin2CPP/*:build_tests=True

View File

@@ -5,13 +5,14 @@ import os
required_conan_version = ">=1.33.0"
class Bigfoot(ConanFile):
name = "bin2cpp"
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 = "0.1.0"
version = "1.0.0"
package_type = "application"
# Binary configuration
settings = "os", "compiler", "build_type", "arch"
@@ -19,11 +20,13 @@ class Bigfoot(ConanFile):
"shared": [True, False],
"fPIC": [True, False],
"build_tests": [True, False],
"asan": [True, False]
}
default_options = {
"shared": False,
"fPIC": True,
"build_tests": False,
"asan": False
}
generators = "CMakeDeps"
@@ -35,7 +38,7 @@ class Bigfoot(ConanFile):
if self.settings.os == "Windows":
del self.options.fPIC
if(self.settings.build_type == "RelWithDebInfo" or self.settings.build_type == "Debug"):
if(self.options.asan and (self.settings.build_type == "RelWithDebInfo" or self.settings.build_type == "Debug")):
self.options["mimalloc"].asan = True
def requirements(self):
@@ -54,6 +57,7 @@ class Bigfoot(ConanFile):
tc = CMakeToolchain(self)
tc.variables["BUILD_TESTS"] = self.options.build_tests
tc.variables["ASAN"] = self.options.asan
tc.generate()

View File

@@ -23,8 +23,8 @@ REM Add the remote
conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/api/conan/BigfootPackages
REM Install dependencies with the specified build option
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/msvc -pr:b=./ConanProfiles/msvc %build_option% -of build -s build_type=Release -o bin2cpp/*:build_tests=True
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/msvcd -pr:b=./ConanProfiles/msvcd %build_option% -of build -s build_type=RelWithDebInfo -o bin2cpp/*:build_tests=True
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/msvcd -pr:b=./ConanProfiles/msvcd %build_option% -of build -s build_type=Debug -o bin2cpp/*:build_tests=True
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/msvc -pr:b=./ConanProfiles/msvc %build_option% -of build -s build_type=Release
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/msvcd -pr:b=./ConanProfiles/msvcd %build_option% -of build -s build_type=RelWithDebInfo
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/msvcd -pr:b=./ConanProfiles/msvcd %build_option% -of build -s build_type=Debug
endlocal

View File

@@ -11,13 +11,13 @@ conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/ap
# Set the build option based on the argument
if [ "$1" == "force" ]; then
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/clang --build='*' -of build -s build_type=Release -o bin2cpp/*:build_tests=True
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build='*' -of build -s build_type=RelWithDebInfo -o bin2cpp/*:build_tests=True
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build='*' -of build -s build_type=Debug -o bin2cpp/*:build_tests=True
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/clang --build='*' -of build -s build_type=Release
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build='*' -of build -s build_type=RelWithDebInfo
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build='*' -of build -s build_type=Debug
elif [ "$1" == "missing" ]; then
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/clang --build=missing -of build -s build_type=Release -o bin2cpp/*:build_tests=True
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build=missing -of build -s build_type=RelWithDebInfo -o bin2cpp/*:build_tests=True
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build=missing -of build -s build_type=Debug -o bin2cpp/*:build_tests=True
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/clang --build=missing -of build -s build_type=Release
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build=missing -of build -s build_type=RelWithDebInfo
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build=missing -of build -s build_type=Debug
else
echo "Invalid argument: $1"
echo "Usage: $0 [force|missing]"