CMakeLists.txt 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # ----------------------------------------------------------------------------
  2. # CMake file for Intel ITT API. See root CMakeLists.txt
  3. #
  4. # ----------------------------------------------------------------------------
  5. if(NOT ITT_LIBRARY)
  6. set(ITT_LIBRARY "ittnotify")
  7. endif()
  8. project(${ITT_LIBRARY} C)
  9. if(NOT WIN32)
  10. include(CheckLibraryExists)
  11. if(COMMAND CHECK_LIBRARY_EXISTS)
  12. CHECK_LIBRARY_EXISTS(dl dlerror "" HAVE_DL_LIBRARY)
  13. endif()
  14. endif()
  15. ocv_warnings_disable(CMAKE_C_FLAGS -Wimplicit-fallthrough)
  16. ocv_include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")
  17. set(ITT_INCLUDE_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include")
  18. set(ITT_PUBLIC_HDRS
  19. include/ittnotify.h
  20. include/jitprofiling.h
  21. include/libittnotify.h
  22. )
  23. set(ITT_PRIVATE_HDRS
  24. src/ittnotify/disable_warnings.h
  25. src/ittnotify/ittnotify_config.h
  26. src/ittnotify/ittnotify_static.h
  27. src/ittnotify/ittnotify_types.h
  28. )
  29. set(ITT_SRCS
  30. src/ittnotify/ittnotify_static.c
  31. src/ittnotify/jitprofiling.c
  32. )
  33. add_library(${ITT_LIBRARY} STATIC ${OPENCV_3RDPARTY_EXCLUDE_FROM_ALL} ${ITT_SRCS} ${ITT_PUBLIC_HDRS} ${ITT_PRIVATE_HDRS})
  34. file(STRINGS "src/ittnotify/ittnotify_config.h" API_VERSION_NUM REGEX "#define\[ \t]+API_VERSION_NUM[ \t]+([0-9\.]+)")
  35. if(API_VERSION_NUM MATCHES "#define\[ \t]+API_VERSION_NUM[ \t]+([0-9\.]*)")
  36. set(ITTNOTIFY_VERSION "${CMAKE_MATCH_1}" CACHE INTERNAL "" FORCE)
  37. endif()
  38. if(NOT WIN32)
  39. if(HAVE_DL_LIBRARY)
  40. target_link_libraries(${ITT_LIBRARY} dl)
  41. endif()
  42. endif()
  43. set_target_properties(${ITT_LIBRARY} PROPERTIES
  44. OUTPUT_NAME ${ITT_LIBRARY}
  45. DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
  46. COMPILE_PDB_NAME ${ITT_LIBRARY}
  47. COMPILE_PDB_NAME_DEBUG "${ITT_LIBRARY}${OPENCV_DEBUG_POSTFIX}"
  48. ARCHIVE_OUTPUT_DIRECTORY ${3P_LIBRARY_OUTPUT_PATH}
  49. )
  50. ocv_warnings_disable(CMAKE_C_FLAGS -Wundef -Wsign-compare)
  51. ocv_warnings_disable(CMAKE_C_FLAGS -Wstrict-prototypes) # clang15
  52. if(ENABLE_SOLUTION_FOLDERS)
  53. set_target_properties(${ITT_LIBRARY} PROPERTIES FOLDER "3rdparty")
  54. endif()
  55. if(NOT BUILD_SHARED_LIBS)
  56. ocv_install_target(${ITT_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev OPTIONAL)
  57. endif()
  58. ocv_install_3rdparty_licenses(ittnotify src/ittnotify/BSD-3-Clause.txt src/ittnotify/GPL-2.0-only.txt)