summaryrefslogtreecommitdiffstats
path: root/src/ceph/cmake/modules/FindLTTngUST.cmake
diff options
context:
space:
mode:
authorQiaowei Ren <qiaowei.ren@intel.com>2018-01-04 13:43:33 +0800
committerQiaowei Ren <qiaowei.ren@intel.com>2018-01-05 11:59:39 +0800
commit812ff6ca9fcd3e629e49d4328905f33eee8ca3f5 (patch)
tree04ece7b4da00d9d2f98093774594f4057ae561d4 /src/ceph/cmake/modules/FindLTTngUST.cmake
parent15280273faafb77777eab341909a3f495cf248d9 (diff)
initial code repo
This patch creates initial code repo. For ceph, luminous stable release will be used for base code, and next changes and optimization for ceph will be added to it. For opensds, currently any changes can be upstreamed into original opensds repo (https://github.com/opensds/opensds), and so stor4nfv will directly clone opensds code to deploy stor4nfv environment. And the scripts for deployment based on ceph and opensds will be put into 'ci' directory. Change-Id: I46a32218884c75dda2936337604ff03c554648e4 Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
Diffstat (limited to 'src/ceph/cmake/modules/FindLTTngUST.cmake')
-rw-r--r--src/ceph/cmake/modules/FindLTTngUST.cmake111
1 files changed, 111 insertions, 0 deletions
diff --git a/src/ceph/cmake/modules/FindLTTngUST.cmake b/src/ceph/cmake/modules/FindLTTngUST.cmake
new file mode 100644
index 0000000..ac8f14c
--- /dev/null
+++ b/src/ceph/cmake/modules/FindLTTngUST.cmake
@@ -0,0 +1,111 @@
+#.rst:
+# FindLTTngUST
+# ------------
+#
+# This module finds the `LTTng-UST <http://lttng.org/>`__ library.
+#
+# Imported target
+# ^^^^^^^^^^^^^^^
+#
+# This module defines the following :prop_tgt:`IMPORTED` target:
+#
+# ``LTTng::UST``
+# The LTTng-UST library, if found
+#
+# Result variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module sets the following
+#
+# ``LTTNGUST_FOUND``
+# ``TRUE`` if system has LTTng-UST
+# ``LTTNGUST_INCLUDE_DIRS``
+# The LTTng-UST include directories
+# ``LTTNGUST_LIBRARIES``
+# The libraries needed to use LTTng-UST
+# ``LTTNGUST_VERSION_STRING``
+# The LTTng-UST version
+# ``LTTNGUST_HAS_TRACEF``
+# ``TRUE`` if the ``tracef()`` API is available in the system's LTTng-UST
+# ``LTTNGUST_HAS_TRACELOG``
+# ``TRUE`` if the ``tracelog()`` API is available in the system's LTTng-UST
+
+#=============================================================================
+# Copyright 2016 Kitware, Inc.
+# Copyright 2016 Philippe Proulx <pproulx@efficios.com>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+find_path(LTTNGUST_INCLUDE_DIRS NAMES lttng/tracepoint.h)
+find_library(LTTNGUST_LIBRARIES NAMES lttng-ust)
+
+if(LTTNGUST_INCLUDE_DIRS AND LTTNGUST_LIBRARIES)
+ # find tracef() and tracelog() support
+ set(LTTNGUST_HAS_TRACEF 0)
+ set(LTTNGUST_HAS_TRACELOG 0)
+
+ if(EXISTS "${LTTNGUST_INCLUDE_DIRS}/lttng/tracef.h")
+ set(LTTNGUST_HAS_TRACEF TRUE)
+ endif()
+
+ if(EXISTS "${LTTNGUST_INCLUDE_DIRS}/lttng/tracelog.h")
+ set(LTTNGUST_HAS_TRACELOG TRUE)
+ endif()
+
+ # get version
+ set(lttngust_version_file "${LTTNGUST_INCLUDE_DIRS}/lttng/ust-version.h")
+
+ if(EXISTS "${lttngust_version_file}")
+ file(STRINGS "${lttngust_version_file}" lttngust_version_major_string
+ REGEX "^[\t ]*#define[\t ]+LTTNG_UST_MAJOR_VERSION[\t ]+[0-9]+[\t ]*$")
+ file(STRINGS "${lttngust_version_file}" lttngust_version_minor_string
+ REGEX "^[\t ]*#define[\t ]+LTTNG_UST_MINOR_VERSION[\t ]+[0-9]+[\t ]*$")
+ file(STRINGS "${lttngust_version_file}" lttngust_version_patch_string
+ REGEX "^[\t ]*#define[\t ]+LTTNG_UST_PATCHLEVEL_VERSION[\t ]+[0-9]+[\t ]*$")
+ string(REGEX REPLACE ".*([0-9]+).*" "\\1"
+ lttngust_v_major "${lttngust_version_major_string}")
+ string(REGEX REPLACE ".*([0-9]+).*" "\\1"
+ lttngust_v_minor "${lttngust_version_minor_string}")
+ string(REGEX REPLACE ".*([0-9]+).*" "\\1"
+ lttngust_v_patch "${lttngust_version_patch_string}")
+ set(LTTNGUST_VERSION_STRING
+ "${lttngust_v_major}.${lttngust_v_minor}.${lttngust_v_patch}")
+ unset(lttngust_version_major_string)
+ unset(lttngust_version_minor_string)
+ unset(lttngust_version_patch_string)
+ unset(lttngust_v_major)
+ unset(lttngust_v_minor)
+ unset(lttngust_v_patch)
+ endif()
+
+ unset(lttngust_version_file)
+
+ if(NOT TARGET LTTng::UST)
+ add_library(LTTng::UST UNKNOWN IMPORTED)
+ set_target_properties(LTTng::UST PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${LTTNGUST_INCLUDE_DIRS}"
+ INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS}
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ IMPORTED_LOCATION "${LTTNGUST_LIBRARIES}")
+ endif()
+
+ # add libdl to required libraries
+ set(LTTNGUST_LIBRARIES ${LTTNGUST_LIBRARIES} ${CMAKE_DL_LIBS})
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set LTTNGUST_FOUND to
+# TRUE if all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(LTTngUST FOUND_VAR LTTNGUST_FOUND
+ REQUIRED_VARS LTTNGUST_LIBRARIES
+ LTTNGUST_INCLUDE_DIRS
+ VERSION_VAR LTTNGUST_VERSION_STRING)
+mark_as_advanced(LTTNGUST_LIBRARIES LTTNGUST_INCLUDE_DIRS)