Skip to content

Commit

Permalink
Model command structure update
Browse files Browse the repository at this point in the history
Signed-off-by: Marcos Wagner <[email protected]>
  • Loading branch information
WagnerMarcos committed Jul 20, 2021
1 parent 9796606 commit 2f8d28c
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 105 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,7 @@ set(IGNITION_GAZEBO_GUI_PLUGIN_INSTALL_DIR
#============================================================================
# Configure the build
#============================================================================
ign_configure_build(QUIT_IF_BUILD_ERRORS
COMPONENTS model
)
ign_configure_build(QUIT_IF_BUILD_ERRORS)

add_subdirectory(examples)

Expand Down
40 changes: 0 additions & 40 deletions model/src/CMakeLists.txt

This file was deleted.

58 changes: 0 additions & 58 deletions model/src/cmd/CMakeLists.txt

This file was deleted.

2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ 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)
target_link_libraries(${ign_lib_target}
PRIVATE
Expand Down Expand Up @@ -59,6 +60,7 @@ set (sources
Util.cc
View.cc
World.cc
cmd/ModelCommandAPI.cc
${PROTO_PRIVATE_SRC}
${network_sources}
)
Expand Down
File renamed without changes.
59 changes: 59 additions & 0 deletions src/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,38 @@ install( FILES
DESTINATION
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/ignition/)

#===============================================================================
# Used for the installed model command version.
# Generate the ruby script that gets installed.
# Note that the major version of the library is included in the name.
set(cmd_model_script_generated "${CMAKE_CURRENT_BINARY_DIR}/cmdmodel${PROJECT_VERSION_MAJOR}.rb")
set(cmd_model_script_configured "${cmd_model_script_generated}.configured")

# Set the model_library_location variable to the relative path to the library file
# within the install directory structure.
set(model_library_location "../../../${CMAKE_INSTALL_LIBDIR}/$<TARGET_FILE_NAME:${model_lib_target}>")

configure_file(
"cmdmodel.rb.in"
"${cmd_model_script_configured}"
@ONLY)
file(GENERATE
OUTPUT "${cmd_model_script_generated}"
INPUT "${cmd_model_script_configured}")

install(FILES ${cmd_model_script_generated} DESTINATION lib/ruby/ignition)

# Used for the installed version.
set(ign_model_ruby_path "${CMAKE_INSTALL_PREFIX}/lib/ruby/ignition/cmdmodel${PROJECT_VERSION_MAJOR}")

set(ignmodel_configured "${CMAKE_CURRENT_BINARY_DIR}/ignmodel${PROJECT_VERSION_MAJOR}.yaml")
configure_file(
"ignmodel.yaml.in"
${ignmodel_configured})

install(FILES ${ignmodel_configured} DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/ignition/)


#===============================================================================
# Generate the ruby script for internal testing.
# Note that the major version of the library is included in the name.
Expand Down Expand Up @@ -66,3 +98,30 @@ set(ign_library_path
configure_file(
"${IGN_DESIGNATION}.yaml.in"
"${CMAKE_BINARY_DIR}/test/conf/${IGN_DESIGNATION}${PROJECT_VERSION_MAJOR}.yaml" @ONLY)

#===============================================================================
# Generate the ruby script for internal testing.
# Note that the major version of the library is included in the name.
set(cmd_model_ruby_test_dir "${CMAKE_BINARY_DIR}/model/test/lib/ruby/ignition")
set(cmd_model_script_generated_test "${cmd_model_ruby_test_dir}/cmdmodel${PROJECT_VERSION_MAJOR}.rb")
set(cmd_model_script_configured_test "${cmd_model_script_generated_test}.configured")

# Set the model_library_location variable to the full path of the library file
# within the build directory
set(model_library_location "$<TARGET_FILE:${model_lib_target}>")

configure_file(
"cmdmodel.rb.in"
"${cmd_model_script_configured_test}"
@ONLY)

file(GENERATE
OUTPUT "${cmd_model_script_generated_test}"
INPUT "${cmd_model_script_configured_test}")

# Used for internal testing.
set(ign_model_ruby_path "${cmd_model_script_generated_test}")

configure_file(
"ignmodel.yaml.in"
"${cmd_model_ruby_test_dir}/ignmodel${PROJECT_VERSION_MAJOR}.yaml")
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions model/src/cmd/cmdmodel.rb.in → src/cmd/cmdmodel.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Cmd

opt_parser = OptionParser.new do |opts|
opts.banner = usage

opts.on('-h', '--help') do
puts usage
exit
Expand Down Expand Up @@ -124,8 +124,8 @@ class Cmd

options
end # parse()


def execute(args)
options = parse(args)

Expand Down Expand Up @@ -159,7 +159,7 @@ class Cmd

Importer.cmdModelInfo(options['model'], options['pose'], options['link'],
options['link_name'], options['joint'], options['joint_name'])
else
else
puts 'Command error: I do not have an implementation for '\
"command [ign #{options['command']}]."
end
Expand Down
File renamed without changes.

0 comments on commit 2f8d28c

Please sign in to comment.