mmp / pbrt-v3

Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.
http://pbrt.org
BSD 2-Clause "Simplified" License
4.86k stars 1.18k forks source link

build error on windows using mingw #324

Open prashant-saxena opened 1 year ago

prashant-saxena commented 1 year ago

Hi,

Windows 10 Cmake 3.22.0 rc 2 g++ (Rev2, Built by MSYS2 project) 10.3.0

$ mingw32-make
[  0%] Building CXX object CMakeFiles/pbrt.dir/src/core/api.cpp.obj
g++.exe: error: /D: No such file or directory
g++.exe: error: PTEX_STATIC: No such file or directory
mingw32-make[2]: *** [CMakeFiles\pbrt.dir\build.make:76: CMakeFiles/pbrt.dir/src/core/api.cpp.obj] Error 1
mingw32-make[1]: *** [CMakeFiles\Makefile2:405: CMakeFiles/pbrt.dir/all] Error 2
mingw32-make: *** [Makefile:165: all] Error 2
mmp commented 1 year ago

I think the issue is that the CMakeLists file assumes that WIN32 implies MSVC, for example here: https://github.com/mmp/pbrt-v3/blob/aaa552a4b9cbf9dccb71450f47b268e0ed6370e2/CMakeLists.txt#L359.

It might suffice to changing that WIN32 check to be for MSVC, but there may be other issues as well. A pull request fixing this would be most welcome!