148 lines
6.5 KiB
Diff
148 lines
6.5 KiB
Diff
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -202,7 +202,7 @@
|
|
|
|
SET(CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo")
|
|
|
|
-IF (WIN32)
|
|
+IF (WIN32 AND NOT MINGW)
|
|
IF (NOT DEFAULT_CMAKE_CONFIGURATION_TYPES_SET)
|
|
SET(CMAKE_CONFIGURATION_TYPES "${CONFIGURATION_TYPES}" CACHE STRING "List of generated configurations." FORCE)
|
|
SET(DEFAULT_CMAKE_CONFIGURATION_TYPES_SET ON CACHE INTERNAL "Default CMake configuration types set.")
|
|
@@ -316,7 +316,7 @@
|
|
OPTION(EMBREE_ISA_SSE42 "Enables SSE4.2 ISA." ON)
|
|
OPTION(EMBREE_ISA_AVX "Enables AVX ISA." ${COMPILER_SUPPORTS_AVX})
|
|
OPTION(EMBREE_ISA_AVX2 "Enables AVX2 ISA." ${COMPILER_SUPPORTS_AVX2})
|
|
- IF (WIN32 OR APPLE)
|
|
+ IF (MSVC OR APPLE)
|
|
OPTION(EMBREE_ISA_AVX512 "Enables AVX512 ISA." OFF)
|
|
ELSE()
|
|
OPTION(EMBREE_ISA_AVX512 "Enables AVX512 ISA." ${COMPILER_SUPPORTS_AVX512})
|
|
--- a/common/math/math.h
|
|
+++ b/common/math/math.h
|
|
@@ -44,7 +44,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
|
|
|
|
@@ -289,7 +289,7 @@
|
|
}
|
|
#endif
|
|
|
|
-#if defined(__WIN32__) || defined(__FreeBSD__)
|
|
+#if defined(_MSC_VER) || defined(__FreeBSD__)
|
|
__forceinline void sincosf(float x, float *s, float *c) {
|
|
*s = sinf(x); *c = cosf(x);
|
|
}
|
|
--- a/common/sys/sysinfo.cpp
|
|
+++ b/common/sys/sysinfo.cpp
|
|
@@ -288,7 +288,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
|
|
--- a/tutorials/common/tutorial/CMakeLists.txt
|
|
+++ b/tutorials/common/tutorial/CMakeLists.txt
|
|
@@ -49,7 +49,7 @@
|
|
TARGET_LINK_LIBRARIES(tutorial_ispc benchmark)
|
|
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
|
|
--- a/common/cmake/clang.cmake
|
|
+++ b/common/cmake/clang.cmake
|
|
@@ -21,7 +21,7 @@
|
|
_SET_IF_EMPTY(FLAGS_AVX512 "-march=skx")
|
|
ENDIF ()
|
|
|
|
-IF (WIN32)
|
|
+IF (MSVC)
|
|
|
|
SET(COMMON_CXX_FLAGS "")
|
|
SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} /EHsc") # catch C++ exceptions only and extern "C" functions never throw a C++ exception
|
|
@@ -92,6 +92,7 @@
|
|
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} -fstack-protector") # protects against return address overrides
|
|
ENDIF()
|
|
@@ -132,8 +133,8 @@
|
|
ELSE(APPLE)
|
|
IF (NOT EMBREE_ADDRESS_SANITIZER) # for address sanitizer this causes link errors
|
|
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined") # issues link error for undefined symbols in shared library
|
|
- SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") # enables position independent execution for executable
|
|
- IF (NOT EMSCRIPTEN)
|
|
+ IF (NOT EMSCRIPTEN AND NOT MINGW)
|
|
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") # enables position independent execution for executable
|
|
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -z relro -z now") # re-arranges data sections to increase security
|
|
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_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
|
|
--- a/common/cmake/gnu.cmake
|
|
+++ b/common/cmake/gnu.cmake
|
|
@@ -53,6 +53,7 @@
|
|
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} -fstack-protector") # protects against return address overrides
|
|
ENDIF()
|
|
@@ -93,10 +94,12 @@
|
|
ELSE(APPLE)
|
|
IF (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
|
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
|
|
+ ENDIF ()
|
|
ENDIF ()
|
|
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") # enables position independent execution for executable
|
|
ENDIF(APPLE)
|
|
--- a/common/cmake/package.cmake
|
|
+++ b/common/cmake/package.cmake
|
|
@@ -23,7 +23,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")
|
|
@@ -35,7 +35,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()
|
|
|
|
--- a/common/math/constants.h
|
|
+++ b/common/math/constants.h
|
|
@@ -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>
|
|
|