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)
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)
#include <boost/scoped_array.hpp>
-#if GOOGLE_PERFTOOLS_FOUND == YES
+#ifdef FG_HAVE_GPERFTOOLS
# include <google/profiler.h>
#endif
// 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()
{
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;
static bool
do_profiler_stop(const SGPropertyNode *arg)
{
-#if GOOGLE_PERFTOOLS_FOUND == YES
+#ifdef FG_HAVE_GPERFTOOLS
ProfilerStop();
return true;
#else
{ "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
};