-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Simpler and standard build workflow * Utilize CTest with the recommended workflow of optional tests * Skip using make directly so these become more platform portable * Skip having to manually create the build directory * Do all operations from the source directory when possible to reduce the number of commands Signed-off-by: Ryan Friedman <[email protected]>
- Loading branch information
Showing
9 changed files
with
146 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,33 @@ | ||
Example program to generate performance data | ||
|
||
### Build | ||
## Build Instructions | ||
|
||
cd examples/standalong/each_performance | ||
mkdir build | ||
cd build | ||
cmake .. | ||
make | ||
From this directory, run the following to compile: | ||
|
||
```bash | ||
cmake -B build | ||
cmake --build build | ||
``` | ||
|
||
### Run | ||
|
||
./each | ||
```bash | ||
cd build | ||
./each | ||
``` | ||
|
||
This will generate `./build/each.data` which is the performance data. | ||
|
||
### Generate and view plots | ||
|
||
One the above program is complete, generate the plots. | ||
|
||
```bash | ||
cd build | ||
# Generate plots | ||
gnuplot -e "filename='each.data'" ../each.gp | ||
eog *.png | ||
``` | ||
|
||
### Generate and view plot | ||
You can now scroll through two plots to view performance data. | ||
|
||
gnuplot -e "filename='each.data'" ../each.gp | ||
eog *.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,33 @@ | ||
cmake_minimum_required(VERSION 3.11.0 FATAL_ERROR) | ||
cmake_minimum_required(VERSION 3.16 FATAL_ERROR) | ||
|
||
project(GTestSetup) | ||
|
||
# Find Gazebo | ||
find_package(gz-sim8 REQUIRED) | ||
set(GZ_SIM_VER ${gz-sim8_VERSION_MAJOR}) | ||
|
||
# Fetch and configure GTest | ||
include(FetchContent) | ||
FetchContent_Declare( | ||
googletest | ||
# Version 1.14. Use commit hash to prevent tag relocation | ||
URL https://github.com/google/googletest/archive/f8d7d77c06936315286eb55f8de22cd23c188571.zip | ||
) | ||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) | ||
FetchContent_MakeAvailable(googletest) | ||
find_package(GTest REQUIRED) | ||
if(NOT TARGET GTest::gtest_main AND TARGET gtest_main) | ||
add_library(GTest::gtest_main ALIAS gtest_main) | ||
endif() | ||
|
||
enable_testing() | ||
include(Dart) | ||
include(CTest) | ||
# CTest defines "BUILD_TESTING" so that users can easily disable tests in a common way. | ||
if(BUILD_TESTING) | ||
# Generate tests | ||
foreach(TEST_TARGET | ||
command_TEST | ||
gravity_TEST) | ||
|
||
# Generate tests | ||
foreach(TEST_TARGET | ||
command_TEST | ||
gravity_TEST) | ||
|
||
add_executable( | ||
${TEST_TARGET} | ||
${TEST_TARGET}.cc | ||
) | ||
target_link_libraries(${TEST_TARGET} | ||
gtest_main | ||
gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER} | ||
) | ||
include(GoogleTest) | ||
gtest_discover_tests(${TEST_TARGET}) | ||
endforeach() | ||
add_executable( | ||
${TEST_TARGET} | ||
${TEST_TARGET}.cc | ||
) | ||
target_link_libraries(${TEST_TARGET} | ||
GTest::gtest_main | ||
gz-sim${GZ_SIM_VER}::gz-sim${GZ_SIM_VER} | ||
) | ||
include(GoogleTest) | ||
gtest_discover_tests(${TEST_TARGET}) | ||
endforeach() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.