RenderKit / ospray

An Open, Scalable, Portable, Ray Tracing Based Rendering Engine for High-Fidelity Visualization
http://ospray.org
Apache License 2.0
997 stars 182 forks source link

OpenImageDenoise error with superbuild on Windows #413

Closed darbyjohnston closed 4 years ago

darbyjohnston commented 4 years ago

Hi,

I'm trying to compile the latest OSPRay with the superbuild script on Windows and am running into an error:

C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe -DDNNL_ENABLE_CONCURRENT_EXEC -DNOMINMAX -DOpenImageDenoise_EXPORTS -D_CRT_SECURE_NO_WARNINGS -D_WIN -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -D__TBBMALLOC_NO_IMPLICIT_LINKAGE=1 -D__TBB_NO_IMPLICIT_LINKAGE=1 -I C:\dev\ospray-build\oidn\build -I C:\dev\ospray-build\oidn\src\include -I C:\dev\ospray-build\oidn\src -I C:\dev\ospray-build\oidn\src\mkl-dnn\include -I C:\dev\ospray-build\oidn\build\mkl-dnn\include -I C:\dev\ospray-build\oidn\src\mkl-dnn\src -I C:\dev\ospray-build\oidn\src\mkl-dnn\src\common -I C:\dev\ospray-build\oidn\src\mkl-dnn\src\cpu -I C:\dev\ospray-build\oidn\src\mkl-dnn\src\cpu\xbyak -I C:\dev\ospray-build\install\include -DWIN32   /Qpar /fo CMakeFiles\OpenImageDenoise.dir\common\oidn.rc.res C:\dev\ospray-build\oidn\src\common\oidn.rc
Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384
Copyright (C) Microsoft Corporation.  All rights reserved.

fatal error RC1107: invalid usage; use RC /? for Help
NMAKE : fatal error U1077: 'C:\PROGRA~2\WI3CF2~1\10\bin\100183~1.0\x64\rc.exe' : return code '0x1'
Stop.

The error is coming from the "/Qpar" options which is not recognized by rc.exe. The "/Qpar" option seems to be coming from "oidn_platform.cmake":

if(WIN32)
  if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
    add_definitions(/Qpar)

The odd part is that if I compile OpenImageDenoise separately everything builds fine and the "/Qpar" option does not show up in the rc.exe command-line, indeed the rc.exe command-line options differ quite a bit between building OpenImageDenoise on it's own and with the OSPRay superbuild script. Has anyone else run into this?

This is on Windows 10 with Visual Studio 2017, configured with this CMake command:

cmake ../ospray/scripts/superbuild -G "NMake Makefiles" -DINSTALL_IN_SEPARATE_DIRECTORIES=FALSE -DBUILD_OIDN=TRUE -DBUILD_OIDN_FROM_SOURCE=TRUE

Thanks, Darby

stukowski commented 4 years ago

I ran into the same issue when building OpenImageDenoise v1.2.0 separately (not the OSPRay superbuild) on Windows 10 with MSVC 2019/NMake. I worked around the issue by editing the CMake script file mentioned above and replacing add_definitions(/Qpar) with add_compile_options(/Qpar).

darbyjohnston commented 4 years ago

Hi, using "add_compile_options" looks like a good change since "/Qpar" is indeed an option for compiling and not a preprocessor definition:

https://docs.microsoft.com/en-us/cpp/build/reference/qpar-auto-parallelizer?view=vs-2019

Oddly enough I did not run into this when I was compiling OpenImageDenoise separately, I'm not sure what I was doing differently from your build. I had originally opened an issue on the OpenImageDenoise GitHub page but @atafra thought it was specific to the OSPRay superbuild:

https://github.com/OpenImageDenoise/oidn/issues/61

I'll re-open that issue and include your suggested change.

darbyjohnston commented 4 years ago

@atafra has made the suggested change and checked it into the OpenImageDenoise devel branch.