Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Commit

Permalink
Support both ITT library names variants
Browse files Browse the repository at this point in the history
Fixes: #338

ITT name variants:
* SEAPI uses libittnotify${arch}.so
* VTUne uses libittnotify.so
This change checks for both names.

Signed-off-by: Dmitry Rogozhkin <[email protected]>
  • Loading branch information
dvrogozh authored and Oleg Nabiullin committed Jun 27, 2018
1 parent 206b451 commit 4cd832d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
25 changes: 23 additions & 2 deletions builder/FindITT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,47 @@ if( ENABLE_ITT )
set( CMAKE_VTUNE_HOME /opt/intel/vtune_amplifier )
endif()

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set( arch "64" )
else()
set( arch "32" )
endif()

find_path( ITT_INCLUDE_DIRS ittnotify.h
PATHS ${CMAKE_ITT_HOME} ${CMAKE_VTUNE_HOME}
PATH_SUFFIXES include )
find_path( ITT_LIBRARY_DIRS libittnotify.a

# Unfortunately SEAPI and VTune uses different names for itt library:
# * SEAPI uses libittnotify${arch}.a
# * VTune uses libittnotify.a
# We are trying to check both giving preference to SEAPI name.
find_path( ITT_LIBRARY_DIRS libittnotify${arch}.a
PATHS ${CMAKE_ITT_HOME} ${CMAKE_VTUNE_HOME}
PATH_SUFFIXES lib64 )
if( NOT ITT_LIBRARY_DIRS MATCHES NOTFOUND )
set( ITT_LIBRARIES "ittnotify${arch}" )
else()
find_path( ITT_LIBRARY_DIRS libittnotify.a
PATHS ${CMAKE_ITT_HOME} ${CMAKE_VTUNE_HOME}
PATH_SUFFIXES lib64 )
if( NOT ITT_LIBRARY_PATH MATCHES NOTFOUND )
set( ITT_LIBRARIES "ittnotify" )
endif()
endif()

if(NOT ITT_INCLUDE_DIRS MATCHES NOTFOUND AND
NOT ITT_LIBRARY_DIRS MATCHES NOTFOUND)

message( STATUS "itt header is in ${ITT_INCLUDE_DIRS}" )
message( STATUS "itt lib is in ${ITT_LIBRARY_DIRS}" )
message( STATUS "itt lib name is ${ITT_LIBRARIES}" )

include_directories( ${ITT_INCLUDE_DIRS} )
link_directories( ${ITT_LIBRARY_DIRS} )

set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMFX_TRACE_ENABLE_ITT" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMFX_TRACE_ENABLE_ITT" )

set( ITT_LIBRARIES "ittnotify" )
set( ITT_FOUND TRUE )
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion builder/FindPackages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function(configure_itt_target target)

set(SCOPE_CFLAGS ${SCOPE_CFLAGS} PARENT_SCOPE)
set(SCOPE_LINKFLAGS ${SCOPE_LINKFLAGS} PARENT_SCOPE)
set(SCOPE_LIBS ${SCOPE_LIBS} ittnotify PARENT_SCOPE)
set(SCOPE_LIBS ${SCOPE_LIBS} ${ITT_LIBRARIES} PARENT_SCOPE)
endfunction()


Expand Down

0 comments on commit 4cd832d

Please sign in to comment.