ssloy / tinyraytracer

A brief computer graphics / rendering course
https://github.com/ssloy/tinyraytracer/wiki
5.04k stars 333 forks source link

Visual Studio OpenMP 2.0 Support #12

Open CeruleanSky opened 5 years ago

CeruleanSky commented 5 years ago

If you want to support Visual Studio's OpenMP which is compiler flag"/openmp" , it has been at version OpenMP 2.0 for around a decade, and complains about size_t for the index and the error says it needs to be a signed int.

https://github.com/ssloy/tinyraytracer/blob/5888c49c4a332b0f71a41937a49697754abd656f/tinyraytracer.cpp#L123-L124

So the above size_t index works when it changed to a signed int for VS compilers.

I didn't want to make a pull since I'm not quite sure what the best way to add "/openmp" to how you have your CMakeLists.txt arranged for Visual Studio.

ssloy commented 5 years ago

Thank you for pointing the stuff; I am not sure either how to add /openmp, let us keep the issue open for a little while.