AssetLibrary
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Clang Format Checks (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test RelWithDebInfo with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang (Unity Build: ON) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: OFF) (push) Has been cancelled
Bigfoot / Build & Test Release with ./ConanProfiles/clang_asan (Unity Build: ON) (push) Has been cancelled
Bigfoot / Clang Format Checks (push) Has been cancelled
Bigfoot / Build & Test Debug with ./ConanProfiles/clang (Unity Build: OFF) (push) Has been cancelled
This commit is contained in:
@@ -7,9 +7,12 @@
|
||||
#ifndef BIGFOOT_ENGINE_ASSET_ASSETHELPER_HPP
|
||||
#define BIGFOOT_ENGINE_ASSET_ASSETHELPER_HPP
|
||||
#include <Engine/Asset/AssetContainer.hpp>
|
||||
#include <Engine/Asset/AssetLibrary.hpp>
|
||||
#include <Engine/Asset/Reference.hpp>
|
||||
#include <Engine/Asset/Reference_generated.hpp>
|
||||
|
||||
#include <Utils/Concat.h>
|
||||
|
||||
#define ASSET_SOFT_REF_DECL(AssetName, AssetType) \
|
||||
namespace flatbuffers \
|
||||
{ \
|
||||
@@ -28,8 +31,6 @@
|
||||
ASSET_SOFT_REF_DECL(AssetName, AssetType) \
|
||||
ASSET_HARD_REF_DECL(AssetName, AssetType)
|
||||
|
||||
#define ASSET_DECL(AssetName, AssetType) ASSET_REF_DECL(AssetName, AssetType)
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
#define ASSET_SOFT_REF_IMPL(AssetName, AssetType) \
|
||||
@@ -62,5 +63,13 @@
|
||||
ASSET_SOFT_REF_IMPL(AssetName, AssetType) \
|
||||
ASSET_HARD_REF_IMPL(AssetName, AssetType)
|
||||
|
||||
#define ASSET_IMPL(AssetName, AssetType) ASSET_REF_IMPL(AssetName, AssetType)
|
||||
/****************************************************************************************/
|
||||
|
||||
#define ASSET_CONTAINER(AssetType) \
|
||||
namespace Bigfoot \
|
||||
{ \
|
||||
AssetContainer<AssetType> MAKE_UNIQUE_VARIABLE_NAME(AssetType##Container); \
|
||||
const bool MAKE_UNIQUE_VARIABLE_NAME(inserted) = \
|
||||
g_assetLibrary.Insert(&MAKE_UNIQUE_VARIABLE_NAME(AssetType##Container)); \
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/*********************************************************************
|
||||
* \file AssetLibrary.hpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date July 2026
|
||||
*********************************************************************/
|
||||
#ifndef BIGFOOT_ENGINE_ASSET_ASSETLIBRARY_HPP
|
||||
#define BIGFOOT_ENGINE_ASSET_ASSETLIBRARY_HPP
|
||||
#include <Engine/Asset/AssetContainer.hpp>
|
||||
#include <Engine/Asset/AssetTypeID.hpp>
|
||||
|
||||
#include <EASTL/any.h>
|
||||
#include <ankerl/unordered_dense.h>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
class AssetLibrary
|
||||
{
|
||||
public:
|
||||
AssetLibrary() = default;
|
||||
|
||||
AssetLibrary(const AssetLibrary& p_library) = default;
|
||||
AssetLibrary(AssetLibrary&& p_library) = default;
|
||||
|
||||
~AssetLibrary() = default;
|
||||
|
||||
template<class ASSET>
|
||||
[[nodiscard]]
|
||||
bool Insert(AssetContainer<ASSET>* p_assetContainer)
|
||||
{
|
||||
static const AssetTypeID typeID = ASSET::GetTypeID();
|
||||
if (m_assetContainers.contains(typeID))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto inserted = m_assetContainers.emplace(typeID, p_assetContainer);
|
||||
|
||||
return inserted.second;
|
||||
}
|
||||
|
||||
template<class ASSET>
|
||||
[[nodiscard]]
|
||||
AssetContainer<ASSET>* Get()
|
||||
{
|
||||
static const AssetTypeID typeID = ASSET::GetTypeID();
|
||||
if (const auto container = m_assetContainers.find(typeID); container != m_assetContainers.end())
|
||||
{
|
||||
return eastl::any_cast<AssetContainer<ASSET>*>(container->second);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template<class ASSET>
|
||||
[[nodiscard]]
|
||||
const AssetContainer<ASSET>* Get() const
|
||||
{
|
||||
static const AssetTypeID typeID = ASSET::GetTypeID();
|
||||
if (const auto container = m_assetContainers.find(typeID); container != m_assetContainers.end())
|
||||
{
|
||||
return eastl::any_cast<const AssetContainer<ASSET>*>(container->second);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AssetLibrary& operator=(const AssetLibrary& p_library) = default;
|
||||
AssetLibrary& operator=(AssetLibrary&& p_library) = default;
|
||||
|
||||
private:
|
||||
std::unordered_map<AssetTypeID, eastl::any> m_assetContainers;
|
||||
};
|
||||
|
||||
inline AssetLibrary g_assetLibrary;
|
||||
} // namespace Bigfoot
|
||||
|
||||
#endif
|
||||
@@ -1,3 +1,5 @@
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Misc)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Utils)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/System)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Engine)
|
||||
@@ -6,10 +6,9 @@
|
||||
*********************************************************************/
|
||||
#include <Engine/Asset/Asset.hpp>
|
||||
|
||||
#include <EngineTests/Asset/AssetA.hpp>
|
||||
#include <EngineTests/Asset/AssetB.hpp>
|
||||
#include <EngineTests/Asset/AssetC.hpp>
|
||||
|
||||
#include <AssetsForTesting/Asset/AssetA.hpp>
|
||||
#include <AssetsForTesting/Asset/AssetB.hpp>
|
||||
#include <AssetsForTesting/Asset/AssetC.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace Bigfoot
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
/*********************************************************************
|
||||
* \file BigFile.cpp
|
||||
* \file AssetContainer.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date December 2025
|
||||
*********************************************************************/
|
||||
#include <Engine/Asset/AssetContainer.hpp>
|
||||
|
||||
#include <EngineTests/Asset/AssetA.hpp>
|
||||
|
||||
#include <AssetsForTesting/Asset/AssetA.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace Bigfoot
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*********************************************************************
|
||||
* \file AssetLibrary.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date July 2026
|
||||
*********************************************************************/
|
||||
#include <Engine/Asset/AssetLibrary.hpp>
|
||||
|
||||
#include <AssetsForTesting/Asset/AssetA.hpp>
|
||||
#include <AssetsForTesting/Asset/AssetB.hpp>
|
||||
#include <AssetsForTesting/Asset/AssetC.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
class AssetLibraryFixture: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
void SetUp() override
|
||||
{
|
||||
std::ignore = m_library.Insert(&m_containerA);
|
||||
std::ignore = m_library.Insert(&m_containerB);
|
||||
}
|
||||
|
||||
AssetContainer<AssetA> m_containerA;
|
||||
AssetContainer<AssetB> m_containerB;
|
||||
|
||||
AssetLibrary m_library;
|
||||
};
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(AssetLibraryFixture, Insert_ShouldReturnTrueIfTheContainerHasBeenInserted)
|
||||
{
|
||||
AssetContainer<AssetC> containerC;
|
||||
EXPECT_TRUE(m_library.Insert(&containerC));
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(AssetLibraryFixture, Insert_ShouldReturnFalseIfTheContainerHasNotBeenInserted)
|
||||
{
|
||||
EXPECT_FALSE(m_library.Insert(&m_containerA)); // Duplicate
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(AssetLibraryFixture, Get_ShouldReturnTheContainersIfTheyAreInTheLibrary)
|
||||
{
|
||||
const AssetContainer<AssetA>* containerA = m_library.Get<AssetA>();
|
||||
const AssetContainer<AssetB>* containerB = m_library.Get<AssetB>();
|
||||
|
||||
EXPECT_EQ(&m_containerA, containerA);
|
||||
EXPECT_EQ(&m_containerB, containerB);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(AssetLibraryFixture, Get_ShouldReturnNullptrIfTheContainersAreNotInTheLibrary)
|
||||
{
|
||||
const AssetContainer<AssetC>* containerC = m_library.Get<AssetC>();
|
||||
|
||||
EXPECT_EQ(nullptr, containerC);
|
||||
}
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
TEST_F(AssetLibraryFixture, GlobalAssetLibraryShouldHaveAssetsRegistered)
|
||||
{
|
||||
EXPECT_NE(g_assetLibrary.Get<AssetA>(), nullptr);
|
||||
EXPECT_NE(g_assetLibrary.Get<AssetB>(), nullptr);
|
||||
EXPECT_NE(g_assetLibrary.Get<AssetC>(), nullptr);
|
||||
}
|
||||
} // namespace Bigfoot
|
||||
@@ -1,7 +1,13 @@
|
||||
get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
project(${PackageName}Tests)
|
||||
|
||||
set(Dependencies)
|
||||
set(BigfootDependencies
|
||||
AssetsForTesting)
|
||||
|
||||
bigfoot_create_package_tests(
|
||||
"${Dependencies}"
|
||||
"${BigfootDependencies}"
|
||||
"")
|
||||
|
||||
bigfoot_create_bigfile("Tests/Bigfoot")
|
||||
@@ -0,0 +1,11 @@
|
||||
/*********************************************************************
|
||||
* \file AssetA.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date July 2026
|
||||
*********************************************************************/
|
||||
#include <AssetsForTesting/Asset/AssetA.hpp>
|
||||
|
||||
#include <Engine/Asset/AssetHelper.hpp>
|
||||
|
||||
ASSET_CONTAINER(AssetA)
|
||||
+1
-1
@@ -4,6 +4,6 @@
|
||||
* \author Romain BOULLARD
|
||||
* \date May 2026
|
||||
*********************************************************************/
|
||||
#include <EngineTests/Asset/AssetA_fwd.hpp>
|
||||
#include <AssetsForTesting/Asset/AssetA_fwd.hpp>
|
||||
|
||||
ASSET_REF_IMPL(AssetA, ::Bigfoot::AssetA)
|
||||
@@ -0,0 +1,11 @@
|
||||
/*********************************************************************
|
||||
* \file AssetB.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date July 2026
|
||||
*********************************************************************/
|
||||
#include <AssetsForTesting/Asset/AssetB.hpp>
|
||||
|
||||
#include <Engine/Asset/AssetHelper.hpp>
|
||||
|
||||
ASSET_CONTAINER(AssetB)
|
||||
+1
-1
@@ -4,6 +4,6 @@
|
||||
* \author Romain BOULLARD
|
||||
* \date May 2026
|
||||
*********************************************************************/
|
||||
#include <EngineTests/Asset/AssetB_fwd.hpp>
|
||||
#include <AssetsForTesting/Asset/AssetB_fwd.hpp>
|
||||
|
||||
ASSET_REF_IMPL(AssetB, ::Bigfoot::AssetB)
|
||||
@@ -0,0 +1,11 @@
|
||||
/*********************************************************************
|
||||
* \file AssetC.cpp
|
||||
*
|
||||
* \author Romain BOULLARD
|
||||
* \date July 2026
|
||||
*********************************************************************/
|
||||
#include <AssetsForTesting/Asset/AssetC.hpp>
|
||||
|
||||
#include <Engine/Asset/AssetHelper.hpp>
|
||||
|
||||
ASSET_CONTAINER(AssetC)
|
||||
+1
-1
@@ -4,6 +4,6 @@
|
||||
* \author Romain BOULLARD
|
||||
* \date May 2026
|
||||
*********************************************************************/
|
||||
#include <EngineTests/Asset/AssetC_fwd.hpp>
|
||||
#include <AssetsForTesting/Asset/AssetC_fwd.hpp>
|
||||
|
||||
ASSET_REF_IMPL(AssetC, ::Bigfoot::AssetC)
|
||||
@@ -0,0 +1,15 @@
|
||||
get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
project(${PackageName})
|
||||
|
||||
set(PublicDependencies)
|
||||
set(PrivateDependencies)
|
||||
set(BigfootPublicDependencies)
|
||||
set(BigfootPrivateDependencies
|
||||
Engine)
|
||||
|
||||
bigfoot_create_package_tests_helper_lib(
|
||||
"${PublicDependencies}"
|
||||
"${PrivateDependencies}"
|
||||
"${BigfootPublicDependencies}"
|
||||
"${BigfootPrivateDependencies}"
|
||||
"")
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
include "Engine/Asset/Reference.fbs";
|
||||
|
||||
native_include "EngineTests/Asset/AssetA_fwd.hpp";
|
||||
native_include "AssetsForTesting/Asset/AssetA_fwd.hpp";
|
||||
|
||||
namespace Flat.Bigfoot;
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
#define BIGFOOT_ENGINETESTS_ASSET_ASSETA_HPP
|
||||
#include <Engine/Asset/Asset.hpp>
|
||||
|
||||
#include <EngineTests/Asset/AssetA_generated.hpp>
|
||||
#include <AssetsForTesting/Asset/AssetA_generated.hpp>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
+1
-1
@@ -13,6 +13,6 @@ namespace Bigfoot
|
||||
class AssetA;
|
||||
} // namespace Bigfoot
|
||||
|
||||
ASSET_DECL(AssetA, ::Bigfoot::AssetA)
|
||||
ASSET_REF_DECL(AssetA, ::Bigfoot::AssetA)
|
||||
|
||||
#endif
|
||||
+1
-1
@@ -16,7 +16,7 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
#include "Engine/Asset/Reference.hpp"
|
||||
#include "System/UUID/UUID.hpp"
|
||||
#include "Engine/Asset/Reference.hpp"
|
||||
#include "EngineTests/Asset/AssetA_fwd.hpp"
|
||||
#include "AssetsForTesting/Asset/AssetA_fwd.hpp"
|
||||
#include "Engine/Asset/Reference_generated.hpp"
|
||||
|
||||
#include "EASTL/unique_ptr.h"
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
include "Engine/Asset/Reference.fbs";
|
||||
|
||||
include "EngineTests/Asset/AssetA.fbs";
|
||||
include "AssetsForTesting/Asset/AssetA.fbs";
|
||||
|
||||
native_include "EngineTests/Asset/AssetB_fwd.hpp";
|
||||
native_include "AssetsForTesting/Asset/AssetB_fwd.hpp";
|
||||
|
||||
namespace Flat.Bigfoot;
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
#define BIGFOOT_ENGINETESTS_ASSET_ASSETB_HPP
|
||||
#include <Engine/Asset/Asset.hpp>
|
||||
|
||||
#include <EngineTests/Asset/AssetB_generated.hpp>
|
||||
#include <AssetsForTesting/Asset/AssetB_generated.hpp>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
+1
-1
@@ -13,6 +13,6 @@ namespace Bigfoot
|
||||
class AssetB;
|
||||
} // namespace Bigfoot
|
||||
|
||||
ASSET_DECL(AssetB, ::Bigfoot::AssetB)
|
||||
ASSET_REF_DECL(AssetB, ::Bigfoot::AssetB)
|
||||
|
||||
#endif
|
||||
+3
-3
@@ -16,10 +16,10 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
#include "Engine/Asset/Reference.hpp"
|
||||
#include "System/UUID/UUID.hpp"
|
||||
#include "Engine/Asset/Reference.hpp"
|
||||
#include "EngineTests/Asset/AssetA_fwd.hpp"
|
||||
#include "EngineTests/Asset/AssetB_fwd.hpp"
|
||||
#include "AssetsForTesting/Asset/AssetA_fwd.hpp"
|
||||
#include "AssetsForTesting/Asset/AssetB_fwd.hpp"
|
||||
#include "Engine/Asset/Reference_generated.hpp"
|
||||
#include "EngineTests/Asset/AssetA_generated.hpp"
|
||||
#include "AssetsForTesting/Asset/AssetA_generated.hpp"
|
||||
|
||||
#include "EASTL/unique_ptr.h"
|
||||
#include "EASTL/string.h"
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
include "Engine/Asset/Reference.fbs";
|
||||
|
||||
include "EngineTests/Asset/AssetA.fbs";
|
||||
include "EngineTests/Asset/AssetB.fbs";
|
||||
include "AssetsForTesting/Asset/AssetA.fbs";
|
||||
include "AssetsForTesting/Asset/AssetB.fbs";
|
||||
|
||||
native_include "EngineTests/Asset/AssetC_fwd.hpp";
|
||||
native_include "AssetsForTesting/Asset/AssetC_fwd.hpp";
|
||||
|
||||
namespace Flat.Bigfoot;
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@
|
||||
#define BIGFOOT_ENGINETESTS_ASSET_ASSETC_HPP
|
||||
#include <Engine/Asset/Asset.hpp>
|
||||
|
||||
#include <EngineTests/Asset/AssetC_generated.hpp>
|
||||
#include <AssetsForTesting/Asset/AssetC_generated.hpp>
|
||||
|
||||
namespace Bigfoot
|
||||
{
|
||||
+1
-1
@@ -13,6 +13,6 @@ namespace Bigfoot
|
||||
class AssetC;
|
||||
} // namespace Bigfoot
|
||||
|
||||
ASSET_DECL(AssetC, ::Bigfoot::AssetC)
|
||||
ASSET_REF_DECL(AssetC, ::Bigfoot::AssetC)
|
||||
|
||||
#endif
|
||||
+5
-5
@@ -16,12 +16,12 @@ static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
|
||||
#include "Engine/Asset/Reference.hpp"
|
||||
#include "System/UUID/UUID.hpp"
|
||||
#include "Engine/Asset/Reference.hpp"
|
||||
#include "EngineTests/Asset/AssetA_fwd.hpp"
|
||||
#include "EngineTests/Asset/AssetB_fwd.hpp"
|
||||
#include "EngineTests/Asset/AssetC_fwd.hpp"
|
||||
#include "AssetsForTesting/Asset/AssetA_fwd.hpp"
|
||||
#include "AssetsForTesting/Asset/AssetB_fwd.hpp"
|
||||
#include "AssetsForTesting/Asset/AssetC_fwd.hpp"
|
||||
#include "Engine/Asset/Reference_generated.hpp"
|
||||
#include "EngineTests/Asset/AssetA_generated.hpp"
|
||||
#include "EngineTests/Asset/AssetB_generated.hpp"
|
||||
#include "AssetsForTesting/Asset/AssetA_generated.hpp"
|
||||
#include "AssetsForTesting/Asset/AssetB_generated.hpp"
|
||||
|
||||
#include "EASTL/unique_ptr.h"
|
||||
#include "EASTL/string.h"
|
||||
@@ -0,0 +1 @@
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/AssetsForTesting)
|
||||
@@ -1,5 +1,10 @@
|
||||
get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
project(${PackageName}Tests)
|
||||
|
||||
set(Dependencies)
|
||||
set(BigfootDependencies)
|
||||
|
||||
bigfoot_create_package_tests(
|
||||
"${Dependencies}"
|
||||
"${BigfootDependencies}"
|
||||
"")
|
||||
@@ -1,7 +1,12 @@
|
||||
get_filename_component(PackageName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
project(${PackageName}Tests)
|
||||
|
||||
set(Dependencies)
|
||||
set(BigfootDependencies)
|
||||
|
||||
bigfoot_create_package_tests(
|
||||
"${Dependencies}"
|
||||
"${BigfootDependencies}"
|
||||
"")
|
||||
|
||||
bigfoot_create_logger()
|
||||
+56
-1
@@ -51,7 +51,7 @@ function(bigfoot_create_package_lib PackagePublicDependencies PackagePrivateDepe
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Bigfoot/${ParentFolder})
|
||||
endfunction()
|
||||
|
||||
function(bigfoot_create_package_tests ParentFolder)
|
||||
function(bigfoot_create_package_tests PackageDependencies PackageBigfootDependencies ParentFolder)
|
||||
add_executable(${PROJECT_NAME})
|
||||
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
|
||||
@@ -59,7 +59,9 @@ function(bigfoot_create_package_tests ParentFolder)
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
BigfootCompileAndLinkFlags
|
||||
${PackageDependencies}
|
||||
$<LINK_LIBRARY:WHOLE_ARCHIVE,${PackageName}>
|
||||
$<LINK_LIBRARY:WHOLE_ARCHIVE,${PackageBigfootDependencies}>
|
||||
gtest::gtest)
|
||||
|
||||
bigfoot_compile_flatbuffers()
|
||||
@@ -153,6 +155,59 @@ function(bigfoot_create_package_tests ParentFolder)
|
||||
set_target_properties(${PROJECT_NAME}Fixture PROPERTIES FOLDER UtilityTargets/Tests/Bigfoot/${ParentFolder})
|
||||
endfunction()
|
||||
|
||||
function(bigfoot_create_package_tests_helper_lib PackagePublicDependencies PackagePrivateDependencies PackageBigfootPublicDependencies PackageBigfootPrivateDependencies ParentFolder)
|
||||
add_library(${PROJECT_NAME} STATIC)
|
||||
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
BigfootCompileAndLinkFlags
|
||||
PUBLIC
|
||||
${PackagePublicDependencies}
|
||||
$<LINK_LIBRARY:WHOLE_ARCHIVE,${PackageBigfootPublicDependencies}>
|
||||
|
||||
PRIVATE
|
||||
${PackagePrivateDependencies}
|
||||
$<LINK_LIBRARY:WHOLE_ARCHIVE,${PackageBigfootPrivateDependencies}>)
|
||||
|
||||
bigfoot_compile_flatbuffers()
|
||||
|
||||
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
|
||||
${_SOURCES}
|
||||
${_OTHERS}
|
||||
PUBLIC
|
||||
FILE_SET HEADERS
|
||||
BASE_DIRS
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Include
|
||||
FILES
|
||||
${_HEADERS}
|
||||
)
|
||||
|
||||
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX Src FILES ${_SOURCES} ${_HEADERS} ${_OTHERS})
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Tests/Bigfoot/${ParentFolder})
|
||||
endfunction()
|
||||
|
||||
function(bigfoot_create_package_benchmarks ParentFolder)
|
||||
add_executable(${PROJECT_NAME})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user