Skip to content

Commit

Permalink
Refs #20543: Fix example test run without THIRDPARTY flags
Browse files Browse the repository at this point in the history
Signed-off-by: JesusPoderoso <[email protected]>
  • Loading branch information
JesusPoderoso committed Apr 2, 2024
1 parent 3e0bfc2 commit 46cefef
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
9 changes: 9 additions & 0 deletions test/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ endif()
set(FILE_EXTENSION "")
set(DOCKER_IMAGE_NAME "")
set(SHELL_EXECUTABLE "")
set(TINYXML2_LIB_DIR_COMPOSE_VOLUME "")
set(TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH "")

# Linux configurations
if(UNIX AND NOT(APPLE) AND NOT(QNXNTO) AND NOT(ANDROID))
Expand Down Expand Up @@ -56,6 +58,13 @@ else()
message(FATAL_ERROR "Unsupported platform")
endif()

# Configure TinyXML2 library path if installed in user library path
if(NOT (TINYXML2_FROM_SOURCE OR TINYXML2_FROM_THIRDPARTY))
get_filename_component(TINYXML2_LIB_DIR ${TINYXML2_LIBRARY} DIRECTORY)
set(TINYXML2_LIB_DIR_COMPOSE_VOLUME "- ${TINYXML2_LIB_DIR}:${TINYXML2_LIB_DIR}")
set(TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH ":${TINYXML2_LIB_DIR}")
endif()

# Find all docker compose yml files for testing
file(GLOB files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.yml)

Expand Down
6 changes: 4 additions & 2 deletions test/examples/basic_configuration.compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ services:
volumes:
- @PROJECT_BINARY_DIR@:@PROJECT_BINARY_DIR@
- @fastcdr_LIB_DIR@:@fastcdr_LIB_DIR@
@TINYXML2_LIB_DIR_COMPOSE_VOLUME@
environment:
# TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows
LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@
LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@
EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/dds/BasicConfigurationExample
command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/BasicConfigurationExample@FILE_EXTENSION@ publisher --wait 2 --samples 10 --interval 10 --reliable --transient & $${EXAMPLE_DIR}/BasicConfigurationExample@FILE_EXTENSION@ subscriber --samples 10 --reliable --transient"

Expand All @@ -18,8 +19,9 @@ services:
volumes:
- @PROJECT_BINARY_DIR@:@PROJECT_BINARY_DIR@
- @fastcdr_LIB_DIR@:@fastcdr_LIB_DIR@
@TINYXML2_LIB_DIR_COMPOSE_VOLUME@
environment:
# TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows
LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@
LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@
EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/dds/BasicConfigurationExample@FILE_EXTENSION@
command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/BasicConfigurationExample@FILE_EXTENSION@ subscriber --samples 10 --reliable --transient"
6 changes: 4 additions & 2 deletions test/examples/hello_world.compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ services:
volumes:
- @PROJECT_BINARY_DIR@:@PROJECT_BINARY_DIR@
- @fastcdr_LIB_DIR@:@fastcdr_LIB_DIR@
@TINYXML2_LIB_DIR_COMPOSE_VOLUME@
environment:
# TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows
LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@
LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@
EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/hello_world@FILE_EXTENSION@
FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/hello_world/hello_world_profile.xml
command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ subscriber --waitset --samples 10"
Expand All @@ -19,9 +20,10 @@ services:
volumes:
- @PROJECT_BINARY_DIR@:@PROJECT_BINARY_DIR@
- @fastcdr_LIB_DIR@:@fastcdr_LIB_DIR@
@TINYXML2_LIB_DIR_COMPOSE_VOLUME@
environment:
# TODO(eduponz): LD_LIBRARY_PATH is not the correct variable for Windows
LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@
LD_LIBRARY_PATH: @PROJECT_BINARY_DIR@/src/cpp:@fastcdr_LIB_DIR@@TINYXML2_LIB_DIR_COMPOSE_LD_LIBRARY_PATH@
EXAMPLE_DIR: @PROJECT_BINARY_DIR@/examples/cpp/hello_world
FASTDDS_DEFAULT_PROFILES_FILE: @PROJECT_BINARY_DIR@/examples/cpp/hello_world/hello_world_profile.xml
command: @SHELL_EXECUTABLE@ -c "$${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ subscriber --samples 10 & $${EXAMPLE_DIR}/hello_world@FILE_EXTENSION@ publisher --samples 10"
Expand Down

0 comments on commit 46cefef

Please sign in to comment.