Merge branch '69-only-include-select-headers' into 'master'

Only include headers that we actually use and need

Closes #69

See merge request micro-ROS/ros_tracing/ros2_tracing!144
This commit is contained in:
Christophe Bedard 2020-03-01 03:20:23 +00:00
commit ee114b660c

View file

@ -33,26 +33,45 @@ if(NOT TRACETOOLS_DISABLED)
endif() endif()
endif() endif()
# store configuration variables for runtime use # Store configuration variables for runtime use
# TRACETOOLS_DISABLED # TRACETOOLS_DISABLED
# TRACETOOLS_LTTNG_ENABLED # 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
include_directories(include ${PROJECT_BINARY_DIR}/include)
# Tracetools lib # Tracetools lib
set(SOURCES set(SOURCES
src/tracetools.c src/tracetools.c
src/utils.cpp src/utils.cpp
) )
set(HEADERS
include/${PROJECT_NAME}/tracetools.h
include/${PROJECT_NAME}/utils.hpp
include/${PROJECT_NAME}/visibility_control.hpp
)
if(TRACETOOLS_LTTNG_ENABLED) if(TRACETOOLS_LTTNG_ENABLED)
# We only need these if we're using LTTng
list(APPEND SOURCES list(APPEND SOURCES
include/tracetools/tp_call.h
src/tp_call.c src/tp_call.c
) )
list(APPEND HEADERS
include/${PROJECT_NAME}/tp_call.h
)
endif() endif()
# Copy select headers to the actual include/ directory that we will use and export
foreach(_header ${HEADERS})
configure_file(
${PROJECT_SOURCE_DIR}/${_header}
${PROJECT_BINARY_DIR}/${_header}
COPYONLY
)
endforeach()
# Only use output/binary include directory
include_directories(
${PROJECT_BINARY_DIR}/include
)
add_library(${PROJECT_NAME} ${SOURCES}) add_library(${PROJECT_NAME} ${SOURCES})
if(TRACETOOLS_LTTNG_ENABLED) if(TRACETOOLS_LTTNG_ENABLED)
target_link_libraries(${PROJECT_NAME} ${LTTNG_LIBRARIES}) target_link_libraries(${PROJECT_NAME} ${LTTNG_LIBRARIES})
@ -79,12 +98,8 @@ install(TARGETS
) )
install( install(
DIRECTORY include/ DIRECTORY ${PROJECT_BINARY_DIR}/include/
DESTINATION include DESTINATION include/
)
install(
FILES ${PROJECT_BINARY_DIR}/include/${PROJECT_NAME}/config.h
DESTINATION include/${PROJECT_NAME}
) )
install( install(
TARGETS ${PROJECT_NAME} TARGETS ${PROJECT_NAME}