mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-20 00:02:55 +00:00
move parts to new common component to avoid circular dependency of zonecommon and objcommon
This commit is contained in:
parent
d616738be4
commit
12461d27e7
@ -82,6 +82,7 @@ group ""
|
||||
-- ========================
|
||||
-- Projects
|
||||
-- ========================
|
||||
include "src/Common.lua"
|
||||
include "src/Crypto.lua"
|
||||
include "src/Linker.lua"
|
||||
include "src/Unlinker.lua"
|
||||
@ -99,6 +100,7 @@ include "src/ObjWriting.lua"
|
||||
|
||||
-- Components group: All projects assist or are part of a tool
|
||||
group "Components"
|
||||
Common:project()
|
||||
Crypto:project()
|
||||
Utils:project()
|
||||
ZoneCode:project()
|
||||
|
41
src/Common.lua
Normal file
41
src/Common.lua
Normal file
@ -0,0 +1,41 @@
|
||||
Common = {}
|
||||
|
||||
function Common:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
Utils:include(includes)
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "Common")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
function Common:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(Utils)
|
||||
end
|
||||
|
||||
function Common:use()
|
||||
|
||||
end
|
||||
|
||||
function Common:name()
|
||||
return "Common"
|
||||
end
|
||||
|
||||
function Common:project()
|
||||
local folder = ProjectFolder()
|
||||
local includes = Includes:create()
|
||||
|
||||
project(self:name())
|
||||
targetdir(TargetDirectoryLib)
|
||||
location "%{wks.location}/src/%{prj.name}"
|
||||
kind "StaticLib"
|
||||
language "C++"
|
||||
|
||||
files {
|
||||
path.join(folder, "Common/**.h"),
|
||||
path.join(folder, "Common/**.cpp")
|
||||
}
|
||||
|
||||
self:include(includes)
|
||||
end
|
@ -2,7 +2,7 @@ ObjCommon = {}
|
||||
|
||||
function ObjCommon:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
ZoneCommon:include(includes)
|
||||
Common:include(includes)
|
||||
minizip:include(includes)
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ObjCommon")
|
||||
@ -13,7 +13,7 @@ end
|
||||
function ObjCommon:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(Utils)
|
||||
links:linkto(ZoneCommon)
|
||||
links:linkto(Common)
|
||||
links:linkto(minizip)
|
||||
end
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "ObjContainerReferenceable.h"
|
||||
|
||||
void ObjContainerReferenceable::AddReference(Zone* referencer)
|
||||
void ObjContainerReferenceable::AddReference(void* referencer)
|
||||
{
|
||||
m_references.insert(referencer);
|
||||
}
|
||||
|
||||
bool ObjContainerReferenceable::RemoveReference(Zone* zone)
|
||||
bool ObjContainerReferenceable::RemoveReference(void* referencer)
|
||||
{
|
||||
return m_references.erase(zone) > 0;
|
||||
return m_references.erase(referencer) > 0;
|
||||
}
|
||||
|
||||
bool ObjContainerReferenceable::IsReferenced() const
|
||||
|
@ -1,16 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "IObjContainer.h"
|
||||
#include "Zone/Zone.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
class ObjContainerReferenceable : public IObjContainer
|
||||
{
|
||||
std::set<Zone*> m_references;
|
||||
std::set<void*> m_references;
|
||||
|
||||
public:
|
||||
void AddReference(Zone* referencer);
|
||||
bool RemoveReference(Zone* zone);
|
||||
void AddReference(void* referencer);
|
||||
bool RemoveReference(void* referencer);
|
||||
bool IsReferenced() const;
|
||||
};
|
||||
|
@ -202,7 +202,7 @@ function ZoneCode:project()
|
||||
buildinputs {
|
||||
path.join(ProjectFolder(), "ZoneCode/Game/%{file.basename}/%{file.basename}.h"),
|
||||
path.join(ProjectFolder(), "ZoneCode/Game/%{file.basename}/%{file.basename}_Commands.txt"),
|
||||
path.join(ProjectFolder(), "ZoneCommon/Game/%{file.basename}/%{file.basename}_Assets.h"),
|
||||
path.join(ProjectFolder(), "Common/Game/%{file.basename}/%{file.basename}_Assets.h"),
|
||||
TargetDirectoryBin .. "/" .. ExecutableByOs('ZoneCodeGenerator')
|
||||
}
|
||||
filter {}
|
||||
|
@ -3,6 +3,6 @@
|
||||
// Entry point for IW4 code generation
|
||||
|
||||
#include "../Common.h"
|
||||
#include "../../../ZoneCommon/Game/IW4/IW4_Assets.h"
|
||||
#include "../../../Common/Game/IW4/IW4_Assets.h"
|
||||
|
||||
// EOF
|
@ -3,6 +3,6 @@
|
||||
// Entry point for T6 code generation
|
||||
|
||||
#include "../Common.h"
|
||||
#include "../../../ZoneCommon/Game/T6/T6_Assets.h"
|
||||
#include "../../../Common/Game/T6/T6_Assets.h"
|
||||
|
||||
// EOF
|
@ -2,17 +2,19 @@ ZoneCommon = {}
|
||||
|
||||
function ZoneCommon:include(includes)
|
||||
if includes:handle(self:name()) then
|
||||
Utils:include(includes)
|
||||
ObjCommon:include(includes)
|
||||
includedirs {
|
||||
path.join(ProjectFolder(), "ZoneCommon")
|
||||
}
|
||||
Utils:include(includes)
|
||||
Common:include(includes)
|
||||
ObjCommon:include(includes)
|
||||
end
|
||||
end
|
||||
|
||||
function ZoneCommon:link(links)
|
||||
links:add(self:name())
|
||||
links:linkto(Utils)
|
||||
links:linkto(Common)
|
||||
links:linkto(ObjCommon)
|
||||
end
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "Pool/ZoneAssetPools.h"
|
||||
#include "Pool/AssetPool.h"
|
||||
#include "IW4.h"
|
||||
#include "Game/IW4/IW4.h"
|
||||
|
||||
class GameAssetPoolIW4 final : public ZoneAssetPools
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
#include "Pool/ZoneAssetPools.h"
|
||||
#include "Pool/AssetPool.h"
|
||||
#include "T6.h"
|
||||
#include "Game/T6/T6.h"
|
||||
|
||||
class GameAssetPoolT6 final : public ZoneAssetPools
|
||||
{
|
||||
|
@ -1,14 +1,15 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
#include "ZoneTypes.h"
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "Zone/ZoneTypes.h"
|
||||
#include "Pool/ZoneAssetPools.h"
|
||||
#include "Game/IGame.h"
|
||||
#include "Game/GameLanguage.h"
|
||||
#include "Zone/XBlock.h"
|
||||
#include "ZoneMemory.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class IGame;
|
||||
class ZoneAssetPools;
|
||||
|
@ -11,6 +11,7 @@ end
|
||||
|
||||
function ZoneLoading:link(links)
|
||||
links:add(self:name())
|
||||
links:add("pthread")
|
||||
links:linkto(Crypto)
|
||||
links:linkto(Utils)
|
||||
links:linkto(ZoneCommon)
|
||||
|
@ -1,14 +1,16 @@
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include "Image/ImageFormat.h"
|
||||
|
||||
namespace image::image_format
|
||||
{
|
||||
TEST_CASE("ImageFormat: EnsureAllFormatsArrayIndicesAreIds", "[image]")
|
||||
{
|
||||
REQUIRE(static_cast<unsigned int>(ImageFormatId::MAX) == _countof(ImageFormat::ALL_FORMATS));
|
||||
REQUIRE(static_cast<unsigned int>(ImageFormatId::MAX) == std::extent<decltype(ImageFormat::ALL_FORMATS)>::value);
|
||||
|
||||
for(unsigned i = 0; i < _countof(ImageFormat::ALL_FORMATS); i++)
|
||||
for(unsigned i = 0; i < std::extent<decltype(ImageFormat::ALL_FORMATS)>::value; i++)
|
||||
{
|
||||
REQUIRE(ImageFormat::ALL_FORMATS[i] != nullptr);
|
||||
REQUIRE(i == static_cast<unsigned>(ImageFormat::ALL_FORMATS[i]->GetId()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user