[x265] [PATCH 2 of 2 STABLE] cmake: add option for -march=native

Steve Borho steve at borho.org
Sun Mar 29 20:36:43 CEST 2015


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1427653450 18000
#      Sun Mar 29 13:24:10 2015 -0500
# Branch stable
# Node ID e5495a8cd07cd3a239a9f3ad9b4c5f4ca1134177
# Parent  65d004d54895eb01ca1ac5a33ca2a21f77eb6ea6
cmake: add option for -march=native

diff -r 65d004d54895 -r e5495a8cd07c source/CMakeLists.txt
--- a/source/CMakeLists.txt	Sun Mar 29 12:01:11 2015 -0500
+++ b/source/CMakeLists.txt	Sun Mar 29 13:24:10 2015 -0500
@@ -25,7 +25,8 @@
 
 option(FPROFILE_GENERATE "Compile executable to generate usage data" OFF)
 option(FPROFILE_USE "Compile executable using generated usage data" OFF)
-mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE)
+option(NATIVE_BUILD "Target the build CPU" OFF)
+mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
 
 # X265_BUILD must be incremented each time the public API is changed
 set(X265_BUILD 50)
@@ -145,7 +146,9 @@
     if(ENABLE_PIC)
          add_definitions(-fPIC)
     endif(ENABLE_PIC)
-    if(X86 AND NOT X64)
+    if(NATIVE_BUILD)
+        add_definitions(-march=native)
+    elseif(X86 AND NOT X64)
         add_definitions(-march=i686)
     endif()
     if(ARM)


More information about the x265-devel mailing list