Closed stkrake closed 2 years ago
shader compiler path:
set(NRD_DXC_CUSTOM_PATH "custom/path/to/dxc")
cmake build files that expect user modification to function are bad practice - this should be written as follows, with an empty
default value, later checked and automatically filled if possible, or a helpful fatal error ensuing.
set(OPTION "Default" CACHE STRING "Helpstring")
i suggest looking here for some cmake logic to locate the shader compilers:
https://github.com/NVIDIAGameWorks/donut/blob/main/cmake/FindDXCdxil.cmake
compiler specific flags:
should at least be checked (with something like this, though there may be a better way):
if (MSVC) ... endif()
here is a not very elegant check for others:
if (COMPILER_ID STREQUAL "gnu" OR COMPILER_ID STREQUAL "clang" OR COMPILER_ID STREQUAL "intel")
while in there, i would also recommend turning on "production warnings"...
add_definitions(/W3 /WX)
Just brushed up my cmake skills a bit: "/MT" or "/MTd" could be configured via CMAKE_MSVC_RUNTIME_LIBRARY from the command line.
But cmake_minimum_required
has to be (VERSION 3.15)
at least for this to work.
Thanks! I believe I have fixed the problems:
set(... CACHE STRING ...)
cmake_minimum_required
has been bumped to 3.15
to unblock CMAKE_MSVC_RUNTIME_LIBRARY
W3 and WX
for NRD for pedants@stkrake Please, verify.
CMakeList.txt now works on win32 and linux without modifications. I also checked that CMAKE_MSVC_RUNTIME_LIBRARY creates a NRD.vcxproj with the expected entries (but I did not compile or further test this).
Unfortunately compiling on linux now breaks due to "-Werror". I will open an new issue for this and closing this one.
Thanks for fixing.
I had these small problems with CMakeLists.txt on win32 and linux. Maybe there are better solutions (I don't know enough cmake):
CMakeLists.txt line 4:
set(NRD_DXC_CUSTOM_PATH "custom/path/to/dxc")
I had touncommentcomment out this line to specify the dxc-path via cmake -D. (Edit: The line was of course "commented out" ("removed"), not "uncommented").CMakeLists.txt lines 48+49:
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
I had to remove "/MT" and "/MTd" to build a static lib that can be used in a "/MD"-project.And this prevents compilation on linux:
#include "..\Resources\Version.h"
. Changing to forward slashes fixes the problem.