Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 114 additions & 29 deletions Dependencies/slang/slang.lua
Original file line number Diff line number Diff line change
@@ -1,40 +1,125 @@
local vkSdk = os.getenv("VULKAN_SDK")
if not vkSdk then
Solution.Util.PrintError("VULKAN_SDK not found. Please ensure Vulkan SDK is installed.")
end
local function getSlangInfo()
if os.target() == "linux" then
local includeDirs = {}
local libDirs = {}
local runtimeLibraries = {}

-- Determine platform-specific library paths
local libName, libSrcPath
if os.target() == "windows" then
libName = "slang.dll"
libSrcPath = vkSdk .. "/bin/" .. libName
else
libName = "libslang.so"
libSrcPath = vkSdk .. "/lib/" .. libName
end
if os.host() == "linux" then
local slangSDK = os.getenv("SLANG_SDK") or os.getenv("VULKAN_SDK")
local includeDir
local libDir

if slangSDK then
includeDir = slangSDK .. "/include"
libDir = slangSDK .. "/lib"

if not os.isfile(includeDir .. "/slang/slang.h") then
Solution.Util.PrintError(
"The configured SDK does not contain Slang headers: '" .. includeDir .. "'."
)
end

if not os.isfile(libDir .. "/libslang.so") then
Solution.Util.PrintError(
"The configured SDK does not contain the Slang library: '" .. libDir .. "'."
)
end
else
includeDir = os.findheader("slang/slang.h")
libDir = os.findlib("slang")
end

if not includeDir then
Solution.Util.PrintError(
"Failed to find the Slang headers in the system include paths. " ..
"Source the Vulkan SDK's setup-env.sh, set SLANG_SDK, or install Slang system-wide."
)
end

-- Copy shared library (release version always) during premake generation
local binDir = Solution.Projects.Current.BinDir
local configs = { "Debug", "RelDebug", "Release" }

for _, cfg in ipairs(configs) do
local destDir = binDir .. "/" .. cfg
os.mkdir(destDir)

local destPath = destDir .. "/" .. libName
local success, err = os.copyfile(libSrcPath, destPath)
if success then
Solution.Util.Print("Copied " .. libName .. " to " .. destDir)
if not libDir then
Solution.Util.PrintError(
"Failed to find the Slang shared library in the system library paths. " ..
"Source the Vulkan SDK's setup-env.sh, set SLANG_SDK, or install Slang system-wide."
)
end

table.insert(includeDirs, includeDir)
table.insert(libDirs, libDir)

if slangSDK then
runtimeLibraries = os.matchfiles(libDir .. "/libslang*.so*")
end
end

-- Requiring slang/slang.h distinguishes Shader Slang from the unrelated
-- S-Lang terminal library commonly installed by Linux distributions.
return {
includeDirs = includeDirs,
libDirs = libDirs,
runtimeLibraries = runtimeLibraries
}
end

-- Newer Vulkan SDKs bundle Slang. SLANG_SDK also permits a standalone Slang
-- installation without forcing Vulkan and Slang to share an SDK root.
local slangSDK = os.getenv("SLANG_SDK") or os.getenv("VULKAN_SDK")
if not slangSDK then
Solution.Util.PrintError(
"Failed to find Slang. Please set SLANG_SDK to the Slang SDK root, " ..
"or VULKAN_SDK when using a Vulkan SDK that bundles Slang."
)
end

local runtimeLibraries
if os.target() == "windows" then
runtimeLibraries = { slangSDK .. "/bin/slang.dll" }
else
Solution.Util.PrintError("Failed to copy " .. libName .. ": " .. (err or "unknown error"))
runtimeLibraries = os.matchfiles(slangSDK .. "/lib/libslang*.so*")
end

return {
includeDirs = { slangSDK .. "/include" },
libDirs = { slangSDK .. "/lib" },
runtimeLibraries = runtimeLibraries
}
end

-- Create dependency
local function copyRuntimeLibraries(runtimeLibraries)
if not runtimeLibraries or #runtimeLibraries == 0 then
return
end

local binDir = Solution.Projects.Current.BinDir
local configs = { "Debug", "RelDebug", "Release" }

for _, runtimeLibrary in ipairs(runtimeLibraries) do
local runtimeLibraryName = path.getname(runtimeLibrary)

for _, cfg in ipairs(configs) do
local destDir = binDir .. "/" .. cfg
os.mkdir(destDir)

local destPath = destDir .. "/" .. runtimeLibraryName
local success, err = os.copyfile(runtimeLibrary, destPath)
if success then
Solution.Util.Print("Copied " .. runtimeLibraryName .. " to " .. destDir)
else
Solution.Util.PrintError(
"Failed to copy " .. runtimeLibraryName .. " from '" .. runtimeLibrary .. "': " ..
(err or "unknown error")
)
end
end
end
end

local slangInfo = getSlangInfo()
copyRuntimeLibraries(slangInfo.runtimeLibraries)

local dep = Solution.Util.CreateDepTable("Slang-Slang", {})

Solution.Util.CreateDep(dep.NameLow, dep.Dependencies, function()
Solution.Util.SetIncludes(vkSdk .. "/include")
Solution.Util.SetLibDirs(vkSdk .. "/lib")
Solution.Util.SetIncludes(slangInfo.includeDirs)
Solution.Util.SetLibDirs(slangInfo.libDirs)
Solution.Util.SetLinks("slang")
end)
96 changes: 75 additions & 21 deletions Dependencies/vulkan/vulkan.lua
Original file line number Diff line number Diff line change
@@ -1,40 +1,94 @@
local function getVulkanInfo()
local envName = "VULKAN_SDK"
local includeDirs = {}
local libDirs = {}
local libs = {}

