summaryrefslogtreecommitdiffstats
path: root/premake5.lua
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-04-25 08:51:12 -0400
committerGitHub <noreply@github.com>2019-04-25 08:51:12 -0400
commitc84e7c0fa526de51f380227a6667f723af36aea2 (patch)
tree755c034fab30a2d0dfe7f8f6027d892b46d19f87 /premake5.lua
parent1004f50bd7d0032411a564ad4625055e982902ea (diff)
Fixed building on CygWin with clang gcc (#953)
* * Make Path:: use lowerCamel method names as per coding standard * Small improvements to make closer to standard * GetDirectoryName -> getParentDirectory - previous method name's action was somewhat unclear, hopefully this is better * * Can build on clang and gcc on CygWin * Fix problem on cygwin loading shared libraries * Renamed Path::isRelative to ::hasRelativeElement because isRelative implies the path is 'relative to the current path' and which isn't quite what it does * Documented how to build for CygWin * * Fix small bug creating platform shared library name. * Small typo fixes in building.md
Diffstat (limited to 'premake5.lua')
-rw-r--r--premake5.lua39
1 files changed, 32 insertions, 7 deletions
diff --git a/premake5.lua b/premake5.lua
index dc3faa392..d939400d0 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -48,6 +48,7 @@
-- From in the build directory you can use
-- % premake5 --file=../premake5.lua --os=linux gmake
+
newoption {
trigger = "override-module",
description = "(Optional) Specify a lua file that can override functions",
@@ -68,8 +69,19 @@ newoption {
allowed = { { "true", "True"}, { "false", "False" } }
}
+newoption {
+ trigger = "target-detail",
+ description = "(Optional) More specific target information",
+ value = "string",
+ allowed = { {"cygwin"}, {"mingw"} }
+}
+
buildLocation = _OPTIONS["build-location"]
executeBinary = (_OPTIONS["execute-binary"] == "true")
+targetDetail = _OPTIONS["target-detail"]
+
+-- Is true when the target is really windows (ie not something on top of windows like cygwin)
+local isTargetWindows = (os.target() == "windows") and not (targetDetail == "mingw" or targetDetail == "cygwin")
overrideModule = {}
local overrideModulePath = _OPTIONS["override-module"]
@@ -79,6 +91,18 @@ end
targetName = "%{cfg.system}-%{cfg.platform:lower()}"
+if not (targetDetail == nil) then
+ targetName = targetDetail .. "-%{cfg.platform:lower()}"
+end
+
+-- This is needed for gcc, for the 'fileno' functions on cygwin
+-- _GNU_SOURCE makes realpath available in gcc
+if targetDetail == "cygwin" then
+ buildoptions { "-D_POSIX_SOURCE" }
+ filter { "toolset:gcc*" }
+ buildoptions { "-D_GNU_SOURCE" }
+end
+
workspace "slang"
-- We will support debug/release configuration and x86/x64 builds.
configurations { "Debug", "Release" }
@@ -379,7 +403,7 @@ function example(name)
links { "slang", "core", "gfx" }
end
-if os.target() == "windows" then
+if isTargetWindows then
--
-- With all of these helper routines defined, we can now define the
-- actual projects quite simply. For example, here is the entire
@@ -471,7 +495,7 @@ toolSharedLibrary "slang-reflection-test"
-- TODO: Fix that requirement.
--
-if os.target() == "windows" then
+if isTargetWindows then
toolSharedLibrary "render-test"
uuid "61F7EB00-7281-4BF3-9470-7C2EA92620C3"
@@ -501,17 +525,18 @@ tool "gfx"
includedirs { ".", "external", "source", "external/imgui" }
- filter { "system:windows" }
-
+ -- To special case that we may be building using cygwin on windows. If 'true windows' we build for dx12/vk and run the script
+ -- If not we assume it's a cygwin/mingw type situation and remove files that aren't appropriate
+ if isTargetWindows then
systemversion "10.0.14393.0"
-- For Windows targets, we want to copy d3dcompiler_47.dll,
-- dxcompiler.dll, and dxil.dll from the Windows SDK redistributable
-- directory into the output directory.
postbuildcommands { '"$(SolutionDir)tools\\copy-hlsl-libs.bat" "$(WindowsSdkDir)Redist/D3D/%{cfg.platform:lower()}/" "%{cfg.targetdir}/"'}
-
- filter { "system:not windows" }
- removefiles { "tools/gfx/circular-resource-heap-d3d12.cpp", "tools/gfx/d3d-util.cpp", "tools/gfx/descriptor-heap-d3d12.cpp", "tools/gfx/render-d3d11.cpp", "tools/gfx/render-d3d12.cpp", "tools/gfx/render-gl.cpp", "tools/gfx/resource-d3d12.cpp", "tools/gfx/render-vk.cpp", "tools/gfx/vk-swap-chain.cpp", "tools/gfx/window.cpp" }
+ else
+ removefiles { "tools/gfx/circular-resource-heap-d3d12.cpp", "tools/gfx/d3d-util.cpp", "tools/gfx/descriptor-heap-d3d12.cpp", "tools/gfx/render-d3d11.cpp", "tools/gfx/render-d3d12.cpp", "tools/gfx/render-gl.cpp", "tools/gfx/resource-d3d12.cpp", "tools/gfx/render-vk.cpp", "tools/gfx/vk-swap-chain.cpp", "tools/gfx/window.cpp" }
+ end
--
-- The `slangc` command-line application is just a very thin wrapper