Created
January 22, 2019 07:42
-
-
Save JSandusky/ffe5f4a334600a4263dd0671ded2c948 to your computer and use it in GitHub Desktop.
DiligentEngine Premake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
Usage: | |
// setup the paths and build options | |
DEGFX_InitPaths(...) | |
DEGFX_InitRenderers(...) | |
// add the projects to build | |
DEGFX_IncludeProjects() | |
// In an active project that needs to reference DE-GFX | |
DEGFX_Bind() | |
example: | |
project "MyProject" | |
DEGFX_Bind() | |
]]-- | |
local degfx_baseDir = "bin/" | |
local degfx_diligentSourceDir = "C:/dev/Git/DiligentEngine/DiligentCore/" | |
local degfx_windows = true | |
local degfx_android = false | |
local degfx_useGL = false | |
local degfx_useD3D11 = false | |
local degfx_useD3D12 = false | |
local degfx_useVulkan = false | |
local degfx_engineD3D11 = "" | |
local degfx_engineD3DBase = "" | |
local degfx_engineD3D12 = "" | |
local degfx_engineGL = "" | |
local degfx_engineVulkan = "" | |
function DEGFX_InitPaths(deSrcDir, baseDir) | |
degfx_diligentSourceDir = deSrcDir | |
degfx_baseDir = baseDir | |
end | |
function DEGFX_InitRenderers(useD3D11, useD3D12, useVulkan) | |
degfx_useD3D11 = useD3D11 | |
degfx_useD3D12 = useD3D12 | |
degfx_useGL = false | |
degfx_useVulkan = useVulkan | |
degfx_engineD3D11 = degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3D11/interface" | |
degfx_engineD3DBase = degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3DBase/include" | |
degfx_engineGL = degfx_diligentSourceDir .. "Graphics/GraphicsEngineOpenGL/include" | |
degfx_engineVulkan = degfx_diligentSourceDir .. "Graphics/GraphicsEngineVulkan/interface" | |
end | |
function DEGFX_AttachDefines() | |
if degfx_windows then | |
defines { "PLATFORM_WIN32" } | |
end | |
if degfx_android then | |
defines { "PLATFORM_ANDROID" } | |
end | |
if degfx_useD3D11 then | |
defines { "D3D11_SUPPORTED" } | |
end | |
if degfx_useD3D12 then | |
defines { "D3D11_SUPPORTED" } | |
end | |
if degfx_useVulkan then | |
defines { "VULKAN_SUPPORTED" } | |
end | |
end | |
function DEGFX_DeepDependency() | |
dependson { "DiligentPrimitives", "DiligentCoreCommon", "DiligentPlatformBasic", "DiligentGraphicsAcc" } | |
links { "DiligentPrimitives", "DiligentCoreCommon", "DiligentPlatformBasic", "DiligentGraphicsAcc" } | |
includedirs { | |
degfx_diligentSourceDir .. "Primitives/interface", | |
degfx_diligentSourceDir .. "Common/interface", | |
degfx_diligentSourceDir .. "Platforms/interface", | |
degfx_diligentSourceDir .. "Platforms/Basic/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngine/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngine/include", | |
degfx_diligentSourceDir .. "Graphics/GraphicsTools/include", | |
degfx_diligentSourceDir .. "Graphics/GraphicsAccessories/interface", | |
} | |
end | |
function DEGFX_AttachD3D11() | |
defines { "D3D11_SUPPORTED" } | |
links { "DiligentGraphicsD3D11", "DiligentGraphicsD3DBase" } | |
dependson { "DiligentGraphicsD3D11", "DiligentGraphicsD3DBase" } | |
includedirs { | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3D11/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3DBase/include", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3DBase/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineBase/include" | |
} | |
end | |
function DEGFX_AttachD3D12() | |
defines { "D3D12_SUPPORTED" } | |
links { "DiligentGraphicsD3D12", "DiligentGraphicsD3DBase" } | |
dependson { "DiligentGraphicsD3D12", "DiligentGraphicsD3DBase" } | |
includedirs { | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3D12/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3DBase/include", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3DBase/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineBase/include" | |
} | |
end | |
function DEGFX_AttachOpenGL() | |
defines { "GL_SUPPORTED" } | |
links { "DiligentGraphicsGL", "DiligentGraphicsD3DBase" } | |
dependson { "DiligentGraphicsGL", "DiligentGraphicsD3DBase" } | |
includedirs { | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineOpenGL/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineBase/include" | |
} | |
end | |
function DEGFX_AttachVulkan() | |
defines { "VULKAN_SUPPORTED" } | |
links { "DiligentGraphicsVulkan", "DiligentGraphicsD3DBase" } | |
dependson { "DiligentGraphicsVulkan", "DiligentGraphicsD3DBase" } | |
includedirs { | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineVulkan/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineBase/include" | |
} | |
end | |
function DEGFX_Bind() | |
if degfx_windows then | |
defines { "PLATFORM_WIN32" } | |
dependson { "DiligentPlatformWin" } | |
links { "DiligentPlatformWin" } | |
includedirs { degfx_diligentSourceDir .. "Graphics/Platforms/Win32/interface" } | |
elseif degfx_android then | |
defines { "PLATFORM_ANDROID" } | |
dependson { "DiligentPlatformAndroid" } | |
links { "DiligentPlatformAndroid" } | |
includedirs { degfx_diligentSourceDir .. "Graphics/Platforms/Android/interface" } | |
end | |
DEGFX_AttachDefines() | |
dependson { | |
"DiligentPrimitives", | |
"DiligentCoreCommon", | |
"DiligentGraphicsTools", | |
"DiligentGraphicsAcc", | |
"DiligentPlatformBasic", | |
"DiligentGraphics" | |
} | |
links { | |
"DiligentPrimitives", | |
"DiligentCoreCommon", | |
"DiligentGraphicsTools", | |
"DiligentGraphicsAcc", | |
"DiligentPlatformBasic", | |
"DiligentGraphics" | |
} | |
includedirs { | |
degfx_diligentSourceDir .. "Primitives/interface", | |
degfx_diligentSourceDir .. "Common/interface", | |
degfx_diligentSourceDir .. "Common/include", | |
degfx_diligentSourceDir .. "Graphics/Platforms/Basic/interface", | |
degfx_diligentSourceDir .. "Graphics/Graphics/GraphicsAccessories/interface", | |
degfx_diligentSourceDir .. "Graphics/Graphics/GraphicsTools/include", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngine/interface" | |
} | |
if degfx_useD3D11 or degfx_useD3D12 then | |
DEGFX_AttachD3D11() | |
end | |
if degfx_useD3D11 then | |
DEGFX_AttachD3D12() | |
end | |
if degfx_useVulkan then | |
DEGFX_AttachVulkan() | |
end | |
end | |
function DEGFX_IncludeProjects() | |
project "DiligentCoreCommon" | |
kind "StaticLib" | |
language "C++" | |
cppdialect "C++11" | |
characterset "MBCS" | |
location "Generated" | |
targetdir (degfx_baseDir .. "DiligentCoreCommon/%{cfg.buildcfg}") | |
dependson { "DiligentPlatformBasic", "DiligentPrimitives" } | |
links { "DiligentPlatformBasic", "DiligentPrimitives" } | |
files { | |
degfx_diligentSourceDir .. "Common/src/**.cpp" | |
} | |
removefiles { | |
degfx_diligentSourceDir .. "Common/src/pch.cpp" | |
} | |
includedirs { | |
degfx_diligentSourceDir .. "Common/include", | |
degfx_diligentSourceDir .. "Common/interface", | |
degfx_diligentSourceDir .. "Platforms/interface", | |
degfx_diligentSourceDir .. "Primitives/interface" | |
} | |
DEGFX_AttachDefines() | |
project "DiligentPrimitives" | |
kind "StaticLib" | |
language "C++" | |
cppdialect "C++11" | |
characterset "MBCS" | |
location "Generated" | |
targetdir (degfx_baseDir .. "DiligentPrimitives/%{cfg.buildcfg}") | |
files { | |
degfx_diligentSourceDir .. "Primitives/src/**.cpp" | |
} | |
includedirs { | |
degfx_diligentSourceDir .. "Primitives/interface" | |
} | |
project "DiligentGraphics" | |
kind "StaticLib" | |
language "C++" | |
cppdialect "C++11" | |
characterset "MBCS" | |
location "Generated" | |
targetdir (degfx_baseDir .. "DiligentGraphics/%{cfg.buildcfg}") | |
dependson { "DiligentCoreCommon", "DiligentPrimitives", "DiligentPlatformBasic", "DiligentPlatformWin" } | |
links { "DiligentCoreCommon", "DiligentPrimitives", "DiligentPlatformBasic", "DiligentPlatformWin" } | |
files { | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngine/src/**.cpp" | |
} | |
includedirs { | |
degfx_diligentSourceDir .. "Common/interface", | |
degfx_diligentSourceDir .. "Primitives/interface", | |
degfx_diligentSourceDir .. "Platforms/Basic/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngine/include", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngine/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsAccessories/interface" | |
} | |
DEGFX_AttachDefines() | |
project "DiligentGraphicsAcc" | |
kind "StaticLib" | |
language "C++" | |
cppdialect "C++11" | |
characterset "MBCS" | |
location "Generated" | |
targetdir (degfx_baseDir .. "DiligentGraphicsAcc/%{cfg.buildcfg}") | |
dependson { "DiligentCoreCommon", "DiligentPrimitives", "DiligentPlatformBasic", "DiligentPlatformWin" } | |
links { "DiligentCoreCommon", "DiligentPrimitives", "DiligentPlatformBasic", "DiligentPlatformWin" } | |
files { degfx_diligentSourceDir .. "Graphics/GraphicsAccessories/**.cpp" } | |
includedirs { | |
degfx_diligentSourceDir .. "Graphics/GraphicsAccessories/interface", | |
degfx_diligentSourceDir .. "Primitives/interface", | |
degfx_diligentSourceDir .. "Platforms/Basic/interface" | |
} | |
DEGFX_AttachDefines() | |
project "DiligentGraphicsD3DBase" | |
kind "StaticLib" | |
language "C++" | |
cppdialect "C++11" | |
characterset "MBCS" | |
location "Generated" | |
targetdir (degfx_baseDir .. "DiligentGraphicsD3DBase/%{cfg.buildcfg}") | |
files { | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3DBase/src/**.cpp" | |
} | |
includedirs { | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3DBase/include" | |
} | |
DEGFX_AttachDefines() | |
DEGFX_DeepDependency() | |
project "DiligentGraphicsTools" | |
kind "StaticLib" | |
language "C++" | |
cppdialect "C++11" | |
characterset "MBCS" | |
location "Generated" | |
targetdir (degfx_baseDir .. "DiligentGraphicsTools/%{cfg.buildcfg}") | |
dependson { "DiligentPrimitives", "DiligentCoreCommon", "DiligentPlatformBasic", "DiligentGraphicsAcc" } | |
links { "DiligentPrimitives", "DiligentCoreCommon", "DiligentPlatformBasic", "DiligentGraphicsAcc" } | |
files { degfx_diligentSourceDir .. "Graphics/GraphicsTools/src/**.cpp" } | |
includedirs { | |
degfx_diligentSourceDir .. "Primitives/interface", | |
degfx_diligentSourceDir .. "Common/interface", | |
degfx_diligentSourceDir .. "Platforms/Basic/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngine/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsTools/include", | |
degfx_diligentSourceDir .. "Graphics/GraphicsAccessories/interface", | |
} | |
if degfx_useD3D11 or degfx_useD3D12 then | |
includedirs { degfx_engineD3DBase } | |
end | |
if degfx_useD3D11 == false then | |
removefiles { degfx_diligentSourceDir .. "Graphics/GraphicsTools/src/*D3D11.cpp" } | |
else | |
includedirs { | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3D11/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3D11/include" | |
} | |
end | |
if degfx_useD3D12 == false then | |
removefiles { degfx_diligentSourceDir .. "Graphics/GraphicsTools/src/*D3D12.cpp" } | |
else | |
includedirs { | |
degfx_engineD3D12, | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3D12/include" | |
} | |
end | |
if degfx_useGL == false then | |
removefiles { degfx_diligentSourceDir .. "Graphics/GraphicsTools/src/*GL.cpp" } | |
end | |
DEGFX_AttachDefines() | |
project "DiligentPlatformBasic" | |
kind "StaticLib" | |
language "C++" | |
cppdialect "C++11" | |
characterset "MBCS" | |
location "Generated" | |
targetdir (degfx_baseDir .. "DiligentPlatformBasic/%{cfg.buildcfg}") | |
dependson { "DiligentPrimitives" } | |
links { "DiligentPrimitives" } | |
files { | |
degfx_diligentSourceDir .. "Platforms/Basic/src/**.cpp", | |
degfx_diligentSourceDir .. "Platforms/Basic/interface/**.h" | |
} | |
removefiles { degfx_diligentSourceDir .. "Platforms/Basic/src/pch.cpp" } | |
includedirs { | |
degfx_diligentSourceDir .. "Platforms/Basic/interface", | |
degfx_diligentSourceDir .. "Platforms/interface", | |
degfx_diligentSourceDir .. "Primitives/interface" | |
} | |
if degfx_windows then | |
project "DiligentPlatformWin" | |
kind "StaticLib" | |
language "C++" | |
cppdialect "C++11" | |
characterset "MBCS" | |
location "Generated" | |
targetdir (degfx_baseDir .. "DiligentPlatformWin/%{cfg.buildcfg}") | |
dependson { "DiligentPlatformBasic", "DiligentPrimitives" } | |
links { "DiligentPlatformBasic", "DiligentPrimitives" } | |
files { degfx_diligentSourceDir .. "Platforms/Win32/src/**.cpp" } | |
removefiles { degfx_diligentSourceDir .. "Platforms/Win32/src/pch.cpp" } | |
includedirs { | |
degfx_diligentSourceDir .. "Platforms/Win32/interface", | |
degfx_diligentSourceDir .. "Platforms/interface", | |
degfx_diligentSourceDir .. "Primitives/interface" | |
} | |
end | |
if degfx_useD3D11 then | |
project "DiligentGraphicsD3D11" | |
kind "StaticLib" | |
language "C++" | |
cppdialect "C++11" | |
characterset "MBCS" | |
location "Generated" | |
targetdir (degfx_baseDir .. "DiligentGraphicsD3D11/%{cfg.buildcfg}") | |
dependson { "DiligentPrimitives", "DiligentCoreCommon", "DiligentPlatformBasic", "DiligentGraphicsAcc", "DiligentGraphics", "DiligentGraphicsD3DBase" } | |
links { "DiligentPrimitives", "DiligentCoreCommon", "DiligentPlatformBasic", "DiligentGraphicsAcc", "DiligentGraphics", "DiligentGraphicsD3DBase" } | |
files { degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3D11/src/**.cpp" } | |
includedirs { | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3D11/include", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3D11/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3DBase/include", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3DBase/interface", | |
} | |
DEGFX_AttachDefines() | |
DEGFX_DeepDependency() | |
end | |
if degfx_useD3D12 then | |
project "DiligentGraphicsD3D12" | |
kind "StaticLib" | |
language "C++" | |
cppdialect "C++11" | |
characterset "MBCS" | |
location "Generated" | |
targetdir (degfx_baseDir .. "DiligentGraphicsD3D12/%{cfg.buildcfg}") | |
dependson { "DiligentPrimitives", "DiligentCoreCommon", "DiligentPlatformBasic", "DiligentGraphicsAcc", "DiligentGraphics", "DiligentGraphicsD3DBase" } | |
links { "DiligentPrimitives", "DiligentCoreCommon", "DiligentPlatformBasic", "DiligentGraphicsAcc", "DiligentGraphics", "DiligentGraphicsD3DBase" } | |
files { degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3D12/src/**.cpp" } | |
includedirs { | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3D12/include", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3D12/interface", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3DBase/include", | |
degfx_diligentSourceDir .. "Graphics/GraphicsEngineD3DBase/interface", | |
} | |
DEGFX_AttachDefines() | |
DEGFX_DeepDependency() | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment