[x265-commits] [x265] cmake: when x86 arch is detected, set gcc -march=i686 glo...

Steve Borho steve at borho.org
Sun Feb 2 19:52:29 CET 2014


details:   http://hg.videolan.org/x265/rev/eff52bc89e94
branches:  
changeset: 5976:eff52bc89e94
user:      Steve Borho <steve at borho.org>
date:      Sun Feb 02 12:52:04 2014 -0600
description:
cmake: when x86 arch is detected, set gcc -march=i686 globally

This enables a number of cleanups in the internal cmake scripts

diffstat:

 source/CMakeLists.txt         |   3 +++
 source/common/CMakeLists.txt  |  13 ++++---------
 source/encoder/CMakeLists.txt |  13 ++++---------
 3 files changed, 11 insertions(+), 18 deletions(-)

diffs (64 lines):

diff -r bb33ab0f4ef9 -r eff52bc89e94 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Sat Feb 01 16:39:12 2014 -0600
+++ b/source/CMakeLists.txt	Sun Feb 02 12:52:04 2014 -0600
@@ -119,6 +119,9 @@ if (GCC)
     if(X64 AND NOT WIN32)
         add_definitions(-fPIC)
     endif(X64 AND NOT WIN32)
+    if(X86 AND NOT X64)
+        add_definitions(-march=i686)
+    endif()
 endif(GCC)
 
 find_package(Yasm)
diff -r bb33ab0f4ef9 -r eff52bc89e94 source/common/CMakeLists.txt
--- a/source/common/CMakeLists.txt	Sat Feb 01 16:39:12 2014 -0600
+++ b/source/common/CMakeLists.txt	Sun Feb 02 12:52:04 2014 -0600
@@ -132,15 +132,10 @@ if(ENABLE_ASSEMBLY)
     source_group(Assembly FILES ${ASM_PRIMITIVES})
 endif(ENABLE_ASSEMBLY)
 
-if(GCC)
-    if(X86 AND NOT X64)
-        # force gcc to generate code for sync primitives
-        set_source_files_properties(threadpool.cpp reference.cpp wavefront.cpp common.cpp PROPERTIES COMPILE_FLAGS -march=i686)
-    endif()
-    if(GCC_HAS_NO_NARROWING)
-        set_source_files_properties(cpu.cpp PROPERTIES COMPILE_FLAGS -Wno-narrowing)
-    endif()
-endif(GCC)
+if(GCC AND GCC_HAS_NO_NARROWING)
+    set_source_files_properties(cpu.cpp PROPERTIES COMPILE_FLAGS -Wno-narrowing)
+endif()
+
 set_source_files_properties(version.cpp PROPERTIES COMPILE_FLAGS -DX265_VERSION=${X265_VERSION})
 
 add_library(common OBJECT
diff -r bb33ab0f4ef9 -r eff52bc89e94 source/encoder/CMakeLists.txt
--- a/source/encoder/CMakeLists.txt	Sat Feb 01 16:39:12 2014 -0600
+++ b/source/encoder/CMakeLists.txt	Sun Feb 02 12:52:04 2014 -0600
@@ -1,13 +1,4 @@
 # vim: syntax=cmake
-if(GCC)
-    # encoder.cpp must include HM headers which are not careful about named parameters
-    set_source_files_properties(encoder.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
-    if(X86 AND NOT X64)
-        # force gcc to generate code for sync primitives
-        set_source_files_properties(framefilter.cpp PROPERTIES COMPILE_FLAGS -march=i686)
-    endif()
-endif(GCC)
-
 set(LIBENCODER_HDR
     ../Lib/TLibEncoder/NALwrite.h
     ../Lib/TLibEncoder/SEIwrite.h
@@ -34,6 +25,10 @@ set(LIBENCODER_SRC
 source_group(TLibEncoder FILES ${LIBENCODER_HDR} ${LIBENCODER_SRC})
 
 if(GCC)
+    # encoder.cpp must include HM headers which are not careful about named parameters
+    set_source_files_properties(encoder.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
+
+    # HM code is not careful about signed compares
     set_source_files_properties(compress.cpp ${LIBENCODER_SRC} PROPERTIES COMPILE_FLAGS 
         "-Wno-sign-compare")
 endif(GCC)


More information about the x265-commits mailing list