From 0afd239ac969c513bec290068a3c6fc2e0da15c6 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Wed, 5 Aug 2020 16:39:17 -0700 Subject: [PATCH] always compile profiler Signed-off-by: Louise Poubel --- CMakeLists.txt | 2 +- gazebo/common/CMakeLists.txt | 88 +++++++++++++-------------- gazebo/common/Profiler.cc | 4 ++ gazebo/common/ProfilerImpl.hh | 4 ++ gazebo/common/RemoteryProfilerImpl.cc | 4 ++ gazebo/common/RemoteryProfilerImpl.hh | 4 ++ 6 files changed, 60 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 174e6744f3..a5d82407d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ if(NOT DEFINED BUILD_TESTING) set(BUILD_TESTING OFF) endif() -option(ENABLE_PROFILER "Enable Ignition Profiler" FALSE) +option(ENABLE_PROFILER "Enable Gazebo Profiler" FALSE) if(ENABLE_PROFILER) add_definitions("-DGZ_PROFILER_ENABLE=1") diff --git a/gazebo/common/CMakeLists.txt b/gazebo/common/CMakeLists.txt index 26c0f6ba43..bc447dec47 100644 --- a/gazebo/common/CMakeLists.txt +++ b/gazebo/common/CMakeLists.txt @@ -215,63 +215,61 @@ if (HAVE_IGNITION_FUEL_TOOLS) ) endif() -# Do not install profiler headers. -if(ENABLE_PROFILER) - set (sources ${sources} - Profiler.cc - ) - - set (remotery_sources - ./Remotery/lib/Remotery.c - ./Remotery/lib/Remotery.h - RemoteryProfilerImpl.cc - ) +# Start profiler +set (sources ${sources} + Profiler.cc +) - if (APPLE) - set (remotery_sources ${remotery_sources} - ./Remotery/lib/RemoteryMetal.mm - ) - find_library(FOUNDATION Foundation - HINTS /System/Library/Frameworks - ) - endif() +set (remotery_sources + ./Remotery/lib/Remotery.c + ./Remotery/lib/Remotery.h + RemoteryProfilerImpl.cc +) - list(APPEND sources ${remotery_sources}) +if (APPLE) + set (remotery_sources ${remotery_sources} + ./Remotery/lib/RemoteryMetal.mm + ) + find_library(FOUNDATION Foundation + HINTS /System/Library/Frameworks + ) +endif() - set(RMT_ENABLED 1) - set(RMT_USE_TINYCRT 0) - set(RMT_USE_CUDA 0) - set(RMT_USE_D3D11 0) - set(RMT_USE_OPENGL 0) - set(RMT_USE_METAL 0) +list(APPEND sources ${remotery_sources}) - if(UNIX OR WIN32) - set(RMT_USE_OPENGL 1) - endif() +set(RMT_ENABLED 1) +set(RMT_USE_TINYCRT 0) +set(RMT_USE_CUDA 0) +set(RMT_USE_D3D11 0) +set(RMT_USE_OPENGL 0) +set(RMT_USE_METAL 0) - if(WIN32) - set(RMT_USE_D3D11 1) - endif() +if(UNIX OR WIN32) + set(RMT_USE_OPENGL 1) +endif() - if(APPLE) - set (RMT_USE_METAL 1) - endif() +if(WIN32) + set(RMT_USE_D3D11 1) +endif() - configure_file(RemoteryConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/RemoteryConfig.h) +if(APPLE) + set (RMT_USE_METAL 1) +endif() - set(GZ_PROFILER_VIS_PATH share/gazebo-${GAZEBO_MAJOR_VERSION}/profiler_vis) +configure_file(RemoteryConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/RemoteryConfig.h) - configure_file(Remotery/gz_remotery_vis.in - ${CMAKE_CURRENT_BINARY_DIR}/gz_remotery_vis) +set(GZ_PROFILER_VIS_PATH share/gazebo-${GAZEBO_MAJOR_VERSION}/profiler_vis) - install(PROGRAMS - ${CMAKE_CURRENT_BINARY_DIR}/gz_remotery_vis - DESTINATION bin) +configure_file(Remotery/gz_remotery_vis.in + ${CMAKE_CURRENT_BINARY_DIR}/gz_remotery_vis) - install(DIRECTORY Remotery/vis/ - DESTINATION ${CMAKE_INSTALL_PREFIX}/${GZ_PROFILER_VIS_PATH}) +install(PROGRAMS + ${CMAKE_CURRENT_BINARY_DIR}/gz_remotery_vis + DESTINATION bin) -endif() +install(DIRECTORY Remotery/vis/ + DESTINATION ${CMAKE_INSTALL_PREFIX}/${GZ_PROFILER_VIS_PATH}) +# End profiler gz_build_tests(${gtest_sources} EXTRA_LIBS gazebo_common ${tinyxml_LIBRARIES}) diff --git a/gazebo/common/Profiler.cc b/gazebo/common/Profiler.cc index 5c1abad644..fb17f315d9 100644 --- a/gazebo/common/Profiler.cc +++ b/gazebo/common/Profiler.cc @@ -15,6 +15,10 @@ * */ +/* + This is a backport of Ignition Common's profiler +*/ + #include "Profiler.hh" #include "ProfilerImpl.hh" #include "RemoteryProfilerImpl.hh" diff --git a/gazebo/common/ProfilerImpl.hh b/gazebo/common/ProfilerImpl.hh index bf96764da5..f3bfc59326 100644 --- a/gazebo/common/ProfilerImpl.hh +++ b/gazebo/common/ProfilerImpl.hh @@ -15,6 +15,10 @@ * */ +/* + This is a backport of Ignition Common's profiler +*/ + #ifndef GAZEBO_COMMON_PROFILERIMPL_HH_ #define GAZEBO_COMMON_PROFILERIMPL_HH_ diff --git a/gazebo/common/RemoteryProfilerImpl.cc b/gazebo/common/RemoteryProfilerImpl.cc index b025753a50..0086f0b97d 100644 --- a/gazebo/common/RemoteryProfilerImpl.cc +++ b/gazebo/common/RemoteryProfilerImpl.cc @@ -15,6 +15,10 @@ * */ +/* + This is a backport of Ignition Common's profiler +*/ + #include "RemoteryProfilerImpl.hh" #include "gazebo/common/Console.hh" diff --git a/gazebo/common/RemoteryProfilerImpl.hh b/gazebo/common/RemoteryProfilerImpl.hh index 03f7bf8503..9643a9c25f 100644 --- a/gazebo/common/RemoteryProfilerImpl.hh +++ b/gazebo/common/RemoteryProfilerImpl.hh @@ -15,6 +15,10 @@ * */ +/* + This is a backport of Ignition Common's profiler +*/ + #ifndef GAZEBO_COMMON_REMOTERYPROFILERIMPL_HH_ #define GAZEBO_COMMON_REMOTERYPROFILERIMPL_HH_