From 808c14bed9ce2babd0ee60ead97e32822c0954a2 Mon Sep 17 00:00:00 2001 From: "U-WIN-6O36QGINL6D\\abcgg" Date: Sat, 17 Jun 2023 23:36:20 +0800 Subject: [PATCH] added support for premake5 --- VEngine/premake5.lua | 74 +++++++++++++++++++++++++++++++++++++ premake5-clean.bat | 3 ++ premake5-generate-gmake.bat | 3 ++ premake5-generate.bat | 3 ++ premake5-wkslight.lua | 18 +++++++++ premake5.lua | 44 ++++++++++++++++++++++ 6 files changed, 145 insertions(+) create mode 100644 VEngine/premake5.lua create mode 100644 premake5-clean.bat create mode 100644 premake5-generate-gmake.bat create mode 100644 premake5-generate.bat create mode 100644 premake5-wkslight.lua create mode 100644 premake5.lua diff --git a/VEngine/premake5.lua b/VEngine/premake5.lua new file mode 100644 index 000000000..e0228883c --- /dev/null +++ b/VEngine/premake5.lua @@ -0,0 +1,74 @@ +project("VEngine") + location(g_wkslight.workspacedir .. "/%{prj.name}") + targetdir(g_wkslight.targetdir) + debugdir("") + debugargs({ "" }) + kind("ConsoleApp") + language("C++") + pchheader("vpch.h") + pchsource("Code/vpch.cpp") + files({ + "Code/**.h", + "Code/**.cpp", + "Code/**.hlsl", + }) + removefiles({ + "Code/Editor/imgui/backends/**.*", + "Code/Editor/imgui/examples/**.*", + "Code/Editor/imgui/misc/**.*", + "Code/Editor/ImGuizmo/example/**.*", + "Code/Editor/ImGuizmo/vcpkg-example/**.*", + }) + files({ + "Code/Editor/imgui/backends/imgui_impl_dx11.cpp", + "Code/Editor/imgui/backends/imgui_impl_win32.cpp", + }) + includedirs({ + "Code", + "Code/Editor/imgui", + "Code/Editor/ImGuizmo", + }) + links({ + "d3d11.lib", + "dxgi.lib", + "d3dcompiler.lib", + "d2d1.lib", + "dwrite.lib", + }) + defines({ + --"_USE_MATH_DEFINES", + }) + filter("files:Code/Editor/imgui/**.cpp") + flags({ "NoPCH" }) + filter("files:Code/Editor/ImGuizmo/**.cpp") + flags({ "NoPCH" }) + filter("files:Code/SHMath/**.cpp") + flags({ "NoPCH" }) + filter("files:Code/**.hlsl") + flags({ "ExcludeFromBuild" }) + shadermodel("5.0") + shaderobjectfileoutput("%{wks.location}/../%{prj.name}/Shaders/%{file.basename}.cso") + filter("files:Code/Render/Shaders/Vertex/*.hlsl") + removeflags({ "ExcludeFromBuild" }) + shadertype("Vertex") + shaderobjectfileoutput("%{wks.location}/../%{prj.name}/Shaders/Vertex/%{file.basename}.cso") + filter("files:Code/Render/Shaders/Pixel/*.hlsl") + removeflags({ "ExcludeFromBuild" }) + shadertype("Pixel") + shaderobjectfileoutput("%{wks.location}/../%{prj.name}/Shaders/Pixel/%{file.basename}.cso") + filter("files:Code/Render/Shaders/Compute/*CS.hlsl") + removeflags({ "ExcludeFromBuild" }) + shadertype("Compute") + shaderentry("CSFunc") + --shaderoptions({ "/E 'CSFunc'" }) + filter("action:vs*") + debugenvs({ + "$(LocalDebuggerEnvironment)", + "QT_QPA_PLATFORM_PLUGIN_PATH=" .. g_wkslight.extras.qt_root .. "\\plugins\\platforms", + }) + vspropertysheet({ + "D:\\dev2\\DirectXTK.props", + "D:\\dev2\\fbxsdk.props", + "D:\\dev2\\PhysX-4.1.props", + "D:\\dev2\\qt5.props", + }) \ No newline at end of file diff --git a/premake5-clean.bat b/premake5-clean.bat new file mode 100644 index 000000000..eec7917b9 --- /dev/null +++ b/premake5-clean.bat @@ -0,0 +1,3 @@ +@echo off +@call "premake5.exe" clean +@ping -n 2 127.0.0.1>nul \ No newline at end of file diff --git a/premake5-generate-gmake.bat b/premake5-generate-gmake.bat new file mode 100644 index 000000000..0e5ff6956 --- /dev/null +++ b/premake5-generate-gmake.bat @@ -0,0 +1,3 @@ +@echo off +@call "premake5.exe" gmake +@ping -n 2 127.0.0.1>nul \ No newline at end of file diff --git a/premake5-generate.bat b/premake5-generate.bat new file mode 100644 index 000000000..cd9c3fdf8 --- /dev/null +++ b/premake5-generate.bat @@ -0,0 +1,3 @@ +@echo off +@call "premake5.exe" vs2022 +@ping -n 2 127.0.0.1>nul \ No newline at end of file diff --git a/premake5-wkslight.lua b/premake5-wkslight.lua new file mode 100644 index 000000000..d1ec1150e --- /dev/null +++ b/premake5-wkslight.lua @@ -0,0 +1,18 @@ +g_wkslight = require("premake5-modules.premake-wkslight.wkslight") +g_wkslight.workspace = { + name = "VEngine-wks", + startproject = "", + platforms = { "x64" }, + cppdialect = "C++20", + thirdparty = { + name = "thirdparty", + projects = { + }, + }, + projects = { + "VEngine", + }, +} +g_wkslight.extras = { + qt_root = "D:\\dev2\\qt-5.15.2", +} \ No newline at end of file diff --git a/premake5.lua b/premake5.lua new file mode 100644 index 000000000..c86b700e1 --- /dev/null +++ b/premake5.lua @@ -0,0 +1,44 @@ +require("premake5-modules.premake-vspropertysheet.vspropertysheet") +require("premake5-wkslight") +workspace(g_wkslight.workspace.name) + location(path.getbasename(g_wkslight.workspacedir)) + platforms(g_wkslight.workspace.platforms) + configurations({ "Debug", "Release" }) + characterset("Default") + cppdialect(g_wkslight.workspace.cppdialect) + floatingpoint("Default") + rtti("Default") + exceptionhandling("Default") + filter("system:windows") + systemversion("latest") + filter("system:linux") + pic("On") + filter("action:vs*") + startproject(g_wkslight.workspace.startproject) + staticruntime("Off") + characterset("MBCS") + flags({ "MultiProcessorCompile" }) + defines({ + "_CRT_SECURE_NO_WARNINGS", + "_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS", + "_HAS_STD_BYTE=0", + }) + --buildoptions({ "/utf-8", "/Zc:char8_t-" }) + filter("action:gmake*") + buildoptions({ "-static" }) + filter("configurations:Debug") + defines({ "_DEBUG" }) + symbols("On") + optimize("Off") + filter("configurations:Release") + defines({ "NDEBUG" }) + symbols("Off") + optimize("Speed") +group(g_wkslight.workspace.thirdparty.name) + for k, v in pairs(g_wkslight.workspace.thirdparty.projects) do + include(v.location) + end +group("") + for i, v in ipairs(g_wkslight.workspace.projects) do + include(v) + end \ No newline at end of file