[x265] [PATCH] cmake: moving vtune compilation into separate file

Steve Borho steve at borho.org
Thu Oct 29 18:41:31 CET 2015


On 10/29, Pradeep Ramachandran wrote:
> # HG changeset patch
> # User Pradeep Ramachandran <pradeep at multicorewareinc.com>
> # Date 1446116970 -19800
> #      Thu Oct 29 16:39:30 2015 +0530
> # Node ID 8325698f4662fd8d9fa2c7ef2c6d48ace93c09b6
> # Parent  6563218ce342c30bfd4f9bc172a1dab510e6e55b
> cmake: moving vtune compilation into separate file

nicely done

> diff -r 6563218ce342 -r 8325698f4662 source/CMakeLists.txt
> --- a/source/CMakeLists.txt	Mon Oct 26 12:13:53 2015 +0530
> +++ b/source/CMakeLists.txt	Thu Oct 29 16:39:30 2015 +0530
> @@ -385,16 +385,19 @@
>  
>  option(ENABLE_VTUNE "Enable Vtune profiling instrumentation" OFF)
>  if(ENABLE_VTUNE)
> -    add_definitions(-DENABLE_VTUNE)
> -    include_directories($ENV{VTUNE_AMPLIFIER_XE_2015_DIR}/include)
> -    list(APPEND PLATFORM_LIBS vtune)
> -    link_directories($ENV{VTUNE_AMPLIFIER_XE_2015_DIR}/lib64)
> -    if(WIN32)
> -        list(APPEND PLATFORM_LIBS libittnotify.lib)
> -    else()
> -        list(APPEND PLATFORM_LIBS libittnotify.a dl)
> -    endif()
> -    add_subdirectory(profile/vtune)
> +    find_package(Vtune)
> +    if(VTUNE_FOUND)
> +        add_definitions(-DENABLE_VTUNE)
> +        include_directories(${VTUNE_INCLUDE_DIR})
> +        list(APPEND PLATFORM_LIBS vtune)
> +        link_directories(${VTUNE_LIBRARY_DIR})
> +        if(WIN32)
> +            list(APPEND PLATFORM_LIBS libittnotify.lib)
> +        else()
> +            list(APPEND PLATFORM_LIBS libittnotify.a dl)
> +        endif()
> +        add_subdirectory(profile/vtune)
> +    endif(VTUNE_FOUND)
>  endif(ENABLE_VTUNE)
>  
>  option(DETAILED_CU_STATS "Enable internal profiling of encoder work" OFF)
> diff -r 6563218ce342 -r 8325698f4662 source/cmake/FindVtune.cmake
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/source/cmake/FindVtune.cmake	Thu Oct 29 16:39:30 2015 +0530
> @@ -0,0 +1,22 @@
> +# Module for locating Vtune
> +#
> +# Read-only variables
> +#   VTUNE_FOUND: Indicates that the library has been found
> +#   VTUNE_INCLUDE_DIR: Points to the vtunes include dir
> +#   VTUNE_LIBRARY_DIR: Points to the directory with libraries
> +#
> +# Copyright (c) 2015 Pradeep Ramachandran
> +
> +include(FindPackageHandleStandardArgs)
> +
> +find_path(VTUNE_DIR
> +    NAMES amplxe-vars.sh
> +    PATHS ENV NUMA_ROOT
> +    HINTS $ENV{VTUNE_AMPLIFIER_XE_2016_DIR} $ENV{VTUNE_AMPLIFIER_XE_2015_DIR}
> +    DOC "Vtune root directory")
> +
> +set (VTUNE_INCLUDE_DIR ${VTUNE_DIR}/include)
> +set (VTUNE_LIBRARY_DIR ${VTUNE_DIR}/lib64)
> +
> +mark_as_advanced(VTUNE_DIR)
> +find_package_handle_standard_args(VTUNE REQUIRED_VARS VTUNE_DIR VTUNE_INCLUDE_DIR VTUNE_LIBRARY_DIR)
> diff -r 6563218ce342 -r 8325698f4662 source/profile/vtune/CMakeLists.txt
> --- a/source/profile/vtune/CMakeLists.txt	Mon Oct 26 12:13:53 2015 +0530
> +++ b/source/profile/vtune/CMakeLists.txt	Thu Oct 29 16:39:30 2015 +0530
> @@ -1,2 +1,2 @@
> -include_directories($ENV{VTUNE_AMPLIFIER_XE_2015_DIR}/include)
> +include_directories(${VTUNE_INCLUDE_DIR})
>  add_library(vtune vtune.h vtune.cpp ../cpuEvents.h)
> diff -r 6563218ce342 -r 8325698f4662 source/profile/vtune/vtune.cpp
> --- a/source/profile/vtune/vtune.cpp	Mon Oct 26 12:13:53 2015 +0530
> +++ b/source/profile/vtune/vtune.cpp	Thu Oct 29 16:39:30 2015 +0530
> @@ -30,7 +30,6 @@
>  const char *stringNames[] =
>  {
>  #include "../cpuEvents.h"
> -    ""
>  };
>  #undef CPU_EVENT
>  
> @@ -44,7 +43,8 @@
>  void vtuneInit()
>  {
>      domain = __itt_domain_create("x265");
> -    for (size_t i = 0; i < sizeof(stringNames) / sizeof(const char *); i++)
> +    size_t length = sizeof(stringNames) / sizeof(const char *);
> +    for (size_t i = 0; i < length; i++)
>          taskHandle[i] = __itt_string_handle_create(stringNames[i]);
>  }
>  
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel

-- 
Steve Borho


More information about the x265-devel mailing list