[x265] [PATCH 1 of 2 STABLE] cmake: introduce fprofile options
Steve Borho
steve at borho.org
Sun Mar 29 20:36:42 CEST 2015
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1427648471 18000
# Sun Mar 29 12:01:11 2015 -0500
# Branch stable
# Node ID 65d004d54895eb01ca1ac5a33ca2a21f77eb6ea6
# Parent 6cd3938d8683841956f255816ead000bdb307a43
cmake: introduce fprofile options
These are hidden from showing up in the GUI, since they come as 'some assembly
required'. The test-harness repo has a script which will drive this processs:
1) build with -fprofile-generate
2) run some representative test encodes
3) build with -fprofile-use
By using generic cmake options, we can add support for MSVC and other compilers
diff -r 6cd3938d8683 -r 65d004d54895 source/CMakeLists.txt
--- a/source/CMakeLists.txt Fri Mar 27 22:59:16 2015 -0500
+++ b/source/CMakeLists.txt Sun Mar 29 12:01:11 2015 -0500
@@ -23,6 +23,10 @@
include(CheckSymbolExists)
include(CheckCXXCompilerFlag)
+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)
+
# X265_BUILD must be incremented each time the public API is changed
set(X265_BUILD 50)
configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
@@ -147,6 +151,14 @@
if(ARM)
add_definitions(-march=armv6 -mfloat-abi=hard -mfpu=vfp)
endif()
+ if(FPROFILE_GENERATE)
+ add_definitions(-fprofile-generate)
+ list(APPEND LINKER_OPTIONS "-fprofile-generate")
+ endif(FPROFILE_GENERATE)
+ if(FPROFILE_USE)
+ add_definitions(-fprofile-use)
+ list(APPEND LINKER_OPTIONS "-fprofile-use")
+ endif(FPROFILE_USE)
check_cxx_compiler_flag(-Wno-narrowing CC_HAS_NO_NARROWING)
check_cxx_compiler_flag(-Wno-array-bounds CC_HAS_NO_ARRAY_BOUNDS)
if (CC_HAS_NO_ARRAY_BOUNDS)
More information about the x265-devel
mailing list