[x265] [PATCH] cmake: support PGO and NATIVE_BUILD for Intel C++ (icpc)
Steve Borho
steve at borho.org
Wed Apr 1 00:23:50 CEST 2015
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1427840459 18000
# Tue Mar 31 17:20:59 2015 -0500
# Branch stable
# Node ID 1116068943dd05f62ee7afc37817435231b2d077
# Parent 3e8737609c2deda6a41bcaf3b65485a766570abe
cmake: support PGO and NATIVE_BUILD for Intel C++ (icpc)
diff -r 3e8737609c2d -r 1116068943dd source/CMakeLists.txt
--- a/source/CMakeLists.txt Tue Mar 31 02:01:23 2015 -0500
+++ b/source/CMakeLists.txt Tue Mar 31 17:20:59 2015 -0500
@@ -147,7 +147,11 @@
add_definitions(-fPIC)
endif(ENABLE_PIC)
if(NATIVE_BUILD)
- add_definitions(-march=native)
+ if(INTEL_CXX)
+ add_definitions(-xhost)
+ else()
+ add_definitions(-march=native)
+ endif()
elseif(X86 AND NOT X64)
add_definitions(-march=i686)
endif()
@@ -155,28 +159,38 @@
add_definitions(-march=armv6 -mfloat-abi=hard -mfpu=vfp)
endif()
if(FPROFILE_GENERATE)
- check_cxx_compiler_flag(-fprofile-generate CC_HAS_PROFILE_GENERATE)
- if(CC_HAS_PROFILE_GENERATE)
- add_definitions(-fprofile-generate)
- list(APPEND LINKER_OPTIONS "-fprofile-generate")
- endif(CC_HAS_PROFILE_GENERATE)
+ if(INTEL_CXX)
+ add_definitions(-prof-gen -prof-dir="${CMAKE_CURRENT_BINARY_DIR}")
+ list(APPEND LINKER_OPTIONS "-prof-gen")
+ else()
+ check_cxx_compiler_flag(-fprofile-generate CC_HAS_PROFILE_GENERATE)
+ if(CC_HAS_PROFILE_GENERATE)
+ add_definitions(-fprofile-generate)
+ list(APPEND LINKER_OPTIONS "-fprofile-generate")
+ endif(CC_HAS_PROFILE_GENERATE)
+ endif(INTEL_CXX)
endif(FPROFILE_GENERATE)
if(FPROFILE_USE)
- check_cxx_compiler_flag(-fprofile-use CC_HAS_PROFILE_USE)
- check_cxx_compiler_flag(-fprofile-correction CC_HAS_PROFILE_CORRECTION)
- check_cxx_compiler_flag(-Wno-error=coverage-mismatch CC_HAS_COVMISMATCH)
- if(CC_HAS_PROFILE_USE)
- add_definitions(-fprofile-use)
- list(APPEND LINKER_OPTIONS "-fprofile-use")
- endif(CC_HAS_PROFILE_USE)
- if(CC_HAS_PROFILE_CORRECTION)
- # auto-correct corrupted counters (happens a lot with x265)
- add_definitions(-fprofile-correction)
- endif(CC_HAS_PROFILE_CORRECTION)
- if(CC_HAS_COVMISMATCH)
- # ignore coverage mismatches (also happens a lot)
- add_definitions(-Wno-error=coverage-mismatch)
- endif(CC_HAS_COVMISMATCH)
+ if(INTEL_CXX)
+ add_definitions(-prof-use -prof-dir="${CMAKE_CURRENT_BINARY_DIR}")
+ list(APPEND LINKER_OPTIONS "-prof-use")
+ else()
+ check_cxx_compiler_flag(-fprofile-use CC_HAS_PROFILE_USE)
+ check_cxx_compiler_flag(-fprofile-correction CC_HAS_PROFILE_CORRECTION)
+ check_cxx_compiler_flag(-Wno-error=coverage-mismatch CC_HAS_COVMISMATCH)
+ if(CC_HAS_PROFILE_USE)
+ add_definitions(-fprofile-use)
+ list(APPEND LINKER_OPTIONS "-fprofile-use")
+ endif(CC_HAS_PROFILE_USE)
+ if(CC_HAS_PROFILE_CORRECTION)
+ # auto-correct corrupted counters (happens a lot with x265)
+ add_definitions(-fprofile-correction)
+ endif(CC_HAS_PROFILE_CORRECTION)
+ if(CC_HAS_COVMISMATCH)
+ # ignore coverage mismatches (also happens a lot)
+ add_definitions(-Wno-error=coverage-mismatch)
+ endif(CC_HAS_COVMISMATCH)
+ endif(INTEL_CXX)
endif(FPROFILE_USE)
if(STATIC_LINK_CRT)
add_definitions(-static)
More information about the x265-devel
mailing list