commit e2549549a43ef288d28398207c7d2b040d89dbb0 Author: Romain BOULLARD Date: Sun Feb 15 11:25:13 2026 +0100 Initial commit diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..e93c306 --- /dev/null +++ b/.clang-format @@ -0,0 +1,122 @@ +--- +AlignAfterOpenBracket: Align +AlignArrayOfStructures: None +AccessModifierOffset: -2 +AlignConsecutiveBitFields: + Enabled: true + AcrossEmptyLines: false + AcrossComments: true + AlignCompound: true + PadOperators: true +AlignConsecutiveMacros: + Enabled: true + AcrossEmptyLines: false + AcrossComments: true + AlignCompound: true + PadOperators: true +AlignConsecutiveShortCaseStatements: + Enabled: true + AcrossEmptyLines: true + AcrossComments: true + AlignCaseColons: true +AlignEscapedNewlines: Right +AlignOperands: Align +AlignTrailingComments: + Kind: Always + OverEmptyLines: 2 +AllowAllArgumentsOnNextLine: false +AllowAllParametersOfDeclarationOnNextLine: false +AllowShortBlocksOnASingleLine: Empty +AllowShortCaseLabelsOnASingleLine: false +AllowShortEnumsOnASingleLine: false +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: Empty +AllowShortLoopsOnASingleLine: false +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: false +BinPackParameters: false +BitFieldColonSpacing: After +BreakBeforeBraces: Custom +BracedInitializerIndentWidth: 2 +BreakAfterAttributes: Always +BreakArrays: false +BreakBeforeTernaryOperators: true +BreakConstructorInitializers: AfterColon +BreakInheritanceList: BeforeComma +BreakStringLiterals: true +CompactNamespaces: false +Cpp11BracedListStyle: true +EmptyLineBeforeAccessModifier: Always +FixNamespaceComments: true +IncludeBlocks: Preserve +IndentCaseBlocks: true +IndentCaseLabels: false +IndentPPDirectives: None +IndentRequiresClause: true +IndentWidth: 4 +IndentWrappedFunctionNames: true +InsertBraces: true +InsertNewlineAtEOF: true +IntegerLiteralSeparator: + Binary: -1 + Decimal: 3 + DecimalMinDigits: 5 + Hex: -1 +LambdaBodyIndentation: Signature +Language: Cpp +NamespaceIndentation: None +PointerAlignment: Left +QualifierAlignment: Leave +ReferenceAlignment: Left +UseTab: Never +Standard: Auto +BraceWrapping: + AfterNamespace: true + AfterCaseLabel: true + AfterClass: true + AfterControlStatement: Always + AfterEnum: true + AfterFunction: true + AfterStruct: true + AfterUnion: true + BeforeElse: true + BeforeLambdaBody: true + BeforeWhile: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +ColumnLimit: 120 +SpaceAfterTemplateKeyword: false +SortIncludes: CaseSensitive +PenaltyReturnTypeOnItsOwnLine: 500 +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCtorInitializerColon: false +SpaceBeforeInheritanceColon: false +SpaceBeforeRangeBasedForLoopColon: false +SpaceBeforeSquareBrackets: false +SpacesInAngles: Never +SpacesInConditionalStatement: false +SpaceBeforeParens: ControlStatements +SpacesInContainerLiterals: false +SpacesInSquareBrackets: false +SpacesBeforeTrailingComments: 3 +PackConstructorInitializers: Never +SeparateDefinitionBlocks: Always +MaxEmptyLinesToKeep: 1 +BreakBeforeBinaryOperators: None +AlignConsecutiveAssignments: + Enabled: false + AcrossEmptyLines: false + AcrossComments: true + AlignCompound: true + PadOperators: true +SpaceAroundPointerQualifiers: Default +SpaceBeforeCpp11BracedList: true +SpaceInEmptyBlock: true +PenaltyBreakAssignment: 200 +KeepEmptyLinesAtTheStartOfBlocks: false \ No newline at end of file diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..d28ed7a --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,22 @@ +# .clang-tidy +--- +Checks: > + -*, + bugprone-*, + clang-analyzer-*, + cppcoreguidelines-*, + modernize-*, + performance-*, + readability-*, + portability-*, + + -modernize-use-trailing-return-type, + -readability-avoid-const-params-in-decls, + -cppcoreguidelines-macro-usage, + -cppcoreguidelines-avoid-do-while + +ExcludeHeaderFilterRegex: '_generated.*' + +CheckOptions: + - key: readability-implicit-bool-conversion.AllowPointerConditions + value: true \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..5dc46e6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +* text=auto eol=lf +*.{cmd,[cC][mM][dD]} text eol=crlf +*.{bat,[bB][aA][tT]} text eol=crlf \ No newline at end of file diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..63e299a --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,65 @@ +name: Bigfoot + +on: + push: + branches: + - '**' + workflow_dispatch: + +env: + CCACHE_BASEDIR: ${{ github.workspace }} + +jobs: + build-and-test: + runs-on: ubuntu-latest + timeout-minutes: 120 + container: + image: git.romainboullard.com/bigfootdev/linuxcppbuilder:main + strategy: + matrix: + build_type: ["Debug", "RelWithDebInfo", "Release"] + name: "Build & Test ${{ matrix.build_type }}" + steps: + - name: Install Node.js + run: apt-get update && apt-get install -y nodejs + + - name: Checkout repository + uses: actions/checkout@v6 + with: + submodules: recursive + + - name: Show ccache stats before + run: ccache --zero-stats + + - name: Build + run: | + conan profile detect + conan install . --deployer=full_deploy --deployer-folder=build --remote=bigfootpackages --build=missing -s build_type=${{ matrix.build_type }} -o bin2cpp/*:build_tests=True + cmake -S . -B ./build/${{ matrix.build_type }} --toolchain ./build/${{ matrix.build_type }}/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -G "Ninja" + cmake --build build/${{ matrix.build_type }} --parallel $(nproc) + + - name: Show ccache stats after + run: ccache --show-stats + + - name: Unit Tests + run: | + cd ./build/${{ matrix.build_type }} + ctest . --output-on-failure + + clang-format: + runs-on: ubuntu-latest + timeout-minutes: 120 + container: + image: git.romainboullard.com/bigfootdev/linuxcppbuilder:main + name: "Clang Format Checks" + steps: + - name: Install Node.js + run: apt-get update && apt-get install -y nodejs + + - name: Checkout repository + uses: actions/checkout@v6 + with: + submodules: recursive + + - name: Clang Format Checks + run: chmod +x format.sh && ./format.sh --check Bigfoot \ No newline at end of file diff --git a/.gitea/workflows/sonarqube.yml b/.gitea/workflows/sonarqube.yml new file mode 100644 index 0000000..9cdec62 --- /dev/null +++ b/.gitea/workflows/sonarqube.yml @@ -0,0 +1,48 @@ +name: Bigfoot + +on: + push: + branches: + - main + - Development + +jobs: + build-and-test: + runs-on: ubuntu-latest + timeout-minutes: 120 + container: + image: git.romainboullard.com/bigfootdev/linuxcppbuilder:main + name: "Sonarqube" + steps: + - name: Install Node.js + run: apt-get update && apt-get install -y nodejs + + - name: Checkout repository + uses: actions/checkout@v6 + with: + fetch-depth: 0 + submodules: recursive + + - name: Generate + run: | + conan profile detect + conan install . --deployer=full_deploy --deployer-folder=build --remote=bigfootpackages --build=missing -s build_type=Debug -o bin2cpp/*:build_tests=True + cmake -S . -B ./build/Debug --toolchain ./build/Debug/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Debug -G "Ninja" + cmake --build build/Debug --parallel $(nproc) + + - name: Clang-Tidy + run: run-clang-tidy -p ./build/Debug/ >> tidy_result.txt + + - name: Infer + run: infer run --compilation-database build/Debug/compile_commands.json + + - name: SonarQube Scan + if: github.head_ref == 'main' || github.ref_name == 'main' + uses: SonarSource/sonarqube-scan-action@v7.0.0 + with: + args: > + -Dsonar.cxx.jsonCompilationDatabase=./build/Debug/compile_commands.json + -Dsonar.verbose=true + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..129a851 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +[Bb]uild* +Environment/output +*.generated.h + +.scannerwork + +SonarqubeResult +*.profraw + +conan_imports_manifest.txt +CMakeUserPresets.json +conan.lock +conanbuildinfo.txt +conaninfo.txt +graph_info.json + +.idea + +test_package/Vendor + +graphviz \ No newline at end of file diff --git a/.inferconfig b/.inferconfig new file mode 100644 index 0000000..0e0dcd2 --- /dev/null +++ b/.inferconfig @@ -0,0 +1,3 @@ +{ + +} \ No newline at end of file diff --git a/Bin2CPP/Sources/Bin2CPPExe/CMakeLists.txt b/Bin2CPP/Sources/Bin2CPPExe/CMakeLists.txt new file mode 100644 index 0000000..e1d489b --- /dev/null +++ b/Bin2CPP/Sources/Bin2CPPExe/CMakeLists.txt @@ -0,0 +1,29 @@ +get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME) +project(${PackageName}) + +add_executable(${PROJECT_NAME}) +set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) + +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Include) + +# collect sources (reconfigure when files are added/removed) +file(GLOB_RECURSE SOURCES + CONFIGURE_DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/*.h + ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp +) + +target_sources(${PROJECT_NAME} + PRIVATE + ${SOURCES} +) + +target_link_libraries(${PROJECT_NAME} PUBLIC CLI11::CLI11 Bin2CPPLib) +target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_DL_LIBS}) + +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX Src FILES ${SOURCES}) + +set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Bin2CPP/${ParentFolder}) + +bin2cpp_setup_dependencies("Bin2CPPExe") \ No newline at end of file diff --git a/Bin2CPP/Sources/Bin2CPPExe/main.cpp b/Bin2CPP/Sources/Bin2CPPExe/main.cpp new file mode 100644 index 0000000..427d4ab --- /dev/null +++ b/Bin2CPP/Sources/Bin2CPPExe/main.cpp @@ -0,0 +1,4 @@ +int main([[maybe_unused]] int argc, [[maybe_unused]] char** argv) +{ + return 0; +} diff --git a/Bin2CPP/Sources/Bin2CPPLib/CMakeLists.txt b/Bin2CPP/Sources/Bin2CPPLib/CMakeLists.txt new file mode 100644 index 0000000..7235b2a --- /dev/null +++ b/Bin2CPP/Sources/Bin2CPPLib/CMakeLists.txt @@ -0,0 +1,28 @@ +get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME) +project(${PackageName}) + +add_library(${PROJECT_NAME} STATIC) +set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) + +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Include) + +# collect sources (reconfigure when files are added/removed) +file(GLOB_RECURSE SOURCES + CONFIGURE_DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/*.h + ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp +) + +target_sources(${PROJECT_NAME} + PRIVATE + ${SOURCES} +) + +target_link_libraries(${PROJECT_NAME} PUBLIC EASTL::EASTL rapidhash::rapidhash mimalloc) +target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_DL_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE $<$:cpptrace::cpptrace> quill::quill) + +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX Src FILES ${SOURCES}) + +set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Bin2CPP/${ParentFolder}) \ No newline at end of file diff --git a/Bin2CPP/Sources/Bin2CPPLib/touch.cpp b/Bin2CPP/Sources/Bin2CPPLib/touch.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Bin2CPP/Sources/CMakeLists.txt b/Bin2CPP/Sources/CMakeLists.txt new file mode 100644 index 0000000..81727b5 --- /dev/null +++ b/Bin2CPP/Sources/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Bin2CPPLib) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Bin2CPPExe) \ No newline at end of file diff --git a/Bin2CPP/Tests/Bin2CPPLib/CMakeLists.txt b/Bin2CPP/Tests/Bin2CPPLib/CMakeLists.txt new file mode 100644 index 0000000..046f1ca --- /dev/null +++ b/Bin2CPP/Tests/Bin2CPPLib/CMakeLists.txt @@ -0,0 +1,53 @@ +get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME) +project(${PackageName}Tests) + +add_executable(${PROJECT_NAME}) +set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) + +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Include) + +file(GLOB_RECURSE TEST_SOURCES + CONFIGURE_DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/*.h + ${CMAKE_CURRENT_SOURCE_DIR}/*.hpp + ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp +) + +target_sources(${PROJECT_NAME} + PRIVATE + ${TEST_SOURCES} +) + +target_link_libraries(${PROJECT_NAME} PRIVATE gtest::gtest Bin2CPPLib) + +include(GoogleTest) +gtest_discover_tests(${PROJECT_NAME} XML_OUTPUT_DIR ${CMAKE_BINARY_DIR}/TestResults/) + +source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX Src/ FILES ${TEST_SOURCES}) + +set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Tests/Bin2CPP/${ParentFolder}) + +##################COPY FIXTURE FOLDER################### + +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 $/Fixture + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/Fixture $/Fixture + DEPENDS ${FIXTURE_FILES} + COMMENT "Copying Fixture folder for ${PROJECT_NAME}" +) + +add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}Fixture) + +set_target_properties(${PROJECT_NAME}Fixture PROPERTIES FOLDER UtilityTargets/Tests/Bin2CPP/${ParentFolder}) + +bin2cpp_setup_dependencies("Tests/Bin2CPP") \ No newline at end of file diff --git a/Bin2CPP/Tests/Bin2CPPLib/Fixture/toto.txt b/Bin2CPP/Tests/Bin2CPPLib/Fixture/toto.txt new file mode 100644 index 0000000..e69de29 diff --git a/Bin2CPP/Tests/Bin2CPPLib/touch.cpp b/Bin2CPP/Tests/Bin2CPPLib/touch.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Bin2CPP/Tests/CMakeLists.txt b/Bin2CPP/Tests/CMakeLists.txt new file mode 100644 index 0000000..8fa1d8a --- /dev/null +++ b/Bin2CPP/Tests/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Bin2CPPLib) diff --git a/CMake/FindDependencies.cmake b/CMake/FindDependencies.cmake new file mode 100644 index 0000000..3c42c1c --- /dev/null +++ b/CMake/FindDependencies.cmake @@ -0,0 +1,22 @@ +find_package(Python3 COMPONENTS Interpreter Development) + +if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) +endif() + +find_package(EASTL REQUIRED) +find_package(mimalloc REQUIRED) +find_package(CLI11 REQUIRED) +find_package(rapidhash REQUIRED) +find_package(quill REQUIRED) + +if(${IS_MULTI_CONFIG}) + find_package(cpptrace REQUIRED) +elseif(${CMAKE_BUILD_TYPE} STREQUAL "Debug" OR ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo") + find_package(cpptrace REQUIRED) +endif() + +if(BUILD_TESTS) + find_package(GTest REQUIRED) +endif() \ No newline at end of file diff --git a/CMake/Utils.cmake b/CMake/Utils.cmake new file mode 100644 index 0000000..915a12f --- /dev/null +++ b/CMake/Utils.cmake @@ -0,0 +1,58 @@ +function(bin2cpp_setup_dependencies ParentFolder) + set(CONAN_DEPLOYER_DIR "${CMAKE_SOURCE_DIR}/build/full_deploy/host") + + if(EXISTS ${CONAN_DEPLOYER_DIR}) + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + file(GLOB_RECURSE SHARED_BINARIES ${CONAN_DEPLOYER_DIR}/*mimalloc*.dll) + elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + file(GLOB_RECURSE SHARED_BINARIES ${CONAN_DEPLOYER_DIR}/*mimalloc*.so*) + endif() + + if(${IS_MULTI_CONFIG}) + foreach(CONFIG ${CMAKE_CONFIGURATION_TYPES}) + foreach(file ${SHARED_BINARIES}) + if(file MATCHES "/${CONFIG}/") + list(APPEND SHARED_BINARIES_${CONFIG} ${file}) + endif() + endforeach() + endforeach() + + add_custom_target(${PROJECT_NAME}CopySharedBinaries + ALL DEPENDS SHARED_BINARIES + COMMAND ${CMAKE_COMMAND} -E make_directory $ + COMMAND ${CMAKE_COMMAND} -E $,copy_if_different,true> ${SHARED_BINARIES_Debug} $ + COMMAND ${CMAKE_COMMAND} -E $,copy_if_different,true> ${SHARED_BINARIES_Release} $ + COMMAND ${CMAKE_COMMAND} -E $,copy_if_different,true> ${SHARED_BINARIES_RelWithDebInfo} $ + COMMENT "Copy shared binaries for ${PROJECT_NAME}" + ) + add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}CopySharedBinaries) + set_target_properties(${PROJECT_NAME}CopySharedBinaries PROPERTIES FOLDER UtilityTargets/${ParentFolder}) + + else() + foreach(file ${SHARED_BINARIES}) + if(file MATCHES "/${CMAKE_BUILD_TYPE}/") + list(APPEND SHARED_BINARIES_${CMAKE_BUILD_TYPE} ${file}) + endif() + endforeach() + + add_custom_target(${PROJECT_NAME}CopySharedBinaries ALL + DEPENDS ${SHARED_BINARIES_${CMAKE_BUILD_TYPE}} + COMMAND ${CMAKE_COMMAND} -E make_directory $ + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SHARED_BINARIES_${CMAKE_BUILD_TYPE}} $ + COMMENT "Copy shared binaries for ${PROJECT_NAME}" + ) + add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}CopySharedBinaries) + set_target_properties(${PROJECT_NAME}CopySharedBinaries PROPERTIES FOLDER UtilityTargets/${ParentFolder}) + endif() + endif() + + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + add_custom_target(${PROJECT_NAME}PatchMinject ALL + COMMAND ${MINJECT_EXECUTABLE} -i -f $ + COMMENT "Patching ${PROJECT_NAME} to ensure mimalloc dynamic override" + ) + add_dependencies(${PROJECT_NAME}PatchMinject ${PROJECT_NAME}) + set_target_properties(${PROJECT_NAME}PatchMinject PROPERTIES FOLDER "UtilityTargets/${ParentFolder}") + endif() + +endfunction() \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b1e9505 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.24) + +project(Bin2CPP VERSION 0.1.0 + DESCRIPTION "Bin2CPP" + LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED True) + +set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) + +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) + +include(${CMAKE_SOURCE_DIR}/CMake/FindDependencies.cmake) +include(${CMAKE_SOURCE_DIR}/CMake/Utils.cmake) + +find_program(MINJECT_EXECUTABLE NAMES minject) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +set(CMAKE_OPTIMIZE_DEPENDENCIES 1) + +add_compile_definitions( + $<$:NOMINMAX> + $<$:WIN32_LEAN_AND_MEAN>) + +if(BUILD_TESTS) + enable_testing() +endif() + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) + +SET(CMAKE_SKIP_BUILD_RPATH FALSE) +SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) +SET(CMAKE_INSTALL_RPATH "\${ORIGIN}") + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Bin2CPP/Sources) +if(${BUILD_TESTS}) + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Bin2CPP/Tests) +endif() + +add_custom_target(NatVis SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/Vendor/NatVis/EASTL/EASTL.natvis) \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e05d49d --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022-2026 Romain BOULLARD + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Vendor/NatVis/EASTL/EASTL.natvis b/Vendor/NatVis/EASTL/EASTL.natvis new file mode 100644 index 0000000..e1ec96d --- /dev/null +++ b/Vendor/NatVis/EASTL/EASTL.natvis @@ -0,0 +1,761 @@ + + + + + + + + ({(void*)mPair.mFirst} = {*mPair.mFirst}) + ({nullptr}) + + (void*)mPair.mFirst + *mPair.mFirst + + + + + ({(void*)mpValue} = {*mpValue}) + ({nullptr}) + + (void*)mpValue + *mpValue + mpRefCount->mRefCount + mpRefCount->mWeakRefCount + + + + + {((mpRefCount && mpRefCount->mRefCount) ? mpValue : nullptr)} + + mpRefCount && mpRefCount->mRefCount ? mpValue : nullptr + + + + + [{$T2}] {{}} + [{$T2}] {{ {*mValue} }} + [{$T2}] {{ {*mValue}, {*(mValue+1)} }} + [{$T2}] {{ {*mValue}, {*(mValue+1)}, {*(mValue+2)} }} + [{$T2}] {{ {*mValue}, {*(mValue+1)}, {*(mValue+2)}, {*(mValue+3)} }} + [{$T2}] {{ {*mValue}, {*(mValue+1)}, {*(mValue+2)}, {*(mValue+3)}, {*(mValue+4)} }} + [{$T2}] {{ {*mValue}, {*(mValue+1)}, {*(mValue+2)}, {*(mValue+3)}, {*(mValue+4)}, {*(mValue+5)} }} + [{$T2}] {{ {*mValue}, {*(mValue+1)}, {*(mValue+2)}, {*(mValue+3)}, {*(mValue+4)}, {*(mValue+5)}, ... }} + + $T2 + + $T2 + mValue + + + + + + "{mPair.mFirst.heap.mpBegin,sb}" + "{mPair.mFirst.sso.mData,sb}" + + mPair.mFirst.heap.mnSize + (mPair.mFirst.heap.mnCapacity & ~kHeapMask) + mPair.mFirst.heap.mpBegin,sb + + (SSOLayout::SSO_CAPACITY - mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize) + SSOLayout::SSO_CAPACITY + mPair.mFirst.sso.mData,sb + + !!(mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize & kSSOMask) + + + + + + {mPair.mFirst.heap.mpBegin,su} + {mPair.mFirst.sso.mData,su} + + mPair.mFirst.heap.mnSize + (mPair.mFirst.heap.mnCapacity & ~kHeapMask) + mPair.mFirst.heap.mpBegin,su + + (SSOLayout::SSO_CAPACITY - mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize) + SSOLayout::SSO_CAPACITY + mPair.mFirst.sso.mData,su + + !!(mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize & kSSOMask) + + + + + ({first}, {second}) + + first + second + + + + + [{mnSize}] {{}} + [{mnSize}] {{ {*mpData} }} + [{mnSize}] {{ {*mpData}, {*(mpData+1)} }} + [{mnSize}] {{ {*mpData}, {*(mpData+1)}, {*(mpData+2)} }} + [{mnSize}] {{ {*mpData}, {*(mpData+1)}, {*(mpData+2)}, {*(mpData+3)} }} + [{mnSize}] {{ {*mpData}, {*(mpData+1)}, {*(mpData+2)}, {*(mpData+3)}, {*(mpData+4)} }} + [{mnSize}] {{ {*mpData}, {*(mpData+1)}, {*(mpData+2)}, {*(mpData+3)}, {*(mpData+4)}, {*(mpData+5)} }} + [{mnSize}] {{ {*mpData}, {*(mpData+1)}, {*(mpData+2)}, {*(mpData+3)}, {*(mpData+4)}, {*(mpData+5)}, ... }} + + mnSize + + mnSize + mpData + + + + + + [{mpEnd - mpBegin}] {{}} + [{mpEnd - mpBegin}] {{ {*mpBegin} }} + [{mpEnd - mpBegin}] {{ {*mpBegin}, {*(mpBegin+1)} }} + [{mpEnd - mpBegin}] {{ {*mpBegin}, {*(mpBegin+1)}, {*(mpBegin+2)} }} + [{mpEnd - mpBegin}] {{ {*mpBegin}, {*(mpBegin+1)}, {*(mpBegin+2)}, {*(mpBegin+3)} }} + [{mpEnd - mpBegin}] {{ {*mpBegin}, {*(mpBegin+1)}, {*(mpBegin+2)}, {*(mpBegin+3)}, {*(mpBegin+4)} }} + [{mpEnd - mpBegin}] {{ {*mpBegin}, {*(mpBegin+1)}, {*(mpBegin+2)}, {*(mpBegin+3)}, {*(mpBegin+4)}, {*(mpBegin+5)} }} + [{mpEnd - mpBegin}] {{ {*mpBegin}, {*(mpBegin+1)}, {*(mpBegin+2)}, {*(mpBegin+3)}, {*(mpBegin+4)}, {*(mpBegin+5)}, ... }} + + mpEnd - mpBegin + mCapacityAllocator.mFirst - mpBegin + + mpEnd - mpBegin + mpBegin + + + + + + + [0] {{}} + + + [1] {{ {*mItBegin.mpCurrent} }} + + + [{(mItEnd.mpCurrentArrayPtr - mItBegin.mpCurrentArrayPtr) * $T3 + (mItEnd.mpCurrent-mItEnd.mpBegin) - (mItBegin.mpCurrent-mItBegin.mpBegin)}] + {{ + {*mItBegin.mpCurrent}, + ... + }} + + + (mItEnd.mpCurrentArrayPtr - mItBegin.mpCurrentArrayPtr) * $T3 + (mItEnd.mpCurrent-mItEnd.mpBegin) - (mItBegin.mpCurrent-mItBegin.mpBegin) + + (mItEnd.mpCurrentArrayPtr - mItBegin.mpCurrentArrayPtr) * $T3 + (mItEnd.mpCurrent-mItEnd.mpBegin) - (mItBegin.mpCurrent-mItBegin.mpBegin) + mItBegin.mpCurrentArrayPtr[(mItBegin.mpCurrent-mItBegin.mpBegin + $i) / $T3][(mItBegin.mpCurrent-mItBegin.mpBegin + $i) % $T3] + + + + + + {*mpCurrent} + + *mpCurrent + *(*(mpCurrentArrayPtr-1) + (mpEnd-mpBegin) - 1) + *(mpCurrent-1) + **(mpCurrentArrayPtr+1) + *(mpCurrent+1) + mpCurrent == mpBegin + mpCurrent+1 == mpEnd + + + + + + + {c} + + c + + + + + + [0] {{}} + + + [1] {{ {((eastl::ListNode<$T1>*)mNodeAllocator.mFirst.mpNext)->mValue} }} + + + [2] + {{ + {((eastl::ListNode<$T1>*)mNodeAllocator.mFirst.mpNext)->mValue}, + {((eastl::ListNode<$T1>*)mNodeAllocator.mFirst.mpNext->mpNext)->mValue} + }} + + + [?] + {{ + {((eastl::ListNode<$T1>*)mNodeAllocator.mFirst.mpNext)->mValue}, + {((eastl::ListNode<$T1>*)mNodeAllocator.mFirst.mpNext->mpNext)->mValue}, + ... + }} + + + + Content of lists will repeat indefinitely. Keep that in mind! + + + mNodeAllocator.mFirst.mpNext + mpNext + ((eastl::ListNode<$T1>*)this)->mValue + + + + + + {mValue} + + mValue + *(eastl::ListNode<$T1>*)mpNext + *(eastl::ListNode<$T1>*)mpPrev + + Content of lists will repeat indefinitely. Keep that in mind! + + + The rest of the list follows: + + + (eastl::ListNode<$T1>*)mpNext->mpNext + (eastl::ListNode<$T1>*)mpNext + mValue + + + + + + {*mpNode} + + *(eastl::ListNode<$T1>*)mpNode + + + + + + [0] {{}} + + + [1] + {{ + {((eastl::SListNode<$T1>*)mNode.mpNext)->mValue} + }} + + + [2] + {{ + {((eastl::SListNode<$T1>*)mNode.mpNext)->mValue}, + {((eastl::SListNode<$T1>*)mNode.mpNext->mpNext)->mValue} + }} + + + [?] + {{ + {((eastl::SListNode<$T1>*)mNode.mpNext)->mValue}, + {((eastl::SListNode<$T1>*)mNode.mpNext->mpNext)->mValue}, + ... + }} + + + + mNode.mpNext + mpNext + ((eastl::SListNode<$T1>*)this)->mValue + + + + + + {mValue} + + mValue + *(eastl::SListNode<$T1>*)mpNext + + The rest of the list follows: + + + mpNext == nullptr ? nullptr : (eastl::SListNode<$T1>*)mpNext->mpNext + (eastl::SListNode<$T1>*)mpNext + mValue + + + + + + {*mpNode} + + *(eastl::SListNode<$T1>*)mpNode + + + + + [0] {{}} + [1] {{ {mAnchor.mpNext} }} + [?] {{ {mAnchor.mpNext}, ... }} + + + Content of intrusive lists will repeat indefinitely. Keep that in mind! + + + mAnchor.mpNext + mpNext + *this + + + + + + {*($T1*)mpNode} + + *($T1*)mpNode + + + + + + + [0] {{}} + + + [1] + {{ + {((eastl::rbtree_node<$T1>*)mAnchor.mpNodeLeft)->mValue} + }} + + + [{mnSize}] + {{ + {((eastl::rbtree_node<$T1>*)mAnchor.mpNodeLeft)->mValue}, + ... + }} + + + mnSize + + mnSize + mAnchor.mpNodeParent + mpNodeLeft + mpNodeRight + ((eastl::rbtree_node<$T1>*)this)->mValue + + + + + + + [0] {{}} + + + [1] + {{ + {((eastl::rbtree_node<$T2>*)mAnchor.mpNodeLeft)->mValue} + }} + + + [{mnSize}] + {{ + {((eastl::rbtree_node<$T2>*)mAnchor.mpNodeLeft)->mValue}, + ... + }} + + + mnSize + + mnSize + mAnchor.mpNodeParent + mpNodeLeft + mpNodeRight + ((eastl::rbtree_node<$T2>*)this)->mValue + + + + + + {mValue} + + mValue + + It is possible to expand parents that do not exist. + + *(eastl::rbtree_node<$T1>*)mpNodeParent + *(eastl::rbtree_node<$T1>*)mpNodeLeft + *(eastl::rbtree_node<$T1>*)mpNodeRight + + + + + {*(eastl::rbtree_node<$T1>*)mpNode} + + *(eastl::rbtree_node<$T1>*)mpNode + + + + + + [{mnElementCount}] {{}} + [{mnElementCount}] {{ ... }} + + + mnBucketCount + mpBucketArray + + + + + + entry->mValue + + entry = entry->mpNext + + + bucketIndex++ + + entry = mpBucketArray[bucketIndex] + + + + + + + + + [{mnElementCount}] {{}} + [{mnElementCount}] {{ ... }} + + + + + + entry->mValue.second + + entry = entry->mpNext + + + bucketIndex++ + + entry = mpBucketArray[bucketIndex] + + + + + + + + {mValue}, {*mpNext} + {mValue} + + + + this + mpNext + mValue + + + + + + {mpNode->mValue} + + mpNode->mValue + + + + + {*(mIterator-1)} + + mIterator-1 + + + + + {{count = {kSize}}} + + kSize + + + + + + kSize + + + bBitValue = ((mWord[iWord] >> iBitInWord) % 2) != 0 ? true : false + bBitValue + iBitInWord++ + + iWord++ + iBitInWord = 0 + + + + + + + + {c} + + c + + + + + {mpBegin,[mnCount]} + mpBegin,[mnCount] + + + + ({mFirst}, {mSecond}) + ({mSecond}) + ({mFirst}) + (empty) + (empty) + ({mFirst}, {mSecond}) + + + + + nullopt + {value()} + + value() + + + + + {$T1} to {$T2}} + + + + + {mRep} nanoseconds + + + + {mRep} microseconds + + + + {mRep} milliseconds + + + + {mRep} seconds + + + + {mRep} minutes + + + + {mRep} hours + + + + {mRep} duration with ratio = [{$T2} : {$T3}] + + + + + + empty + {mInvokeFuncPtr} + + + + + {*val} + + + + + empty + {m_storage.external_storage} + + + + + {mAtomic} + + mAtomic + + + + + {mFlag.mAtomic} + + + + + [valueless_by_exception] + {{ index=0, value={($T1*)mStorage.mBuffer.mCharData}} + {{ index=1, value={($T2*)mStorage.mBuffer.mCharData}} + {{ index=2, value={($T3*)mStorage.mBuffer.mCharData}} + {{ index=3, value={($T4*)mStorage.mBuffer.mCharData}} + {{ index=4, value={($T5*)mStorage.mBuffer.mCharData}} + {{ index=5, value={($T6*)mStorage.mBuffer.mCharData}} + {{ index=6, value={($T7*)mStorage.mBuffer.mCharData}} + {{ index=7, value={($T8*)mStorage.mBuffer.mCharData}} + {{ index=8, value={($T9*)mStorage.mBuffer.mCharData}} + {{ index=9, value={($T10*)mStorage.mBuffer.mCharData}} + {{ index=10, value={($T11*)mStorage.mBuffer.mCharData}} + {{ index=11, value={($T12*)mStorage.mBuffer.mCharData}} + {{ index=12, value={($T13*)mStorage.mBuffer.mCharData}} + {{ index=13, value={($T14*)mStorage.mBuffer.mCharData}} + {{ index=14, value={($T15*)mStorage.mBuffer.mCharData}} + {{ index=15, value={($T16*)mStorage.mBuffer.mCharData}} + {{ index=16, value={($T17*)mStorage.mBuffer.mCharData}} + {{ index=17, value={($T18*)mStorage.mBuffer.mCharData}} + {{ index=18, value={($T19*)mStorage.mBuffer.mCharData}} + {{ index=19, value={($T20*)mStorage.mBuffer.mCharData}} + {{ index=20, value={($T21*)mStorage.mBuffer.mCharData}} + {{ index=21, value={($T22*)mStorage.mBuffer.mCharData}} + {{ index=22, value={($T23*)mStorage.mBuffer.mCharData}} + {{ index=23, value={($T24*)mStorage.mBuffer.mCharData}} + {{ index=24, value={($T25*)mStorage.mBuffer.mCharData}} + {{ index=25, value={($T26*)mStorage.mBuffer.mCharData}} + {{ index=26, value={($T27*)mStorage.mBuffer.mCharData}} + {{ index=27, value={($T28*)mStorage.mBuffer.mCharData}} + {{ index=28, value={($T29*)mStorage.mBuffer.mCharData}} + {{ index=29, value={($T30*)mStorage.mBuffer.mCharData}} + {{ index=30, value={($T31*)mStorage.mBuffer.mCharData}} + + index() + ($T1*)mStorage.mBuffer.mCharData + ($T2*)mStorage.mBuffer.mCharData + ($T3*)mStorage.mBuffer.mCharData + ($T4*)mStorage.mBuffer.mCharData + ($T5*)mStorage.mBuffer.mCharData + ($T6*)mStorage.mBuffer.mCharData + ($T7*)mStorage.mBuffer.mCharData + ($T8*)mStorage.mBuffer.mCharData + ($T9*)mStorage.mBuffer.mCharData + ($T10*)mStorage.mBuffer.mCharData + ($T11*)mStorage.mBuffer.mCharData + ($T12*)mStorage.mBuffer.mCharData + ($T13*)mStorage.mBuffer.mCharData + ($T14*)mStorage.mBuffer.mCharData + ($T15*)mStorage.mBuffer.mCharData + ($T16*)mStorage.mBuffer.mCharData + ($T17*)mStorage.mBuffer.mCharData + ($T18*)mStorage.mBuffer.mCharData + ($T19*)mStorage.mBuffer.mCharData + ($T20*)mStorage.mBuffer.mCharData + ($T21*)mStorage.mBuffer.mCharData + ($T22*)mStorage.mBuffer.mCharData + ($T23*)mStorage.mBuffer.mCharData + ($T24*)mStorage.mBuffer.mCharData + ($T25*)mStorage.mBuffer.mCharData + ($T26*)mStorage.mBuffer.mCharData + ($T27*)mStorage.mBuffer.mCharData + ($T28*)mStorage.mBuffer.mCharData + ($T29*)mStorage.mBuffer.mCharData + ($T30*)mStorage.mBuffer.mCharData + ($T31*)mStorage.mBuffer.mCharData + + + + + + + ({*this,view(noparens)}) + + + + + {(*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue} + ({*this,view(noparens)}) + + (*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue + + + + + {(*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<1,$T2,0>*)&mImpl)).mValue} + ({*this,view(noparens)}) + + (*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<1,$T2,0>*)&mImpl)).mValue + + + + + {(*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<1,$T2,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<2,$T3,0>*)&mImpl)).mValue} + ({*this,view(noparens)}) + + (*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<1,$T2,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<2,$T3,0>*)&mImpl)).mValue + + + + + {(*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<1,$T2,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<2,$T3,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<3,$T4,0>*)&mImpl)).mValue} + ({*this,view(noparens)}) + + (*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<1,$T2,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<2,$T3,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<3,$T4,0>*)&mImpl)).mValue + + + + + {(*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<1,$T2,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<2,$T3,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<3,$T4,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<4,$T5,0>*)&mImpl)).mValue} + ({*this,view(noparens)}) + + (*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<1,$T2,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<2,$T3,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<3,$T4,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<4,$T5,0>*)&mImpl)).mValue + + + + + {(*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<1,$T2,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<2,$T3,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<3,$T4,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<4,$T5,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<5,$T6,0>*)&mImpl)).mValue} + ({*this,view(noparens)}) + + (*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<1,$T2,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<2,$T3,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<3,$T4,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<4,$T5,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<5,$T6,0>*)&mImpl)).mValue + + + + + {(*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<1,$T2,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<2,$T3,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<3,$T4,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<4,$T5,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<5,$T6,0>*)&mImpl)).mValue}, {(*((eastl::Internal::TupleLeaf<6,$T7,0>*)&mImpl)).mValue} + ({*this,view(noparens)}) + + (*((eastl::Internal::TupleLeaf<0,$T1,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<1,$T2,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<2,$T3,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<3,$T4,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<4,$T5,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<5,$T6,0>*)&mImpl)).mValue + (*((eastl::Internal::TupleLeaf<6,$T7,0>*)&mImpl)).mValue + + + + + diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..21e306c --- /dev/null +++ b/conanfile.py @@ -0,0 +1,66 @@ +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 Bigfoot(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" + + # Binary configuration + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_tests": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_tests": False, + } + + generators = "CMakeDeps" + + def layout(self): + cmake_layout(self) + + def configure(self): + if self.settings.os == "Windows": + del self.options.fPIC + + self.options['mimalloc'].override = True + self.options['mimalloc'].shared = True + if(self.settings.os == "Windows"): + self.options["mimalloc"].win_redirect = True + + def requirements(self): + self.requires("quill/11.0.2", transitive_headers=True) + self.requires("eastl/3.27.01@bigfootdev/main", transitive_headers=True) + self.requires("mimalloc/3.2.8@bigfootdev/main", transitive_headers=True) + self.requires("cli11/2.6.1@bigfootdev/main") + self.requires("rapidhash/3.0@bigfootdev/main", transitive_headers=True) + + 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.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() \ No newline at end of file diff --git a/format.bat b/format.bat new file mode 100644 index 0000000..54d904f --- /dev/null +++ b/format.bat @@ -0,0 +1,71 @@ +@echo off +SETLOCAL ENABLEDELAYEDEXPANSION + +REM ========================= +REM Variables +REM ========================= +SET FMT=clang-format +SET MODE= +SET EXIT_CODE=0 + +REM ========================= +REM Parse arguments +REM ========================= +:parse_args +IF "%~1"=="" GOTO end_parse_args +IF "%~1"=="--check" ( + SET MODE=check +) ELSE IF "%~1"=="--fix" ( + SET MODE=fix +) ELSE ( + REM Accumulate directories + SET DIRS=!DIRS! "%~1" +) +SHIFT +GOTO parse_args +:end_parse_args + +IF "%MODE%"=="" ( + ECHO Usage: %~nx0 --check|--fix [ ...] + EXIT /B 1 +) + +IF "%DIRS%"=="" ( + ECHO Please provide at least one directory. + EXIT /B 1 +) + +REM ========================= +REM Iterate over directories +REM ========================= +FOR %%D IN (%DIRS%) DO ( + IF NOT EXIST "%%~D" ( + ECHO %%~D is not a valid directory. + SET EXIT_CODE=1 + GOTO :continue_dirs + ) + + REM Recursively find source files + FOR /R "%%~D" %%F IN (*.h *.hpp *.c *.cpp *.m *.mm) DO ( + SET FILE=%%F + REM Skip *_generated* files + ECHO !FILE! | FINDSTR /I "_generated" >nul + IF ERRORLEVEL 1 ( + IF "%MODE%"=="fix" ( + ECHO Formatting !FILE! + %FMT% -i "!FILE!" + ) ELSE ( + ECHO Checking !FILE! + %FMT% --dry-run --Werror "!FILE!" 2>nul + IF ERRORLEVEL 1 ( + REM clang-format will already print diagnostics + SET EXIT_CODE=1 + ) + ) + ) + ) + + :continue_dirs +) + +EXIT /B %EXIT_CODE% diff --git a/format.sh b/format.sh new file mode 100644 index 0000000..eb8f665 --- /dev/null +++ b/format.sh @@ -0,0 +1,68 @@ +#!/bin/bash +set -euo pipefail + +FMT="clang-format" +MODE="" +DIRS=() +EXIT_CODE=0 + +# ========================= +# Parse arguments +# ========================= +for arg in "$@"; do + case "$arg" in + --check) + MODE="check" + ;; + --fix) + MODE="fix" + ;; + *) + DIRS+=("$arg") + ;; + esac +done + +# Ensure mode is set +if [[ -z "$MODE" ]]; then + echo "Usage: $0 --check|--fix [ ...]" + exit 1 +fi + +# Ensure at least one directory +if [[ ${#DIRS[@]} -eq 0 ]]; then + echo "Please provide at least one directory." + exit 1 +fi + +# ========================= +# Process directories +# ========================= +for DIR in "${DIRS[@]}"; do + if [[ ! -d "$DIR" ]]; then + echo "$DIR is not a valid directory." + EXIT_CODE=1 + continue + fi + + # Find all source files safely (null-separated) + while IFS= read -r -d '' FILE; do + [[ "$FILE" == *_generated* ]] && continue + + if [[ "$MODE" == "fix" ]]; then + echo "Formatting $FILE" + "$FMT" -i "$FILE" + else + echo "Checking $FILE" + # Check mode: clang-format diagnostic only + if ! "$FMT" --dry-run --Werror "$FILE"; then + # clang-format prints: file:line:col: error ... + EXIT_CODE=1 + fi + fi + done < <( + find "$DIR" \( -name '*.h' -o -name '*.hpp' -o -name '*.c' -o -name '*.cpp' -o -name '*.m' -o -name '*.mm' \) -print0 + ) +done + +exit $EXIT_CODE diff --git a/generate_bin2cpp.bat b/generate_bin2cpp.bat new file mode 100644 index 0000000..0f4298f --- /dev/null +++ b/generate_bin2cpp.bat @@ -0,0 +1 @@ +cmake -S . -B build --toolchain build/generators/conan_toolchain.cmake --graphviz=graphviz/graph.dot \ No newline at end of file diff --git a/generate_bin2cpp.sh b/generate_bin2cpp.sh new file mode 100644 index 0000000..1b72527 --- /dev/null +++ b/generate_bin2cpp.sh @@ -0,0 +1,3 @@ +cmake -S . -B build/Debug --toolchain build/build/Debug/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE="Debug" -G "Ninja" --graphviz=graphviz/Debug/graph.dot +cmake -S . -B build/Release --toolchain build/build/Release/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE="Release" -G "Ninja" --graphviz=graphviz/Release/graph.dot +cmake -S . -B build/RelWithDebInfo --toolchain build/build/RelWithDebInfo/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE="RelWithDebInfo" -G "Ninja" --graphviz=graphviz/RelWithDebInfo/graph.dot \ No newline at end of file diff --git a/generate_dependencies.bat b/generate_dependencies.bat new file mode 100644 index 0000000..9ef984c --- /dev/null +++ b/generate_dependencies.bat @@ -0,0 +1,33 @@ +@echo off +setlocal + +REM Check if the correct number of arguments is provided +if "%~1"=="" ( + echo Usage: %0 "[force|missing]" + exit /b 1 +) + +REM Set the build option based on the argument +set build_option= +if "%~1"=="force" ( + set build_option=--build="*" +) else if "%~1"=="missing" ( + set build_option=--build=missing +) else ( + echo Invalid argument: %~1 + echo Usage: %0 "[force|missing]" + exit /b 1 +) + +REM Add the remote +conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/api/conan/BigfootPackages + +REM Install the conan configuration +conan config install https://git.romainboullard.com/BigfootDev/ConanProfiles.git + +REM Install dependencies with the specified build option +conan install . --deployer=full_deploy --remote=bigfootpackages %build_option% -of build -s build_type=Release -o bin2cpp/*:build_tests=True +conan install . --deployer=full_deploy --remote=bigfootpackages %build_option% -of build -s build_type=RelWithDebInfo -o bin2cpp/*:build_tests=True +conan install . --deployer=full_deploy --remote=bigfootpackages %build_option% -of build -s build_type=Debug -o bin2cpp/*:build_tests=True + +endlocal diff --git a/generate_dependencies.sh b/generate_dependencies.sh new file mode 100644 index 0000000..aed8021 --- /dev/null +++ b/generate_dependencies.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Check if the correct number of arguments is provided +if [ -z "$1" ]; then + echo "Usage: $0 [force|missing]" + exit 1 +fi + +# Add the remote +conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/api/conan/BigfootPackages + +# Install the conan configuration +conan config install https://git.romainboullard.com/BigfootDev/ConanProfiles.git + +# Set the build option based on the argument +if [ "$1" == "force" ]; then + conan install . --deployer=full_deploy --remote=bigfootpackages --build='*' -of build -s build_type=Release -o bin2cpp/*:build_tests=True + conan install . --deployer=full_deploy --remote=bigfootpackages --build='*' -of build -s build_type=RelWithDebInfo -o bin2cpp/*:build_tests=True + conan install . --deployer=full_deploy --remote=bigfootpackages --build='*' -of build -s build_type=Debug -o bin2cpp/*:build_tests=True +elif [ "$1" == "missing" ]; then + conan install . --deployer=full_deploy --remote=bigfootpackages --build=missing -of build -s build_type=Release -o bin2cpp/*:build_tests=True + conan install . --deployer=full_deploy --remote=bigfootpackages --build=missing -of build -s build_type=RelWithDebInfo -o bin2cpp/*:build_tests=True + conan install . --deployer=full_deploy --remote=bigfootpackages --build=missing -of build -s build_type=Debug -o bin2cpp/*:build_tests=True + echo "Invalid argument: $1" + echo "Usage: $0 [force|missing]" + exit 1 +fi diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..6d53dbf --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,14 @@ +sonar.projectKey=Bin2CPP + +sonar.projectVersion=0.1.0 + +sonar.sourceEncoding=UTF-8 + +sonar.sources=Bin2CPP/Sources +sonar.tests=Bin2CPP/Tests + +sonar.cxx.file.suffixes=.hpp,.cpp,.h +sonar.cxx.clangtidy.reportPaths=tidy_result.txt +sonar.cxx.infer.reportPaths=infer-out/report.json + +sonar.cxx.jsonCompilationDatabase.analyzeOnlyContainedFiles=True