From c2e5d2468ad6a38cdb8a067da0678302f6cc6066 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 13 Sep 2019 15:59:15 -0400 Subject: Refactor render-test to make cross platform (#1053) * First pass of render-test refactor. * Make window construction a function that can choose an implementation. * Remove OpenGL as currently has windows dependency. * Disable Vulkan as Renderer impl has dependency on windows. * Pass Window in as parameter of 'update'. * Add win-window.cpp as was missing. * Fix warning on windows about signs during comparison. --- premake5.lua | 64 +++++++++++++++++++++++++++--------------------------------- 1 file changed, 29 insertions(+), 35 deletions(-) (limited to 'premake5.lua') diff --git a/premake5.lua b/premake5.lua index 63f83b00e..a1e729113 100644 --- a/premake5.lua +++ b/premake5.lua @@ -501,42 +501,26 @@ toolSharedLibrary "slang-reflection-test" -- TODO: Fix that requirement. -- -if isTargetWindows then - toolSharedLibrary "render-test" - uuid "61F7EB00-7281-4BF3-9470-7C2EA92620C3" - - includedirs { ".", "external", "source", "tools/gfx" } - links { "core", "slang", "gfx" } - - systemversion "10.0.14393.0" - - removefiles { "tools/render-test/cpu-render-test-main.cpp" } - - -- For Windows targets, we want to copy - -- dxcompiler.dll, and dxil.dll from the Windows SDK redistributable - -- directory into the output directory. - -- d3dcompiler_47.dll is copied from the external/slang-binaries submodule. - postbuildcommands { '"$(SolutionDir)tools\\copy-hlsl-libs.bat" "$(WindowsSdkDir)Redist/D3D/%{cfg.platform:lower()}/" "%{cfg.targetdir}/" "windows-%{cfg.platform:lower()}"'} - -end - -toolSharedLibrary "cpu-render-test" - uuid "5701695E-7324-4B4D-977A-8D56C2A041B1" +toolSharedLibrary "render-test" + uuid "61F7EB00-7281-4BF3-9470-7C2EA92620C3" includedirs { ".", "external", "source", "tools/gfx" } links { "core", "slang", "gfx" } + + removefiles { "tools/render-test/cpu-render-test-main.cpp" } - addSourceDir("tools/render-test") - - removefiles { "tools/render-test/render-test-main.cpp" } - - if isTargetWindows then + if isTargetWindows then + addSourceDir "tools/render-test/windows" + + systemversion "10.0.14393.0" + -- For Windows targets, we want to copy -- dxcompiler.dll, and dxil.dll from the Windows SDK redistributable -- directory into the output directory. -- d3dcompiler_47.dll is copied from the external/slang-binaries submodule. - postbuildcommands { '"$(SolutionDir)tools\\copy-hlsl-libs.bat" "$(WindowsSdkDir)Redist/D3D/%{cfg.platform:lower()}/" "%{cfg.targetdir}/"'} - end + postbuildcommands { '"$(SolutionDir)tools\\copy-hlsl-libs.bat" "$(WindowsSdkDir)Redist/D3D/%{cfg.platform:lower()}/" "%{cfg.targetdir}/" "windows-%{cfg.platform:lower()}"'} + end + -- -- `gfx` is a utility library for doing GPU rendering -- and compute, which is used by both our testing and exmaples. @@ -561,15 +545,25 @@ tool "gfx" -- directory into the output directory. -- d3dcompiler_47.dll is copied from the external/slang-binaries submodule. postbuildcommands { '"$(SolutionDir)tools\\copy-hlsl-libs.bat" "$(WindowsSdkDir)Redist/D3D/%{cfg.platform:lower()}/" "%{cfg.targetdir}/"'} + + addSourceDir "tools/gfx/vulkan" + addSourceDir "tools/gfx/open-gl" + addSourceDir "tools/gfx/d3d" + addSourceDir "tools/gfx/d3d11" + addSourceDir "tools/gfx/d3d12" + + addSourceDir "tools/gfx/windows" + + elseif targetDetail == "mingw" or targetDetail == "cygwin" then + -- Don't support any render techs... + elseif os.target() == "macosx" then + --addSourceDir "tools/gfx/open-gl" 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" } + -- Linux like + --addSourceDir "tools/gfx/vulkan" + --addSourceDir "tools/gfx/open-gl" end - - -- Remove VK from OSX gfx build - if os.target() == "macosx" then - removefiles { "tools/gfx/render-vk.cpp", "tools/gfx/vk-device-queue.cpp", "tools/gfx/vk-api.cpp", "tools/gfx/vk-module.cpp", "tools/gfx/vk-swap-chain.cpp", "tools/gfx/vk-util.cpp" } - end - + filter { "system:linux" } -- might be able to do pic(true) buildoptions{"-fPIC"} -- cgit v1.2.3