Compare commits
30 Commits
9786d5a016
...
BigFile
| Author | SHA1 | Date | |
|---|---|---|---|
| 5397d358f6 | |||
| 9c59bd6ab8 | |||
| ab96945192 | |||
| 45342a3555 | |||
| a21354b4b4 | |||
| d6df6d8a71 | |||
| bbc8aa3e80 | |||
| 75bd0bf441 | |||
| e4bcf5563c | |||
| 46c3034ea6 | |||
| f5ad5adff6 | |||
| 0ef2f842cb | |||
| 5f8643538b | |||
| a886b4da8a | |||
| a41c732808 | |||
| 6317604bd2 | |||
| b2f3b095be | |||
| 5829530652 | |||
| a062a058cd | |||
| 46b8095c6a | |||
| 63fd92c584 | |||
| 3466469440 | |||
| b5c2e4936b | |||
| 02a08012d0 | |||
| 3d4394765b | |||
| 063645fae3 | |||
| 6c8979684d | |||
| 245867da3b | |||
| 3a890069de | |||
| 1775e864b4 |
22
.clang-tidy
Normal file
22
.clang-tidy
Normal file
@@ -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
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
conan install . --deployer=full_deploy --deployer-folder=build --remote=bigfootpackages -pr:h=clang -pr:b=clang --build=missing -s build_type=${{ matrix.build_type }} -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=False -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/clang --build=missing -s build_type=${{ matrix.build_type }} -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=False -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
cmake -S . -B ./build/${{ matrix.build_type }} --toolchain ./build/${{ matrix.build_type }}/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_UNITY_BUILD=${{ matrix.unity_build }} -G "Ninja"
|
||||
cmake --build build/${{ matrix.build_type }} --parallel $(nproc)
|
||||
|
||||
|
||||
47
.gitea/workflows/sonarqube.yml
Normal file
47
.gitea/workflows/sonarqube.yml
Normal file
@@ -0,0 +1,47 @@
|
||||
name: Bigfoot
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- Development
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 120
|
||||
container:
|
||||
image: git.romainboullard.com/bigfootdev/linuxbigfootbuilder: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 install . --remote=bigfootpackages -pr:h=./ConanProfiles/clang_coverage -pr:b=./ConanProfiles/clang_coverage --build=missing -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=False -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=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 }}
|
||||
3
.inferconfig
Normal file
3
.inferconfig
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
||||
22
Bigfoot/Sources/Engine/BigFile/Asset/AssetTypeID.cpp
Normal file
22
Bigfoot/Sources/Engine/BigFile/Asset/AssetTypeID.cpp
Normal file
@@ -0,0 +1,22 @@
|
||||
/*********************************************************************
|
||||
* \file AssetTypeID.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date February 2026
|
||||
*********************************************************************/
|
||||
#include <Engine/BigFile/Asset/AssetTypeID.hpp>
|
||||
|
||||
namespace flatbuffers
|
||||
{
|
||||
Bigfoot::Flat::AssetTypeID Pack(const Bigfoot::AssetTypeID& p_assetTypeID)
|
||||
{
|
||||
return Bigfoot::Flat::AssetTypeID {p_assetTypeID};
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
Bigfoot::AssetTypeID UnPack(const Bigfoot::Flat::AssetTypeID& p_flatAssetTypeID)
|
||||
{
|
||||
return Bigfoot::AssetTypeID {p_flatAssetTypeID.value()};
|
||||
}
|
||||
} // namespace flatbuffers
|
||||
275
Bigfoot/Sources/Engine/BigFile/BigFile.cpp
Normal file
275
Bigfoot/Sources/Engine/BigFile/BigFile.cpp
Normal file
@@ -0,0 +1,275 @@
|
||||
/*********************************************************************
|
||||
* \file BigFile.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date October 2025
|
||||
*********************************************************************/
|
||||
#include <Engine/BigFile/BigFile.hpp>
|
||||
|
||||
#include <Engine/EngineAssertHandler.hpp>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
BigFile::BigFile(const File& p_file)
|
||||
{
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_open_v2(p_file.Absolute().Path().data(), &m_db, SQLITE_OPEN_READWRITE, nullptr);
|
||||
CRITICAL_ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to open BigFile DB: {}", sqlite3_errmsg(m_db));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
void BigFile::BeginTransaction()
|
||||
{
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_exec(m_db, "BEGIN TRANSACTION;", nullptr, nullptr, nullptr);
|
||||
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to begin transaction: {}", sqlite3_errmsg(m_db));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
void BigFile::CommitTransaction()
|
||||
{
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_exec(m_db, "COMMIT TRANSACTION;", nullptr, nullptr, nullptr);
|
||||
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to commit: {}", sqlite3_errmsg(m_db));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
void BigFile::RollbackTransaction()
|
||||
{
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_exec(m_db, "ROLLBACK TRANSACTION;", nullptr, nullptr, nullptr);
|
||||
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to rollback: {}", sqlite3_errmsg(m_db));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
BigFile::~BigFile()
|
||||
{
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_close_v2(m_db);
|
||||
CRITICAL_ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to close BigFile DB: {}", sqlite3_errmsg(m_db));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
BigFile::Request::Request(const BigFile& p_bigFile, const eastl::string_view p_request):
|
||||
m_db(p_bigFile.m_db)
|
||||
{
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_prepare_v2(m_db,
|
||||
p_request.data(),
|
||||
static_cast<std::uint32_t>(p_request.size()),
|
||||
&m_statement,
|
||||
nullptr);
|
||||
CRITICAL_ASSERT(EngineAssertHandler,
|
||||
result == SQLITE_OK,
|
||||
"Failed to create statement from BigFile DB: {}",
|
||||
sqlite3_errmsg(m_db));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
void BigFile::Request::Bind(const std::uint32_t p_index, const std::int32_t p_value)
|
||||
{
|
||||
ASSERT(EngineAssertHandler,
|
||||
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
|
||||
"Invalid index for statement");
|
||||
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_bind_int(m_statement, p_index, p_value);
|
||||
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
void BigFile::Request::Bind(const std::uint32_t p_index, const std::uint32_t p_value)
|
||||
{
|
||||
ASSERT(EngineAssertHandler,
|
||||
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
|
||||
"Invalid index for statement");
|
||||
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_bind_int(m_statement, p_index, p_value);
|
||||
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
void BigFile::Request::Bind(const std::uint32_t p_index, const std::int64_t p_value)
|
||||
{
|
||||
ASSERT(EngineAssertHandler,
|
||||
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
|
||||
"Invalid index for statement");
|
||||
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_bind_int64(m_statement, p_index, p_value);
|
||||
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
void BigFile::Request::Bind(const std::uint32_t p_index, const float p_value)
|
||||
{
|
||||
ASSERT(EngineAssertHandler,
|
||||
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
|
||||
"Invalid index for statement");
|
||||
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_bind_double(m_statement, p_index, p_value);
|
||||
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
void BigFile::Request::Bind(const std::uint32_t p_index, const double p_value)
|
||||
{
|
||||
ASSERT(EngineAssertHandler,
|
||||
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
|
||||
"Invalid index for statement");
|
||||
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_bind_double(m_statement, p_index, p_value);
|
||||
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
void BigFile::Request::Bind(const std::uint32_t p_index, const eastl::string_view p_value, const CopyValue p_copy)
|
||||
{
|
||||
ASSERT(EngineAssertHandler,
|
||||
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
|
||||
"Invalid index for statement");
|
||||
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_bind_text(m_statement,
|
||||
p_index,
|
||||
p_value.data(),
|
||||
static_cast<std::uint32_t>(p_value.size()),
|
||||
p_copy ? SQLITE_TRANSIENT : SQLITE_STATIC);
|
||||
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
void BigFile::Request::Bind(const std::uint32_t p_index,
|
||||
const eastl::span<const std::byte> p_value,
|
||||
const CopyValue p_copy)
|
||||
{
|
||||
ASSERT(EngineAssertHandler,
|
||||
(p_index >= 1) && (p_index <= static_cast<std::uint32_t>(sqlite3_bind_parameter_count(m_statement))),
|
||||
"Invalid index for statement");
|
||||
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_bind_blob(m_statement,
|
||||
p_index,
|
||||
p_value.data(),
|
||||
static_cast<std::uint32_t>(p_value.size()),
|
||||
p_copy ? SQLITE_TRANSIENT : SQLITE_STATIC);
|
||||
ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to bind value for statement: {}", sqlite3_errmsg(m_db));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
bool BigFile::Request::Step()
|
||||
{
|
||||
const int result = sqlite3_step(m_statement);
|
||||
ASSERT(EngineAssertHandler,
|
||||
(result == SQLITE_DONE) || (result == SQLITE_ROW),
|
||||
"Failed to step through the statement: {}",
|
||||
sqlite3_errmsg(m_db));
|
||||
|
||||
return result == SQLITE_ROW;
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
std::uint32_t BigFile::Request::Execute()
|
||||
{
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_step(m_statement);
|
||||
ASSERT(EngineAssertHandler, (result == SQLITE_DONE), "Failed to execute the statement: {}", sqlite3_errmsg(m_db));
|
||||
|
||||
return sqlite3_changes(m_db);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
BigFile::Request::Column::Column(const Request& p_request, const std::uint32_t p_index):
|
||||
m_statement(p_request.m_statement),
|
||||
m_index(p_index)
|
||||
{
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
BigFile::Request::Column::operator std::int32_t() const
|
||||
{
|
||||
return sqlite3_column_int(m_statement, m_index);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
BigFile::Request::Column::operator std::uint32_t() const
|
||||
{
|
||||
return sqlite3_column_int(m_statement, m_index);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
BigFile::Request::Column::operator std::int64_t() const
|
||||
{
|
||||
return sqlite3_column_int64(m_statement, m_index);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
BigFile::Request::Column::operator float() const
|
||||
{
|
||||
return static_cast<float>(sqlite3_column_double(m_statement, m_index));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
BigFile::Request::Column::operator double() const
|
||||
{
|
||||
return sqlite3_column_double(m_statement, m_index);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
BigFile::Request::Column::operator eastl::string_view() const
|
||||
{
|
||||
return eastl::string_view {reinterpret_cast<const char*>(sqlite3_column_text(m_statement, m_index)),
|
||||
static_cast<std::size_t>(sqlite3_column_bytes(m_statement, m_index))};
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
BigFile::Request::Column::operator eastl::span<const std::byte>() const
|
||||
{
|
||||
return eastl::span<const std::byte> {static_cast<const std::byte*>(sqlite3_column_blob(m_statement, m_index)),
|
||||
static_cast<std::size_t>(sqlite3_column_bytes(m_statement, m_index))};
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
BigFile::Request::Column BigFile::Request::Get(const std::uint32_t p_index) const
|
||||
{
|
||||
ASSERT(EngineAssertHandler,
|
||||
p_index < static_cast<std::uint32_t>(sqlite3_column_count(m_statement)),
|
||||
"Invalid index for column!");
|
||||
return {*this, p_index};
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
BigFile::Request::~Request()
|
||||
{
|
||||
[[maybe_unused]]
|
||||
const int result = sqlite3_finalize(m_statement);
|
||||
CRITICAL_ASSERT(EngineAssertHandler, result == SQLITE_OK, "Failed to finalize statement: {}", sqlite3_errmsg(m_db));
|
||||
}
|
||||
} // namespace Bigfoot
|
||||
122
Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/Asset.hpp
Normal file
122
Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/Asset.hpp
Normal file
@@ -0,0 +1,122 @@
|
||||
/*********************************************************************
|
||||
* \file Asset.hpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date February 2026
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_ENGINE_ASSET_HPP
|
||||
#define BIGFOOT_ENGINE_ASSET_HPP
|
||||
#include <Engine/BigFile/Asset/AssetHeader_generated.hpp>
|
||||
|
||||
#include <Engine/EngineAssertHandler.hpp>
|
||||
|
||||
#include <EASTL/vector.h>
|
||||
#include <rapidhash.h>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
template<typename FLAT_ASSET>
|
||||
concept FlatAssetConcept = requires(FLAT_ASSET p_flatAsset) {
|
||||
requires std::is_base_of_v<::flatbuffers::Table, FLAT_ASSET> &&
|
||||
std::derived_from<typename FLAT_ASSET::NativeTableType, ::flatbuffers::NativeTable>;
|
||||
|
||||
{ FLAT_ASSET::GetFullyQualifiedName() } -> std::convertible_to<const char*>;
|
||||
{ p_flatAsset.asset_header() } -> std::same_as<const Bigfoot::Flat::AssetHeader*>;
|
||||
};
|
||||
|
||||
template<FlatAssetConcept FLAT_ASSET>
|
||||
class FlatAssetWrapper
|
||||
{
|
||||
private:
|
||||
using FLAT_ASSET_NATIVE = FLAT_ASSET::NativeTableType;
|
||||
using FLAT_ASSET_BUILDER = FLAT_ASSET::Builder;
|
||||
|
||||
public:
|
||||
FlatAssetWrapper()
|
||||
{
|
||||
m_asset.asset_header = eastl::make_unique<Flat::AssetHeaderT>();
|
||||
m_asset.asset_header->type_id = TypeID();
|
||||
m_asset.asset_header->type_name = TypeName();
|
||||
}
|
||||
|
||||
FlatAssetWrapper(const eastl::span<const std::byte> p_flatBuffer)
|
||||
{
|
||||
flatbuffers::Verifier::Options verifierOptions;
|
||||
flatbuffers::Verifier verifier {std::bit_cast<const std::uint8_t*>(p_flatBuffer.data()),
|
||||
p_flatBuffer.size(),
|
||||
verifierOptions};
|
||||
CRITICAL_ASSERT(EngineAssertHandler,
|
||||
verifier.VerifyBuffer<FLAT_ASSET>(),
|
||||
"Flatbuffer verifier failed for FLAT_ASSET!");
|
||||
|
||||
const FLAT_ASSET* flatAsset = flatbuffers::GetRoot<FLAT_ASSET>(p_flatBuffer.data());
|
||||
CRITICAL_ASSERT(EngineAssertHandler,
|
||||
flatAsset->asset_header()->type_id()->value() == TypeID() &&
|
||||
(std::strcmp(flatAsset->asset_header()->type_name()->c_str(), TypeName().data()) == 0),
|
||||
"Mismatch between flatbufer type and actual type! flatbuffer = {}/{}; expected = {}/{}",
|
||||
flatAsset->asset_header()->type_name()->c_str(),
|
||||
flatAsset->asset_header()->type_id()->value(),
|
||||
TypeName(),
|
||||
TypeID());
|
||||
|
||||
flatAsset->UnPackTo(&m_asset);
|
||||
}
|
||||
|
||||
FlatAssetWrapper(const FlatAssetWrapper& p_assetWrapper) = delete;
|
||||
FlatAssetWrapper(FlatAssetWrapper&& p_assetWrapper) = delete;
|
||||
|
||||
~FlatAssetWrapper() = default;
|
||||
|
||||
eastl::vector<std::byte> Pack() const
|
||||
{
|
||||
flatbuffers::FlatBufferBuilder builder;
|
||||
builder.Finish(FLAT_ASSET::Pack(builder, &m_asset));
|
||||
|
||||
eastl::vector<std::byte> result {builder.GetSize()};
|
||||
eastl::transform(builder.GetBufferSpan().begin(),
|
||||
builder.GetBufferSpan().end(),
|
||||
result.begin(),
|
||||
[](const std::uint8_t p_value)
|
||||
{
|
||||
return static_cast<std::byte>(p_value);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
FLAT_ASSET_NATIVE& Asset()
|
||||
{
|
||||
return m_asset;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
const FLAT_ASSET_NATIVE& Asset() const
|
||||
{
|
||||
return m_asset;
|
||||
}
|
||||
|
||||
static AssetTypeID TypeID()
|
||||
{
|
||||
static eastl::string_view typeName = TypeName();
|
||||
static AssetTypeID typeID = rapidhash(typeName.data(), typeName.size());
|
||||
|
||||
return typeID;
|
||||
}
|
||||
|
||||
static eastl::string_view TypeName()
|
||||
{
|
||||
static eastl::string_view typeName {FLAT_ASSET::GetFullyQualifiedName()};
|
||||
|
||||
return typeName;
|
||||
}
|
||||
|
||||
FlatAssetWrapper& operator=(const FlatAssetWrapper p_assetWrapper) = delete;
|
||||
FlatAssetWrapper& operator=(FlatAssetWrapper&& p_assetWrapper) = delete;
|
||||
|
||||
private:
|
||||
FLAT_ASSET_NATIVE m_asset;
|
||||
};
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,115 @@
|
||||
/*********************************************************************
|
||||
* \file AssetContainer.hpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date February 2026
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_ENGINE_ASSETCONTAINER_HPP
|
||||
#define BIGFOOT_ENGINE_ASSETCONTAINER_HPP
|
||||
#include <Engine/BigFile/Asset/Asset.hpp>
|
||||
#include <Engine/EngineAssertHandler.hpp>
|
||||
|
||||
#include <ankerl/unordered_dense.h>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
template<typename ASSET>
|
||||
concept BigfootAssetConcept = requires(ASSET p_asset, const ASSET p_constAsset) {
|
||||
requires FlatAssetConcept<typename ASSET::FLAT_ASSET> &&
|
||||
std::constructible_from<ASSET, FlatAssetWrapper<typename ASSET::FLAT_ASSET>*>;
|
||||
};
|
||||
|
||||
template<BigfootAssetConcept ASSET>
|
||||
class AssetContainer
|
||||
{
|
||||
public:
|
||||
AssetContainer() = default;
|
||||
|
||||
AssetContainer(const AssetContainer& p_container) = delete;
|
||||
AssetContainer(AssetContainer&& p_container) = delete;
|
||||
|
||||
[[nodiscard]]
|
||||
bool Add(const UUID& p_uuid)
|
||||
{
|
||||
return m_assets.emplace(p_uuid, AssetHandle {}).second;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
bool Load(const UUID& p_uuid, const eastl::span<const std::byte> p_flatBuffer)
|
||||
{
|
||||
if (!m_assets.contains(p_uuid))
|
||||
{
|
||||
const bool added = Add(p_uuid);
|
||||
ASSERT(EngineAssertHandler, added, "{} not added to AssetContainer! Already in container ?", p_uuid);
|
||||
}
|
||||
|
||||
AssetHandle& assetHandle = m_assets.at(p_uuid);
|
||||
if (assetHandle.m_assetPair)
|
||||
{
|
||||
SOFT_ASSERT(EngineAssertHandler, false, "{} already loaded!", p_uuid);
|
||||
return true;
|
||||
}
|
||||
|
||||
assetHandle.m_assetPair = eastl::make_unique<AssetHandle::Data>(p_flatBuffer);
|
||||
CRITICAL_ASSERT(EngineAssertHandler,
|
||||
assetHandle.m_assetPair->m_flatAsset.Asset().asset_header->uuid == p_uuid,
|
||||
"Mismatch between expected UUID and deserialized UUID ! Got {}; Expected {}",
|
||||
assetHandle.m_assetPair->m_flatAsset.Asset().asset_header->uuid,
|
||||
p_uuid);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void UnloadUnreferenced()
|
||||
{
|
||||
for (auto& keyValue: m_assets)
|
||||
{
|
||||
if (keyValue.second.m_hardRefCount == 0 && keyValue.second.m_assetPair)
|
||||
{
|
||||
keyValue.second.m_assetPair.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
~AssetContainer() = default;
|
||||
|
||||
AssetContainer& operator=(const AssetContainer& p_container) = delete;
|
||||
AssetContainer& operator=(AssetContainer&& p_container) = delete;
|
||||
|
||||
private:
|
||||
struct AssetHandle
|
||||
{
|
||||
struct Data
|
||||
{
|
||||
Data(const eastl::span<const std::byte> p_flatBuffer):
|
||||
m_flatAsset(p_flatBuffer),
|
||||
m_asset(&m_flatAsset)
|
||||
{
|
||||
}
|
||||
|
||||
FlatAssetWrapper<typename ASSET::FLAT_ASSET> m_flatAsset;
|
||||
ASSET m_asset;
|
||||
};
|
||||
|
||||
eastl::unique_ptr<Data> m_assetPair = nullptr;
|
||||
|
||||
std::uint32_t m_hardRefCount = 0;
|
||||
std::uint32_t m_softRefCount = 0;
|
||||
};
|
||||
|
||||
// We use a segmented_map here to keep stable references
|
||||
ankerl::unordered_dense::segmented_map<UUID, AssetHandle> m_assets;
|
||||
};
|
||||
|
||||
template<BigfootAssetConcept ASSET>
|
||||
class HardRef
|
||||
{
|
||||
};
|
||||
|
||||
template<BigfootAssetConcept ASSET>
|
||||
class SoftRef
|
||||
{
|
||||
};
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
include "Engine/BigFile/Asset/AssetTypeID.fbs";
|
||||
native_include "Engine/BigFile/Asset/AssetTypeID.hpp";
|
||||
|
||||
include "System/UUID/UUID.fbs";
|
||||
native_include "System/UUID/UUID.hpp";
|
||||
|
||||
namespace Bigfoot.Flat;
|
||||
|
||||
table AssetHeader
|
||||
{
|
||||
uuid: UUID (required, native_inline);
|
||||
name: string (required);
|
||||
type_id: AssetTypeID (required, native_inline);
|
||||
type_name: string (required);
|
||||
version: uint;
|
||||
}
|
||||
|
||||
root_type AssetHeader;
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Auto-generated header from: AssetHeader.fbs
|
||||
* Generated by Bin2CPP
|
||||
*
|
||||
* DO NOT TOUCH
|
||||
*/
|
||||
#ifndef ASSETHEADER_FBS_HPP
|
||||
#define ASSETHEADER_FBS_HPP
|
||||
#include <EASTL/array.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
inline constexpr eastl::array<std::byte, 407> g_AssetHeader_fbs = {
|
||||
std::byte{0x69}, std::byte{0x6E}, std::byte{0x63}, std::byte{0x6C}, std::byte{0x75}, std::byte{0x64}, std::byte{0x65}, std::byte{0x20}, std::byte{0x22}, std::byte{0x45}, std::byte{0x6E}, std::byte{0x67}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x65}, std::byte{0x2F},
|
||||
std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x46}, std::byte{0x69}, std::byte{0x6C}, std::byte{0x65}, std::byte{0x2F}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x2F}, std::byte{0x41}, std::byte{0x73},
|
||||
std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x54}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x49}, std::byte{0x44}, std::byte{0x2E}, std::byte{0x66}, std::byte{0x62}, std::byte{0x73}, std::byte{0x22}, std::byte{0x3B}, std::byte{0x0A},
|
||||
std::byte{0x6E}, std::byte{0x61}, std::byte{0x74}, std::byte{0x69}, std::byte{0x76}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x63}, std::byte{0x6C}, std::byte{0x75}, std::byte{0x64}, std::byte{0x65}, std::byte{0x20}, std::byte{0x22},
|
||||
std::byte{0x45}, std::byte{0x6E}, std::byte{0x67}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x65}, std::byte{0x2F}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x46}, std::byte{0x69}, std::byte{0x6C}, std::byte{0x65}, std::byte{0x2F}, std::byte{0x41},
|
||||
std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x2F}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x54}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x49}, std::byte{0x44},
|
||||
std::byte{0x2E}, std::byte{0x68}, std::byte{0x70}, std::byte{0x70}, std::byte{0x22}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x63}, std::byte{0x6C}, std::byte{0x75}, std::byte{0x64}, std::byte{0x65}, std::byte{0x20},
|
||||
std::byte{0x22}, std::byte{0x53}, std::byte{0x79}, std::byte{0x73}, std::byte{0x74}, std::byte{0x65}, std::byte{0x6D}, std::byte{0x2F}, std::byte{0x55}, std::byte{0x55}, std::byte{0x49}, std::byte{0x44}, std::byte{0x2F}, std::byte{0x55}, std::byte{0x55}, std::byte{0x49},
|
||||
std::byte{0x44}, std::byte{0x2E}, std::byte{0x66}, std::byte{0x62}, std::byte{0x73}, std::byte{0x22}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x6E}, std::byte{0x61}, std::byte{0x74}, std::byte{0x69}, std::byte{0x76}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x69},
|
||||
std::byte{0x6E}, std::byte{0x63}, std::byte{0x6C}, std::byte{0x75}, std::byte{0x64}, std::byte{0x65}, std::byte{0x20}, std::byte{0x22}, std::byte{0x53}, std::byte{0x79}, std::byte{0x73}, std::byte{0x74}, std::byte{0x65}, std::byte{0x6D}, std::byte{0x2F}, std::byte{0x55},
|
||||
std::byte{0x55}, std::byte{0x49}, std::byte{0x44}, std::byte{0x2F}, std::byte{0x55}, std::byte{0x55}, std::byte{0x49}, std::byte{0x44}, std::byte{0x2E}, std::byte{0x68}, std::byte{0x70}, std::byte{0x70}, std::byte{0x22}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x0A},
|
||||
std::byte{0x6E}, std::byte{0x61}, std::byte{0x6D}, std::byte{0x65}, std::byte{0x73}, std::byte{0x70}, std::byte{0x61}, std::byte{0x63}, std::byte{0x65}, std::byte{0x20}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F},
|
||||
std::byte{0x74}, std::byte{0x2E}, std::byte{0x46}, std::byte{0x6C}, std::byte{0x61}, std::byte{0x74}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x74}, std::byte{0x61}, std::byte{0x62}, std::byte{0x6C}, std::byte{0x65}, std::byte{0x20}, std::byte{0x41},
|
||||
std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x48}, std::byte{0x65}, std::byte{0x61}, std::byte{0x64}, std::byte{0x65}, std::byte{0x72}, std::byte{0x0A}, std::byte{0x7B}, std::byte{0x0A}, std::byte{0x09}, std::byte{0x75}, std::byte{0x75},
|
||||
std::byte{0x69}, std::byte{0x64}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x55}, std::byte{0x55}, std::byte{0x49}, std::byte{0x44}, std::byte{0x20}, std::byte{0x28}, std::byte{0x72}, std::byte{0x65}, std::byte{0x71}, std::byte{0x75}, std::byte{0x69}, std::byte{0x72},
|
||||
std::byte{0x65}, std::byte{0x64}, std::byte{0x2C}, std::byte{0x20}, std::byte{0x6E}, std::byte{0x61}, std::byte{0x74}, std::byte{0x69}, std::byte{0x76}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x6C}, std::byte{0x69}, std::byte{0x6E},
|
||||
std::byte{0x65}, std::byte{0x29}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x09}, std::byte{0x6E}, std::byte{0x61}, std::byte{0x6D}, std::byte{0x65}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x73}, std::byte{0x74}, std::byte{0x72}, std::byte{0x69}, std::byte{0x6E},
|
||||
std::byte{0x67}, std::byte{0x20}, std::byte{0x28}, std::byte{0x72}, std::byte{0x65}, std::byte{0x71}, std::byte{0x75}, std::byte{0x69}, std::byte{0x72}, std::byte{0x65}, std::byte{0x64}, std::byte{0x29}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x09}, std::byte{0x74},
|
||||
std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x69}, std::byte{0x64}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x54}, std::byte{0x79}, std::byte{0x70},
|
||||
std::byte{0x65}, std::byte{0x49}, std::byte{0x44}, std::byte{0x20}, std::byte{0x28}, std::byte{0x72}, std::byte{0x65}, std::byte{0x71}, std::byte{0x75}, std::byte{0x69}, std::byte{0x72}, std::byte{0x65}, std::byte{0x64}, std::byte{0x2C}, std::byte{0x20}, std::byte{0x6E},
|
||||
std::byte{0x61}, std::byte{0x74}, std::byte{0x69}, std::byte{0x76}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x6C}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x65}, std::byte{0x29}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x09},
|
||||
std::byte{0x74}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x6E}, std::byte{0x61}, std::byte{0x6D}, std::byte{0x65}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x73}, std::byte{0x74}, std::byte{0x72}, std::byte{0x69}, std::byte{0x6E},
|
||||
std::byte{0x67}, std::byte{0x20}, std::byte{0x28}, std::byte{0x72}, std::byte{0x65}, std::byte{0x71}, std::byte{0x75}, std::byte{0x69}, std::byte{0x72}, std::byte{0x65}, std::byte{0x64}, std::byte{0x29}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x09}, std::byte{0x76},
|
||||
std::byte{0x65}, std::byte{0x72}, std::byte{0x73}, std::byte{0x69}, std::byte{0x6F}, std::byte{0x6E}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x75}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x74}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x7D}, std::byte{0x0A},
|
||||
std::byte{0x0A}, std::byte{0x72}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x5F}, std::byte{0x74}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x20}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74},
|
||||
std::byte{0x48}, std::byte{0x65}, std::byte{0x61}, std::byte{0x64}, std::byte{0x65}, std::byte{0x72}, std::byte{0x3B}
|
||||
};
|
||||
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif // ASSETHEADER_FBS_HPP
|
||||
@@ -0,0 +1,262 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_ASSETHEADER_BIGFOOT_FLAT_H_
|
||||
#define FLATBUFFERS_GENERATED_ASSETHEADER_BIGFOOT_FLAT_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
#include "Engine/BigFile/Asset/AssetTypeID.hpp"
|
||||
#include "Engine/BigFile/Asset/AssetTypeID.hpp"
|
||||
#include "System/UUID/UUID.hpp"
|
||||
#include "Engine/BigFile/Asset/AssetTypeID_generated.hpp"
|
||||
#include "System/UUID/UUID_generated.hpp"
|
||||
|
||||
#include "EASTL/unique_ptr.h"
|
||||
#include "EASTL/string.h"
|
||||
|
||||
namespace Bigfoot {
|
||||
namespace Flat {
|
||||
|
||||
struct AssetHeader;
|
||||
struct AssetHeaderBuilder;
|
||||
struct AssetHeaderT;
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetHeaderTypeTable();
|
||||
|
||||
struct AssetHeaderT : public ::flatbuffers::NativeTable {
|
||||
typedef AssetHeader TableType;
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "Bigfoot.Flat.AssetHeaderT";
|
||||
}
|
||||
::Bigfoot::UUID uuid{};
|
||||
eastl::string name{};
|
||||
::Bigfoot::AssetTypeID type_id{};
|
||||
eastl::string type_name{};
|
||||
uint32_t version = 0;
|
||||
};
|
||||
|
||||
struct AssetHeader FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef AssetHeaderT NativeTableType;
|
||||
typedef AssetHeaderBuilder Builder;
|
||||
struct Traits;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return AssetHeaderTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "Bigfoot.Flat.AssetHeader";
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_UUID = 4,
|
||||
VT_NAME = 6,
|
||||
VT_TYPE_ID = 8,
|
||||
VT_TYPE_NAME = 10,
|
||||
VT_VERSION = 12
|
||||
};
|
||||
const Bigfoot::Flat::UUID *uuid() const {
|
||||
return GetStruct<const Bigfoot::Flat::UUID *>(VT_UUID);
|
||||
}
|
||||
const ::flatbuffers::String *name() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_NAME);
|
||||
}
|
||||
const Bigfoot::Flat::AssetTypeID *type_id() const {
|
||||
return GetStruct<const Bigfoot::Flat::AssetTypeID *>(VT_TYPE_ID);
|
||||
}
|
||||
const ::flatbuffers::String *type_name() const {
|
||||
return GetPointer<const ::flatbuffers::String *>(VT_TYPE_NAME);
|
||||
}
|
||||
uint32_t version() const {
|
||||
return GetField<uint32_t>(VT_VERSION, 0);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyFieldRequired<Bigfoot::Flat::UUID>(verifier, VT_UUID, 1) &&
|
||||
VerifyOffsetRequired(verifier, VT_NAME) &&
|
||||
verifier.VerifyString(name()) &&
|
||||
VerifyFieldRequired<Bigfoot::Flat::AssetTypeID>(verifier, VT_TYPE_ID, 8) &&
|
||||
VerifyOffsetRequired(verifier, VT_TYPE_NAME) &&
|
||||
verifier.VerifyString(type_name()) &&
|
||||
VerifyField<uint32_t>(verifier, VT_VERSION, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
AssetHeaderT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(AssetHeaderT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<AssetHeader> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const AssetHeaderT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct AssetHeaderBuilder {
|
||||
typedef AssetHeader Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_uuid(const Bigfoot::Flat::UUID *uuid) {
|
||||
fbb_.AddStruct(AssetHeader::VT_UUID, uuid);
|
||||
}
|
||||
void add_name(::flatbuffers::Offset<::flatbuffers::String> name) {
|
||||
fbb_.AddOffset(AssetHeader::VT_NAME, name);
|
||||
}
|
||||
void add_type_id(const Bigfoot::Flat::AssetTypeID *type_id) {
|
||||
fbb_.AddStruct(AssetHeader::VT_TYPE_ID, type_id);
|
||||
}
|
||||
void add_type_name(::flatbuffers::Offset<::flatbuffers::String> type_name) {
|
||||
fbb_.AddOffset(AssetHeader::VT_TYPE_NAME, type_name);
|
||||
}
|
||||
void add_version(uint32_t version) {
|
||||
fbb_.AddElement<uint32_t>(AssetHeader::VT_VERSION, version, 0);
|
||||
}
|
||||
explicit AssetHeaderBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<AssetHeader> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<AssetHeader>(end);
|
||||
fbb_.Required(o, AssetHeader::VT_UUID);
|
||||
fbb_.Required(o, AssetHeader::VT_NAME);
|
||||
fbb_.Required(o, AssetHeader::VT_TYPE_ID);
|
||||
fbb_.Required(o, AssetHeader::VT_TYPE_NAME);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<AssetHeader> CreateAssetHeader(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
const Bigfoot::Flat::UUID *uuid = nullptr,
|
||||
::flatbuffers::Offset<::flatbuffers::String> name = 0,
|
||||
const Bigfoot::Flat::AssetTypeID *type_id = nullptr,
|
||||
::flatbuffers::Offset<::flatbuffers::String> type_name = 0,
|
||||
uint32_t version = 0) {
|
||||
AssetHeaderBuilder builder_(_fbb);
|
||||
builder_.add_version(version);
|
||||
builder_.add_type_name(type_name);
|
||||
builder_.add_type_id(type_id);
|
||||
builder_.add_name(name);
|
||||
builder_.add_uuid(uuid);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
struct AssetHeader::Traits {
|
||||
using type = AssetHeader;
|
||||
static auto constexpr Create = CreateAssetHeader;
|
||||
};
|
||||
|
||||
::flatbuffers::Offset<AssetHeader> CreateAssetHeader(::flatbuffers::FlatBufferBuilder &_fbb, const AssetHeaderT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
inline AssetHeaderT *AssetHeader::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::make_unique<AssetHeaderT>();
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void AssetHeader::UnPackTo(AssetHeaderT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = uuid(); if (_e) _o->uuid = ::flatbuffers::UnPack(*_e); }
|
||||
{ auto _e = name(); if (_e) _o->name = eastl::string(_e->c_str(), _e->size()); }
|
||||
{ auto _e = type_id(); if (_e) _o->type_id = ::flatbuffers::UnPack(*_e); }
|
||||
{ auto _e = type_name(); if (_e) _o->type_name = eastl::string(_e->c_str(), _e->size()); }
|
||||
{ auto _e = version(); _o->version = _e; }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<AssetHeader> CreateAssetHeader(::flatbuffers::FlatBufferBuilder &_fbb, const AssetHeaderT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return AssetHeader::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<AssetHeader> AssetHeader::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const AssetHeaderT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const AssetHeaderT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _uuid = ::flatbuffers::Pack(_o->uuid);
|
||||
auto _name = _fbb.CreateString(_o->name);
|
||||
auto _type_id = ::flatbuffers::Pack(_o->type_id);
|
||||
auto _type_name = _fbb.CreateString(_o->type_name);
|
||||
auto _version = _o->version;
|
||||
return Bigfoot::Flat::CreateAssetHeader(
|
||||
_fbb,
|
||||
&_uuid,
|
||||
_name,
|
||||
&_type_id,
|
||||
_type_name,
|
||||
_version);
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetHeaderTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||
{ ::flatbuffers::ET_STRING, 0, -1 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 1 },
|
||||
{ ::flatbuffers::ET_STRING, 0, -1 },
|
||||
{ ::flatbuffers::ET_UINT, 0, -1 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
Bigfoot::Flat::UUIDTypeTable,
|
||||
Bigfoot::Flat::AssetTypeIDTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"uuid",
|
||||
"name",
|
||||
"type_id",
|
||||
"type_name",
|
||||
"version"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 5, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const Bigfoot::Flat::AssetHeader *GetAssetHeader(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<Bigfoot::Flat::AssetHeader>(buf);
|
||||
}
|
||||
|
||||
inline const Bigfoot::Flat::AssetHeader *GetSizePrefixedAssetHeader(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<Bigfoot::Flat::AssetHeader>(buf);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifyAssetHeaderBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifyBuffer<Bigfoot::Flat::AssetHeader>(nullptr);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifySizePrefixedAssetHeaderBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifySizePrefixedBuffer<Bigfoot::Flat::AssetHeader>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishAssetHeaderBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Bigfoot::Flat::AssetHeader> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedAssetHeaderBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Bigfoot::Flat::AssetHeader> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
inline eastl::unique_ptr<Bigfoot::Flat::AssetHeaderT> UnPackAssetHeader(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return eastl::unique_ptr<Bigfoot::Flat::AssetHeaderT>(GetAssetHeader(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
inline eastl::unique_ptr<Bigfoot::Flat::AssetHeaderT> UnPackSizePrefixedAssetHeader(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return eastl::unique_ptr<Bigfoot::Flat::AssetHeaderT>(GetSizePrefixedAssetHeader(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
} // namespace Flat
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_ASSETHEADER_BIGFOOT_FLAT_H_
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Bigfoot.Flat;
|
||||
|
||||
struct AssetTypeID (native_type: "::Bigfoot::AssetTypeID")
|
||||
{
|
||||
value: ulong;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Auto-generated header from: AssetTypeID.fbs
|
||||
* Generated by Bin2CPP
|
||||
*
|
||||
* DO NOT TOUCH
|
||||
*/
|
||||
#ifndef ASSETTYPEID_FBS_HPP
|
||||
#define ASSETTYPEID_FBS_HPP
|
||||
#include <EASTL/array.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
inline constexpr eastl::array<std::byte, 105> g_AssetTypeID_fbs = {
|
||||
std::byte{0x6E}, std::byte{0x61}, std::byte{0x6D}, std::byte{0x65}, std::byte{0x73}, std::byte{0x70}, std::byte{0x61}, std::byte{0x63}, std::byte{0x65}, std::byte{0x20}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F},
|
||||
std::byte{0x74}, std::byte{0x2E}, std::byte{0x46}, std::byte{0x6C}, std::byte{0x61}, std::byte{0x74}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x73}, std::byte{0x74}, std::byte{0x72}, std::byte{0x75}, std::byte{0x63}, std::byte{0x74}, std::byte{0x20},
|
||||
std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x54}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x49}, std::byte{0x44}, std::byte{0x20}, std::byte{0x28}, std::byte{0x6E}, std::byte{0x61}, std::byte{0x74},
|
||||
std::byte{0x69}, std::byte{0x76}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x74}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x22}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67},
|
||||
std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x54}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x49},
|
||||
std::byte{0x44}, std::byte{0x22}, std::byte{0x29}, std::byte{0x0A}, std::byte{0x7B}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x76}, std::byte{0x61}, std::byte{0x6C}, std::byte{0x75}, std::byte{0x65}, std::byte{0x3A},
|
||||
std::byte{0x20}, std::byte{0x75}, std::byte{0x6C}, std::byte{0x6F}, std::byte{0x6E}, std::byte{0x67}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x7D}
|
||||
};
|
||||
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif // ASSETTYPEID_FBS_HPP
|
||||
@@ -0,0 +1,24 @@
|
||||
/*********************************************************************
|
||||
* \file AssetTypeID.hpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date February 2026
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_ENGINE_ASSETTYPEID_HPP
|
||||
#define BIGFOOT_ENGINE_ASSETTYPEID_HPP
|
||||
#include <Engine/BigFile/Asset/AssetTypeID_generated.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
using AssetTypeID = std::uint64_t;
|
||||
}
|
||||
|
||||
namespace flatbuffers
|
||||
{
|
||||
Bigfoot::Flat::AssetTypeID Pack(const Bigfoot::AssetTypeID& p_assetTypeID);
|
||||
Bigfoot::AssetTypeID UnPack(const Bigfoot::Flat::AssetTypeID& p_flatAssetTypeID);
|
||||
} // namespace flatbuffers
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,71 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_ASSETTYPEID_BIGFOOT_FLAT_H_
|
||||
#define FLATBUFFERS_GENERATED_ASSETTYPEID_BIGFOOT_FLAT_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
#include "EASTL/unique_ptr.h"
|
||||
#include "EASTL/string.h"
|
||||
|
||||
namespace Bigfoot {
|
||||
namespace Flat {
|
||||
|
||||
struct AssetTypeID;
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetTypeIDTypeTable();
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) AssetTypeID FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
uint64_t value_;
|
||||
|
||||
public:
|
||||
struct Traits;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return AssetTypeIDTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "Bigfoot.Flat.AssetTypeID";
|
||||
}
|
||||
AssetTypeID()
|
||||
: value_(0) {
|
||||
}
|
||||
AssetTypeID(uint64_t _value)
|
||||
: value_(::flatbuffers::EndianScalar(_value)) {
|
||||
}
|
||||
uint64_t value() const {
|
||||
return ::flatbuffers::EndianScalar(value_);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(AssetTypeID, 8);
|
||||
|
||||
struct AssetTypeID::Traits {
|
||||
using type = AssetTypeID;
|
||||
};
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetTypeIDTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_ULONG, 0, -1 }
|
||||
};
|
||||
static const int64_t values[] = { 0, 8 };
|
||||
static const char * const names[] = {
|
||||
"value"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_STRUCT, 1, type_codes, nullptr, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
} // namespace Flat
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_ASSETTYPEID_BIGFOOT_FLAT_H_
|
||||
262
Bigfoot/Sources/Engine/Include/Engine/BigFile/BigFile.hpp
Normal file
262
Bigfoot/Sources/Engine/Include/Engine/BigFile/BigFile.hpp
Normal file
@@ -0,0 +1,262 @@
|
||||
/*********************************************************************
|
||||
* \file BigFile.hpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date October 2025
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_ENGINE_BIGFILE_HPP
|
||||
#define BIGFOOT_ENGINE_BIGFILE_HPP
|
||||
#include <System/File.hpp>
|
||||
|
||||
#include <Utils/TaggedType.hpp>
|
||||
|
||||
#include <EASTL/span.h>
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
class BigFile
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param p_file The file targetting the BigFile DB
|
||||
*/
|
||||
BigFile(const File& p_file);
|
||||
|
||||
BigFile(const BigFile& p_bigFile) = default;
|
||||
BigFile(BigFile&& p_bigFile) = default;
|
||||
|
||||
/**
|
||||
* Begin a transaction
|
||||
*
|
||||
*/
|
||||
void BeginTransaction();
|
||||
|
||||
/**
|
||||
* Commit a transaction
|
||||
*
|
||||
*/
|
||||
void CommitTransaction();
|
||||
|
||||
/**
|
||||
* Rollback a transaction
|
||||
*
|
||||
*/
|
||||
void RollbackTransaction();
|
||||
|
||||
~BigFile();
|
||||
|
||||
BigFile& operator=(const BigFile& p_bigFile) = default;
|
||||
BigFile& operator=(BigFile&& p_bigFile) = default;
|
||||
|
||||
class Request
|
||||
{
|
||||
public:
|
||||
/*
|
||||
* Constructor
|
||||
*
|
||||
* \param p_bigFile The bigfile
|
||||
* \param p_request The SQL request
|
||||
*/
|
||||
Request(const BigFile& p_bigFile, const eastl::string_view p_request);
|
||||
|
||||
Request(const Request& p_request) = default;
|
||||
Request(Request&& p_request) = default;
|
||||
|
||||
using CopyValue = TaggedType<bool>;
|
||||
|
||||
/*
|
||||
* Bind a int32 value to the Request at index
|
||||
*
|
||||
* \param p_index The index to bind to
|
||||
* \param p_value The value
|
||||
*/
|
||||
void Bind(const std::uint32_t p_index, const std::int32_t p_value);
|
||||
|
||||
/*
|
||||
* Bind a uint32 value to the Request at index
|
||||
*
|
||||
* \param p_index The index to bind to
|
||||
* \param p_value The value
|
||||
*/
|
||||
void Bind(const std::uint32_t p_index, const std::uint32_t p_value);
|
||||
|
||||
/*
|
||||
* Bind a int64 value to the Request at index
|
||||
*
|
||||
* \param p_index The index to bind to
|
||||
* \param p_value The value
|
||||
*/
|
||||
void Bind(const std::uint32_t p_index, const std::int64_t p_value);
|
||||
|
||||
/*
|
||||
* Bind a float value to the Request at index
|
||||
*
|
||||
* \param p_index The index to bind to
|
||||
* \param p_value The value
|
||||
*/
|
||||
void Bind(const std::uint32_t p_index, const float p_value);
|
||||
|
||||
/*
|
||||
* Bind a double value to the Request at index
|
||||
*
|
||||
* \param p_index The index to bind to
|
||||
* \param p_value The value
|
||||
*/
|
||||
void Bind(const std::uint32_t p_index, const double p_value);
|
||||
|
||||
/*
|
||||
* Bind a string value to the Request at index
|
||||
*
|
||||
* \param p_index The index to bind to
|
||||
* \param p_value The value
|
||||
* \param p_copy Should the memory be copied so that caller does not have to retain it
|
||||
*/
|
||||
void Bind(const std::uint32_t p_index,
|
||||
const eastl::string_view p_value,
|
||||
const CopyValue p_copy = CopyValue {false});
|
||||
|
||||
/*
|
||||
* Bind a blob value to the Request at index
|
||||
*
|
||||
* \param p_index The index to bind to
|
||||
* \param p_value The value
|
||||
* \param p_copy Should the memory be copied so that caller does not have to retain it
|
||||
*/
|
||||
void Bind(const std::uint32_t p_index,
|
||||
const eastl::span<const std::byte> p_value,
|
||||
const CopyValue p_copy = CopyValue {false});
|
||||
|
||||
/*
|
||||
* Step through the request
|
||||
*
|
||||
* \return True if the request can continue (get next row), false otherwise
|
||||
*/
|
||||
[[nodiscard]]
|
||||
bool Step();
|
||||
|
||||
/*
|
||||
* Execute the request once
|
||||
*
|
||||
* The number of modified rows
|
||||
*/
|
||||
[[maybe_unused]]
|
||||
std::uint32_t Execute();
|
||||
|
||||
class Column
|
||||
{
|
||||
public:
|
||||
/*
|
||||
* Constructor
|
||||
*
|
||||
* \param p_request The request to get the column of
|
||||
* \param p_index Column index
|
||||
*/
|
||||
Column(const Request& p_request, const std::uint32_t p_index);
|
||||
|
||||
Column(const Column& p_column) = default;
|
||||
Column(Column&& p_column) = default;
|
||||
|
||||
~Column() = default;
|
||||
|
||||
Column& operator=(const Column& p_column) = default;
|
||||
Column& operator=(Column&& p_column) = default;
|
||||
|
||||
/*
|
||||
* Get value as a int32
|
||||
*
|
||||
* \return The value
|
||||
*/
|
||||
operator std::int32_t() const;
|
||||
|
||||
/*
|
||||
* Get value as a uint32
|
||||
*
|
||||
* \return The value
|
||||
*/
|
||||
operator std::uint32_t() const;
|
||||
|
||||
/*
|
||||
* Get value as a int64
|
||||
*
|
||||
* \return The value
|
||||
*/
|
||||
operator std::int64_t() const;
|
||||
|
||||
/*
|
||||
* Get value as a float
|
||||
*
|
||||
* \return The value
|
||||
*/
|
||||
operator float() const;
|
||||
|
||||
/*
|
||||
* Get value as a double
|
||||
*
|
||||
* \return The value
|
||||
*/
|
||||
operator double() const;
|
||||
|
||||
/*
|
||||
* Get value as a string
|
||||
*
|
||||
* \return The value
|
||||
*/
|
||||
operator eastl::string_view() const;
|
||||
|
||||
/*
|
||||
* Get value as a blob
|
||||
*
|
||||
* \return The value
|
||||
*/
|
||||
operator eastl::span<const std::byte>() const;
|
||||
|
||||
private:
|
||||
/*
|
||||
* The statement
|
||||
*/
|
||||
sqlite3_stmt* m_statement;
|
||||
|
||||
/*
|
||||
* The column index
|
||||
*/
|
||||
std::uint32_t m_index;
|
||||
};
|
||||
|
||||
/*
|
||||
* Get a column
|
||||
*
|
||||
* \param p_index Column index
|
||||
*/
|
||||
[[nodiscard]]
|
||||
Column Get(const std::uint32_t p_index) const;
|
||||
|
||||
~Request();
|
||||
|
||||
Request& operator=(const Request& p_request) = default;
|
||||
Request& operator=(Request&& p_request) = default;
|
||||
|
||||
private:
|
||||
/*
|
||||
* The database
|
||||
*/
|
||||
sqlite3* m_db;
|
||||
|
||||
/*
|
||||
* The statement
|
||||
*/
|
||||
sqlite3_stmt* m_statement;
|
||||
};
|
||||
|
||||
private:
|
||||
/**
|
||||
* The BigFile DB
|
||||
*/
|
||||
sqlite3* m_db;
|
||||
};
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif
|
||||
@@ -45,7 +45,7 @@ class EngineAssertHandler
|
||||
{
|
||||
BIGFOOT_LOG_FATAL(ENGINE_LOGGER,
|
||||
"Assert: {} (File:{}, Line:{}, Function:{}\n{}",
|
||||
std::format(p_format, eastl::forward<ARGS>(p_args)...),
|
||||
std::format(p_format, std::forward<ARGS>(p_args)...),
|
||||
p_location.file_name(),
|
||||
p_location.line(),
|
||||
p_location.function_name(),
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
// to delete when an actual source is in Engine
|
||||
@@ -3,7 +3,7 @@ project(${PackageName})
|
||||
|
||||
set(PublicDependencies
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:quill::quill>
|
||||
mimalloc
|
||||
$<IF:$<BOOL:${ASAN}>,mimalloc-asan,mimalloc-static>
|
||||
stduuid::stduuid)
|
||||
set(PrivateDependencies)
|
||||
set(BigfootPublicDependencies
|
||||
@@ -20,9 +20,9 @@ bigfoot_create_package_lib(
|
||||
bigfoot_create_logger()
|
||||
|
||||
target_compile_definitions(${PROJECT_NAME}
|
||||
PUBLIC $<$<CONFIG:Debug,RelWithDebInfo>:QUILL_NO_EXCEPTIONS>
|
||||
PUBLIC $<$<CONFIG:Debug,RelWithDebInfo>:QUILL_DISABLE_NON_PREFIXED_MACROS>
|
||||
|
||||
PUBLIC MI_SHARED_LIB)
|
||||
PUBLIC
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:QUILL_NO_EXCEPTIONS>
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:QUILL_DISABLE_NON_PREFIXED_MACROS>
|
||||
MI_SHARED_LIB )
|
||||
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/MimallocImpl.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
||||
|
||||
|
||||
50
Bigfoot/Sources/System/Include/System/Log/Log.fbs.hpp
Normal file
50
Bigfoot/Sources/System/Include/System/Log/Log.fbs.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
/**
|
||||
* Auto-generated header from: Log.fbs
|
||||
* Generated by Bin2CPP
|
||||
*
|
||||
* DO NOT TOUCH
|
||||
*/
|
||||
#ifndef LOG_FBS_HPP
|
||||
#define LOG_FBS_HPP
|
||||
#include <EASTL/array.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
inline constexpr eastl::array<std::byte, 154> g_Log_fbs = {
|
||||
std::byte{0x6E}, std::byte{0x61}, std::byte{0x6D}, std::byte{0x65}, std::byte{0x73},
|
||||
std::byte{0x70}, std::byte{0x61}, std::byte{0x63}, std::byte{0x65}, std::byte{0x20},
|
||||
std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F},
|
||||
std::byte{0x6F}, std::byte{0x74}, std::byte{0x2E}, std::byte{0x46}, std::byte{0x6C},
|
||||
std::byte{0x61}, std::byte{0x74}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x0A},
|
||||
std::byte{0x65}, std::byte{0x6E}, std::byte{0x75}, std::byte{0x6D}, std::byte{0x20},
|
||||
std::byte{0x4C}, std::byte{0x6F}, std::byte{0x67}, std::byte{0x53}, std::byte{0x69},
|
||||
std::byte{0x6E}, std::byte{0x6B}, std::byte{0x54}, std::byte{0x79}, std::byte{0x70},
|
||||
std::byte{0x65}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x62}, std::byte{0x79},
|
||||
std::byte{0x74}, std::byte{0x65}, std::byte{0x0A}, std::byte{0x7B}, std::byte{0x0A},
|
||||
std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x43},
|
||||
std::byte{0x6F}, std::byte{0x6E}, std::byte{0x73}, std::byte{0x6F}, std::byte{0x6C},
|
||||
std::byte{0x65}, std::byte{0x0A}, std::byte{0x7D}, std::byte{0x0A}, std::byte{0x0A},
|
||||
std::byte{0x65}, std::byte{0x6E}, std::byte{0x75}, std::byte{0x6D}, std::byte{0x20},
|
||||
std::byte{0x4C}, std::byte{0x6F}, std::byte{0x67}, std::byte{0x4C}, std::byte{0x65},
|
||||
std::byte{0x76}, std::byte{0x65}, std::byte{0x6C}, std::byte{0x3A}, std::byte{0x20},
|
||||
std::byte{0x62}, std::byte{0x79}, std::byte{0x74}, std::byte{0x65}, std::byte{0x0A},
|
||||
std::byte{0x7B}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20},
|
||||
std::byte{0x20}, std::byte{0x44}, std::byte{0x65}, std::byte{0x62}, std::byte{0x75},
|
||||
std::byte{0x67}, std::byte{0x2C}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20},
|
||||
std::byte{0x20}, std::byte{0x20}, std::byte{0x54}, std::byte{0x72}, std::byte{0x61},
|
||||
std::byte{0x63}, std::byte{0x65}, std::byte{0x2C}, std::byte{0x0A}, std::byte{0x20},
|
||||
std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x49}, std::byte{0x6E},
|
||||
std::byte{0x66}, std::byte{0x6F}, std::byte{0x2C}, std::byte{0x0A}, std::byte{0x20},
|
||||
std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x57}, std::byte{0x61},
|
||||
std::byte{0x72}, std::byte{0x6E}, std::byte{0x2C}, std::byte{0x0A}, std::byte{0x20},
|
||||
std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x45}, std::byte{0x72},
|
||||
std::byte{0x72}, std::byte{0x6F}, std::byte{0x72}, std::byte{0x2C}, std::byte{0x0A},
|
||||
std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x43},
|
||||
std::byte{0x72}, std::byte{0x69}, std::byte{0x74}, std::byte{0x69}, std::byte{0x63},
|
||||
std::byte{0x61}, std::byte{0x6C}, std::byte{0x0A}, std::byte{0x7D}
|
||||
};
|
||||
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif // LOG_FBS_HPP
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Auto-generated header from: Log.fbs
|
||||
* Generated by Bin2CPP
|
||||
*
|
||||
* DO NOT TOUCH
|
||||
*/
|
||||
#ifndef LOG_FBS_HPP
|
||||
#define LOG_FBS_HPP
|
||||
#include <EASTL/array.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
inline constexpr eastl::array<std::byte, 154> g_Log_fbs = {
|
||||
std::byte{0x6E}, std::byte{0x61}, std::byte{0x6D}, std::byte{0x65}, std::byte{0x73}, std::byte{0x70}, std::byte{0x61}, std::byte{0x63}, std::byte{0x65}, std::byte{0x20}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F},
|
||||
std::byte{0x74}, std::byte{0x2E}, std::byte{0x46}, std::byte{0x6C}, std::byte{0x61}, std::byte{0x74}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x65}, std::byte{0x6E}, std::byte{0x75}, std::byte{0x6D}, std::byte{0x20}, std::byte{0x4C}, std::byte{0x6F},
|
||||
std::byte{0x67}, std::byte{0x53}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x6B}, std::byte{0x54}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x62}, std::byte{0x79}, std::byte{0x74}, std::byte{0x65}, std::byte{0x0A},
|
||||
std::byte{0x7B}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x43}, std::byte{0x6F}, std::byte{0x6E}, std::byte{0x73}, std::byte{0x6F}, std::byte{0x6C}, std::byte{0x65}, std::byte{0x0A}, std::byte{0x7D}, std::byte{0x0A},
|
||||
std::byte{0x0A}, std::byte{0x65}, std::byte{0x6E}, std::byte{0x75}, std::byte{0x6D}, std::byte{0x20}, std::byte{0x4C}, std::byte{0x6F}, std::byte{0x67}, std::byte{0x4C}, std::byte{0x65}, std::byte{0x76}, std::byte{0x65}, std::byte{0x6C}, std::byte{0x3A}, std::byte{0x20},
|
||||
std::byte{0x62}, std::byte{0x79}, std::byte{0x74}, std::byte{0x65}, std::byte{0x0A}, std::byte{0x7B}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x44}, std::byte{0x65}, std::byte{0x62}, std::byte{0x75}, std::byte{0x67},
|
||||
std::byte{0x2C}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x54}, std::byte{0x72}, std::byte{0x61}, std::byte{0x63}, std::byte{0x65}, std::byte{0x2C}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20},
|
||||
std::byte{0x20}, std::byte{0x49}, std::byte{0x6E}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x2C}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x57}, std::byte{0x61}, std::byte{0x72}, std::byte{0x6E}, std::byte{0x2C},
|
||||
std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x45}, std::byte{0x72}, std::byte{0x72}, std::byte{0x6F}, std::byte{0x72}, std::byte{0x2C}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20},
|
||||
std::byte{0x43}, std::byte{0x72}, std::byte{0x69}, std::byte{0x74}, std::byte{0x69}, std::byte{0x63}, std::byte{0x61}, std::byte{0x6C}, std::byte{0x0A}, std::byte{0x7D}
|
||||
};
|
||||
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif // LOG_FBS_HPP
|
||||
@@ -68,6 +68,12 @@ class Log
|
||||
*/
|
||||
void ChangeLoggerLogLevel(LoggerInfo& p_loggerInfo, const Flat::LogLevel p_level);
|
||||
|
||||
/*
|
||||
* Flush all the loggers
|
||||
*
|
||||
*/
|
||||
void Flush();
|
||||
|
||||
~Log();
|
||||
|
||||
Log& operator=(const Log& p_logger) = delete;
|
||||
|
||||
@@ -45,7 +45,7 @@ class SystemAssertHandler
|
||||
{
|
||||
BIGFOOT_LOG_FATAL(SYSTEM_LOGGER,
|
||||
"Assert: {} (File:{}, Line:{}, Function:{}\n{}",
|
||||
std::format(p_format, eastl::forward<ARGS>(p_args)...),
|
||||
std::format(p_format, std::forward<ARGS>(p_args)...),
|
||||
p_location.file_name(),
|
||||
p_location.line(),
|
||||
p_location.function_name(),
|
||||
|
||||
6
Bigfoot/Sources/System/Include/System/Time/Time.fbs
Normal file
6
Bigfoot/Sources/System/Include/System/Time/Time.fbs
Normal file
@@ -0,0 +1,6 @@
|
||||
namespace Bigfoot.Flat;
|
||||
|
||||
struct Time (native_type: "::Bigfoot::Time")
|
||||
{
|
||||
epoch:ulong;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Auto-generated header from: Time.fbs
|
||||
* Generated by Bin2CPP
|
||||
*
|
||||
* DO NOT TOUCH
|
||||
*/
|
||||
#ifndef TIME_FBS_HPP
|
||||
#define TIME_FBS_HPP
|
||||
#include <EASTL/array.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
inline constexpr eastl::array<std::byte, 88> g_Time_fbs = {
|
||||
std::byte{0x6E}, std::byte{0x61}, std::byte{0x6D}, std::byte{0x65}, std::byte{0x73}, std::byte{0x70}, std::byte{0x61}, std::byte{0x63}, std::byte{0x65}, std::byte{0x20}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F},
|
||||
std::byte{0x74}, std::byte{0x2E}, std::byte{0x46}, std::byte{0x6C}, std::byte{0x61}, std::byte{0x74}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x73}, std::byte{0x74}, std::byte{0x72}, std::byte{0x75}, std::byte{0x63}, std::byte{0x74}, std::byte{0x20},
|
||||
std::byte{0x54}, std::byte{0x69}, std::byte{0x6D}, std::byte{0x65}, std::byte{0x20}, std::byte{0x28}, std::byte{0x6E}, std::byte{0x61}, std::byte{0x74}, std::byte{0x69}, std::byte{0x76}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x74}, std::byte{0x79}, std::byte{0x70},
|
||||
std::byte{0x65}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x22}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x54},
|
||||
std::byte{0x69}, std::byte{0x6D}, std::byte{0x65}, std::byte{0x22}, std::byte{0x29}, std::byte{0x0A}, std::byte{0x7B}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x65}, std::byte{0x70}, std::byte{0x6F}, std::byte{0x63}, std::byte{0x68}, std::byte{0x3A},
|
||||
std::byte{0x75}, std::byte{0x6C}, std::byte{0x6F}, std::byte{0x6E}, std::byte{0x67}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x7D}
|
||||
};
|
||||
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif // TIME_FBS_HPP
|
||||
@@ -6,6 +6,8 @@
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_SYSTEM_TIME_HPP
|
||||
#define BIGFOOT_SYSTEM_TIME_HPP
|
||||
#include <System/Time/Time_generated.hpp>
|
||||
|
||||
#include <chrono>
|
||||
#include <compare>
|
||||
#include <cstdint>
|
||||
@@ -65,4 +67,12 @@ class Time
|
||||
};
|
||||
} // namespace Bigfoot
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
namespace flatbuffers
|
||||
{
|
||||
Bigfoot::Flat::Time Pack(const Bigfoot::Time& p_time);
|
||||
Bigfoot::Time UnPack(const Bigfoot::Flat::Time& p_flatTime);
|
||||
} // namespace flatbuffers
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,71 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_TIME_BIGFOOT_FLAT_H_
|
||||
#define FLATBUFFERS_GENERATED_TIME_BIGFOOT_FLAT_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
#include "EASTL/unique_ptr.h"
|
||||
#include "EASTL/string.h"
|
||||
|
||||
namespace Bigfoot {
|
||||
namespace Flat {
|
||||
|
||||
struct Time;
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TimeTypeTable();
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Time FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
uint64_t epoch_;
|
||||
|
||||
public:
|
||||
struct Traits;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return TimeTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "Bigfoot.Flat.Time";
|
||||
}
|
||||
Time()
|
||||
: epoch_(0) {
|
||||
}
|
||||
Time(uint64_t _epoch)
|
||||
: epoch_(::flatbuffers::EndianScalar(_epoch)) {
|
||||
}
|
||||
uint64_t epoch() const {
|
||||
return ::flatbuffers::EndianScalar(epoch_);
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(Time, 8);
|
||||
|
||||
struct Time::Traits {
|
||||
using type = Time;
|
||||
};
|
||||
|
||||
inline const ::flatbuffers::TypeTable *TimeTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_ULONG, 0, -1 }
|
||||
};
|
||||
static const int64_t values[] = { 0, 8 };
|
||||
static const char * const names[] = {
|
||||
"epoch"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_STRUCT, 1, type_codes, nullptr, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
} // namespace Flat
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_TIME_BIGFOOT_FLAT_H_
|
||||
@@ -1,18 +0,0 @@
|
||||
/*********************************************************************
|
||||
* \file FlatUUID.hpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date December 2025
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_SYSTEM_FLATUUID_HPP
|
||||
#define BIGFOOT_SYSTEM_FLATUUID_HPP
|
||||
#include <System/UUID/UUID.hpp>
|
||||
#include <System/UUID/UUID_generated.hpp>
|
||||
|
||||
namespace flatbuffers
|
||||
{
|
||||
Bigfoot::Flat::UUID Pack(const Bigfoot::UUID& p_uuid);
|
||||
Bigfoot::UUID UnPack(const Bigfoot::Flat::UUID& p_flatUUID);
|
||||
} // namespace flatbuffers
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,3 @@
|
||||
native_include "System/UUID/FlatUUID.hpp";
|
||||
|
||||
namespace Bigfoot.Flat;
|
||||
|
||||
struct UUID (native_type: "::Bigfoot::UUID")
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Auto-generated header from: UUID.fbs
|
||||
* Generated by Bin2CPP
|
||||
*
|
||||
* DO NOT TOUCH
|
||||
*/
|
||||
#ifndef UUID_FBS_HPP
|
||||
#define UUID_FBS_HPP
|
||||
#include <EASTL/array.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
inline constexpr eastl::array<std::byte, 93> g_UUID_fbs = {
|
||||
std::byte{0x6E}, std::byte{0x61}, std::byte{0x6D}, std::byte{0x65}, std::byte{0x73}, std::byte{0x70}, std::byte{0x61}, std::byte{0x63}, std::byte{0x65}, std::byte{0x20}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F},
|
||||
std::byte{0x74}, std::byte{0x2E}, std::byte{0x46}, std::byte{0x6C}, std::byte{0x61}, std::byte{0x74}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x73}, std::byte{0x74}, std::byte{0x72}, std::byte{0x75}, std::byte{0x63}, std::byte{0x74}, std::byte{0x20},
|
||||
std::byte{0x55}, std::byte{0x55}, std::byte{0x49}, std::byte{0x44}, std::byte{0x20}, std::byte{0x28}, std::byte{0x6E}, std::byte{0x61}, std::byte{0x74}, std::byte{0x69}, std::byte{0x76}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x74}, std::byte{0x79}, std::byte{0x70},
|
||||
std::byte{0x65}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x22}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x55},
|
||||
std::byte{0x55}, std::byte{0x49}, std::byte{0x44}, std::byte{0x22}, std::byte{0x29}, std::byte{0x0A}, std::byte{0x7B}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x62}, std::byte{0x79}, std::byte{0x74}, std::byte{0x65}, std::byte{0x73}, std::byte{0x3A},
|
||||
std::byte{0x5B}, std::byte{0x75}, std::byte{0x62}, std::byte{0x79}, std::byte{0x74}, std::byte{0x65}, std::byte{0x3A}, std::byte{0x31}, std::byte{0x36}, std::byte{0x5D}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x7D}
|
||||
};
|
||||
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif // UUID_FBS_HPP
|
||||
@@ -6,6 +6,7 @@
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_SYSTEM_UUID_HPP
|
||||
#define BIGFOOT_SYSTEM_UUID_HPP
|
||||
#include <System/UUID/UUID_generated.hpp>
|
||||
|
||||
#include <uuid.h>
|
||||
|
||||
@@ -118,6 +119,8 @@ struct std::formatter<Bigfoot::UUID, char>
|
||||
}
|
||||
};
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
#include <quill/DeferredFormatCodec.h>
|
||||
|
||||
@@ -141,4 +144,12 @@ struct quill::Codec<Bigfoot::UUID>: quill::DeferredFormatCodec<Bigfoot::UUID>
|
||||
};
|
||||
#endif
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
namespace flatbuffers
|
||||
{
|
||||
Bigfoot::Flat::UUID Pack(const Bigfoot::UUID& p_uuid);
|
||||
Bigfoot::UUID UnPack(const Bigfoot::Flat::UUID& p_flatUUID);
|
||||
} // namespace flatbuffers
|
||||
|
||||
#endif
|
||||
|
||||
@@ -13,8 +13,6 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
#include "System/UUID/FlatUUID.hpp"
|
||||
|
||||
#include "EASTL/unique_ptr.h"
|
||||
#include "EASTL/string.h"
|
||||
|
||||
|
||||
@@ -79,6 +79,16 @@ void Log::SetLoggerLevel(const LoggerInfo& p_loggerInfo)
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
void Log::Flush()
|
||||
{
|
||||
for (quill::Logger* logger: quill::Frontend::get_all_loggers())
|
||||
{
|
||||
logger->flush_log();
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
Log::~Log()
|
||||
{
|
||||
for (quill::Logger* logger: quill::Frontend::get_all_loggers())
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* \author Romain BOULLARD
|
||||
* \date December 2025
|
||||
*********************************************************************/
|
||||
#include <System/Time.hpp>
|
||||
#include <System/Time/Time.hpp>
|
||||
|
||||
#include <System/SystemAssertHandler.hpp>
|
||||
|
||||
@@ -119,3 +119,20 @@ Time Time::Now()
|
||||
return Time {epochInMicroSeconds};
|
||||
}
|
||||
} // namespace Bigfoot
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
namespace flatbuffers
|
||||
{
|
||||
Bigfoot::Flat::Time Pack(const Bigfoot::Time& p_time)
|
||||
{
|
||||
return Bigfoot::Flat::Time {p_time.Epoch()};
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
Bigfoot::Time UnPack(const Bigfoot::Flat::Time& p_flatTime)
|
||||
{
|
||||
return Bigfoot::Time {p_flatTime.epoch()};
|
||||
}
|
||||
} // namespace flatbuffers
|
||||
@@ -1,27 +0,0 @@
|
||||
/*********************************************************************
|
||||
* \file FlatUUID.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date December 2025
|
||||
*********************************************************************/
|
||||
#include <System/UUID/FlatUUID.hpp>
|
||||
|
||||
namespace flatbuffers
|
||||
{
|
||||
Bigfoot::Flat::UUID Pack(const Bigfoot::UUID& p_uuid)
|
||||
{
|
||||
const std::span<const std::byte, Bigfoot::UUID::UUID_BYTE_SIZE> bytes = p_uuid;
|
||||
return Bigfoot::Flat::UUID {
|
||||
std::span<const std::uint8_t, Bigfoot::UUID::UUID_BYTE_SIZE> {reinterpret_cast<const std::uint8_t*>(bytes.data()),
|
||||
bytes.size()}};
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
Bigfoot::UUID UnPack(const Bigfoot::Flat::UUID& p_flatUUID)
|
||||
{
|
||||
const std::span<const std::uint8_t, Bigfoot::UUID::UUID_BYTE_SIZE> bytesView {p_flatUUID.bytes()->data(),
|
||||
p_flatUUID.bytes()->size()};
|
||||
return Bigfoot::UUID {std::as_bytes(bytesView)};
|
||||
}
|
||||
} // namespace flatbuffers
|
||||
@@ -85,3 +85,25 @@ uuids::uuid_random_generator UUID::GetUUIDGenerator()
|
||||
return uuids::uuid_random_generator {ms_randomGenerator};
|
||||
}
|
||||
} // namespace Bigfoot
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
namespace flatbuffers
|
||||
{
|
||||
Bigfoot::Flat::UUID Pack(const Bigfoot::UUID& p_uuid)
|
||||
{
|
||||
const std::span<const std::byte, Bigfoot::UUID::UUID_BYTE_SIZE> bytes = p_uuid;
|
||||
return Bigfoot::Flat::UUID {
|
||||
std::span<const std::uint8_t, Bigfoot::UUID::UUID_BYTE_SIZE> {reinterpret_cast<const std::uint8_t*>(bytes.data()),
|
||||
bytes.size()}};
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
Bigfoot::UUID UnPack(const Bigfoot::Flat::UUID& p_flatUUID)
|
||||
{
|
||||
const std::span<const std::uint8_t, Bigfoot::UUID::UUID_BYTE_SIZE> bytesView {p_flatUUID.bytes()->data(),
|
||||
p_flatUUID.bytes()->size()};
|
||||
return Bigfoot::UUID {std::as_bytes(bytesView)};
|
||||
}
|
||||
} // namespace flatbuffers
|
||||
|
||||
@@ -2,7 +2,8 @@ get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
project(${PackageName})
|
||||
|
||||
set(PublicDependencies
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:cpptrace::cpptrace>)
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:cpptrace::cpptrace>
|
||||
unordered_dense::unordered_dense)
|
||||
set(PrivateDependencies)
|
||||
set(BigfootPublicDependencies)
|
||||
set(BigfootPrivateDependencies)
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
* \author Romain BOULLARD
|
||||
* \date October 2025
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_UTILS_ASSERT_HPP
|
||||
#define BIGFOOT_UTILS_ASSERT_HPP
|
||||
#ifndef BIGFOOT_SYSTEM_ASSERT_HPP
|
||||
#define BIGFOOT_SYSTEM_ASSERT_HPP
|
||||
#include <System/Log/Log.hpp>
|
||||
|
||||
#if defined BIGFOOT_NOT_OPTIMIZED
|
||||
|
||||
@@ -79,6 +80,10 @@
|
||||
}; \
|
||||
\
|
||||
HANDLER::Handle(location, stacktrace(), p_message __VA_OPT__(, ) __VA_ARGS__); \
|
||||
if (Bigfoot::Singleton<Bigfoot::Log>::HasInstance()) \
|
||||
{ \
|
||||
Bigfoot::Singleton<Bigfoot::Log>::Instance().Flush(); \
|
||||
} \
|
||||
BREAK; \
|
||||
std::abort(); \
|
||||
} \
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <EASTL/array.h>
|
||||
#include <EASTL/bit.h>
|
||||
#include <EASTL/optional.h>
|
||||
#include <EASTL/type_traits.h>
|
||||
#include <EASTL/utility.h>
|
||||
|
||||
@@ -32,7 +33,17 @@ class Singleton
|
||||
*/
|
||||
static constexpr TYPE& Instance()
|
||||
{
|
||||
return *eastl::bit_cast<TYPE*>(ms_instance.data());
|
||||
return ms_instance.value();
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the instance initialized
|
||||
*
|
||||
* \return True if initialized, false otherwise
|
||||
*/
|
||||
static constexpr bool HasInstance()
|
||||
{
|
||||
return ms_instance.has_value();
|
||||
}
|
||||
|
||||
class Lifetime
|
||||
@@ -43,11 +54,10 @@ class Singleton
|
||||
*
|
||||
* \param p_args Arguments for the singleton
|
||||
*/
|
||||
template<typename... ARGS,
|
||||
typename = eastl::enable_if_t<!(eastl::is_same_v<Lifetime, eastl::decay_t<ARGS>> || ...)>>
|
||||
template<typename... ARGS>
|
||||
explicit Lifetime(ARGS&&... p_args)
|
||||
{
|
||||
Initialize(eastl::forward<ARGS>(p_args)...);
|
||||
Initialize(std::forward<ARGS>(p_args)...);
|
||||
}
|
||||
|
||||
Lifetime(const Lifetime& p_lifetime) = delete;
|
||||
@@ -78,9 +88,7 @@ class Singleton
|
||||
template<typename... ARGS>
|
||||
static void Initialize(ARGS&&... p_args)
|
||||
{
|
||||
new (ms_instance.data()) TYPE(eastl::forward<ARGS>(p_args)...);
|
||||
|
||||
ms_initialized = true;
|
||||
ms_instance.emplace(std::forward<ARGS>(p_args)...);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,20 +97,13 @@ class Singleton
|
||||
*/
|
||||
static void Finalize()
|
||||
{
|
||||
eastl::bit_cast<TYPE*>(ms_instance.data())->~TYPE();
|
||||
|
||||
ms_initialized = false;
|
||||
ms_instance.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* The singleton.
|
||||
*/
|
||||
alignas(alignof(TYPE)) inline static eastl::array<std::byte, sizeof(TYPE)> ms_instance;
|
||||
|
||||
/**
|
||||
* Is the singleton initialized?
|
||||
*/
|
||||
inline static bool ms_initialized = false;
|
||||
inline static eastl::optional<TYPE> ms_instance;
|
||||
};
|
||||
} // namespace Bigfoot
|
||||
#endif
|
||||
|
||||
@@ -92,7 +92,7 @@ class Version
|
||||
return m_combined;
|
||||
}
|
||||
|
||||
[[nodiscard]] operator std::string() const;
|
||||
operator std::string() const;
|
||||
|
||||
constexpr Version& operator=(const Version& p_version) = default;
|
||||
|
||||
|
||||
210
Bigfoot/Tests/Engine/BigFile/BigFile.cpp
Normal file
210
Bigfoot/Tests/Engine/BigFile/BigFile.cpp
Normal file
@@ -0,0 +1,210 @@
|
||||
/*********************************************************************
|
||||
* \file BigFile.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date December 2025
|
||||
*********************************************************************/
|
||||
#include <Engine/BigFile/BigFile.hpp>
|
||||
|
||||
#include <Engine/BigFile/Asset/Asset.hpp>
|
||||
|
||||
#include <System/Log/Log.hpp>
|
||||
#include <System/Time/Time.hpp>
|
||||
#include <System/UUID/UUID.hpp>
|
||||
|
||||
#include <Utils/Singleton.hpp>
|
||||
#include <Utils/TargetMacros.h>
|
||||
|
||||
#include <EngineTests/BigFile/Asset/AssetA.hpp>
|
||||
#include <EngineTests/BigFile/Asset/AssetB.hpp>
|
||||
#include <EngineTests/BigFileInfo_generated.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
class BigFileFixture: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
void SetUp() override
|
||||
{
|
||||
BigFile::Request deleteHeader {m_bigFile, "DELETE FROM AssetHeader"};
|
||||
BigFile::Request deleteAsset {m_bigFile, "DELETE FROM AssetHeader"};
|
||||
|
||||
m_bigFile.BeginTransaction();
|
||||
deleteHeader.Execute();
|
||||
deleteAsset.Execute();
|
||||
m_bigFile.CommitTransaction();
|
||||
}
|
||||
|
||||
AssetAContainer m_assetAContainer;
|
||||
AssetBContainer m_assetBContainer;
|
||||
|
||||
BIGFOOT_NOT_OPTIMIZED_ONLY(Singleton<Log>::Lifetime m_loggerLifetime;)
|
||||
|
||||
BigFile m_bigFile {File {BIGFILE_ENGINETESTS_LOCATION}};
|
||||
};
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(BigFileFixture, Lol)
|
||||
{
|
||||
{
|
||||
EXPECT_STREQ(FlatAssetWrapper<Flat::AssetA>::TypeName().data(), "Bigfoot.Flat.AssetA");
|
||||
EXPECT_EQ(FlatAssetWrapper<Flat::AssetA>::TypeID(),
|
||||
rapidhash(FlatAssetWrapper<Flat::AssetA>::TypeName().data(),
|
||||
FlatAssetWrapper<Flat::AssetA>::TypeName().size()));
|
||||
|
||||
UUID uuid;
|
||||
std::ignore = m_assetAContainer.Add(uuid);
|
||||
|
||||
FlatAssetWrapper<Flat::AssetA> test {};
|
||||
test.Asset().asset_header->name = "Instance";
|
||||
test.Asset().asset_header->uuid = uuid;
|
||||
|
||||
const eastl::vector<std::byte> flatBuffer = test.Pack();
|
||||
|
||||
std::ignore = m_assetAContainer.Load(uuid, flatBuffer);
|
||||
m_assetAContainer.UnloadUnreferenced();
|
||||
|
||||
// UUID uuid;
|
||||
// std::ignore = m_assetAContainer.Add(uuid, "Instance");
|
||||
|
||||
// AssetA* test = m_assetAContainer.Get(uuid);
|
||||
|
||||
// test->Health() = 100;
|
||||
// test->Mana() = 42;
|
||||
|
||||
// const eastl::vector<std::byte> flatbuffer = m_assetAContainer.Pack(uuid);
|
||||
// m_assetAContainer.Remove(uuid);
|
||||
|
||||
// std::ignore = m_assetAContainer.Add(uuid, flatbuffer);
|
||||
// std::ignore = m_assetAContainer.Add(UUID {}, "Instance2");
|
||||
// std::ignore = m_assetAContainer.Add(UUID {}, "Instance3");
|
||||
|
||||
// AssetA* test2 = m_assetAContainer.Get(uuid);
|
||||
|
||||
// EXPECT_EQ(test2->Health(), 100);
|
||||
// EXPECT_EQ(test2->Mana(), 42);
|
||||
|
||||
// EXPECT_STREQ(test2->AssetHeader()->name.c_str(), "Instance");
|
||||
// EXPECT_EQ(test2->AssetHeader()->type_id, FlatAssetWrapper<Flat::AssetA>::TypeID());
|
||||
// EXPECT_STREQ(test2->AssetHeader()->type_name.c_str(), FlatAssetWrapper<Flat::AssetA>::TypeName().data());
|
||||
// EXPECT_EQ(test2->AssetHeader()->uuid, uuid);
|
||||
// EXPECT_EQ(test2->AssetHeader()->version, 2);
|
||||
}
|
||||
|
||||
UUID uuid;
|
||||
UUID uuid2;
|
||||
|
||||
eastl::array<std::byte, 4> blob {std::byte {1}, std::byte {2}, std::byte {3}, std::byte {4}};
|
||||
eastl::array<std::byte, 4> blob2 {std::byte {1}, std::byte {2}, std::byte {3}, std::byte {5}};
|
||||
eastl::array<std::byte, 4> blob3 {std::byte {1}, std::byte {2}, std::byte {3}, std::byte {6}};
|
||||
|
||||
{
|
||||
BigFile::Request assetHeaderRequest {
|
||||
m_bigFile,
|
||||
"INSERT INTO AssetHeader (UUID, Name, TypeID, TypeName) VALUES(?, ?, ?, ?)"};
|
||||
assetHeaderRequest.Bind(1, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid));
|
||||
assetHeaderRequest.Bind(2, "Test");
|
||||
assetHeaderRequest.Bind(3, 42);
|
||||
assetHeaderRequest.Bind(4, "TypeTest");
|
||||
|
||||
BigFile::Request assetRequest {m_bigFile, "INSERT INTO Asset (UUID, Asset) VALUES(?, ?)"};
|
||||
assetRequest.Bind(1, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid));
|
||||
assetRequest.Bind(2, blob);
|
||||
|
||||
BigFile::Request assetHeaderRequest2 {
|
||||
m_bigFile,
|
||||
"INSERT INTO AssetHeader (UUID, Name, TypeID, TypeName) VALUES(?, ?, ?, ?)"};
|
||||
assetHeaderRequest2.Bind(1, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid2));
|
||||
assetHeaderRequest2.Bind(2, "Test2");
|
||||
assetHeaderRequest2.Bind(3, 42);
|
||||
assetHeaderRequest2.Bind(4, "TypeTest");
|
||||
|
||||
BigFile::Request assetRequest2 {m_bigFile, "INSERT INTO Asset (UUID, Asset) VALUES(?, ?)"};
|
||||
assetRequest2.Bind(1, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid2));
|
||||
assetRequest2.Bind(2, blob3);
|
||||
|
||||
m_bigFile.BeginTransaction();
|
||||
[[maybe_unused]]
|
||||
std::uint32_t assetHeaderChangedCount = assetHeaderRequest.Execute();
|
||||
[[maybe_unused]]
|
||||
std::uint32_t assetChangedCount = assetRequest.Execute();
|
||||
|
||||
[[maybe_unused]]
|
||||
std::uint32_t assetHeaderChangedCount2 = assetHeaderRequest2.Execute();
|
||||
[[maybe_unused]]
|
||||
std::uint32_t assetChangedCount2 = assetRequest2.Execute();
|
||||
|
||||
m_bigFile.CommitTransaction();
|
||||
}
|
||||
|
||||
{
|
||||
BigFile::Request updateAsset {m_bigFile, "UPDATE Asset SET Asset = ? WHERE UUID = ?"};
|
||||
updateAsset.Bind(1, blob2);
|
||||
updateAsset.Bind(2, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid));
|
||||
|
||||
m_bigFile.BeginTransaction();
|
||||
[[maybe_unused]]
|
||||
std::uint32_t updateAssetChangedCount = updateAsset.Execute();
|
||||
m_bigFile.CommitTransaction();
|
||||
}
|
||||
|
||||
{
|
||||
BigFile::Request request {
|
||||
m_bigFile,
|
||||
"SELECT Name, TypeID, TypeName, CreateTime, ModificationTime FROM AssetHeader WHERE UUID = ?"};
|
||||
request.Bind(1, static_cast<std::span<const std::byte, UUID::UUID_BYTE_SIZE>>(uuid));
|
||||
|
||||
[[maybe_unused]]
|
||||
const bool get = request.Step();
|
||||
|
||||
[[maybe_unused]]
|
||||
const eastl::string name {static_cast<eastl::string_view>(request.Get(0))};
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t typeId = request.Get(1);
|
||||
[[maybe_unused]]
|
||||
const eastl::string typeName {static_cast<eastl::string_view>(request.Get(2))};
|
||||
[[maybe_unused]]
|
||||
const Time createTime = static_cast<std::int64_t>(request.Get(3));
|
||||
[[maybe_unused]]
|
||||
const Time modificationTime = static_cast<std::int64_t>(request.Get(4));
|
||||
|
||||
{
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t year = createTime.Year();
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t month = createTime.Month();
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t day = createTime.Day();
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t hour = createTime.Hour();
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t minute = createTime.Minute();
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t second = createTime.Second();
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t microsecond = createTime.Microsecond();
|
||||
}
|
||||
|
||||
{
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t year = modificationTime.Year();
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t month = modificationTime.Month();
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t day = modificationTime.Day();
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t hour = modificationTime.Hour();
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t minute = modificationTime.Minute();
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t second = modificationTime.Second();
|
||||
[[maybe_unused]]
|
||||
const std::uint32_t microsecond = modificationTime.Microsecond();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Bigfoot
|
||||
@@ -10,6 +10,4 @@ bigfoot_create_bigfile("Tests/Bigfoot")
|
||||
|
||||
bigfoot_create_package_tests(
|
||||
""
|
||||
"${BigfootDependencies}")
|
||||
|
||||
bigfoot_setup_dependencies("Tests/Bigfoot")
|
||||
"${BigfootDependencies}")
|
||||
@@ -0,0 +1,23 @@
|
||||
include "Engine/BigFile/Asset/AssetHeader.fbs";
|
||||
|
||||
namespace Bigfoot.Flat;
|
||||
|
||||
struct AssetAHardRef (native_type: "::Bigfoot::HardRef<::Bigfoot::AssetA>")
|
||||
{
|
||||
uuid: UUID;
|
||||
}
|
||||
|
||||
struct AssetASoftRef (native_type: "::Bigfoot::SoftRef<::Bigfoot::AssetA>")
|
||||
{
|
||||
uuid: UUID;
|
||||
}
|
||||
|
||||
table AssetA
|
||||
{
|
||||
asset_header: AssetHeader;
|
||||
|
||||
health: uint;
|
||||
mana: uint;
|
||||
}
|
||||
|
||||
root_type AssetA;
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Auto-generated header from: AssetA.fbs
|
||||
* Generated by Bin2CPP
|
||||
*
|
||||
* DO NOT TOUCH
|
||||
*/
|
||||
#ifndef ASSETA_FBS_HPP
|
||||
#define ASSETA_FBS_HPP
|
||||
#include <EASTL/array.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
inline constexpr eastl::array<std::byte, 369> g_AssetA_fbs = {
|
||||
std::byte{0x69}, std::byte{0x6E}, std::byte{0x63}, std::byte{0x6C}, std::byte{0x75}, std::byte{0x64}, std::byte{0x65}, std::byte{0x20}, std::byte{0x22}, std::byte{0x45}, std::byte{0x6E}, std::byte{0x67}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x65}, std::byte{0x2F},
|
||||
std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x46}, std::byte{0x69}, std::byte{0x6C}, std::byte{0x65}, std::byte{0x2F}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x2F}, std::byte{0x41}, std::byte{0x73},
|
||||
std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x48}, std::byte{0x65}, std::byte{0x61}, std::byte{0x64}, std::byte{0x65}, std::byte{0x72}, std::byte{0x2E}, std::byte{0x66}, std::byte{0x62}, std::byte{0x73}, std::byte{0x22}, std::byte{0x3B}, std::byte{0x0A},
|
||||
std::byte{0x0A}, std::byte{0x6E}, std::byte{0x61}, std::byte{0x6D}, std::byte{0x65}, std::byte{0x73}, std::byte{0x70}, std::byte{0x61}, std::byte{0x63}, std::byte{0x65}, std::byte{0x20}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F},
|
||||
std::byte{0x6F}, std::byte{0x74}, std::byte{0x2E}, std::byte{0x46}, std::byte{0x6C}, std::byte{0x61}, std::byte{0x74}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x73}, std::byte{0x74}, std::byte{0x72}, std::byte{0x75}, std::byte{0x63}, std::byte{0x74},
|
||||
std::byte{0x20}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x41}, std::byte{0x48}, std::byte{0x61}, std::byte{0x72}, std::byte{0x64}, std::byte{0x52}, std::byte{0x65}, std::byte{0x66}, std::byte{0x20}, std::byte{0x28},
|
||||
std::byte{0x6E}, std::byte{0x61}, std::byte{0x74}, std::byte{0x69}, std::byte{0x76}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x74}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x22}, std::byte{0x3A}, std::byte{0x3A},
|
||||
std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x48}, std::byte{0x61}, std::byte{0x72}, std::byte{0x64}, std::byte{0x52}, std::byte{0x65}, std::byte{0x66},
|
||||
std::byte{0x3C}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65},
|
||||
std::byte{0x74}, std::byte{0x41}, std::byte{0x3E}, std::byte{0x22}, std::byte{0x29}, std::byte{0x0A}, std::byte{0x7B}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x75}, std::byte{0x75}, std::byte{0x69}, std::byte{0x64},
|
||||
std::byte{0x3A}, std::byte{0x20}, std::byte{0x55}, std::byte{0x55}, std::byte{0x49}, std::byte{0x44}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x7D}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x73}, std::byte{0x74}, std::byte{0x72}, std::byte{0x75}, std::byte{0x63},
|
||||
std::byte{0x74}, std::byte{0x20}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x41}, std::byte{0x53}, std::byte{0x6F}, std::byte{0x66}, std::byte{0x74}, std::byte{0x52}, std::byte{0x65}, std::byte{0x66}, std::byte{0x20},
|
||||
std::byte{0x28}, std::byte{0x6E}, std::byte{0x61}, std::byte{0x74}, std::byte{0x69}, std::byte{0x76}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x74}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x22}, std::byte{0x3A},
|
||||
std::byte{0x3A}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x53}, std::byte{0x6F}, std::byte{0x66}, std::byte{0x74}, std::byte{0x52}, std::byte{0x65},
|
||||
std::byte{0x66}, std::byte{0x3C}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73},
|
||||
std::byte{0x65}, std::byte{0x74}, std::byte{0x41}, std::byte{0x3E}, std::byte{0x22}, std::byte{0x29}, std::byte{0x0A}, std::byte{0x7B}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x75}, std::byte{0x75}, std::byte{0x69},
|
||||
std::byte{0x64}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x55}, std::byte{0x55}, std::byte{0x49}, std::byte{0x44}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x7D}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x74}, std::byte{0x61}, std::byte{0x62}, std::byte{0x6C},
|
||||
std::byte{0x65}, std::byte{0x20}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x41}, std::byte{0x0A}, std::byte{0x7B}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x61},
|
||||
std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x5F}, std::byte{0x68}, std::byte{0x65}, std::byte{0x61}, std::byte{0x64}, std::byte{0x65}, std::byte{0x72}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73},
|
||||
std::byte{0x65}, std::byte{0x74}, std::byte{0x48}, std::byte{0x65}, std::byte{0x61}, std::byte{0x64}, std::byte{0x65}, std::byte{0x72}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x68},
|
||||
std::byte{0x65}, std::byte{0x61}, std::byte{0x6C}, std::byte{0x74}, std::byte{0x68}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x75}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x74}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20},
|
||||
std::byte{0x20}, std::byte{0x6D}, std::byte{0x61}, std::byte{0x6E}, std::byte{0x61}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x75}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x74}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x7D}, std::byte{0x0A}, std::byte{0x0A},
|
||||
std::byte{0x72}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x5F}, std::byte{0x74}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x20}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x41},
|
||||
std::byte{0x3B}
|
||||
};
|
||||
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif // ASSETA_FBS_HPP
|
||||
@@ -0,0 +1,69 @@
|
||||
/*********************************************************************
|
||||
* \file AssetA.hpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date February 2026
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_ENGINETESTS_ASSETA_HPP
|
||||
#define BIGFOOT_ENGINETESTS_ASSETA_HPP
|
||||
#include <Engine/BigFile/Asset/AssetContainer.hpp>
|
||||
|
||||
#include <EngineTests/BigFile/Asset/AssetA_generated.hpp>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
class AssetA
|
||||
{
|
||||
public:
|
||||
using FLAT_ASSET = Flat::AssetA;
|
||||
|
||||
AssetA(FlatAssetWrapper<Flat::AssetA>* p_flatAsset):
|
||||
m_flatAsset(p_flatAsset)
|
||||
{
|
||||
// deprecation...
|
||||
if (m_flatAsset->Asset().asset_header->version < 2)
|
||||
{
|
||||
m_flatAsset->Asset().asset_header->version = 2;
|
||||
}
|
||||
}
|
||||
|
||||
AssetA(const AssetA& p_assetA) = default;
|
||||
AssetA(AssetA&& p_assetA) = default;
|
||||
|
||||
[[nodiscard]]
|
||||
std::uint32_t& Health()
|
||||
{
|
||||
return m_flatAsset->Asset().health;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
std::uint32_t& Mana()
|
||||
{
|
||||
return m_flatAsset->Asset().mana;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
Flat::AssetHeaderT* AssetHeader()
|
||||
{
|
||||
return m_flatAsset->Asset().asset_header.get();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
const Flat::AssetHeaderT* AssetHeader() const
|
||||
{
|
||||
return m_flatAsset->Asset().asset_header.get();
|
||||
}
|
||||
|
||||
~AssetA() = default;
|
||||
|
||||
AssetA& operator=(const AssetA& p_assetA) = default;
|
||||
AssetA& operator=(AssetA&& p_assetA) = default;
|
||||
|
||||
private:
|
||||
FlatAssetWrapper<Flat::AssetA>* m_flatAsset;
|
||||
};
|
||||
|
||||
using AssetAContainer = AssetContainer<AssetA>;
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,338 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_ASSETA_BIGFOOT_FLAT_H_
|
||||
#define FLATBUFFERS_GENERATED_ASSETA_BIGFOOT_FLAT_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
#include "Engine/BigFile/Asset/AssetTypeID.hpp"
|
||||
#include "Engine/BigFile/Asset/AssetTypeID.hpp"
|
||||
#include "System/UUID/UUID.hpp"
|
||||
#include "Engine/BigFile/Asset/AssetHeader_generated.hpp"
|
||||
|
||||
#include "EASTL/unique_ptr.h"
|
||||
#include "EASTL/string.h"
|
||||
|
||||
namespace Bigfoot {
|
||||
namespace Flat {
|
||||
|
||||
struct AssetAHardRef;
|
||||
|
||||
struct AssetASoftRef;
|
||||
|
||||
struct AssetA;
|
||||
struct AssetABuilder;
|
||||
struct AssetAT;
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetAHardRefTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetASoftRefTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetATypeTable();
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) AssetAHardRef FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
Bigfoot::Flat::UUID uuid_;
|
||||
|
||||
public:
|
||||
struct Traits;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return AssetAHardRefTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "Bigfoot.Flat.AssetAHardRef";
|
||||
}
|
||||
AssetAHardRef()
|
||||
: uuid_() {
|
||||
}
|
||||
AssetAHardRef(const Bigfoot::Flat::UUID &_uuid)
|
||||
: uuid_(_uuid) {
|
||||
}
|
||||
const Bigfoot::Flat::UUID &uuid() const {
|
||||
return uuid_;
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(AssetAHardRef, 16);
|
||||
|
||||
struct AssetAHardRef::Traits {
|
||||
using type = AssetAHardRef;
|
||||
};
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) AssetASoftRef FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
Bigfoot::Flat::UUID uuid_;
|
||||
|
||||
public:
|
||||
struct Traits;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return AssetASoftRefTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "Bigfoot.Flat.AssetASoftRef";
|
||||
}
|
||||
AssetASoftRef()
|
||||
: uuid_() {
|
||||
}
|
||||
AssetASoftRef(const Bigfoot::Flat::UUID &_uuid)
|
||||
: uuid_(_uuid) {
|
||||
}
|
||||
const Bigfoot::Flat::UUID &uuid() const {
|
||||
return uuid_;
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(AssetASoftRef, 16);
|
||||
|
||||
struct AssetASoftRef::Traits {
|
||||
using type = AssetASoftRef;
|
||||
};
|
||||
|
||||
struct AssetAT : public ::flatbuffers::NativeTable {
|
||||
typedef AssetA TableType;
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "Bigfoot.Flat.AssetAT";
|
||||
}
|
||||
eastl::unique_ptr<Bigfoot::Flat::AssetHeaderT> asset_header{};
|
||||
uint32_t health = 0;
|
||||
uint32_t mana = 0;
|
||||
AssetAT() = default;
|
||||
AssetAT(const AssetAT &o);
|
||||
AssetAT(AssetAT&&) FLATBUFFERS_NOEXCEPT = default;
|
||||
AssetAT &operator=(AssetAT o) FLATBUFFERS_NOEXCEPT;
|
||||
};
|
||||
|
||||
struct AssetA FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef AssetAT NativeTableType;
|
||||
typedef AssetABuilder Builder;
|
||||
struct Traits;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return AssetATypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "Bigfoot.Flat.AssetA";
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_ASSET_HEADER = 4,
|
||||
VT_HEALTH = 6,
|
||||
VT_MANA = 8
|
||||
};
|
||||
const Bigfoot::Flat::AssetHeader *asset_header() const {
|
||||
return GetPointer<const Bigfoot::Flat::AssetHeader *>(VT_ASSET_HEADER);
|
||||
}
|
||||
uint32_t health() const {
|
||||
return GetField<uint32_t>(VT_HEALTH, 0);
|
||||
}
|
||||
uint32_t mana() const {
|
||||
return GetField<uint32_t>(VT_MANA, 0);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_ASSET_HEADER) &&
|
||||
verifier.VerifyTable(asset_header()) &&
|
||||
VerifyField<uint32_t>(verifier, VT_HEALTH, 4) &&
|
||||
VerifyField<uint32_t>(verifier, VT_MANA, 4) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
AssetAT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(AssetAT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<AssetA> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const AssetAT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct AssetABuilder {
|
||||
typedef AssetA Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_asset_header(::flatbuffers::Offset<Bigfoot::Flat::AssetHeader> asset_header) {
|
||||
fbb_.AddOffset(AssetA::VT_ASSET_HEADER, asset_header);
|
||||
}
|
||||
void add_health(uint32_t health) {
|
||||
fbb_.AddElement<uint32_t>(AssetA::VT_HEALTH, health, 0);
|
||||
}
|
||||
void add_mana(uint32_t mana) {
|
||||
fbb_.AddElement<uint32_t>(AssetA::VT_MANA, mana, 0);
|
||||
}
|
||||
explicit AssetABuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<AssetA> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<AssetA>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<AssetA> CreateAssetA(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<Bigfoot::Flat::AssetHeader> asset_header = 0,
|
||||
uint32_t health = 0,
|
||||
uint32_t mana = 0) {
|
||||
AssetABuilder builder_(_fbb);
|
||||
builder_.add_mana(mana);
|
||||
builder_.add_health(health);
|
||||
builder_.add_asset_header(asset_header);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
struct AssetA::Traits {
|
||||
using type = AssetA;
|
||||
static auto constexpr Create = CreateAssetA;
|
||||
};
|
||||
|
||||
::flatbuffers::Offset<AssetA> CreateAssetA(::flatbuffers::FlatBufferBuilder &_fbb, const AssetAT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
inline AssetAT::AssetAT(const AssetAT &o)
|
||||
: asset_header((o.asset_header) ? new Bigfoot::Flat::AssetHeaderT(*o.asset_header) : nullptr),
|
||||
health(o.health),
|
||||
mana(o.mana) {
|
||||
}
|
||||
|
||||
inline AssetAT &AssetAT::operator=(AssetAT o) FLATBUFFERS_NOEXCEPT {
|
||||
std::swap(asset_header, o.asset_header);
|
||||
std::swap(health, o.health);
|
||||
std::swap(mana, o.mana);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline AssetAT *AssetA::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::make_unique<AssetAT>();
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void AssetA::UnPackTo(AssetAT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = asset_header(); if (_e) { if(_o->asset_header) { _e->UnPackTo(_o->asset_header.get(), _resolver); } else { _o->asset_header = eastl::unique_ptr<Bigfoot::Flat::AssetHeaderT>(_e->UnPack(_resolver)); } } else if (_o->asset_header) { _o->asset_header.reset(); } }
|
||||
{ auto _e = health(); _o->health = _e; }
|
||||
{ auto _e = mana(); _o->mana = _e; }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<AssetA> CreateAssetA(::flatbuffers::FlatBufferBuilder &_fbb, const AssetAT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return AssetA::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<AssetA> AssetA::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const AssetAT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const AssetAT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _asset_header = _o->asset_header ? CreateAssetHeader(_fbb, _o->asset_header.get(), _rehasher) : 0;
|
||||
auto _health = _o->health;
|
||||
auto _mana = _o->mana;
|
||||
return Bigfoot::Flat::CreateAssetA(
|
||||
_fbb,
|
||||
_asset_header,
|
||||
_health,
|
||||
_mana);
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetAHardRefTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
Bigfoot::Flat::UUIDTypeTable
|
||||
};
|
||||
static const int64_t values[] = { 0, 16 };
|
||||
static const char * const names[] = {
|
||||
"uuid"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_STRUCT, 1, type_codes, type_refs, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetASoftRefTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
Bigfoot::Flat::UUIDTypeTable
|
||||
};
|
||||
static const int64_t values[] = { 0, 16 };
|
||||
static const char * const names[] = {
|
||||
"uuid"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_STRUCT, 1, type_codes, type_refs, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetATypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||
{ ::flatbuffers::ET_UINT, 0, -1 },
|
||||
{ ::flatbuffers::ET_UINT, 0, -1 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
Bigfoot::Flat::AssetHeaderTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"asset_header",
|
||||
"health",
|
||||
"mana"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 3, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const Bigfoot::Flat::AssetA *GetAssetA(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<Bigfoot::Flat::AssetA>(buf);
|
||||
}
|
||||
|
||||
inline const Bigfoot::Flat::AssetA *GetSizePrefixedAssetA(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<Bigfoot::Flat::AssetA>(buf);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifyAssetABuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifyBuffer<Bigfoot::Flat::AssetA>(nullptr);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifySizePrefixedAssetABuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifySizePrefixedBuffer<Bigfoot::Flat::AssetA>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishAssetABuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Bigfoot::Flat::AssetA> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedAssetABuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Bigfoot::Flat::AssetA> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
inline eastl::unique_ptr<Bigfoot::Flat::AssetAT> UnPackAssetA(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return eastl::unique_ptr<Bigfoot::Flat::AssetAT>(GetAssetA(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
inline eastl::unique_ptr<Bigfoot::Flat::AssetAT> UnPackSizePrefixedAssetA(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return eastl::unique_ptr<Bigfoot::Flat::AssetAT>(GetSizePrefixedAssetA(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
} // namespace Flat
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_ASSETA_BIGFOOT_FLAT_H_
|
||||
@@ -0,0 +1,22 @@
|
||||
include "EngineTests/BigFile/Asset/AssetA.fbs";
|
||||
|
||||
namespace Bigfoot.Flat;
|
||||
|
||||
struct AssetBHardRef (native_type: "::Bigfoot::HardRef<::Bigfoot::AssetB>")
|
||||
{
|
||||
uuid: UUID;
|
||||
}
|
||||
|
||||
struct AssetBSoftRef (native_type: "::Bigfoot::SoftRef<::Bigfoot::AssetB>")
|
||||
{
|
||||
uuid: UUID;
|
||||
}
|
||||
|
||||
table AssetB
|
||||
{
|
||||
asset_header: AssetHeader;
|
||||
|
||||
asset_a_hard_ref: AssetAHardRef (native_inline);
|
||||
}
|
||||
|
||||
root_type AssetB;
|
||||
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Auto-generated header from: AssetB.fbs
|
||||
* Generated by Bin2CPP
|
||||
*
|
||||
* DO NOT TOUCH
|
||||
*/
|
||||
#ifndef ASSETB_FBS_HPP
|
||||
#define ASSETB_FBS_HPP
|
||||
#include <EASTL/array.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
inline constexpr eastl::array<std::byte, 388> g_AssetB_fbs = {
|
||||
std::byte{0x69}, std::byte{0x6E}, std::byte{0x63}, std::byte{0x6C}, std::byte{0x75}, std::byte{0x64}, std::byte{0x65}, std::byte{0x20}, std::byte{0x22}, std::byte{0x45}, std::byte{0x6E}, std::byte{0x67}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x65}, std::byte{0x54},
|
||||
std::byte{0x65}, std::byte{0x73}, std::byte{0x74}, std::byte{0x73}, std::byte{0x2F}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x46}, std::byte{0x69}, std::byte{0x6C}, std::byte{0x65}, std::byte{0x2F}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73},
|
||||
std::byte{0x65}, std::byte{0x74}, std::byte{0x2F}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x41}, std::byte{0x2E}, std::byte{0x66}, std::byte{0x62}, std::byte{0x73}, std::byte{0x22}, std::byte{0x3B}, std::byte{0x0A},
|
||||
std::byte{0x0A}, std::byte{0x6E}, std::byte{0x61}, std::byte{0x6D}, std::byte{0x65}, std::byte{0x73}, std::byte{0x70}, std::byte{0x61}, std::byte{0x63}, std::byte{0x65}, std::byte{0x20}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F},
|
||||
std::byte{0x6F}, std::byte{0x74}, std::byte{0x2E}, std::byte{0x46}, std::byte{0x6C}, std::byte{0x61}, std::byte{0x74}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x73}, std::byte{0x74}, std::byte{0x72}, std::byte{0x75}, std::byte{0x63}, std::byte{0x74},
|
||||
std::byte{0x20}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x42}, std::byte{0x48}, std::byte{0x61}, std::byte{0x72}, std::byte{0x64}, std::byte{0x52}, std::byte{0x65}, std::byte{0x66}, std::byte{0x20}, std::byte{0x28},
|
||||
std::byte{0x6E}, std::byte{0x61}, std::byte{0x74}, std::byte{0x69}, std::byte{0x76}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x74}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x22}, std::byte{0x3A}, std::byte{0x3A},
|
||||
std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x48}, std::byte{0x61}, std::byte{0x72}, std::byte{0x64}, std::byte{0x52}, std::byte{0x65}, std::byte{0x66},
|
||||
std::byte{0x3C}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65},
|
||||
std::byte{0x74}, std::byte{0x42}, std::byte{0x3E}, std::byte{0x22}, std::byte{0x29}, std::byte{0x0A}, std::byte{0x7B}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x75}, std::byte{0x75}, std::byte{0x69}, std::byte{0x64},
|
||||
std::byte{0x3A}, std::byte{0x20}, std::byte{0x55}, std::byte{0x55}, std::byte{0x49}, std::byte{0x44}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x7D}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x73}, std::byte{0x74}, std::byte{0x72}, std::byte{0x75}, std::byte{0x63},
|
||||
std::byte{0x74}, std::byte{0x20}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x42}, std::byte{0x53}, std::byte{0x6F}, std::byte{0x66}, std::byte{0x74}, std::byte{0x52}, std::byte{0x65}, std::byte{0x66}, std::byte{0x20},
|
||||
std::byte{0x28}, std::byte{0x6E}, std::byte{0x61}, std::byte{0x74}, std::byte{0x69}, std::byte{0x76}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x74}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x22}, std::byte{0x3A},
|
||||
std::byte{0x3A}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x53}, std::byte{0x6F}, std::byte{0x66}, std::byte{0x74}, std::byte{0x52}, std::byte{0x65},
|
||||
std::byte{0x66}, std::byte{0x3C}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x42}, std::byte{0x69}, std::byte{0x67}, std::byte{0x66}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x3A}, std::byte{0x3A}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73},
|
||||
std::byte{0x65}, std::byte{0x74}, std::byte{0x42}, std::byte{0x3E}, std::byte{0x22}, std::byte{0x29}, std::byte{0x0A}, std::byte{0x7B}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x75}, std::byte{0x75}, std::byte{0x69},
|
||||
std::byte{0x64}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x55}, std::byte{0x55}, std::byte{0x49}, std::byte{0x44}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x7D}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x74}, std::byte{0x61}, std::byte{0x62}, std::byte{0x6C},
|
||||
std::byte{0x65}, std::byte{0x20}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x42}, std::byte{0x0A}, std::byte{0x7B}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x61},
|
||||
std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x5F}, std::byte{0x68}, std::byte{0x65}, std::byte{0x61}, std::byte{0x64}, std::byte{0x65}, std::byte{0x72}, std::byte{0x3A}, std::byte{0x20}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73},
|
||||
std::byte{0x65}, std::byte{0x74}, std::byte{0x48}, std::byte{0x65}, std::byte{0x61}, std::byte{0x64}, std::byte{0x65}, std::byte{0x72}, std::byte{0x3B}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x20}, std::byte{0x61},
|
||||
std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x5F}, std::byte{0x61}, std::byte{0x5F}, std::byte{0x68}, std::byte{0x61}, std::byte{0x72}, std::byte{0x64}, std::byte{0x5F}, std::byte{0x72}, std::byte{0x65}, std::byte{0x66}, std::byte{0x3A},
|
||||
std::byte{0x20}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73}, std::byte{0x65}, std::byte{0x74}, std::byte{0x41}, std::byte{0x48}, std::byte{0x61}, std::byte{0x72}, std::byte{0x64}, std::byte{0x52}, std::byte{0x65}, std::byte{0x66}, std::byte{0x20}, std::byte{0x28},
|
||||
std::byte{0x6E}, std::byte{0x61}, std::byte{0x74}, std::byte{0x69}, std::byte{0x76}, std::byte{0x65}, std::byte{0x5F}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x6C}, std::byte{0x69}, std::byte{0x6E}, std::byte{0x65}, std::byte{0x29}, std::byte{0x3B}, std::byte{0x0A},
|
||||
std::byte{0x7D}, std::byte{0x0A}, std::byte{0x0A}, std::byte{0x72}, std::byte{0x6F}, std::byte{0x6F}, std::byte{0x74}, std::byte{0x5F}, std::byte{0x74}, std::byte{0x79}, std::byte{0x70}, std::byte{0x65}, std::byte{0x20}, std::byte{0x41}, std::byte{0x73}, std::byte{0x73},
|
||||
std::byte{0x65}, std::byte{0x74}, std::byte{0x42}, std::byte{0x3B}
|
||||
};
|
||||
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif // ASSETB_FBS_HPP
|
||||
@@ -0,0 +1,59 @@
|
||||
/*********************************************************************
|
||||
* \file AssetB.hpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date February 2026
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_ENGINETESTS_ASSETB_HPP
|
||||
#define BIGFOOT_ENGINETESTS_ASSETB_HPP
|
||||
#include <Engine/BigFile/Asset/AssetContainer.hpp>
|
||||
|
||||
#include <EngineTests/BigFile/Asset/AssetA.hpp>
|
||||
#include <EngineTests/BigFile/Asset/AssetB_generated.hpp>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
class AssetB
|
||||
{
|
||||
public:
|
||||
using FLAT_ASSET = Flat::AssetB;
|
||||
|
||||
AssetB(FlatAssetWrapper<Flat::AssetB>* p_flatAsset):
|
||||
m_flatAsset(p_flatAsset)
|
||||
{
|
||||
}
|
||||
|
||||
AssetB(const AssetB& p_assetB) = default;
|
||||
AssetB(AssetB&& p_assetB) = default;
|
||||
|
||||
[[nodiscard]]
|
||||
HardRef<AssetA> Health()
|
||||
{
|
||||
return m_flatAsset->Asset().asset_a_hard_ref;
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
Flat::AssetHeaderT* AssetHeader()
|
||||
{
|
||||
return m_flatAsset->Asset().asset_header.get();
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
const Flat::AssetHeaderT* AssetHeader() const
|
||||
{
|
||||
return m_flatAsset->Asset().asset_header.get();
|
||||
}
|
||||
|
||||
~AssetB() = default;
|
||||
|
||||
AssetB& operator=(const AssetB& p_assetB) = default;
|
||||
AssetB& operator=(AssetB&& p_assetB) = default;
|
||||
|
||||
private:
|
||||
FlatAssetWrapper<Flat::AssetB>* m_flatAsset;
|
||||
};
|
||||
|
||||
using AssetBContainer = AssetContainer<AssetB>;
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,321 @@
|
||||
// automatically generated by the FlatBuffers compiler, do not modify
|
||||
|
||||
|
||||
#ifndef FLATBUFFERS_GENERATED_ASSETB_BIGFOOT_FLAT_H_
|
||||
#define FLATBUFFERS_GENERATED_ASSETB_BIGFOOT_FLAT_H_
|
||||
|
||||
#include "flatbuffers/flatbuffers.h"
|
||||
|
||||
// Ensure the included flatbuffers.h is the same version as when this file was
|
||||
// generated, otherwise it may not be compatible.
|
||||
static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
FLATBUFFERS_VERSION_MINOR == 12 &&
|
||||
FLATBUFFERS_VERSION_REVISION == 19,
|
||||
"Non-compatible flatbuffers version included");
|
||||
|
||||
#include "Engine/BigFile/Asset/AssetTypeID.hpp"
|
||||
#include "Engine/BigFile/Asset/AssetTypeID.hpp"
|
||||
#include "System/UUID/UUID.hpp"
|
||||
#include "EngineTests/BigFile/Asset/AssetA_generated.hpp"
|
||||
|
||||
#include "EASTL/unique_ptr.h"
|
||||
#include "EASTL/string.h"
|
||||
|
||||
namespace Bigfoot {
|
||||
namespace Flat {
|
||||
|
||||
struct AssetBHardRef;
|
||||
|
||||
struct AssetBSoftRef;
|
||||
|
||||
struct AssetB;
|
||||
struct AssetBBuilder;
|
||||
struct AssetBT;
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetBHardRefTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetBSoftRefTypeTable();
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetBTypeTable();
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) AssetBHardRef FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
Bigfoot::Flat::UUID uuid_;
|
||||
|
||||
public:
|
||||
struct Traits;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return AssetBHardRefTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "Bigfoot.Flat.AssetBHardRef";
|
||||
}
|
||||
AssetBHardRef()
|
||||
: uuid_() {
|
||||
}
|
||||
AssetBHardRef(const Bigfoot::Flat::UUID &_uuid)
|
||||
: uuid_(_uuid) {
|
||||
}
|
||||
const Bigfoot::Flat::UUID &uuid() const {
|
||||
return uuid_;
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(AssetBHardRef, 16);
|
||||
|
||||
struct AssetBHardRef::Traits {
|
||||
using type = AssetBHardRef;
|
||||
};
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(1) AssetBSoftRef FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
Bigfoot::Flat::UUID uuid_;
|
||||
|
||||
public:
|
||||
struct Traits;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return AssetBSoftRefTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "Bigfoot.Flat.AssetBSoftRef";
|
||||
}
|
||||
AssetBSoftRef()
|
||||
: uuid_() {
|
||||
}
|
||||
AssetBSoftRef(const Bigfoot::Flat::UUID &_uuid)
|
||||
: uuid_(_uuid) {
|
||||
}
|
||||
const Bigfoot::Flat::UUID &uuid() const {
|
||||
return uuid_;
|
||||
}
|
||||
};
|
||||
FLATBUFFERS_STRUCT_END(AssetBSoftRef, 16);
|
||||
|
||||
struct AssetBSoftRef::Traits {
|
||||
using type = AssetBSoftRef;
|
||||
};
|
||||
|
||||
struct AssetBT : public ::flatbuffers::NativeTable {
|
||||
typedef AssetB TableType;
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "Bigfoot.Flat.AssetBT";
|
||||
}
|
||||
eastl::unique_ptr<Bigfoot::Flat::AssetHeaderT> asset_header{};
|
||||
::Bigfoot::HardRef<::Bigfoot::AssetA> asset_a_hard_ref{};
|
||||
AssetBT() = default;
|
||||
AssetBT(const AssetBT &o);
|
||||
AssetBT(AssetBT&&) FLATBUFFERS_NOEXCEPT = default;
|
||||
AssetBT &operator=(AssetBT o) FLATBUFFERS_NOEXCEPT;
|
||||
};
|
||||
|
||||
struct AssetB FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
|
||||
typedef AssetBT NativeTableType;
|
||||
typedef AssetBBuilder Builder;
|
||||
struct Traits;
|
||||
static const ::flatbuffers::TypeTable *MiniReflectTypeTable() {
|
||||
return AssetBTypeTable();
|
||||
}
|
||||
static FLATBUFFERS_CONSTEXPR_CPP11 const char *GetFullyQualifiedName() {
|
||||
return "Bigfoot.Flat.AssetB";
|
||||
}
|
||||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
|
||||
VT_ASSET_HEADER = 4,
|
||||
VT_ASSET_A_HARD_REF = 6
|
||||
};
|
||||
const Bigfoot::Flat::AssetHeader *asset_header() const {
|
||||
return GetPointer<const Bigfoot::Flat::AssetHeader *>(VT_ASSET_HEADER);
|
||||
}
|
||||
const Bigfoot::Flat::AssetAHardRef *asset_a_hard_ref() const {
|
||||
return GetStruct<const Bigfoot::Flat::AssetAHardRef *>(VT_ASSET_A_HARD_REF);
|
||||
}
|
||||
template <bool B = false>
|
||||
bool Verify(::flatbuffers::VerifierTemplate<B> &verifier) const {
|
||||
return VerifyTableStart(verifier) &&
|
||||
VerifyOffset(verifier, VT_ASSET_HEADER) &&
|
||||
verifier.VerifyTable(asset_header()) &&
|
||||
VerifyField<Bigfoot::Flat::AssetAHardRef>(verifier, VT_ASSET_A_HARD_REF, 1) &&
|
||||
verifier.EndTable();
|
||||
}
|
||||
AssetBT *UnPack(const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
void UnPackTo(AssetBT *_o, const ::flatbuffers::resolver_function_t *_resolver = nullptr) const;
|
||||
static ::flatbuffers::Offset<AssetB> Pack(::flatbuffers::FlatBufferBuilder &_fbb, const AssetBT* _o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
};
|
||||
|
||||
struct AssetBBuilder {
|
||||
typedef AssetB Table;
|
||||
::flatbuffers::FlatBufferBuilder &fbb_;
|
||||
::flatbuffers::uoffset_t start_;
|
||||
void add_asset_header(::flatbuffers::Offset<Bigfoot::Flat::AssetHeader> asset_header) {
|
||||
fbb_.AddOffset(AssetB::VT_ASSET_HEADER, asset_header);
|
||||
}
|
||||
void add_asset_a_hard_ref(const Bigfoot::Flat::AssetAHardRef *asset_a_hard_ref) {
|
||||
fbb_.AddStruct(AssetB::VT_ASSET_A_HARD_REF, asset_a_hard_ref);
|
||||
}
|
||||
explicit AssetBBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
|
||||
: fbb_(_fbb) {
|
||||
start_ = fbb_.StartTable();
|
||||
}
|
||||
::flatbuffers::Offset<AssetB> Finish() {
|
||||
const auto end = fbb_.EndTable(start_);
|
||||
auto o = ::flatbuffers::Offset<AssetB>(end);
|
||||
return o;
|
||||
}
|
||||
};
|
||||
|
||||
inline ::flatbuffers::Offset<AssetB> CreateAssetB(
|
||||
::flatbuffers::FlatBufferBuilder &_fbb,
|
||||
::flatbuffers::Offset<Bigfoot::Flat::AssetHeader> asset_header = 0,
|
||||
const Bigfoot::Flat::AssetAHardRef *asset_a_hard_ref = nullptr) {
|
||||
AssetBBuilder builder_(_fbb);
|
||||
builder_.add_asset_a_hard_ref(asset_a_hard_ref);
|
||||
builder_.add_asset_header(asset_header);
|
||||
return builder_.Finish();
|
||||
}
|
||||
|
||||
struct AssetB::Traits {
|
||||
using type = AssetB;
|
||||
static auto constexpr Create = CreateAssetB;
|
||||
};
|
||||
|
||||
::flatbuffers::Offset<AssetB> CreateAssetB(::flatbuffers::FlatBufferBuilder &_fbb, const AssetBT *_o, const ::flatbuffers::rehasher_function_t *_rehasher = nullptr);
|
||||
|
||||
inline AssetBT::AssetBT(const AssetBT &o)
|
||||
: asset_header((o.asset_header) ? new Bigfoot::Flat::AssetHeaderT(*o.asset_header) : nullptr),
|
||||
asset_a_hard_ref(o.asset_a_hard_ref) {
|
||||
}
|
||||
|
||||
inline AssetBT &AssetBT::operator=(AssetBT o) FLATBUFFERS_NOEXCEPT {
|
||||
std::swap(asset_header, o.asset_header);
|
||||
std::swap(asset_a_hard_ref, o.asset_a_hard_ref);
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline AssetBT *AssetB::UnPack(const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
auto _o = std::make_unique<AssetBT>();
|
||||
UnPackTo(_o.get(), _resolver);
|
||||
return _o.release();
|
||||
}
|
||||
|
||||
inline void AssetB::UnPackTo(AssetBT *_o, const ::flatbuffers::resolver_function_t *_resolver) const {
|
||||
(void)_o;
|
||||
(void)_resolver;
|
||||
{ auto _e = asset_header(); if (_e) { if(_o->asset_header) { _e->UnPackTo(_o->asset_header.get(), _resolver); } else { _o->asset_header = eastl::unique_ptr<Bigfoot::Flat::AssetHeaderT>(_e->UnPack(_resolver)); } } else if (_o->asset_header) { _o->asset_header.reset(); } }
|
||||
{ auto _e = asset_a_hard_ref(); if (_e) _o->asset_a_hard_ref = ::flatbuffers::UnPack(*_e); }
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<AssetB> CreateAssetB(::flatbuffers::FlatBufferBuilder &_fbb, const AssetBT *_o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
return AssetB::Pack(_fbb, _o, _rehasher);
|
||||
}
|
||||
|
||||
inline ::flatbuffers::Offset<AssetB> AssetB::Pack(::flatbuffers::FlatBufferBuilder &_fbb, const AssetBT* _o, const ::flatbuffers::rehasher_function_t *_rehasher) {
|
||||
(void)_rehasher;
|
||||
(void)_o;
|
||||
struct _VectorArgs { ::flatbuffers::FlatBufferBuilder *__fbb; const AssetBT* __o; const ::flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va;
|
||||
auto _asset_header = _o->asset_header ? CreateAssetHeader(_fbb, _o->asset_header.get(), _rehasher) : 0;
|
||||
auto _asset_a_hard_ref = ::flatbuffers::Pack(_o->asset_a_hard_ref);
|
||||
return Bigfoot::Flat::CreateAssetB(
|
||||
_fbb,
|
||||
_asset_header,
|
||||
&_asset_a_hard_ref);
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetBHardRefTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
Bigfoot::Flat::UUIDTypeTable
|
||||
};
|
||||
static const int64_t values[] = { 0, 16 };
|
||||
static const char * const names[] = {
|
||||
"uuid"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_STRUCT, 1, type_codes, type_refs, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetBSoftRefTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
Bigfoot::Flat::UUIDTypeTable
|
||||
};
|
||||
static const int64_t values[] = { 0, 16 };
|
||||
static const char * const names[] = {
|
||||
"uuid"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_STRUCT, 1, type_codes, type_refs, nullptr, values, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const ::flatbuffers::TypeTable *AssetBTypeTable() {
|
||||
static const ::flatbuffers::TypeCode type_codes[] = {
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 0 },
|
||||
{ ::flatbuffers::ET_SEQUENCE, 0, 1 }
|
||||
};
|
||||
static const ::flatbuffers::TypeFunction type_refs[] = {
|
||||
Bigfoot::Flat::AssetHeaderTypeTable,
|
||||
Bigfoot::Flat::AssetAHardRefTypeTable
|
||||
};
|
||||
static const char * const names[] = {
|
||||
"asset_header",
|
||||
"asset_a_hard_ref"
|
||||
};
|
||||
static const ::flatbuffers::TypeTable tt = {
|
||||
::flatbuffers::ST_TABLE, 2, type_codes, type_refs, nullptr, nullptr, names
|
||||
};
|
||||
return &tt;
|
||||
}
|
||||
|
||||
inline const Bigfoot::Flat::AssetB *GetAssetB(const void *buf) {
|
||||
return ::flatbuffers::GetRoot<Bigfoot::Flat::AssetB>(buf);
|
||||
}
|
||||
|
||||
inline const Bigfoot::Flat::AssetB *GetSizePrefixedAssetB(const void *buf) {
|
||||
return ::flatbuffers::GetSizePrefixedRoot<Bigfoot::Flat::AssetB>(buf);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifyAssetBBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifyBuffer<Bigfoot::Flat::AssetB>(nullptr);
|
||||
}
|
||||
|
||||
template <bool B = false>
|
||||
inline bool VerifySizePrefixedAssetBBuffer(
|
||||
::flatbuffers::VerifierTemplate<B> &verifier) {
|
||||
return verifier.template VerifySizePrefixedBuffer<Bigfoot::Flat::AssetB>(nullptr);
|
||||
}
|
||||
|
||||
inline void FinishAssetBBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Bigfoot::Flat::AssetB> root) {
|
||||
fbb.Finish(root);
|
||||
}
|
||||
|
||||
inline void FinishSizePrefixedAssetBBuffer(
|
||||
::flatbuffers::FlatBufferBuilder &fbb,
|
||||
::flatbuffers::Offset<Bigfoot::Flat::AssetB> root) {
|
||||
fbb.FinishSizePrefixed(root);
|
||||
}
|
||||
|
||||
inline eastl::unique_ptr<Bigfoot::Flat::AssetBT> UnPackAssetB(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return eastl::unique_ptr<Bigfoot::Flat::AssetBT>(GetAssetB(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
inline eastl::unique_ptr<Bigfoot::Flat::AssetBT> UnPackSizePrefixedAssetB(
|
||||
const void *buf,
|
||||
const ::flatbuffers::resolver_function_t *res = nullptr) {
|
||||
return eastl::unique_ptr<Bigfoot::Flat::AssetBT>(GetSizePrefixedAssetB(buf)->UnPack(res));
|
||||
}
|
||||
|
||||
} // namespace Flat
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif // FLATBUFFERS_GENERATED_ASSETB_BIGFOOT_FLAT_H_
|
||||
@@ -1 +0,0 @@
|
||||
// to delete when an actual test is in EngineTests
|
||||
@@ -9,6 +9,4 @@ bigfoot_create_package_tests(
|
||||
""
|
||||
"${BigfootDependencies}")
|
||||
|
||||
bigfoot_create_logger()
|
||||
|
||||
bigfoot_setup_dependencies("Tests/Bigfoot")
|
||||
bigfoot_create_logger()
|
||||
@@ -4,7 +4,7 @@
|
||||
* \author Romain BOULLARD
|
||||
* \date December 2025
|
||||
*********************************************************************/
|
||||
#include <System/Time.hpp>
|
||||
#include <System/Time/Time.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@@ -6,6 +6,4 @@ set(BigfootDependencies
|
||||
|
||||
bigfoot_create_package_tests(
|
||||
""
|
||||
"${BigfootDependencies}")
|
||||
|
||||
bigfoot_setup_dependencies("Tests/Bigfoot")
|
||||
"${BigfootDependencies}")
|
||||
32
CMake/CustomTargets.cmake
Normal file
32
CMake/CustomTargets.cmake
Normal file
@@ -0,0 +1,32 @@
|
||||
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()
|
||||
if("${CMAKE_SHARED_LINKER_FLAGS_${CONFIG}}" MATCHES "/INCREMENTAL:NO")
|
||||
string(REGEX REPLACE "/INCREMENTAL([^:]|$)" ""
|
||||
CMAKE_SHARED_LINKER_FLAGS_${CONFIG}
|
||||
"${CMAKE_SHARED_LINKER_FLAGS_${CONFIG}}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_library(BigfootCompileAndLinkFlags INTERFACE)
|
||||
|
||||
target_compile_options(BigfootCompileAndLinkFlags INTERFACE
|
||||
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
|
||||
$<$<CXX_COMPILER_ID:Clang,GNU>:-Wall -Wextra -Wpedantic -Werror>
|
||||
$<$<AND:$<BOOL:${COVERAGE}>,$<CXX_COMPILER_ID:Clang>>:-fprofile-instr-generate -fcoverage-mapping>
|
||||
)
|
||||
|
||||
target_link_options(BigfootCompileAndLinkFlags INTERFACE
|
||||
$<$<AND:$<BOOL:${COVERAGE}>,$<CXX_COMPILER_ID:Clang>>:-fprofile-instr-generate>
|
||||
)
|
||||
|
||||
target_compile_definitions(BigfootCompileAndLinkFlags INTERFACE
|
||||
$<$<PLATFORM_ID:Windows>:NOMINMAX>
|
||||
$<$<PLATFORM_ID:Windows>:WIN32_LEAN_AND_MEAN>
|
||||
$<$<PLATFORM_ID:Windows>:BIGFOOT_WINDOWS>
|
||||
$<$<PLATFORM_ID:Linux>:BIGFOOT_LINUX>
|
||||
$<$<CONFIG:Release>:BIGFOOT_OPTIMIZED>
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:BIGFOOT_NOT_OPTIMIZED>)
|
||||
@@ -7,7 +7,11 @@ endif()
|
||||
|
||||
find_package(EASTL REQUIRED)
|
||||
find_package(unordered_dense REQUIRED)
|
||||
find_package(mimalloc REQUIRED)
|
||||
if(${ASAN})
|
||||
find_package(mimalloc-asan REQUIRED)
|
||||
else()
|
||||
find_package(mimalloc REQUIRED)
|
||||
endif()
|
||||
find_package(stduuid REQUIRED)
|
||||
find_package(SQLite3 REQUIRED)
|
||||
find_package(CLI11 REQUIRED)
|
||||
|
||||
@@ -1,69 +1,110 @@
|
||||
function(bigfoot_create_package_lib PackagePublicDependencies PackagePrivateDependencies PackageBigfootPublicDependencies PackageBigfootPrivateDependencies ParentFolder)
|
||||
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)
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
|
||||
|
||||
bigfoot_compile_flatbuffers("${PackageBigfootPublicDependencies}")
|
||||
|
||||
# collect sources (reconfigure when files are added/removed)
|
||||
file(GLOB_RECURSE _BF_SOURCES
|
||||
CONFIGURE_DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp.in
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.fbs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.sql
|
||||
file(GLOB_RECURSE _SOURCES
|
||||
CONFIGURE_DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE _HEADERS
|
||||
CONFIGURE_DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE _OTHERS
|
||||
CONFIGURE_DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp.in
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.fbs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.sql
|
||||
)
|
||||
|
||||
target_sources(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
${_BF_SOURCES}
|
||||
${_SOURCES}
|
||||
${_OTHERS}
|
||||
PUBLIC
|
||||
FILE_SET HEADERS
|
||||
BASE_DIRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Include
|
||||
FILES
|
||||
${_HEADERS}
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC unordered_dense::unordered_dense EASTL::EASTL flatbuffers::flatbuffers rapidhash::rapidhash)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_DL_LIBS})
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
BigfootCompileAndLinkFlags
|
||||
PUBLIC
|
||||
unordered_dense::unordered_dense
|
||||
EASTL::EASTL
|
||||
flatbuffers::flatbuffers
|
||||
rapidhash::rapidhash
|
||||
|
||||
${PackagePublicDependencies}
|
||||
$<LINK_LIBRARY:WHOLE_ARCHIVE,${PackageBigfootPublicDependencies}>
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC ${PackagePublicDependencies})
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ${PackagePrivateDependencies})
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC $<LINK_LIBRARY:WHOLE_ARCHIVE,${PackageBigfootPublicDependencies}>)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE $<LINK_LIBRARY:WHOLE_ARCHIVE,${PackageBigfootPrivateDependencies}>)
|
||||
PRIVATE
|
||||
${PackagePrivateDependencies}
|
||||
$<LINK_LIBRARY:WHOLE_ARCHIVE,${PackageBigfootPrivateDependencies}>)
|
||||
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX Src FILES ${_BF_SOURCES})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX Src FILES ${_SOURCES} ${_HEADERS} ${_OTHERS})
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Bigfoot/${ParentFolder})
|
||||
endfunction()
|
||||
|
||||
function(bigfoot_create_package_tests ParentFolder BigfootDependencies)
|
||||
add_executable(${PROJECT_NAME})
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX)
|
||||
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
|
||||
|
||||
bigfoot_compile_flatbuffers("${BigfootDependencies}")
|
||||
|
||||
file(GLOB_RECURSE _BF_TEST_SOURCES
|
||||
CONFIGURE_DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp.in
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.fbs
|
||||
file(GLOB_RECURSE _SOURCES
|
||||
CONFIGURE_DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE _HEADERS
|
||||
CONFIGURE_DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE _OTHERS
|
||||
CONFIGURE_DEPENDS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp.in
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.fbs
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/*.sql
|
||||
)
|
||||
|
||||
target_sources(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
${_BF_TEST_SOURCES}
|
||||
${_SOURCES}
|
||||
${_OTHERS}
|
||||
PUBLIC
|
||||
FILE_SET HEADERS
|
||||
BASE_DIRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Include
|
||||
FILES
|
||||
${_HEADERS}
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/Include)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
BigfootCompileAndLinkFlags
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE $<LINK_LIBRARY:WHOLE_ARCHIVE,${PackageName}>)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE gtest::gtest)
|
||||
PRIVATE
|
||||
$<LINK_LIBRARY:WHOLE_ARCHIVE,${PackageName}>
|
||||
gtest::gtest)
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(${PROJECT_NAME} XML_OUTPUT_DIR ${CMAKE_BINARY_DIR}/TestResults/)
|
||||
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX Src/ FILES ${_BF_TEST_SOURCES})
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX Src/ FILES ${_SOURCES} ${_HEADERS} ${_OTHERS})
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Tests/Bigfoot/${ParentFolder})
|
||||
|
||||
@@ -89,5 +130,4 @@ function(bigfoot_create_package_tests ParentFolder BigfootDependencies)
|
||||
add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}Fixture)
|
||||
|
||||
set_target_properties(${PROJECT_NAME}Fixture PROPERTIES FOLDER UtilityTargets/Tests/Bigfoot/${ParentFolder})
|
||||
|
||||
endfunction()
|
||||
@@ -38,15 +38,22 @@ endfunction()
|
||||
function(bigfoot_compile_flatbuffers BigfootDependencies)
|
||||
set(IncludeFolders "")
|
||||
|
||||
get_target_property(CurrentTargetDependencyInclude ${PROJECT_NAME} INCLUDE_DIRECTORIES)
|
||||
if(CurrentTargetDependencyInclude)
|
||||
list(APPEND IncludeFolders ${CurrentTargetDependencyInclude})
|
||||
endif()
|
||||
|
||||
list(APPEND IncludeFolders ${CMAKE_CURRENT_SOURCE_DIR}/Include)
|
||||
|
||||
foreach(Dependency IN LISTS BigfootDependencies)
|
||||
get_target_property(DependencyInclude ${Dependency} INCLUDE_DIRECTORIES)
|
||||
if(DependencyInclude)
|
||||
list(APPEND IncludeFolders ${DependencyInclude})
|
||||
if(TARGET ${Dependency})
|
||||
get_target_property(DependencyIncludeDirs ${Dependency} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if(DependencyIncludeDirs)
|
||||
foreach(Dir IN LISTS DependencyIncludeDirs)
|
||||
# Strip $<BUILD_INTERFACE:...> generator expression
|
||||
if(Dir MATCHES "^\\$<BUILD_INTERFACE:(.+)>$")
|
||||
list(APPEND IncludeFolders "${CMAKE_MATCH_1}")
|
||||
elseif(NOT Dir MATCHES "^\\$<")
|
||||
# Pass through plain paths, skip other generator expressions
|
||||
list(APPEND IncludeFolders "${Dir}")
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
@@ -58,7 +65,7 @@ function(bigfoot_compile_flatbuffers BigfootDependencies)
|
||||
file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/Include/*.fbs")
|
||||
foreach(SOURCE_FILE IN LISTS SOURCES)
|
||||
get_filename_component(SOURCE_DIRECTORY ${SOURCE_FILE} DIRECTORY)
|
||||
|
||||
get_filename_component(SOURCE_NAME_WE ${SOURCE_FILE} NAME_WE)
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${SOURCE_FILE})
|
||||
|
||||
execute_process(
|
||||
@@ -80,66 +87,16 @@ function(bigfoot_compile_flatbuffers BigfootDependencies)
|
||||
--cpp-include "EASTL/unique_ptr.h"
|
||||
--cpp-include "EASTL/string.h"
|
||||
-o "${SOURCE_DIRECTORY}"
|
||||
"${SOURCE_FILE}"
|
||||
"${SOURCE_FILE}"
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${BIN2CPP_EXECUTABLE}
|
||||
--input "${SOURCE_FILE}"
|
||||
--output "${SOURCE_DIRECTORY}/${SOURCE_NAME_WE}.fbs_generated.hpp"
|
||||
--arrayType eastl::array
|
||||
--arrayInclude <EASTL/array.h>
|
||||
--namespace Bigfoot
|
||||
)
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(bigfoot_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 $<TARGET_FILE_DIR:${PROJECT_NAME}>
|
||||
COMMAND ${CMAKE_COMMAND} -E $<IF:$<CONFIG:Debug>,copy_if_different,true> ${SHARED_BINARIES_Debug} $<TARGET_FILE_DIR:${PROJECT_NAME}>
|
||||
COMMAND ${CMAKE_COMMAND} -E $<IF:$<CONFIG:Release>,copy_if_different,true> ${SHARED_BINARIES_Release} $<TARGET_FILE_DIR:${PROJECT_NAME}>
|
||||
COMMAND ${CMAKE_COMMAND} -E $<IF:$<CONFIG:RelWithDebInfo>,copy_if_different,true> ${SHARED_BINARIES_RelWithDebInfo} $<TARGET_FILE_DIR:${PROJECT_NAME}>
|
||||
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 $<TARGET_FILE_DIR:${PROJECT_NAME}>
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SHARED_BINARIES_${CMAKE_BUILD_TYPE}} $<TARGET_FILE_DIR:${PROJECT_NAME}>
|
||||
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 $<TARGET_FILE:${PROJECT_NAME}>
|
||||
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()
|
||||
@@ -1,20 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.24)
|
||||
|
||||
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
cmake_minimum_required(VERSION 3.26)
|
||||
|
||||
project(Bigfoot VERSION 0.1.0
|
||||
DESCRIPTION "The Bigfoot engine"
|
||||
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)
|
||||
option(ASAN OFF)
|
||||
option(COVERAGE OFF)
|
||||
option(TRACY ON)
|
||||
option(BUILD_TOOLS ON)
|
||||
option(VULKAN ON)
|
||||
@@ -22,6 +19,7 @@ option(BUILD_BENCHMARKS OFF)
|
||||
|
||||
set(AUTO_GENERATED_COMMENT "// AUTO-GENERATED DO NOT TOUCH")
|
||||
|
||||
include(${CMAKE_SOURCE_DIR}/CMake/CustomTargets.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/CMake/FindDependencies.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/CMake/Utils.cmake)
|
||||
include(${CMAKE_SOURCE_DIR}/CMake/Package.cmake)
|
||||
@@ -29,18 +27,11 @@ include(${CMAKE_SOURCE_DIR}/CMake/Package.cmake)
|
||||
find_program(FLATBUFFERS_FLATC_EXECUTABLE NAMES flatc)
|
||||
find_program(SQLITE3_EXECUTABLE NAMES sqlite3)
|
||||
find_program(MINJECT_EXECUTABLE NAMES minject)
|
||||
find_program(BIN2CPP_EXECUTABLE NAMES Bin2CPP)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
set(CMAKE_OPTIMIZE_DEPENDENCIES 1)
|
||||
|
||||
add_compile_definitions(
|
||||
$<$<PLATFORM_ID:Windows>:NOMINMAX>
|
||||
$<$<PLATFORM_ID:Windows>:WIN32_LEAN_AND_MEAN>
|
||||
$<$<PLATFORM_ID:Windows>:BIGFOOT_WINDOWS>
|
||||
$<$<PLATFORM_ID:Linux>:BIGFOOT_LINUX>
|
||||
$<$<CONFIG:Release>:BIGFOOT_OPTIMIZED>
|
||||
$<$<CONFIG:Debug,RelWithDebInfo>:BIGFOOT_NOT_OPTIMIZED>)
|
||||
|
||||
if(BUILD_TESTS)
|
||||
enable_testing()
|
||||
endif()
|
||||
|
||||
32
ConanProfiles/clang
Normal file
32
ConanProfiles/clang
Normal file
@@ -0,0 +1,32 @@
|
||||
[settings]
|
||||
os=Linux
|
||||
arch=x86_64
|
||||
compiler=clang
|
||||
compiler.version=20
|
||||
compiler.libcxx=libstdc++11
|
||||
compiler.cppstd=20
|
||||
compiler.cstd=17
|
||||
compiler.runtime=static
|
||||
build_type=Release
|
||||
|
||||
[conf]
|
||||
tools.cmake.cmaketoolchain:extra_variables={'CMAKE_CXX_COMPILER_LAUNCHER': 'ccache', 'CMAKE_C_COMPILER_LAUNCHER': 'ccache'}
|
||||
|
||||
tools.system.package_manager:mode=install
|
||||
tools.system.package_manager:sudo=True
|
||||
|
||||
tools.build:exelinkflags=["-fuse-ld=mold", "-flto"]
|
||||
tools.build:sharedlinkflags=["-fuse-ld=mold", "-flto"]
|
||||
|
||||
tools.build:cflags=["-flto"]
|
||||
tools.build:cxxflags=["-flto"]
|
||||
|
||||
tools.build:compiler_executables={"c": "clang", "cpp": "clang++"}
|
||||
|
||||
tools.cmake.cmaketoolchain:generator=Ninja
|
||||
|
||||
[tool_requires]
|
||||
!cmake/*: cmake/[>=4.2]
|
||||
|
||||
[options]
|
||||
Bin2CPP/*:build_tests=True
|
||||
30
ConanProfiles/clang_coverage
Normal file
30
ConanProfiles/clang_coverage
Normal file
@@ -0,0 +1,30 @@
|
||||
[settings]
|
||||
os=Linux
|
||||
arch=x86_64
|
||||
compiler=clang
|
||||
compiler.version=20
|
||||
compiler.libcxx=libstdc++11
|
||||
compiler.cppstd=20
|
||||
compiler.cstd=17
|
||||
compiler.runtime=static
|
||||
build_type=Debug
|
||||
|
||||
[conf]
|
||||
tools.cmake.cmaketoolchain:extra_variables={'CMAKE_CXX_COMPILER_LAUNCHER': 'ccache', 'CMAKE_C_COMPILER_LAUNCHER': 'ccache'}
|
||||
|
||||
tools.system.package_manager:mode=install
|
||||
tools.system.package_manager:sudo=True
|
||||
|
||||
tools.build:exelinkflags=["-fuse-ld=mold"]
|
||||
tools.build:sharedlinkflags=["-fuse-ld=mold"]
|
||||
|
||||
tools.cmake.cmaketoolchain:generator=Ninja
|
||||
|
||||
tools.build:compiler_executables={"c": "clang", "cpp": "clang++"}
|
||||
|
||||
[tool_requires]
|
||||
!cmake/*: cmake/[>=4.2]
|
||||
|
||||
[options]
|
||||
Bin2CPP/*:build_tests=True
|
||||
Bin2CPP/*:coverage=True
|
||||
29
ConanProfiles/clangd
Normal file
29
ConanProfiles/clangd
Normal file
@@ -0,0 +1,29 @@
|
||||
[settings]
|
||||
os=Linux
|
||||
arch=x86_64
|
||||
compiler=clang
|
||||
compiler.version=20
|
||||
compiler.libcxx=libstdc++11
|
||||
compiler.cppstd=20
|
||||
compiler.cstd=17
|
||||
compiler.runtime=static
|
||||
build_type=Debug
|
||||
|
||||
[conf]
|
||||
tools.cmake.cmaketoolchain:extra_variables={'CMAKE_CXX_COMPILER_LAUNCHER': 'ccache', 'CMAKE_C_COMPILER_LAUNCHER': 'ccache'}
|
||||
|
||||
tools.system.package_manager:mode=install
|
||||
tools.system.package_manager:sudo=True
|
||||
|
||||
tools.build:exelinkflags=["-fuse-ld=mold"]
|
||||
tools.build:sharedlinkflags=["-fuse-ld=mold"]
|
||||
|
||||
tools.cmake.cmaketoolchain:generator=Ninja
|
||||
|
||||
tools.build:compiler_executables={"c": "clang", "cpp": "clang++"}
|
||||
|
||||
[tool_requires]
|
||||
!cmake/*: cmake/[>=4.2]
|
||||
|
||||
[options]
|
||||
Bin2CPP/*:build_tests=True
|
||||
33
ConanProfiles/clangd_asan
Normal file
33
ConanProfiles/clangd_asan
Normal file
@@ -0,0 +1,33 @@
|
||||
[settings]
|
||||
os=Linux
|
||||
arch=x86_64
|
||||
compiler=clang
|
||||
compiler.version=20
|
||||
compiler.libcxx=libstdc++11
|
||||
compiler.cppstd=20
|
||||
compiler.cstd=17
|
||||
compiler.runtime=static
|
||||
build_type=Debug
|
||||
|
||||
[conf]
|
||||
tools.cmake.cmaketoolchain:extra_variables={'CMAKE_CXX_COMPILER_LAUNCHER': 'ccache', 'CMAKE_C_COMPILER_LAUNCHER': 'ccache'}
|
||||
|
||||
tools.system.package_manager:mode=install
|
||||
tools.system.package_manager:sudo=True
|
||||
|
||||
tools.build:exelinkflags=["-fuse-ld=mold", "-fsanitize=address,undefined,leak"]
|
||||
tools.build:sharedlinkflags=["-fuse-ld=mold", "-fsanitize=address,undefined,leak"]
|
||||
|
||||
tools.build:cflags=["-fsanitize=address,undefined,leak", "-fno-sanitize-recover=all"]
|
||||
tools.build:cxxflags=["-fsanitize=address,undefined,leak", "-fno-sanitize-recover=all"]
|
||||
|
||||
tools.cmake.cmaketoolchain:generator=Ninja
|
||||
|
||||
tools.build:compiler_executables={"c": "clang", "cpp": "clang++"}
|
||||
|
||||
[tool_requires]
|
||||
!cmake/*: cmake/[>=4.2]
|
||||
|
||||
[options]
|
||||
Bin2CPP/*:asan=True
|
||||
Bin2CPP/*:build_tests=True
|
||||
24
ConanProfiles/msvc
Normal file
24
ConanProfiles/msvc
Normal file
@@ -0,0 +1,24 @@
|
||||
[settings]
|
||||
os=Windows
|
||||
arch=x86_64
|
||||
compiler=msvc
|
||||
compiler.version=195
|
||||
compiler.cppstd=20
|
||||
compiler.cstd=17
|
||||
compiler.runtime=static
|
||||
build_type=Release
|
||||
|
||||
[conf]
|
||||
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", "/permissive-", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope", "/Zc:throwingNew"]
|
||||
|
||||
[tool_requires]
|
||||
!cmake/*: cmake/[>=4.2]
|
||||
|
||||
[options]
|
||||
Bin2CPP/*:build_tests=True
|
||||
19
ConanProfiles/msvc_ccache.cmake
Normal file
19
ConanProfiles/msvc_ccache.cmake
Normal file
@@ -0,0 +1,19 @@
|
||||
# https://github.com/ccache/ccache/wiki/MS-Visual-Studio#usage-with-cmake
|
||||
|
||||
find_program(ccache_exe ccache)
|
||||
if(ccache_exe)
|
||||
file(COPY_FILE
|
||||
${ccache_exe} ${CMAKE_BINARY_DIR}/cl.exe
|
||||
ONLY_IF_DIFFERENT)
|
||||
|
||||
# By default Visual Studio generators will use /Zi which is not compatible
|
||||
# with ccache, so tell Visual Studio to use /Z7 instead.
|
||||
message(STATUS "Setting MSVC debug information format to 'Embedded'")
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>")
|
||||
|
||||
set(CMAKE_VS_GLOBALS
|
||||
"CLToolExe=cl.exe"
|
||||
"CLToolPath=${CMAKE_BINARY_DIR}"
|
||||
"UseMultiToolTask=true"
|
||||
)
|
||||
endif()
|
||||
20
ConanProfiles/msvcd
Normal file
20
ConanProfiles/msvcd
Normal file
@@ -0,0 +1,20 @@
|
||||
[settings]
|
||||
os=Windows
|
||||
arch=x86_64
|
||||
compiler=msvc
|
||||
compiler.version=195
|
||||
compiler.cppstd=20
|
||||
compiler.cstd=17
|
||||
compiler.runtime=static
|
||||
build_type=Debug
|
||||
|
||||
[conf]
|
||||
tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/msvc_ccache.cmake
|
||||
|
||||
tools.build:cflags=["/Zc:preprocessor", "/Zc:__STDC__", "/D_CRT_DECLARE_NONSTDC_NAMES=1"]
|
||||
tools.build:cxxflags=["/Zc:preprocessor", "/permissive-", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope", "/Zc:throwingNew"]
|
||||
[tool_requires]
|
||||
!cmake/*: cmake/[>=4.2]
|
||||
|
||||
[options]
|
||||
Bin2CPP/*:build_tests=True
|
||||
25
ConanProfiles/msvcd_asan
Normal file
25
ConanProfiles/msvcd_asan
Normal file
@@ -0,0 +1,25 @@
|
||||
[settings]
|
||||
os=Windows
|
||||
arch=x86_64
|
||||
compiler=msvc
|
||||
compiler.version=195
|
||||
compiler.cppstd=20
|
||||
compiler.cstd=17
|
||||
compiler.runtime=static
|
||||
build_type=Debug
|
||||
|
||||
[conf]
|
||||
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"]
|
||||
tools.build:cxxflags=["/Zc:preprocessor", "/permissive-", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope", "/Zc:throwingNew"]
|
||||
|
||||
[tool_requires]
|
||||
!cmake/*: cmake/[>=4.2]
|
||||
|
||||
[options]
|
||||
Bin2CPP/*:asan=True
|
||||
Bin2CPP/*:build_tests=True
|
||||
30
conanfile.py
30
conanfile.py
@@ -18,6 +18,8 @@ class Bigfoot(ConanFile):
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"asan": [True, False],
|
||||
"coverage": [True, False],
|
||||
"build_tests": [True, False],
|
||||
"tracy": [True, False],
|
||||
"build_tools": [True, False],
|
||||
@@ -27,6 +29,8 @@ class Bigfoot(ConanFile):
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"asan": False,
|
||||
"coverage": False,
|
||||
"build_tests": False,
|
||||
"tracy": False,
|
||||
"build_tools": True,
|
||||
@@ -43,10 +47,8 @@ class Bigfoot(ConanFile):
|
||||
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
|
||||
if(self.options.asan):
|
||||
self.options["mimalloc"].asan = True
|
||||
|
||||
self.options['stduuid'].with_cxx20_span = True
|
||||
self.options['flatbuffers'].header_only = True
|
||||
@@ -59,15 +61,17 @@ class Bigfoot(ConanFile):
|
||||
|
||||
if(self.options.build_benchmarks):
|
||||
self.options["benchmark"].enable_exceptions = False
|
||||
self.options["benchmark"].enable_lto = True
|
||||
|
||||
def build_requirements(self):
|
||||
self.tool_requires("bin2cpp/1.0.0@bigfootdev/main")
|
||||
|
||||
def requirements(self):
|
||||
self.requires("eastl/3.27.01@bigfootdev/main", transitive_headers=True)
|
||||
self.requires("unordered_dense/4.8.1@bigfootdev/main", transitive_headers=True)
|
||||
self.requires("mimalloc/3.1.5@bigfootdev/main", transitive_headers=True)
|
||||
self.requires("stduuid/1.2.3", transitive_headers=True)
|
||||
self.requires("sqlite3/3.51.0@bigfootdev/main", transitive_headers=True)
|
||||
self.requires("cli11/2.6.0")
|
||||
self.requires("mimalloc/3.2.8@bigfootdev/main", transitive_headers=True)
|
||||
self.requires("stduuid/1.2.3@bigfootdev/main", transitive_headers=True)
|
||||
self.requires("sqlite3/3.51.2@bigfootdev/main", transitive_headers=True)
|
||||
self.requires("cli11/2.6.1@bigfootdev/main")
|
||||
self.requires("rapidhash/3.0@bigfootdev/main", transitive_headers=True)
|
||||
self.requires("effolkronium-random/1.5.0", transitive_headers=True)
|
||||
self.requires("flatbuffers/25.12.19@bigfootdev/main", transitive_headers=True)
|
||||
@@ -77,10 +81,10 @@ class Bigfoot(ConanFile):
|
||||
self.requires("cpptrace/1.0.4", transitive_headers=True)
|
||||
|
||||
if(self.options.tracy):
|
||||
self.requires("tracy/0.12.2", transitive_headers=True)
|
||||
self.requires("tracy/0.13.1", transitive_headers=True)
|
||||
|
||||
self.requires("glm/1.0.1", transitive_headers=True)
|
||||
self.requires("lodepng/cci.20250727@bigfootdev/main", transitive_headers=True)
|
||||
self.requires("lodepng/cci.20260210@bigfootdev/main", transitive_headers=True)
|
||||
self.requires("imgui/1.92.5-docking", transitive_headers=True)
|
||||
|
||||
if(self.options.vulkan):
|
||||
@@ -100,7 +104,7 @@ class Bigfoot(ConanFile):
|
||||
self.requires("spirv-cross/1.4.313.0")
|
||||
self.requires("shaderc/2025.3@bigfootdev/main")
|
||||
self.requires("stb/cci.20240531", override=True)
|
||||
self.requires("assimp/6.0.2")
|
||||
self.requires("assimp/6.0.4@bigfootdev/main")
|
||||
self.requires("meshoptimizer/1.0@bigfootdev/main")
|
||||
self.requires("libsquish/1.15")
|
||||
|
||||
@@ -110,6 +114,8 @@ class Bigfoot(ConanFile):
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
|
||||
tc.variables["ASAN"] = self.options.asan
|
||||
tc.variables["COVERAGE"] = self.options.coverage
|
||||
tc.variables["BUILD_TESTS"] = self.options.build_tests
|
||||
tc.variables["TRACY"] = self.options.tracy
|
||||
tc.variables["BUILD_TOOLS"] = self.options.build_tools
|
||||
|
||||
@@ -22,12 +22,9 @@ if "%~1"=="force" (
|
||||
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 -pr:h=msvc -pr:b=msvc %build_option% -of build -s build_type=Release -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=msvcd -pr:b=msvcd %build_option% -of build -s build_type=RelWithDebInfo -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=msvcd -pr:b=msvcd %build_option% -of build -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/msvc -pr:b=./ConanProfiles/msvc %build_option% -of build -s build_type=Release -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/msvcd -pr:b=./ConanProfiles/msvcd %build_option% -of build -s build_type=RelWithDebInfo -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/msvcd -pr:b=./ConanProfiles/msvcd %build_option% -of build -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
|
||||
endlocal
|
||||
|
||||
@@ -9,18 +9,15 @@ 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 -pr:h=clang -pr:b=clang --build='*' -of build -s build_type=Release -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=clangd -pr:b=clangd --build='*' -of build -s build_type=RelWithDebInfo -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=clangd -pr:b=clangd --build='*' -of build -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/clang --build='*' -of build -s build_type=Release -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build='*' -of build -s build_type=RelWithDebInfo -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build='*' -of build -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
elif [ "$1" == "missing" ]; then
|
||||
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=clang -pr:b=clang --build=missing -of build -s build_type=Release -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=clangd -pr:b=clangd --build=missing -of build -s build_type=RelWithDebInfo -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --deployer=full_deploy --remote=bigfootpackages -pr:h=clangd -pr:b=clangd --build=missing -of build -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/clang --build=missing -of build -s build_type=Release -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build=missing -of build -s build_type=RelWithDebInfo -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build=missing -of build -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -o bigfoot/*:build_benchmarks=True
|
||||
else
|
||||
echo "Invalid argument: $1"
|
||||
echo "Usage: $0 [force|missing]"
|
||||
|
||||
14
sonar-project.properties
Normal file
14
sonar-project.properties
Normal file
@@ -0,0 +1,14 @@
|
||||
sonar.projectKey=Bigfoot
|
||||
|
||||
sonar.projectVersion=0.1.0
|
||||
|
||||
sonar.sourceEncoding=UTF-8
|
||||
|
||||
sonar.sources=Bigfoot/Sources
|
||||
sonar.tests=Bigfoot/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
|
||||
Reference in New Issue
Block a user