]> git.mxchange.org Git - flightgear.git/commitdiff
Really make profiling commands optional
authorThomas Geymayer <tomgey@gmail.com>
Thu, 15 Nov 2012 12:56:31 +0000 (13:56 +0100)
committerThomas Geymayer <tomgey@gmail.com>
Thu, 15 Nov 2012 12:56:31 +0000 (13:56 +0100)
CMakeLists.txt
src/Include/config_cmake.h.in
src/Main/CMakeLists.txt
src/Main/fg_commands.cxx

index fe0af050040536ad4e72d5704ebb7d7726f6eb90..c99783b7555404f26dbe54ea0d4f690e65b0b26b 100644 (file)
@@ -105,6 +105,7 @@ option(ENABLE_JSBSIM     "Set to ON to build FlightGear with JSBSim FDM (default
 option(EVENT_INPUT       "Set to ON to build FlightGear with event-based Input support" ${EVENT_INPUT_DEFAULT})
 option(ENABLE_LIBSVN     "Set to ON to build FlightGear/terrasync with libsvnclient support (default)" ON)
 option(ENABLE_RTI        "Set to ON to build FlightGear with RTI support" OFF)
+option(ENABLE_PROFILE    "Set to ON to build FlightGear with gperftools profiling support" ON)
 option(JPEG_FACTORY      "Set to ON to build FlightGear with JPEG-factory support" OFF)
 option(SYSTEM_SQLITE     "Set to ON to build FlightGear with the system's SQLite3 library" OFF)
 
@@ -223,8 +224,12 @@ check_include_file(unistd.h   HAVE_UNISTD_H)
 check_include_file(sys/time.h HAVE_SYS_TIME_H)
 check_include_file(windows.h  HAVE_WINDOWS_H)
 
-# check optionally supported dependencies
-find_package(GooglePerfTools)
+if(ENABLE_PROFILE)
+    find_package(GooglePerfTools)
+    if(GOOGLE_PERFTOOLS_FOUND)
+        set(FG_HAVE_GPERFTOOLS 1)
+    endif()
+endif()
 
 if(ENABLE_RTI)
     find_package(RTI)
index 181beffa56a3fd69e8242a58a344ed1c20f1eff6..3963d71e9e68f4c86a67207f8e05872b6b6034ec 100644 (file)
@@ -36,6 +36,7 @@
 #define WEB_BROWSER "@WEB_BROWSER@"
 
 #cmakedefine FG_HAVE_HLA
+#cmakedefine FG_HAVE_GPERFTOOLS
 #cmakedefine FG_JPEG_SERVER
 
 #cmakedefine SYSTEM_SQLITE
index 72ed8634a6697df5324ac0745bdd633423cd24c7..259b51132fafa752d84b5f13748c36668f60f80c 100644 (file)
@@ -90,7 +90,7 @@ if(ENABLE_JSBSIM)
     target_link_libraries(fgfs JSBSim)
 endif()
 
-if(GOOGLE_PERFTOOLS_FOUND)
+if(FG_HAVE_GPERFTOOLS)
     target_link_libraries(fgfs profiler)
 endif()
 
index 1e32ef6b2b1efd810d974846322218b7185d37ab..2230d7f3a20ba0da30528374cdee79b22b783d04 100644 (file)
@@ -53,7 +53,7 @@
 
 #include <boost/scoped_array.hpp>
 
-#if GOOGLE_PERFTOOLS_FOUND == YES
+#ifdef FG_HAVE_GPERFTOOLS
 # include <google/profiler.h>
 #endif
 
@@ -1453,7 +1453,7 @@ do_release_cockpit_button (const SGPropertyNode *arg)
 // Optional profiling commands using gperftools:
 // http://code.google.com/p/gperftools/
 
-#if GOOGLE_PERFTOOLS_FOUND != YES
+#ifndef FG_HAVE_GPERFTOOLS
 static void
 no_profiling_support()
 {
@@ -1469,7 +1469,7 @@ no_profiling_support()
 static bool
 do_profiler_start(const SGPropertyNode *arg)
 {
-#if GOOGLE_PERFTOOLS_FOUND == YES
+#ifdef FG_HAVE_GPERFTOOLS
   const char *filename = arg->getStringValue("filename", "fgfs.profile");
   ProfilerStart(filename);
   return true;
@@ -1482,7 +1482,7 @@ do_profiler_start(const SGPropertyNode *arg)
 static bool
 do_profiler_stop(const SGPropertyNode *arg)
 {
-#if GOOGLE_PERFTOOLS_FOUND == YES
+#ifdef FG_HAVE_GPERFTOOLS
   ProfilerStop();
   return true;
 #else
@@ -1565,10 +1565,8 @@ static struct {
     { "reload-shaders", do_reload_shaders },
     { "reload-materials", do_materials_reload },
 
-#if GOOGLE_PERFTOOLS_FOUND == YES
     { "profiler-start", do_profiler_start },
     { "profiler-stop",  do_profiler_stop },
-#endif
 
     { 0, 0 }                   // zero-terminated
 };