Move TRACETOOLS_LTTNG_ENABLED definition to config.h.in
Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
This commit is contained in:
parent
40092071e9
commit
c6b7a645e3
3 changed files with 11 additions and 7 deletions
|
@ -22,18 +22,20 @@ endif()
|
||||||
option(TRACETOOLS_DISABLED "Explicitly disable support for tracing with LTTng" ${DISABLED_DEFAULT})
|
option(TRACETOOLS_DISABLED "Explicitly disable support for tracing with LTTng" ${DISABLED_DEFAULT})
|
||||||
|
|
||||||
if(NOT TRACETOOLS_DISABLED)
|
if(NOT TRACETOOLS_DISABLED)
|
||||||
# Set TRACING_ENABLED if we can find lttng-ust
|
# Set TRACETOOLS_LTTNG_ENABLED if we can find lttng-ust
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
if(PkgConfig_FOUND)
|
if(PkgConfig_FOUND)
|
||||||
pkg_check_modules(LTTNG lttng-ust)
|
pkg_check_modules(LTTNG lttng-ust)
|
||||||
if(LTTNG_FOUND)
|
if(LTTNG_FOUND)
|
||||||
set(TRACING_ENABLED TRUE)
|
set(TRACETOOLS_LTTNG_ENABLED TRUE)
|
||||||
message("LTTng found: tracing enabled")
|
message("LTTng found: tracing enabled")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# store configuration variables for runtime use
|
# store configuration variables for runtime use
|
||||||
|
# TRACETOOLS_DISABLED
|
||||||
|
# TRACETOOLS_LTTNG_ENABLED
|
||||||
configure_file(include/${PROJECT_NAME}/config.h.in include/${PROJECT_NAME}/config.h)
|
configure_file(include/${PROJECT_NAME}/config.h.in include/${PROJECT_NAME}/config.h)
|
||||||
|
|
||||||
# add both source and output include, to capture config.h
|
# add both source and output include, to capture config.h
|
||||||
|
@ -44,7 +46,7 @@ set(SOURCES
|
||||||
src/tracetools.c
|
src/tracetools.c
|
||||||
src/utils.cpp
|
src/utils.cpp
|
||||||
)
|
)
|
||||||
if(TRACING_ENABLED)
|
if(TRACETOOLS_LTTNG_ENABLED)
|
||||||
list(APPEND SOURCES
|
list(APPEND SOURCES
|
||||||
include/tracetools/tp_call.h
|
include/tracetools/tp_call.h
|
||||||
src/tp_call.c
|
src/tp_call.c
|
||||||
|
@ -52,8 +54,7 @@ if(TRACING_ENABLED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(${PROJECT_NAME} ${SOURCES})
|
add_library(${PROJECT_NAME} ${SOURCES})
|
||||||
if(TRACING_ENABLED)
|
if(TRACETOOLS_LTTNG_ENABLED)
|
||||||
target_compile_definitions(${PROJECT_NAME} PUBLIC TRACETOOLS_LTTNG_ENABLED)
|
|
||||||
target_link_libraries(${PROJECT_NAME} ${LTTNG_LIBRARIES})
|
target_link_libraries(${PROJECT_NAME} ${LTTNG_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
@ -95,7 +96,7 @@ install(
|
||||||
)
|
)
|
||||||
|
|
||||||
ament_export_include_directories(include)
|
ament_export_include_directories(include)
|
||||||
if(TRACING_ENABLED)
|
if(TRACETOOLS_LTTNG_ENABLED)
|
||||||
ament_export_libraries(${PROJECT_NAME} ${LTTNG_LIBRARIES})
|
ament_export_libraries(${PROJECT_NAME} ${LTTNG_LIBRARIES})
|
||||||
else()
|
else()
|
||||||
ament_export_libraries(${PROJECT_NAME})
|
ament_export_libraries(${PROJECT_NAME})
|
||||||
|
@ -109,7 +110,7 @@ if(BUILD_TESTING)
|
||||||
ament_lint_auto_find_test_dependencies()
|
ament_lint_auto_find_test_dependencies()
|
||||||
|
|
||||||
# Only build tracetools utils tests if LTTng is enabled and found
|
# Only build tracetools utils tests if LTTng is enabled and found
|
||||||
if(TRACING_ENABLED)
|
if(TRACETOOLS_LTTNG_ENABLED)
|
||||||
ament_add_gtest(test_utils test/test_utils.cpp)
|
ament_add_gtest(test_utils test/test_utils.cpp)
|
||||||
if(TARGET test_utils)
|
if(TARGET test_utils)
|
||||||
target_link_libraries(test_utils ${PROJECT_NAME} -rdynamic)
|
target_link_libraries(test_utils ${PROJECT_NAME} -rdynamic)
|
||||||
|
|
|
@ -16,5 +16,6 @@
|
||||||
#define TRACETOOLS__CONFIG_H_
|
#define TRACETOOLS__CONFIG_H_
|
||||||
|
|
||||||
#cmakedefine TRACETOOLS_DISABLED
|
#cmakedefine TRACETOOLS_DISABLED
|
||||||
|
#cmakedefine TRACETOOLS_LTTNG_ENABLED
|
||||||
|
|
||||||
#endif // TRACETOOLS__CONFIG_H_
|
#endif // TRACETOOLS__CONFIG_H_
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
|
#include "tracetools/config.h"
|
||||||
|
|
||||||
#ifdef TRACETOOLS_LTTNG_ENABLED
|
#ifdef TRACETOOLS_LTTNG_ENABLED
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <cxxabi.h>
|
#include <cxxabi.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue