Skip to content

Commit

Permalink
Install the profiler in a version-safe manner (#170)
Browse files Browse the repository at this point in the history
This allows the script to be side-by-side installable.

Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Louise Poubel <[email protected]>

Co-authored-by: Steve Peters <[email protected]>
Co-authored-by: Louise Poubel <[email protected]>
  • Loading branch information
3 people authored Feb 20, 2021
1 parent df047cb commit 7510820
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
8 changes: 5 additions & 3 deletions profiler/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,17 @@ if(TARGET UNIT_Profiler_Remotery_TEST)
endif()

if(IGN_PROFILER_REMOTERY)
set(IGN_PROFILER_SCRIPT_PATH ${CMAKE_INSTALL_LIBDIR}/ignition/ignition-common${PROJECT_VERSION_MAJOR})
set(IGN_PROFILER_VIS_PATH ${IGN_DATA_INSTALL_DIR}/profiler_vis)

configure_file(Remotery/ign_remotery_vis.in
${CMAKE_CURRENT_BINARY_DIR}/ign_remotery_vis)
${CMAKE_CURRENT_BINARY_DIR}/ign_remotery_vis
@ONLY)

install(PROGRAMS
${CMAKE_CURRENT_BINARY_DIR}/ign_remotery_vis
DESTINATION bin)
DESTINATION ${IGN_PROFILER_SCRIPT_PATH})

install(DIRECTORY Remotery/vis/
DESTINATION ${IGN_DATA_INSTALL_DIR}/profiler_vis)
DESTINATION ${IGN_PROFILER_VIS_PATH})
endif()
13 changes: 12 additions & 1 deletion profiler/src/Remotery/ign_remotery_vis.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
#!/usr/bin/env bash

VIS_PATH=@CMAKE_INSTALL_PREFIX@/@IGN_PROFILER_VIS_PATH@/index.html
SCRIPT_PATH=@IGN_PROFILER_SCRIPT_PATH@/ign_remotery_vis
VIS_PATH=@IGN_PROFILER_VIS_PATH@/index.html

# Get the full path to this script
SCRIPT=`realpath $0`

# Strip the known script path off the end of the full path
INSTALL_ROOT=${SCRIPT%${SCRIPT_PATH}}

# Append the relative vis path
VIS_PATH=$INSTALL_ROOT/$VIS_PATH

# Open with a system web browser
if [ -x "$(command -v xdg-open)" ]; then
xdg-open $VIS_PATH
elif [ -x "$(command -v open)" ]; then
Expand Down
7 changes: 5 additions & 2 deletions tutorials/profiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,11 @@ From terminal 1:
From terminal 2, open the visualizer using one of the following commands

```{.sh}
# Use a launcher script (Linux and macOS)
ign_remotery_vis
# Find the launcher script and use it (Linux and macOS)
find /usr | grep ign_remotery_vis
...
/usr/<path_to>/ign_remotery_vis
# Use the source path (Linux)
# Substitute the path to your ign-common source checkout
Expand Down

0 comments on commit 7510820

Please sign in to comment.