|
| 1 | +# ---------------------------------------------------------------------------- |
| 2 | +# CMake file for Intel ITT API. See root CMakeLists.txt |
| 3 | +# |
| 4 | +# ---------------------------------------------------------------------------- |
| 5 | + |
| 6 | +if(NOT ITT_LIBRARY) |
| 7 | + set(ITT_LIBRARY "ittnotify") |
| 8 | +endif() |
| 9 | +project(${ITT_LIBRARY} C) |
| 10 | + |
| 11 | +if(NOT WIN32) |
| 12 | + include(CheckLibraryExists) |
| 13 | + if(COMMAND CHECK_LIBRARY_EXISTS) |
| 14 | + CHECK_LIBRARY_EXISTS(dl dlerror "" HAVE_DL_LIBRARY) |
| 15 | + endif() |
| 16 | +endif() |
| 17 | + |
| 18 | +ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include") |
| 19 | +set(ITT_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include") |
| 20 | + |
| 21 | +set(ITT_PUBLIC_HDRS |
| 22 | + include/ittnotify.h |
| 23 | + include/jitprofiling.h |
| 24 | + include/libittnotify.h |
| 25 | + include/llvm_jit_event_listener.hpp |
| 26 | +) |
| 27 | +set(ITT_PRIVATE_HDRS |
| 28 | + src/ittnotify/disable_warnings.h |
| 29 | + src/ittnotify/ittnotify_config.h |
| 30 | + src/ittnotify/ittnotify_static.h |
| 31 | + src/ittnotify/ittnotify_types.h |
| 32 | +) |
| 33 | +set(ITT_SRCS |
| 34 | + src/ittnotify/ittnotify_static.c |
| 35 | + src/ittnotify/jitprofiling.c |
| 36 | +) |
| 37 | + |
| 38 | +add_library(${ITT_LIBRARY} STATIC ${ITT_SRCS} ${ITT_PUBLIC_HDRS} ${ITT_PRIVATE_HDRS}) |
| 39 | + |
| 40 | +if(NOT WIN32) |
| 41 | + if(HAVE_DL_LIBRARY) |
| 42 | + target_link_libraries(${ITT_LIBRARY} dl) |
| 43 | + endif() |
| 44 | +endif() |
| 45 | + |
| 46 | +if(UNIX) |
| 47 | + if(CMAKE_COMPILER_IS_GNUCXX OR CV_ICC) |
| 48 | + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") |
| 49 | + endif() |
| 50 | +endif() |
| 51 | + |
| 52 | +set_target_properties(${ITT_LIBRARY} PROPERTIES |
| 53 | + OUTPUT_NAME ${ITT_LIBRARY} |
| 54 | + DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" |
| 55 | + COMPILE_PDB_NAME ${ITT_LIBRARY} |
| 56 | + COMPILE_PDB_NAME_DEBUG "${ITT_LIBRARY}${OPENCV_DEBUG_POSTFIX}" |
| 57 | + ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH} |
| 58 | + ) |
| 59 | + |
| 60 | +ocv_warnings_disable(CMAKE_C_FLAGS -Wundef -Wsign-compare) |
| 61 | + |
| 62 | +if(ENABLE_SOLUTION_FOLDERS) |
| 63 | + set_target_properties(${ITT_LIBRARY} PROPERTIES FOLDER "3rdparty") |
| 64 | +endif() |
| 65 | + |
| 66 | +if(NOT BUILD_SHARED_LIBS) |
| 67 | + ocv_install_target(${ITT_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev) |
| 68 | +endif() |
0 commit comments