mirror of
https://github.com/Kbz-8/Pulse.git
synced 2026-01-11 07:23:35 +00:00
adding D3D11 base, working on Vulkan backend
This commit is contained in:
70
xmake.lua
70
xmake.lua
@@ -2,6 +2,23 @@
|
||||
-- This file is part of "Pulse"
|
||||
-- For conditions of distribution and use, see copyright notice in LICENSE
|
||||
|
||||
local backends = {
|
||||
Vulkan = {
|
||||
option = "vulkan",
|
||||
default = true,
|
||||
has_cpp_files = true,
|
||||
packages = { "vulkan-headers", "vulkan-memory-allocator" },
|
||||
custom = function()
|
||||
add_defines("VK_NO_PROTOTYPES")
|
||||
end
|
||||
},
|
||||
D3D11 = {
|
||||
option = "d3d11",
|
||||
default = is_plat("windows", "mingw"),
|
||||
has_cpp_files = false,
|
||||
}
|
||||
}
|
||||
|
||||
local sanitizers = {
|
||||
asan = "address",
|
||||
lsan = "leak",
|
||||
@@ -15,10 +32,18 @@ for opt, policy in table.orderpairs(sanitizers) do
|
||||
end
|
||||
end
|
||||
|
||||
for name, module in table.orderpairs(backends) do
|
||||
if module.option then
|
||||
option(module.option, { description = "Enables the " .. name .. " backend", default = module.default })
|
||||
end
|
||||
end
|
||||
|
||||
add_rules("mode.debug", "mode.release")
|
||||
|
||||
add_includedirs("Includes")
|
||||
set_languages("c99", "cxx20")
|
||||
set_encodings("utf-8")
|
||||
set_warnings("allextra")
|
||||
|
||||
set_objectdir("build/Objs/$(os)_$(arch)")
|
||||
set_targetdir("build/Bin/$(os)_$(arch)")
|
||||
@@ -27,17 +52,54 @@ set_dependir("build/.deps")
|
||||
|
||||
set_optimize("fastest")
|
||||
|
||||
for name, module in pairs(backends) do
|
||||
if has_config(module.option) then
|
||||
if module.packages then
|
||||
add_requires(table.unpack(module.packages))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
target("pulse_gpu")
|
||||
set_kind("$(kind)")
|
||||
add_defines("PULSE_BUILD")
|
||||
add_headerfiles("Includes/*.hpp)")
|
||||
add_headerfiles("Sources/**.h", { prefixdir = "private", install = false })
|
||||
add_headerfiles("Sources/**.inl", { prefixdir = "private", install = false })
|
||||
add_files("Sources/**.c")
|
||||
add_files("Sources/**.cpp")
|
||||
add_headerfiles("Sources/*.h", { prefixdir = "private", install = false })
|
||||
add_headerfiles("Sources/*.inl", { prefixdir = "private", install = false })
|
||||
|
||||
add_files("Sources/*.c")
|
||||
|
||||
for name, module in pairs(backends) do
|
||||
if not has_config(module.option) then
|
||||
goto continue
|
||||
end
|
||||
|
||||
if module.packages then
|
||||
add_packages(table.unpack(module.packages))
|
||||
end
|
||||
|
||||
add_defines("PULSE_ENABLE_" .. name:upper() .. "_BACKEND")
|
||||
|
||||
add_headerfiles("Sources/Backends/" .. name .. "/**.h", { prefixdir = "private", install = false })
|
||||
add_headerfiles("Sources/Backends/" .. name .. "/*.inl", { prefixdir = "private", install = false })
|
||||
|
||||
add_files("Sources/Backends/" .. name .. "/**.c")
|
||||
if module.has_cpp_files then
|
||||
add_files("Sources/Backends/" .. name .. "/**.cpp")
|
||||
end
|
||||
|
||||
if module.custom then
|
||||
module.custom()
|
||||
end
|
||||
|
||||
::continue::
|
||||
end
|
||||
|
||||
on_load(function(target)
|
||||
if target:kind() == "static" then
|
||||
target:add("defines", "PULSE_STATIC", { public = true })
|
||||
end
|
||||
end)
|
||||
target_end()
|
||||
|
||||
includes("Tests/*.lua")
|
||||
|
||||
Reference in New Issue
Block a user