Skip to content

Commit

Permalink
Premake: extract helpers for internal projects.
Browse files Browse the repository at this point in the history
  • Loading branch information
kosua20 committed Oct 8, 2023
1 parent dc881ac commit 7f9cf8a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
39 changes: 25 additions & 14 deletions premake5.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ workspace("Rendu")

-- Helper functions for the projects.

function CommonSetup()
function CommonSetup(relativeSrcRoot)
-- C++ settings
language("C++")
cppdialect("C++11")
Expand All @@ -73,10 +73,13 @@ function CommonSetup()
-- Ignore missing PDBs.
linkoptions({ "/IGNORE:4099"})
filter({})
-- Common include dirs

-- System headers are used to support angled brackets in Xcode.
externalincludedirs({ "src/libs/", "src/libs/glfw/include/"})
externalincludedirs({ relativeSrcRoot.."/libs/", relativeSrcRoot.."/libs/glfw/include/"})

filter({})

-- Vulkan dependencies
if _OPTIONS["env_vulkan_sdk"] then
externalincludedirs({ "$(VULKAN_SDK)/include" })
libdirs({ "$(VULKAN_SDK)/lib" })
Expand All @@ -89,17 +92,11 @@ function CommonSetup()
externalincludedirs({ "/usr/local/include/" })
libdirs({ "/usr/local/lib" })
end
filter({})
end

function ExecutableSetup()
kind("ConsoleApp")
CommonSetup()

-- Link with compiled librarires
includedirs({ "src/engine" })
links({"Engine"})
filter({})
end

function LinkSystemLibraries()
links({"nfd", "glfw3"})

-- Libraries for each platform.
Expand All @@ -113,16 +110,30 @@ function ExecutableSetup()
filter("system:windows")
links({"comctl32"})

filter({})

-- Vulkan dependencies
filter("system:macosx or linux")
links({"glslang", "MachineIndependent", "GenericCodeGen", "OGLCompiler", "SPIRV", "SPIRV-Tools-opt", "SPIRV-Tools","OSDependent" })

filter({"system:windows", "configurations:Dev"})
links({"glslangd", "OGLCompilerd", "SPIRVd", "OSDependentd", "MachineIndependentd", "GenericCodeGend", "SPIRV-Tools-optd", "SPIRV-Toolsd"})

filter({"system:windows", "configurations:Release" })
links({"glslang", "OGLCompiler", "SPIRV", "OSDependent", "MachineIndependent", "GenericCodeGen", "SPIRV-Tools-opt", "SPIRV-Tools"})

filter({})
end

function ExecutableSetup()
kind("ConsoleApp")
CommonSetup("src")

-- Link with compiled librarires
includedirs({ "src/engine" })
links({"Engine"})

LinkSystemLibraries();

-- Register in the projects list for the ALL target.
table.insert(projects, project().name)
Expand Down Expand Up @@ -164,7 +175,7 @@ end
-- Projects

project("Engine")
CommonSetup()
CommonSetup("src")
kind("StaticLib")

includedirs({ "src/engine" })
Expand Down Expand Up @@ -263,7 +274,7 @@ group("Meta")

project("ALL")
kind("ConsoleApp")
CommonSetup()
CommonSetup("src")
dependson({ "Engine" })
dependson( projects )
-- We need a dummy file to execute.
Expand Down
2 changes: 1 addition & 1 deletion src/engine/resources/ResourcesManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ char * Resources::loadRawDataFromExternalFile(const std::string & path, size_t &

std::ifstream inputFile(System::widen(path), std::ios::binary | std::ios::ate);
if(inputFile.bad() || inputFile.fail()) {
Log::Warning() << Log::Resources << "Unable to load file at path \"" << path << "\"." << std::endl;
Log::Error() << Log::Resources << "Unable to load file at path \"" << path << "\"." << std::endl;
size = 0;
return nullptr;
}
Expand Down

0 comments on commit 7f9cf8a

Please sign in to comment.