This commit is contained in:
ouczbs 2024-08-03 09:44:59 +08:00
parent d71b9a90a0
commit 9be3ad6bac
13 changed files with 29 additions and 42 deletions

View File

@ -1,5 +1,7 @@
#pragma once
#include "zlib.h"
#include "core.h"
ENGINE_API const char* engine();
ENGINE_API extern Module engine_module;
ENGINE_API extern Module engine_module_hello;
ENGINE_API extern Module engine_module_hello;

View File

@ -2,4 +2,4 @@
#include "zlib.h"
#include "core.h"
const char* asset();
inline Module asset_module{ asset(), false};
//inline Module asset_module{ asset(), false};

View File

@ -1,14 +1,14 @@
#pragma once
#include "zlib.h"
const char* core();
inline Module core_module{ core(), false};
struct ModuleManager;
struct ModuleManagerPtr {
ModuleManager* ptr;
ModuleManagerPtr();
};
CORE_API inline ModuleManagerPtr ms_instance;
inline Module core_module{ "ssss", false};
struct ModuleManager {
ModuleManager();
static ModuleManager* Ptr();
};
};
struct ModuleManagerPtr {
public:
ModuleManager* ptr;
ModuleManagerPtr();
};
inline int s_ptr;

View File

@ -11,8 +11,8 @@ ModuleManager::ModuleManager()
ModuleManager* ModuleManager::Ptr()
{
static ModuleManager module;
auto* ptr = &module;
static ModuleManager manager;
auto* ptr = &manager;
return ptr;
}

View File

@ -6,6 +6,9 @@ struct Detail {
int count = 0;
int new_count = 0;
int del_count = 0;
Detail() {
std::cout << "Detail" << std::endl;
}
};
struct Module;
ZLIB_API inline Detail detail;

View File

@ -43,5 +43,7 @@ namespace zlog {
const std::string format_str = fmt::format(std::forward<Args>(args)...);
throw std::runtime_error(format_str);
};
void flush();
inline void flush() {
zlog.flush();
}
};

View File

@ -32,7 +32,4 @@ namespace zlog {
m_logger->flush();
spdlog::drop_all();
}
void flush(){
zlog.flush();
}
}

View File

@ -1,7 +1,9 @@
#include "api.h"
ENGINE_API Module engine_module{ engine(), true };
ENGINE_API inline Module engine_module_hello{ "engine_module_hello", true };
ENGINE_API Module engine_module_hello{ "engine_module_hello", true };
const char* engine()
{
return "engine";
}

View File

@ -7,8 +7,8 @@ target("engine")
add_includedirs("modules/asset/include", {public = true})
add_includedirs("modules/core/include", {public = true})
add_includedirs("modules/zlib/include", {public = true})
add_deps("asset", "zlib", "core", { inherit = false})
add_rules("engine.api", {inherit = false})
add_deps("asset", "zlib", "core")
add_rules("engine.api")
includes("xmake/xmake.lua")
includes("modules/*/xmake.lua")

View File

@ -36,26 +36,10 @@ function main(target)
target:add("links", dep)
local dir = deptarget:targetdir()
if not linkdirs[dir] then
target:add("linkdirs", dir)
target:add("linkdirs", path.join(os.projectdir(),dir))
linkdirs[dir] = true
end
end
end
end
-- local real_deps = {}
-- local links = {}
-- for _,dep in ipairs(deps) do
-- local deptarget = project.target(dep)
-- if deptarget:kind() == "static" then
-- add_define(target, dep, is_static)
-- --add_packages(target, deptarget)
-- table.insert(links, dep)
-- elseif is_link then
-- table.insert(real_deps, dep)
-- end
-- end
-- if is_link then
-- --target:add("links", links)
-- --target:set("deps", real_deps)
-- end
end

View File

@ -1,6 +1,5 @@
#pragma once
#include "zlib.h"
#include "core.h"
#include "api.h"
VULKAN_API const char* vulkan();
inline Module vulkan_module{vulkan(), true};
VULKAN_API extern Module vulkan_module;

View File

@ -2,7 +2,7 @@
const char* vulkan()
{
auto c1 = engine_module_hello.name.c_str();
auto c2 = zlib_module.name.c_str();
return "vulkan";
}

View File

@ -2,6 +2,4 @@ target("zworld-editor")
set_kind("binary")
set_group("game")
add_files("src/*.cpp")
add_headerfiles("include/*.h")
add_includedirs("include", {public = true})
add_deps("zworld", {public = true})