Skip to content

Commit

Permalink
feat: ProjectCore -> StreamFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
0-Sacha committed Sep 16, 2024
1 parent 8db40ed commit dedbaec
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Default Windows",
"includePath": [
"src/",
"bazel-littleecs/external/_main~_repo_rules~ProjectCore/src/"
"bazel-littleecs/external/_main~_repo_rules~StreamFormat/src/"
],
"cStandard": "c17",
"cppStandard": "c++20",
Expand Down
8 changes: 4 additions & 4 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ cc_test(
name = "LittleECSTests",
srcs = glob([ "Tests/**/*.h", "Tests/**/*.cpp" ], exclude=["Tests/Perf/**"]),
includes = [ "src/" ],
defines = [ "LECS_USE_PROJECTCORE" ],
defines = [ "LECS_USE_STREAMFORMAT" ],
copts = select({
"@rules_cc//cc/compiler:msvc-cl": ["/std:c++20"],
"//conditions:default": ["-std=c++20"],
}),
deps = [ "@ProjectCore//:ProjectCore", ":LittleECS" ],
deps = [ "@StreamFormat//:StreamFormat", ":LittleECS" ],
visibility = ["//visibility:public"],
)

cc_test(
name = "LittleECSTestsPerf",
srcs = glob([ "Tests/**/*.h", "Tests/**/*.cpp" ]),
includes = [ "src/" ],
defines = [ "LECS_USE_PROJECTCORE" ],
defines = [ "LECS_USE_STREAMFORMAT" ],
copts = select({
"@rules_cc//cc/compiler:msvc-cl": ["/std:c++20"],
"//conditions:default": ["-std=c++20"],
}),
deps = [ "@ProjectCore//:ProjectCore", ":LittleECS" ],
deps = [ "@StreamFormat//:StreamFormat", ":LittleECS" ],
visibility = ["//visibility:public"],
)
6 changes: 3 additions & 3 deletions Examples/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ local_path_override(

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "ProjectCore",
urls = [ "https://github.com/0-Sacha/ProjectCore/archive/refs/heads/dev.zip" ],
strip_prefix = "ProjectCore-dev"
name = "StreamFormat",
urls = [ "https://github.com/0-Sacha/StreamFormat/archive/refs/heads/dev.zip" ],
strip_prefix = "StreamFormat-dev"
)
2 changes: 1 addition & 1 deletion Examples/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Example of ProjectCore
# Example of StreamFormat

### Try thoses examples !

Expand Down
4 changes: 2 additions & 2 deletions Examples/Workflow/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ load("@rules_cc//cc:defs.bzl", "cc_binary")
cc_binary(
name = "Workflow",
srcs = glob([ "*.h", "*.cpp" ]),
defines = [ "LECS_USE_PROJECTCORE" ],
defines = [ "LECS_USE_STREAMFORMAT" ],
copts = select({
"@rules_cc//cc/compiler:msvc-cl": ["/std:c++20"],
"//conditions:default": ["-std=c++20"],
}),
deps = [ "@ProjectCore//:ProjectCore", "@littleecs//:LittleECS" ],
deps = [ "@StreamFormat//:StreamFormat", "@littleecs//:LittleECS" ],
visibility = ["//visibility:public"],
)
6 changes: 3 additions & 3 deletions Examples/Workflow/main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "LittleECS/LittleECS.h"

#include "ProjectCore/FLog.h"
#include "StreamFormat/FLog.h"

ProjectCore::FLog::BasicLogger Logger("Workflow");
StreamFormat::FLog::BasicLogger Logger("Workflow");

/****** Components ******/
struct ASmallComponent
Expand All @@ -20,7 +20,7 @@ struct Name
std::string Name;
};
// To be able to Format the struct Name
PROJECTCORE_AUTO_FORMATTER(Name, "{}", value.Name);
STREAMFORMAT_AUTO_FORMATTER(Name, "{}", value.Name);

int main()
{
Expand Down
7 changes: 3 additions & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ bazel_dep(name = "rules_cc", version = "0.0.9")

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "ProjectCore",
urls = [ "https://github.com/0-Sacha/ProjectCore/archive/refs/heads/dev.zip" ],
strip_prefix = "ProjectCore-dev",
integrity = "sha256-28v/wuBCDSekQV03i9/2Tn+AR9hllqPdCOMYOvHBwmI=",
name = "StreamFormat",
urls = [ "https://github.com/0-Sacha/StreamFormat/archive/refs/heads/dev.zip" ],
strip_prefix = "StreamFormat-dev",
)
2 changes: 1 addition & 1 deletion Tests/BaseLittleECSTest.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once

#include "ProjectCore/Tester/TestSuite/AllTestSuite.h"
#include "StreamFormat/Tester/TestSuite/AllTestSuite.h"

inline PCT_TEST_SUITE(LITTLE_ECS);
2 changes: 1 addition & 1 deletion Tests/BasicWorkflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "LittleECS/LittleECS.h"

#include "ProjectCore/ProfilerManager.h"
#include "StreamFormat/ProfilerManager.h"

#include <set>

Expand Down
18 changes: 9 additions & 9 deletions Tests/Perf/PerformanceTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "LittleECS/LittleECS.h"

#include "ProjectCore/ProfilerManager.h"
#include "StreamFormat/ProfilerManager.h"

#include <set>

Expand Down Expand Up @@ -35,15 +35,15 @@ struct LECS::Detail::ComponentStorageInfo<BasicIntComponent> : public DefaultCom

