| --- embree-3.12.0/CMakeLists.txt.orig 2020-10-08 13:06:09.573257200 +0300 |
| +++ embree-3.12.0/CMakeLists.txt 2020-10-08 13:07:16.344816300 +0300 |
| @@ -198,10 +198,15 @@ |
| MESSAGE("Intel Compiler detected") |
| INCLUDE (intel) |
| ELSE() |
| + IF(MINGW) |
| + MESSAGE("GCC detected") |
| + INCLUDE (gnu) |
| + ELSE() |
| - IF (EMBREE_ISA_AVX512KNL OR EMBREE_ISA_AVX512SKX) |
| - MESSAGE(FATAL_ERROR "Microsoft Visual C++ Compiler does not support AVX512. Please use Intel Compiler or Clang.") |
| - ENDIF() |
| - INCLUDE (msvc) |
| + IF (EMBREE_ISA_AVX512KNL OR EMBREE_ISA_AVX512SKX) |
| + MESSAGE(FATAL_ERROR "Microsoft Visual C++ Compiler does not support AVX512. Please use Intel Compiler or Clang.") |
| + ENDIF() |
| + INCLUDE (msvc) |
| + ENDIF() |
| ENDIF() |
| |
| ELSE (WIN32) |
| --- embree-3.12.0/common/math/math.h.orig 2020-10-08 13:23:56.732826200 +0300 |
| +++ embree-3.12.0/common/math/math.h 2020-10-08 13:24:09.816659600 +0300 |
| @@ -13,7 +13,7 @@ |
| #include <immintrin.h> |
| |
| #if defined(__WIN32__) |
| -#if (__MSV_VER <= 1700) |
| +#if defined(_MSC_VER) && (_MSC_VER <= 1700) |
| namespace std |
| { |
| __forceinline bool isinf ( const float x ) { return _finite(x) == 0; } |
| @@ -40,7 +40,7 @@ |
| __forceinline int toInt (const float& a) { return int(a); } |
| __forceinline float toFloat(const int& a) { return float(a); } |
| |
| -#if defined(__WIN32__) |
| +#if defined(_MSC_VER) |
| __forceinline bool finite ( const float x ) { return _finite(x) != 0; } |
| #endif |
| |
| @@ -86,7 +86,7 @@ |
| return _mm_cvtss_f32(c); |
| } |
| |
| -#if defined(__WIN32__) && (__MSC_VER <= 1700) |
| +#if defined(_MSC_VER) && (_MSC_VER <= 1700) |
| __forceinline float nextafter(float x, float y) { if ((x<y) == (x>0)) return x*(1.1f+float(ulp)); else return x*(0.9f-float(ulp)); } |
| __forceinline double nextafter(double x, double y) { return _nextafter(x, y); } |
| __forceinline int roundf(float f) { return (int)(f + 0.5f); } |
| --- embree-3.12.0/common/sys/library.cpp.orig 2020-10-08 13:25:49.035618400 +0300 |
| +++ embree-3.12.0/common/sys/library.cpp 2020-10-08 13:27:18.700305300 +0300 |
| @@ -27,7 +27,7 @@ |
| |
| /* returns address of a symbol from the library */ |
| void* getSymbol(lib_t lib, const std::string& sym) { |
| - return GetProcAddress(HMODULE(lib),sym.c_str()); |
| + return (void *)GetProcAddress(HMODULE(lib),sym.c_str()); |
| } |
| |
| /* closes the shared library */ |
| --- embree-3.12.0/common/sys/intrinsics.h.orig 2020-10-08 13:46:29.816139700 +0300 |
| +++ embree-3.12.0/common/sys/intrinsics.h 2020-10-08 13:47:04.718594900 +0300 |
| @@ -30,7 +30,9 @@ |
| #endif |
| |
| #if defined(__WIN32__) |
| +# if !defined(NOMINMAX) |
| # define NOMINMAX |
| +# endif |
| # include <windows.h> |
| #endif |
| |
| --- embree-3.12.0/include/embree3/rtcore_common.h.orig 2020-10-08 13:45:45.391426500 +0300 |
| +++ embree-3.12.0/include/embree3/rtcore_common.h 2020-10-08 13:45:56.064816000 +0300 |
| @@ -19,7 +19,7 @@ |
| #endif |
| #endif |
| |
| -#ifdef _WIN32 |
| +#ifdef _MSC_VER |
| # define RTC_ALIGN(...) __declspec(align(__VA_ARGS__)) |
| #else |
| # define RTC_ALIGN(...) __attribute__((aligned(__VA_ARGS__))) |
| --- embree-3.12.0/common/tasking/taskschedulertbb.h.orig 2020-10-08 13:54:46.957437800 +0300 |
| +++ embree-3.12.0/common/tasking/taskschedulertbb.h 2020-10-08 13:55:28.620373200 +0300 |
| @@ -12,7 +12,9 @@ |
| #include "../sys/ref.h" |
| |
| #if defined(__WIN32__) |
| +# if !defined(NOMINMAX) |
| # define NOMINMAX |
| +# endif |
| #endif |
| |
| // We need to define these to avoid implicit linkage against |
| --- embree-3.12.0/common/sys/sysinfo.cpp.orig 2020-10-08 14:04:36.119217500 +0300 |
| +++ embree-3.12.0/common/sys/sysinfo.cpp 2020-10-08 14:05:22.213153600 +0300 |
| @@ -177,7 +177,7 @@ |
| |
| __noinline int64_t get_xcr0() |
| { |
| -#if defined (__WIN32__) |
| +#if defined (_MSC_VER) |
| int64_t xcr0 = 0; // int64_t is workaround for compiler bug under VS2013, Win32 |
| xcr0 = _xgetbv(0); |
| return xcr0; |
| @@ -211,7 +211,7 @@ |
| int cpuid_leaf_e1[4] = { 0,0,0,0 }; |
| if (nIds >= 1) __cpuid (cpuid_leaf_1,0x00000001); |
| #if _WIN32 |
| -#if _MSC_VER && (_MSC_FULL_VER < 160040219) |
| +#if defined(_MSC_VER) && (_MSC_FULL_VER < 160040219) |
| #else |
| if (nIds >= 7) __cpuidex(cpuid_leaf_7,0x00000007,0); |
| #endif |
| --- embree-3.12.0/tutorials/common/tutorial/CMakeLists.txt.orig 2020-10-08 15:10:28.601395100 +0300 |
| +++ embree-3.12.0/tutorials/common/tutorial/CMakeLists.txt 2020-10-08 15:10:32.753196700 +0300 |
| @@ -26,7 +26,7 @@ |
| SET_PROPERTY(TARGET noise_ispc APPEND PROPERTY COMPILE_FLAGS " ${FLAGS_LOWEST}") |
| ENDIF() |
| |
| -IF (WIN32 AND NOT EMBREE_EXTERNAL_GLFW) |
| +IF (MSVC AND NOT EMBREE_EXTERNAL_GLFW) |
| |
| GET_FILENAME_COMPONENT(GLFW_DIR ${GLFW_LIBRARY} PATH) |
| ADD_CUSTOM_COMMAND(TARGET tutorial POST_BUILD |
| --- embree-3.12.0/common/cmake/gnu.cmake.orig 2020-10-08 20:26:40.332913400 +0300 |
| +++ embree-3.12.0/common/cmake/gnu.cmake 2020-10-08 20:30:01.359024200 +0300 |
| @@ -39,8 +39,9 @@ |
| SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden") # makes all inline symbols hidden by default |
| SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") # disables strict aliasing rules |
| SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-tree-vectorize") # disable auto vectorizer |
| -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORTIFY_SOURCE=2") # perform extra security checks for some standard library calls |
| +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_USE_MATH_DEFINES") |
| IF (EMBREE_STACK_PROTECTOR) |
| + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORTIFY_SOURCE=2") # perform extra security checks for some standard library calls |
| SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector") # protects against return address overrides |
| ENDIF() |
| MACRO(DISABLE_STACK_PROTECTOR_FOR_FILE file) |
| @@ -69,10 +70,12 @@ |
| SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") # link against libc++ which supports C++11 features |
| ELSE(APPLE) |
| SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") # issues link error for undefined symbols in shared library |
| + IF (NOT MINGW) |
| SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z noexecstack") # we do not need an executable stack |
| SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z relro -z now") # re-arranges data sections to increase security |
| SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z noexecstack") # we do not need an executable stack |
| SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z relro -z now") # re-arranges data sections to increase security |
| SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") # enables position independent execution for executable |
| + ENDIF () |
| ENDIF(APPLE) |
| |
| --- embree-3.12.0/common/cmake/package.cmake.orig 2020-10-08 20:43:01.906336600 +0300 |
| +++ embree-3.12.0/common/cmake/package.cmake 2020-10-08 20:45:40.283140100 +0300 |
| @@ -24,7 +24,7 @@ |
| # Install MSVC runtime |
| ############################################################## |
| |
| -IF (WIN32) |
| +IF (MSVC) |
| SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE) |
| INCLUDE(InstallRequiredSystemLibraries) |
| LIST(FILTER CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS INCLUDE REGEX ".*msvcp[0-9]+\.dll|.*vcruntime[0-9]+\.dll|.*vcruntime[0-9]+_[0-9]+\.dll") |
| @@ -36,7 +36,7 @@ |
| ############################################################## |
| |
| INSTALL(DIRECTORY include/embree3 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT devel) |
| -IF (NOT WIN32) |
| +IF (NOT MSVC) |
| INSTALL(DIRECTORY man/man3 DESTINATION ${CMAKE_INSTALL_MANDIR} COMPONENT devel) |
| ENDIF() |
| |
| @@ -106,7 +106,7 @@ |
| ENDIF() |
| ENDIF() |
| |
| -IF (WIN32 OR EMBREE_ZIP_MODE) |
| +IF (MSVC OR EMBREE_ZIP_MODE) |
| # for local "installs" and on Windows we want the cmake config files placed |
| # in the install root, such that users can point the CMake variable |
| # embree_DIR just to the install folder |
| @@ -116,7 +116,11 @@ |
| ELSE() |
| SET(EMBREE_CMAKECONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/embree-${EMBREE_VERSION}") |
| SET(EMBREE_CMAKEEXPORT_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/embree-${EMBREE_VERSION}") |
| - FILE(RELATIVE_PATH EMBREE_RELATIV_ROOT_DIR "/${EMBREE_CMAKECONFIG_DIR}" "/") |
| + IF (WIN32) |
| + SET(EMBREE_RELATIV_ROOT_DIR "../../../") |
| + ELSE() |
| + FILE(RELATIVE_PATH EMBREE_RELATIV_ROOT_DIR "/${EMBREE_CMAKECONFIG_DIR}" "/") |
| + ENDIF() |
| ENDIF() |
| |
| CONFIGURE_FILE(common/cmake/embree-config.cmake embree-config-install.cmake @ONLY) |
| --- embree-3.12.0/common/math/constants.h.orig 2020-10-08 20:54:58.498103100 +0300 |
| +++ embree-3.12.0/common/math/constants.h 2020-10-08 20:55:08.724746100 +0300 |
| @@ -7,8 +7,7 @@ |
| |
| #include <limits> |
| |
| -#define _USE_MATH_DEFINES |
| -#include <math.h> // using cmath causes issues under Windows |
| +#include <cmath> // using cmath causes issues under Windows |
| #include <cfloat> |
| #include <climits> |
| |