local vulkanSDK = os.getenv(envName)
if not vulkanSDK then
Solution.Util.PrintError("Failed to find Vulkan SDK with system variable '" .. envName .. "'. Please ensure Vulkan is installed and configured properly")
end

-- Add Includes path
table.insert(includeDirs, vulkanSDK .. "/include")

-- Add Library
if os.target() == "windows" then
table.insert(libs, vulkanSDK .. "/lib/vulkan-1.lib")
else

if os.target() == "linux" then
if os.host() == "linux" then
local vulkanSDK = os.getenv("VULKAN_SDK")
local includeDir
local libDir

if vulkanSDK then
includeDir = vulkanSDK .. "/include"
libDir = vulkanSDK .. "/lib/VulkanLoader/lib"

if not os.isfile(includeDir .. "/vulkan/vulkan.h") then
Solution.Util.PrintError(
"VULKAN_SDK does not contain Vulkan headers: '" .. includeDir .. "'."
)
end

if not os.isfile(libDir .. "/libvulkan.so") then
Solution.Util.PrintError(
"VULKAN_SDK does not contain the Vulkan loader: '" .. libDir .. "'."
)
end
else
includeDir = os.findheader("vulkan/vulkan.h")
libDir = os.findlib("vulkan")
end

if not includeDir then
Solution.Util.PrintError(
"Failed to find the Vulkan headers in the system include paths. " ..
"Source the Vulkan SDK's setup-env.sh, or install the Vulkan development packages."
)
end

if not libDir then
Solution.Util.PrintError(
"Failed to find the Vulkan loader in the system library paths. " ..
"Source the Vulkan SDK's setup-env.sh, or install the Vulkan development packages."
)
end

table.insert(includeDirs, includeDir)
table.insert(libDirs, libDir)
end

table.insert(libs, "vulkan")
else
local envName = "VULKAN_SDK"
local vulkanSDK = os.getenv(envName)
if not vulkanSDK then
Solution.Util.PrintError(
"Failed to find the Vulkan SDK with system variable '" .. envName .. "'. " ..
"Please ensure Vulkan is installed and configured properly."
)
end

table.insert(includeDirs, vulkanSDK .. "/include")

if os.target() == "windows" then
table.insert(libs, vulkanSDK .. "/lib/vulkan-1.lib")
else
table.insert(libs, "vulkan")
end
end
return includeDirs, libs

return includeDirs, libDirs, libs
end

local dep = Solution.Util.CreateDepTable("vulkan", {})

Solution.Util.CreateDep(dep.Name, dep.Dependencies, function()
local cachedData = Solution.Util.GetDepCache(dep.Name, "cache")

local includeDirs, libs
local includeDirs, libDirs, libs
if cachedData then
includeDirs, libs = cachedData.includes, cachedData.libs
includeDirs, libDirs, libs = cachedData.includes, cachedData.libDirs, cachedData.libs
else
includeDirs, libs = getVulkanInfo()
Solution.Util.SetDepCache(dep.Name, "cache", { includes = includeDirs, libs = libs })
includeDirs, libDirs, libs = getVulkanInfo()
Solution.Util.SetDepCache(dep.Name, "cache", {
includes = includeDirs,
libDirs = libDirs,
libs = libs
})
end

Solution.Util.SetIncludes(includeDirs)
Solution.Util.SetLibDirs(libDirs)
Solution.Util.SetLinks(libs)
Solution.Util.SetDefines({ "_CRT_SECURE_NO_WARNINGS" })
end)
end)
5 changes: 5 additions & 0 deletions Premake/ProjectUtil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ Solution.Util.CreateProject = function(name, projectType, binDir, dependencies,
characterset ("ASCII")
editandcontinue "Off"

filter "system:linux"
linkgroups "On"
linkoptions { "-Wl,-rpath,'$$ORIGIN'" }
filter {}

filter "configurations:Debug"
runtime "Debug"
symbols "On"
Expand Down
1 change: 1 addition & 0 deletions Source/Filesystem/Filesystem/Core/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <filesystem>
#include <fstream>
#include <thread>

namespace fs = std::filesystem;

Expand Down
4 changes: 2 additions & 2 deletions Source/Gameplay/Gameplay/Network/GameMessageRouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ namespace Network
}

template <PacketConcept PacketStruct>
void UnregisterPacketHandler(OpcodeType opcode)
void UnregisterPacketHandler(OpcodeType /*opcode*/)
{
auto opcode = static_cast<OpcodeType>(PacketStruct::PACKET_ID);

Expand All @@ -78,4 +78,4 @@ namespace Network
private:
GameMessageHandler _handlers[(u16)MetaGen::PacketListEnum::Count];
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ VERSION HISTORY

#define SPIRV_REFLECT_USE_SYSTEM_SPIRV_H
#if defined(SPIRV_REFLECT_USE_SYSTEM_SPIRV_H)
#include <spirv-headers/spirv.h>
#include <spirv/unified1/spirv.h>
#else
#include "./include/spirv/unified1/spirv.h"
#endif
Expand Down Expand Up @@ -2465,4 +2465,4 @@ namespace spv_reflect {
#endif // defined(__cplusplus) && !defined(SPIRV_REFLECT_DISABLE_CPP_WRAPPER)
#endif // SPIRV_REFLECT_H

// clang-format on
// clang-format on
Loading