#define BenchmarkTest(Size, Name) PCT_TEST_FUNC(PERFORMANCE, ADD_MANY_COMPONENT_ ## Name) \
{ \
ProjectCore::ProfilerManager::Profiler profiler("ADD_MANY_COMPONENT_" #Name); \
StreamFormat::ProfilerManager::Profiler profiler("ADD_MANY_COMPONENT_" #Name); \
\
LECS::Registry registry; \
\
std::vector<LECS::EntityId> entities; \
entities.reserve(Size); \
\
{ \
ProjectCore::ProfilerManager::ScopeProfile scope(profiler, "Create Entities"); \
StreamFormat::ProfilerManager::ScopeProfile scope(profiler, "Create Entities"); \
\
for (std::size_t i = 0; i < Size; ++i) \
{ \
Expand All @@ -52,7 +52,7 @@ struct LECS::Detail::ComponentStorageInfo<BasicIntComponent> : public DefaultCom
} \
\
{ \
ProjectCore::ProfilerManager::ScopeProfile scope(profiler, "Check Entities Ids"); \
StreamFormat::ProfilerManager::ScopeProfile scope(profiler, "Check Entities Ids"); \
\
bool uid = true; \
\
Expand Down Expand Up @@ -91,7 +91,7 @@ struct LECS::Detail::ComponentStorageInfo<BasicIntComponent> : public DefaultCom
} \
\
{ \
ProjectCore::ProfilerManager::ScopeProfile scope(profiler, "Add Component"); \
StreamFormat::ProfilerManager::ScopeProfile scope(profiler, "Add Component"); \
\
for (std::size_t i = 0; i < Size; ++i) \
{ \
Expand All @@ -100,7 +100,7 @@ struct LECS::Detail::ComponentStorageInfo<BasicIntComponent> : public DefaultCom
} \
\
{ \
ProjectCore::ProfilerManager::ScopeProfile scope(profiler, "Get Component"); \
StreamFormat::ProfilerManager::ScopeProfile scope(profiler, "Get Component"); \
\
for (std::size_t i = 0; i < Size; ++i) \
{ \
Expand All @@ -109,7 +109,7 @@ struct LECS::Detail::ComponentStorageInfo<BasicIntComponent> : public DefaultCom
} \
\
{ \
ProjectCore::ProfilerManager::ScopeProfile scope(profiler, "Has Component"); \
StreamFormat::ProfilerManager::ScopeProfile scope(profiler, "Has Component"); \
\
for (std::size_t i = 0; i < Size; ++i) \
{ \
Expand All @@ -119,15 +119,15 @@ struct LECS::Detail::ComponentStorageInfo<BasicIntComponent> : public DefaultCom
} \
\
{ \
ProjectCore::ProfilerManager::ScopeProfile scope(profiler, "ForEach Component"); \
StreamFormat::ProfilerManager::ScopeProfile scope(profiler, "ForEach Component"); \
\
registry.ForEachUniqueComponent<BasicIntComponent>([](LECS::EntityId, BasicIntComponent& k) \
{ \
k = 5ull; \
}); \
} \
\
ProjectCore::ProfilerManager::ProfilerFactory::ToJson(profiler); \
StreamFormat::ProfilerManager::ProfilerFactory::ToJson(profiler); \
}

BenchmarkTest(1'000, 1K);
Expand Down
6 changes: 3 additions & 3 deletions Tests/Tests.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

#include "ProjectCore/Tester/TestSuite/AllTestSuite.h"
#include "StreamFormat/Tester/TestSuite/AllTestSuite.h"

int main()
{
ProjectCore::Tester::TestSuitesManager::Verbose = false;
return ProjectCore::Tester::TestSuitesManager::ExecAllTestSuites();
StreamFormat::Tester::TestSuitesManager::Verbose = false;
return StreamFormat::Tester::TestSuitesManager::ExecAllTestSuites();
}
4 changes: 2 additions & 2 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ Solution.Projects["LittleECS"].Defines = {
"LECS_ENABLE_EACH"
}
Solution.Projects["LittleECS"].ProjectDependencies = {
"ProjectCore"
"StreamFormat"
}

project "LittleECS"
kind (Solution.Projects["ProjectCore"].Type)
kind (Solution.Projects["StreamFormat"].Type)
language "C++"
cppdialect "C++20"

Expand Down
4 changes: 2 additions & 2 deletions src/LittleECS/Core/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#define LECS_LOGGER_ENABLE
#endif

#ifdef LECS_USE_PROJECTCORE
#include "UseProjectCore.h"
#ifdef LECS_USE_STREAMFORMAT
#include "UseStreamFormat.h"
#endif

#ifdef LECS_LOGGER_ENABLE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#pragma once

#include "ProjectCore/FMT.h"
#include "StreamFormat/FMT.h"

#ifdef LECS_LOGGER_ENABLE
#include "ProjectCore/FLog.h"
#include "StreamFormat/FLog.h"

namespace LECS
{
class Core
{
public:
static ProjectCore::FLog::BasicLogger& Logger() { return m_Logger; }
static StreamFormat::FLog::BasicLogger& Logger() { return m_Logger; }
private:
static inline ProjectCore::FLog::BasicLogger m_Logger{};
static inline StreamFormat::FLog::BasicLogger m_Logger{};
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/LittleECS/Detail/ComponentId.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace LECS
}
}

namespace ProjectCore::FMT
namespace StreamFormat::FMT
{
template<typename FormatterContext>
struct FormatterType<LECS::ComponentId, FormatterContext> {
Expand Down
4 changes: 2 additions & 2 deletions src/LittleECS/Detail/EntityId.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ namespace LECS
}
}

#ifdef PROJECTCORE_FORMATTER_DECLARED
namespace ProjectCore::FMT
#ifdef STREAMFORMAT_FORMATTER_DECLARED
namespace StreamFormat::FMT
{
template<typename FormatterContext>
struct FormatterType<LECS::EntityId, FormatterContext> {
Expand Down

0 comments on commit dedbaec

Please sign in to comment.