bugfix xmake mono

This commit is contained in:
ouczbs 2024-05-28 22:09:36 +08:00
parent d639159948
commit 008dd45e60
12 changed files with 37 additions and 20 deletions

View File

@ -1,8 +1,13 @@
--includes("*/xmake.lua") --includes("*/xmake.lua")
add_requires("gtest") add_requires("gtest")
add_requires("vulkansdk",{configs = {utils = { --dumpbin /directives glslang.lib
"glslang", "SPIRV", "SPIRV-Tools", "shaderc", "shaderc_shared","shaderc_util", "shaderc_combined", local utils = {
"glslang", "SPIRV", "SPIRV-Tools", "shaderc", "shaderc_shared","shaderc_util", "shaderc_combined",
"spirv-cross-glsl","spirv-cross-cpp", "spirv-cross-core", "spirv-cross-reflect","spirv-cross-util" "spirv-cross-glsl","spirv-cross-cpp", "spirv-cross-core", "spirv-cross-reflect","spirv-cross-util"
}}}) }
for k,v in ipairs(utils) do
utils[k] = v .. "d"
end
add_requires("vulkansdk",{configs = {utils = utils}})
--add_requires("shaderc", "spirv-tools", "glslang", "spirv-cross") --add_requires("shaderc", "spirv-tools", "glslang", "spirv-cross")
add_requires("assimp","freetype","glad","glfw","stb") add_requires("assimp","freetype","glad","glfw","stb")

Binary file not shown.

Binary file not shown.

View File

@ -51,7 +51,11 @@
namespace idk namespace idk
{ {
template<>
inline bool GameObject::HasComponent<AspectRatioFitter>() const
{
return _component_ranges[ComponentID<AspectRatioFitter>].count != 0;
}
void IGE_InspectorWindow::DisplayComponentInner(Handle<Transform> c_transform) void IGE_InspectorWindow::DisplayComponentInner(Handle<Transform> c_transform)
{ {
ImVec2 cursorPos = ImGui::GetCursorPos(); ImVec2 cursorPos = ImGui::GetCursorPos();

View File

@ -14,6 +14,7 @@
#include <opengl/system/OpenGLGraphicsSystem.h> #include <opengl/system/OpenGLGraphicsSystem.h>
#include <opengl/resource/OpenGLMesh.h> #include <opengl/resource/OpenGLMesh.h>
#include <opengl/resource/OpenGLTexture.h> #include <opengl/resource/OpenGLTexture.h>
#include <editor/windows/IGE_IWindow.h>
#include <editor/IDE.h> #include <editor/IDE.h>
#include <file/FileSystem.h> #include <file/FileSystem.h>
#include <debug/LogSystem.h> #include <debug/LogSystem.h>

View File

@ -62,8 +62,9 @@ namespace idk::mono
auto img = mono_assembly_get_image(_assembly); auto img = mono_assembly_get_image(_assembly);
auto klass = mono_class_from_name(img, "idk", "IDK"); auto klass = mono_class_from_name(img, "idk", "IDK");
main = mono_class_get_method_from_name(klass, "Main", 1); main = mono_class_get_method_from_name(klass, "Main", 1);
void* args[] = { 0 }; const char* args[] = { "arg1", "arg2", "arg3" }; // 传递适当的命令行参数
mono_runtime_invoke(main, nullptr, args, nullptr); void* p = &args;
mono_runtime_invoke(main, nullptr, &p, nullptr);
} }
ScanTypes(); ScanTypes();

View File

@ -59,11 +59,12 @@ namespace idk::mono
void ScriptSystem::Init() void ScriptSystem::Init()
{ {
auto exe_dir = string{ Core::GetSystem<FileSystem>().GetExeDir() }; const char* monoPath = getenv("MONO");
mono_set_dirs( assert(monoPath);
(exe_dir + "/mono/lib/").data(), auto& filesys = Core::GetSystem<FileSystem>();
(exe_dir + "/mono/etc/").data() filesys.Mount(monoPath, "/mono");
); mono_set_assemblies_path("mono/lib/mono/4.5");
mono_set_dirs(filesys.GetFullPath("/mono/lib/").data(), filesys.GetFullPath("/mono/etc/").data());
mono_trace_set_print_handler([](const char* string, [[maybe_unused]] mono_bool is_stdout) { mono_trace_set_print_handler([](const char* string, [[maybe_unused]] mono_bool is_stdout) {
LOG_TO(LogPool::MONO, string); LOG_TO(LogPool::MONO, string);
}); });
@ -80,9 +81,10 @@ namespace idk::mono
} }
, nullptr); , nullptr);
if (Core::GetSystem<FileSystem>().ExistsFull(exe_dir + "/engine_data/idk.dll")) string dll = filesys.GetFullPath("/mono/me/idk.dll");
if (Core::GetSystem<FileSystem>().ExistsFull(dll))
{ {
main_environment = std::make_unique<MonoWrapperEnvironment>(exe_dir + "/engine_data/idk.dll"); main_environment = std::make_unique<MonoWrapperEnvironment>(dll);
main_environment->Init(); main_environment->Init();
} }
} }
@ -93,6 +95,8 @@ namespace idk::mono
string{ Core::GetSystem<ProjectManager>().GetProjectDir() } + "/Scripts", string{ Core::GetSystem<ProjectManager>().GetProjectDir() } + "/Scripts",
"/scripts", "/scripts",
true); true);
auto& filesys = Core::GetSystem<FileSystem>();
string file = string{ Core::GetSystem<ProjectManager>().GetProjectDir() } + "/Scripts";
if (&Core::GetSystem<IEditor>()) if (&Core::GetSystem<IEditor>())
CompileGameScripts(); CompileGameScripts();
LoadGameScripts(); LoadGameScripts();

View File

@ -600,7 +600,9 @@ namespace idk::vkn
++curr_state; ++curr_state;
//TODO: Submit the command buffers //TODO: Submit the command buffers
if (curr_state >= _pre_states.size()) {
curr_state = 0;
}
vector<vk::CommandBuffer> buffers{}; vector<vk::CommandBuffer> buffers{};
if (cameras.size()==0) if (cameras.size()==0)

View File

@ -314,10 +314,10 @@ namespace idk::vkn
{ {
result.graphics_family = static_cast<uint32_t>(i); result.graphics_family = static_cast<uint32_t>(i);
} }
//if (family.queueFlags & vk::QueueFlagBits::eTransfer) if (family.queueFlags & vk::QueueFlagBits::eTransfer)
//{ {
// result.transfer_family = static_cast<uint32_t>(i); result.transfer_family = static_cast<uint32_t>(i);
//} }
} }
if (result.isComplete()) if (result.isComplete())
{ {

View File

@ -5,9 +5,9 @@ set_project("idk")
set_config("vs_toolset", "14.2") set_config("vs_toolset", "14.2")
-- 设置 Visual Studio 版本为 2019 -- 设置 Visual Studio 版本为 2019
set_toolchains("msvc") set_toolchains("msvc")
set_runtimes("MD") set_runtimes("MDd")
-- 添加 /bigobj 编译选项 -- 添加 /bigobj 编译选项
add_cxflags("/bigobj", "-MD", {force = true}) add_cxflags("/bigobj", "-MDd", {force = true})
includes("src/xmake.lua") includes("src/xmake.lua")
--__std_find_trivial_1 msvc 版本不一致会有这个报错 --__std_find_trivial_1 msvc 版本不一致会有这个报错
--xmake project -k vsxmake2022 -a x64 --xmake project -k vsxmake2022 -a x64