Skip to content

Commit

Permalink
Suggestions to model CLI (#893) (#928)
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
Signed-off-by: Franco Cipollone <[email protected]>

Co-authored-by: Franco Cipollone <[email protected]>
  • Loading branch information
chapulina and francocipollone committed Jul 23, 2021
1 parent 937bb61 commit b907c86
Show file tree
Hide file tree
Showing 9 changed files with 332 additions and 327 deletions.
32 changes: 18 additions & 14 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ set(gui_sources
PARENT_SCOPE
)

ign_add_component(model SOURCES cmd/ModelCommandAPI.cc GET_TARGET_NAME model_lib_target)
ign_add_component(ign SOURCES ign.cc GET_TARGET_NAME ign_lib_target)
ign_add_component(ign
SOURCES
ign.cc
cmd/ModelCommandAPI.cc
GET_TARGET_NAME ign_lib_target)
target_link_libraries(${ign_lib_target}
PRIVATE
${PROJECT_LIBRARY_TARGET_NAME}
Expand Down Expand Up @@ -137,7 +140,14 @@ ign_build_tests(TYPE UNIT
ignition-gazebo${PROJECT_VERSION_MAJOR}
)

if(TARGET UNIT_ign_TEST)
# Command line tests need extra settings
foreach(CMD_TEST
UNIT_ign_TEST
UNIT_ModelCommandAPI_TEST)

if(NOT TARGET ${CMD_TEST})
continue()
endif()

# Running `ign gazebo` on macOS has problems when run with /usr/bin/ruby
# due to System Integrity Protection (SIP). Try to find ruby from
Expand All @@ -146,33 +156,27 @@ if(TARGET UNIT_ign_TEST)
find_program(BREW_RUBY ruby HINTS /usr/local/opt/ruby/bin)
endif()

add_dependencies(UNIT_ign_TEST
add_dependencies(${CMD_TEST}
${ign_lib_target}
TestModelSystem
TestSensorSystem
TestWorldSystem
)

target_compile_definitions(UNIT_ign_TEST PRIVATE
target_compile_definitions(${CMD_TEST} PRIVATE
"BREW_RUBY=\"${BREW_RUBY} \"")

target_compile_definitions(UNIT_ign_TEST PRIVATE
target_compile_definitions(${CMD_TEST} PRIVATE
"IGN_PATH=\"${IGNITION-TOOLS_BINARY_DIRS}\"")

set(_env_vars)
list(APPEND _env_vars "IGN_CONFIG_PATH=${CMAKE_BINARY_DIR}/test/conf")
list(APPEND _env_vars "IGN_GAZEBO_SYSTEM_PLUGIN_PATH=$<TARGET_FILE_DIR:TestModelSystem>")

set_tests_properties(UNIT_ign_TEST PROPERTIES
set_tests_properties(${CMD_TEST} PROPERTIES
ENVIRONMENT "${_env_vars}")
endif()

if(TARGET UNIT_ModelCommandAPI_TEST)

target_compile_definitions(UNIT_ModelCommandAPI_TEST PRIVATE
"IGN_PATH=\"${IGNITION-TOOLS_BINARY_DIRS}\"")

endif()
endforeach()

if(NOT WIN32)
add_subdirectory(cmd)
Expand Down
Loading

0 comments on commit b907c86

Please sign in to comment.