Files
openvino/cmake/debug.cmake

74 lines
2.3 KiB
CMake
Raw Normal View History

2020-02-11 22:48:49 +03:00
# Copyright (C) 2018-2020 Intel Corporation
2018-10-16 13:45:03 +03:00
# SPDX-License-Identifier: Apache-2.0
#
function (debug_message)
if (VERBOSE_BUILD)
message(${ARGV})
endif()
endfunction()
function(clean_message type)
string (REPLACE ";" "" output_string "${ARGN}")
execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${output_string}")
if(${ARGV0} STREQUAL "FATAL_ERROR")
message (FATAL_ERROR)
endif()
endfunction()
file(REMOVE ${CMAKE_BINARY_DIR}/ld_library_rpath_64.txt)
# log relative path to shared library that has to be used in LD_LIBRARY_PATH
function (log_rpath_remove_top component component_remove_top lib lib_remove_top)
set(top_lib_dir ${${component}})
set(lib_dir ${lib})
# debug_message(STATUS "LIB-IN=${lib} ")
# debug_message(STATUS "TOPLIB-IN=${top_lib_dir} ")
2020-02-11 22:48:49 +03:00
get_filename_component(top_lib_dir "${${component}}" DIRECTORY)
2018-10-16 13:45:03 +03:00
if (${component_remove_top} AND ${component})
else()
2020-02-11 22:48:49 +03:00
get_filename_component(add_name "${${component}}" NAME)
2018-10-16 13:45:03 +03:00
set(top_lib_dir "${top_lib_dir}/${add_name}")
endif()
if (${lib_remove_top} AND lib)
get_filename_component(lib_dir ${lib} DIRECTORY)
endif()
string (REPLACE "//" "/" top_lib_dir "${top_lib_dir}")
string (REPLACE "//" "/" lib_dir "${lib_dir}")
string (REPLACE "\\\\" "/" top_lib_dir "${top_lib_dir}")
string (REPLACE "\\\\" "/" lib_dir "${lib_dir}")
# debug_message(STATUS "LIB-OUT=${lib_dir}")
# debug_message(STATUS "TOPLIB-OUT=${top_lib_dir}")
2019-08-09 19:02:42 +03:00
if (WIN32)
string (TOLOWER "${top_lib_dir}" top_lib_dir)
string (TOLOWER "${lib_dir}" lib_dir)
endif()
2018-10-16 13:45:03 +03:00
string (REPLACE "${top_lib_dir}" "" component_dir "${lib_dir}")
set(RPATH_INFO "${component}=${component_dir}")
debug_message(STATUS "LD_LIBRARY_RPATH: ${RPATH_INFO}")
file(APPEND ${CMAKE_BINARY_DIR}/ld_library_rpath_64.txt "${RPATH_INFO}\n")
endfunction()
function (log_rpath_from_dir component lib_dir)
2019-08-09 19:02:42 +03:00
log_rpath_remove_top("${component}" TRUE "${lib_dir}" FALSE)
2018-10-16 13:45:03 +03:00
endfunction()
function (log_rpath component lib_path)
log_rpath_remove_top(${component} TRUE ${lib_path} TRUE)
endfunction()
# Just wrapping of the original message() function to make this macro known during IE build.
# This macro is redefined (with additional checks) within the InferenceEngineConfig.cmake file.
macro(ext_message TRACE_LEVEL)
message(${TRACE_LEVEL} "${ARGN}")
2020-02-11 22:48:49 +03:00
endmacro()