RenderKit / oidn

Intel® Open Image Denoise library
https://www.openimagedenoise.org/
Apache License 2.0
1.77k stars 164 forks source link

Fix #include <windows.h> for case-senstive cross-compilation. #72

Closed madmiraal closed 4 years ago

madmiraal commented 4 years ago

Fixes "common/platform.h:22:12: fatal error: Windows.h: No such file or directory" error when trying to cross-compile for Windows using mingw-64 compiler on Linux, because on Linux filenames are case-sensitive.

atafra commented 4 years ago

Hmm, I just checked the Windows SDK and the header is named Windows.h, not lowercase as in your case. Does the cross-compiler really ship with a lowercase name, and if so, why doesn't it use the official naming? Thanks!

akien-mga commented 4 years ago

The mingw-w64 implementation of the Windows SDK (and the original mingw before it) use lowercase filenames, so to enable cross-compilation one should indeed use windows.h. I don't know why they settled on lowercase filenames, but it seems the MSVC headers changed from WINDOWS.H to Windows.h in the past, so I guess picking a third, Unix idiomatic naming scheme might have made sense back then.

https://sourceforge.net/p/mingw-w64/mingw-w64/ci/master/tree/mingw-w64-headers/include/windows.h

It shouldn't be a problem on Windows which is usually case insensitive (though there are advanced options to make NTFS or a specific folder case sensitive).

Some additional info: here's the output grepping for `windows.h` and `Windows.h` respectively in the Godot Engine source code, which includes a number of thirdparty libraries including OpenImageDenoise:
$ rg "#include .windows.h." -l | sort
core/safe_refcount.cpp
drivers/unix/ip_unix.cpp
drivers/wasapi/audio_driver_wasapi.h
drivers/windows/dir_access_windows.cpp
drivers/windows/file_access_windows.cpp
drivers/windows/rw_lock_windows.h
drivers/windows/thread_windows.h
drivers/winmidi/midi_driver_winmidi.h
drivers/xaudio2/audio_driver_xaudio2.h
modules/mono/utils/mono_reg_utils.cpp
modules/mono/utils/path_utils.cpp
platform/uwp/os_uwp.h
platform/windows/context_gl_windows.h
platform/windows/crash_handler_windows.h
platform/windows/display_server_windows.h
platform/windows/key_mapping_windows.h
platform/windows/lang_table.h
platform/windows/os_windows.h
platform/windows/vulkan_context_win.h
platform/windows/windows_terminal_logger.cpp
thirdparty/assimp/code/Common/DefaultIOSystem.cpp
thirdparty/assimp/code/Common/Win32DebugLogStream.h
thirdparty/basis_universal/basisu_enc.cpp
thirdparty/bullet/Bullet3Common/b3Logging.cpp
thirdparty/bullet/Bullet3OpenCL/Initialize/b3OpenCLUtils.cpp
thirdparty/bullet/clew/clew.c
thirdparty/bullet/LinearMath/btQuickprof.cpp
thirdparty/bullet/LinearMath/btThreads.cpp
thirdparty/bullet/LinearMath/TaskScheduler/btTaskScheduler.cpp
thirdparty/bullet/LinearMath/TaskScheduler/btThreadSupportWin32.cpp
thirdparty/etc2comp/EtcImage.cpp
thirdparty/glad/glad.c
thirdparty/glslang/glslang/OSDependent/Windows/main.cpp
thirdparty/glslang/glslang/OSDependent/Windows/ossource.cpp
thirdparty/libvpx/vp8/common/generic/systemdependent.c
thirdparty/libvpx/vp8/common/threading.h
thirdparty/libvpx/vpx_ports/arm_cpudetect.c
thirdparty/libvpx/vpx_ports/vpx_once.h
thirdparty/libvpx/vpx_ports/vpx_timer.h
thirdparty/libvpx/vpx_ports/x86.h
thirdparty/libvpx/vpx_util/vpx_thread.h
thirdparty/libwebp/src/utils/thread_utils.c
thirdparty/mbedtls/library/entropy_poll.c
thirdparty/mbedtls/library/net_sockets.c
thirdparty/mbedtls/library/timing.c
thirdparty/mbedtls/library/x509_crl.c
thirdparty/mbedtls/library/x509_crt.c
thirdparty/mbedtls/patches/1453.diff
thirdparty/oidn/mkl-dnn/src/common/utils.cpp
thirdparty/oidn/mkl-dnn/src/cpu/jit_utils/jitprofiling/ittnotify_config.h
thirdparty/oidn/mkl-dnn/src/cpu/jit_utils/jitprofiling/jitprofiling.c
thirdparty/oidn/mkl-dnn/src/cpu/xbyak/xbyak.h
thirdparty/opus/silk/debug.c
thirdparty/opus/silk/debug.h
thirdparty/pcre2/src/sljit/sljitLir.c
thirdparty/pcre2/src/sljit/sljitUtils.c
thirdparty/vhacd/inc/vhacdMutex.h
thirdparty/vhacd/inc/vhacdTimer.h
thirdparty/vulkan/include/vulkan/vulkan.h
thirdparty/vulkan/vk_mem_alloc.h
thirdparty/zstd/common/threading.h
$ rg "#include .Windows.h." -l 
thirdparty/oidn/common/platform.h
atafra commented 4 years ago

Thanks!