This is an automated email from the ASF dual-hosted git repository.

apeforest pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 97e09f2  Improve CMake handling of sse2 and sse3 (#14757)
97e09f2 is described below

commit 97e09f23cfdc1f5a3f794e4a5f539b502b4e7731
Author: Pedro Larroy <pedro.larroy.li...@gmail.com>
AuthorDate: Thu Apr 25 15:39:48 2019 -0700

    Improve CMake handling of sse2 and sse3 (#14757)
    
    Fix #14304 where CFLAGS were overriden instead of appended to.
---
 CMakeLists.txt | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 09a52be..4a22184 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -121,6 +121,7 @@ else(MSVC)
   # For cross compilation, we can't rely on the compiler which accepts the 
flag, but mshadow will
   # add platform specific includes not available in other arches
   if(USE_SSE)
+    check_cxx_compiler_flag("-msse3"     SUPPORT_MSSE3)
     check_cxx_compiler_flag("-msse2"     SUPPORT_MSSE2)
   else()
     set(SUPPORT_MSSE2 FALSE)
@@ -134,14 +135,15 @@ else(MSVC)
     set(SUPPORT_F16C FALSE)
   endif()
   if(SUPPORT_F16C)
-    set(CMAKE_CXX_FLAGS  "${CMAKE_CXX_FLAGS} -mf16c")
+    message(STATUS "F16C enabled")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mf16c")
   else()
     add_definitions(-DMSHADOW_USE_F16C=0)
   endif()
   set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-  set(CMAKE_C_FLAGS "-Wall -Wno-unknown-pragmas -Wno-sign-compare")
+  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-unknown-pragmas 
-Wno-sign-compare")
   if ("${CMAKE_CXX_COMPILER_ID}" MATCHES ".*Clang$")
-    set(CMAKE_C_FLAGS "-Wno-braced-scalar-init")
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-braced-scalar-init")
   endif()
   if(CMAKE_BUILD_TYPE STREQUAL "Debug")
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g")
@@ -152,7 +154,9 @@ else(MSVC)
     add_definitions(-DNDEBUG=1)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
   endif()
-  if(SUPPORT_MSSE2)
+  if(SUPPORT_MSSE3)
+    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse3")
+  elseif(SUPPORT_MSSE2)
     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -msse2")
   endif()
   set(CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})
@@ -403,8 +407,8 @@ if(USE_OPENCV)
   endif()
   include_directories(SYSTEM ${OpenCV_INCLUDE_DIRS})
   list(APPEND mxnet_LINKER_LIBS ${OpenCV_LIBS})
-  message(STATUS " OpenCV_LIBS=${OpenCV_LIBS}")
   message(STATUS "OpenCV ${OpenCV_VERSION} found (${OpenCV_CONFIG_PATH})")
+  message(STATUS " OpenCV_LIBS=${OpenCV_LIBS}")
   add_definitions(-DMXNET_USE_OPENCV=1)
 else(USE_OPENCV)
   message(STATUS "OpenCV Disabled")

Reply via email to