Add toolchain flags for SSE2 compilation
authorMark Abraham <mark.j.abraham@gmail.com>
Thu, 28 Jul 2016 17:53:50 +0000 (19:53 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 28 Jul 2016 18:05:06 +0000 (20:05 +0200)
This is how the code should be, though my testing didn't need it.

Also fixed function documentation.

Fixes #2008

Change-Id: Ic1e1c16d22e054e9f741d91c667305de7398cd30

cmake/gmxFindFlagsForSource.cmake
cmake/gmxManageSimd.cmake

index c047a489552c3be684cfd88cd5de215205cad99b..250e4a49410768721043ca6ba87c8bebe5520ba0 100644 (file)
@@ -110,12 +110,18 @@ FUNCTION(GMX_FIND_FLAG_FOR_SOURCE RESULT_VARIABLE SOURCE LANGUAGE TOOLCHAIN_FLAG
 ENDFUNCTION()
 
 # Helper routine to find a flag (from a list) that will compile a specific source (in both C and C++).
-# SOURCE                   Source code to test
-# TOOLCHAIN_C_FLAGS        Flags needed by the C toolchain.
-# TOOLCHAIN_CXX_FLAGS      Flags needed by the C++ toolchain.
-# C_FLAGS_VARIABLE         Variable into which to write the C compiler flag needed to compile the source
-# CXX_FLAGS_VARIABLE       Variable into which to write the C++ compiler flag needed to compile the source
-# Args 6 through N         Multiple strings with compiler flags to test
+# SOURCE                        Source code to test
+# TOOLCHAIN_C_FLAGS_VARIABLE    As input, names a variable that contains flags needed
+#                               by the C toolchain, to which any necessary C compiler
+#                               flag needed to compile the source will be appended.
+# TOOLCHAIN_CXX_FLAGS_VARIABLE  As input, names a variable that contains flags needed
+#                               by the C++ toolchain, to which any necessary C++ compiler
+#                               flag needed to compile the source will be appended.
+# C_FLAGS_VARIABLE              Names a variable that will be set true if a way
+#                               to compile the source as C was found
+# CXX_FLAGS_VARIABLE            Names a variable that will be set true if a way
+#                               to compile the source as C++ was found
+# Args 6 through N              Multiple strings with compiler flags to test
 #
 # If a compile flag is found, but the project in check_c/cxx_source_compiles
 # fails to build, sets SUGGEST_BINUTILS_UPDATE in parent scope to suggest
index 6d3c3f07dc0dece83014905e997179efb9fb0fa3..f3bf27bde9c7f11d3ed6866a954d7ec9ba591b47 100644 (file)
@@ -142,6 +142,8 @@ elseif(GMX_SIMD STREQUAL "SSE2")
         gmx_give_fatal_error_when_simd_support_not_found("SSE2" "disable SIMD support (slow)" "${SUGGEST_BINUTILS_UPDATE}")
     endif()
 
+    set(SIMD_C_FLAGS "${TOOLCHAIN_C_FLAGS}")
+    set(SIMD_CXX_FLAGS "${TOOLCHAIN_CXX_FLAGS}")
     set(GMX_SIMD_X86_${GMX_SIMD} 1)
     set(SIMD_STATUS_MESSAGE "Enabling SSE2 SIMD instructions")