summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-07-19 06:35:09 +0000
committerflaviojs <flaviojs@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-07-19 06:35:09 +0000
commit49aeb514a6fe9d96cb8478163b066d3ba5d269a9 (patch)
treedfd012d65e95a25882f1e2acd7f974a2eb284836 /CMakeLists.txt
parentac908e937abd27784ce0251fe6568351bdd5403a (diff)
downloadhercules-49aeb514a6fe9d96cb8478163b066d3ba5d269a9.tar.gz
hercules-49aeb514a6fe9d96cb8478163b066d3ba5d269a9.tar.bz2
hercules-49aeb514a6fe9d96cb8478163b066d3ba5d269a9.tar.xz
hercules-49aeb514a6fe9d96cb8478163b066d3ba5d269a9.zip
* CMake: added option ENABLE_EXTRA_DEBUG_CODE.
* CMake: added option ENABLE_PROFILER. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14915 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt48
1 files changed, 42 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 660df46d7..e2be5c28f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -272,16 +272,26 @@ endforeach()
#
-# Use RDTSC instruction as a timing source (time stamp counter on x86 since Pentium)
+# Use RDTSC instruction as a timing source (time stamp counter on x86 since Pentium) (default=OFF)
#
# Enable it when you've timing issues. (ex: in conjunction with XEN or Other Virtualization mechanisms)
# Please ensure that you've disabled dynamic CPU-Frequencys, such as power saving options.
# (On the most modern Dedicated Servers cpufreq is preconfigured, see your distribution's manual how to disable it)
#
-option( ENABLE_RDTSC "use RDTSC instruction as a timing source" OFF )
+option( ENABLE_RDTSC "use RDTSC instruction as a timing source (default=OFF)" OFF )
if( ENABLE_RDTSC )
- message( STATUS "Enabled RDTSC" )
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DENABLE_RDTSC" )
+ message( STATUS "Enabled RDTSC as a timing source" )
+endif()
+
+
+#
+# Enable extra debug code (default=OFF)
+#
+option( ENABLE_EXTRA_DEBUG_CODE "enable extra debug code (default=OFF)" OFF )
+if( ENABLE_EXTRA_DEBUG_CODE )
+ set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DDEBUG" )
+ message( STATUS "Enabled extra DEBUG code" )
endif()
@@ -289,16 +299,16 @@ endif()
# Enable builtin memory manager (default=default)
#
set( MEMMGR_OPTIONS "default;yes;no" )
-set( ENABLE_MEMMGR "default" CACHE STRING "enable the builtin memory manager? (${MEMMGR_OPTIONS})" )
+set( ENABLE_MEMMGR "default" CACHE STRING "enable builtin memory manager: ${MEMMGR_OPTIONS} (default=default)" )
set_property( CACHE ENABLE_MEMMGR PROPERTY STRINGS ${MEMMGR_OPTIONS} )
if( ENABLE_MEMMGR STREQUAL "default" )
# use source code default
elseif( ENABLE_MEMMGR STREQUAL "yes" )
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DUSE_MEMMGR" )
- message( STATUS "Enabled builtin memory manager" )
+ message( STATUS "Enabled the builtin memory manager" )
elseif( ENABLE_MEMMGR STREQUAL "no" )
set_property( CACHE GLOBAL_DEFINITIONS PROPERTY VALUE "${GLOBAL_DEFINITIONS} -DNO_MEMMGR" )
- message( STATUS "Disabled builtin memory manager" )
+ message( STATUS "Disabled the builtin memory manager" )
else()
message( FATAL_ERROR "invalid option ENABLE_MEMMGR=${ENABLE_MEMMGR} (valid options: ${MEMMGR_OPTIONS})" )
endif()
@@ -357,6 +367,32 @@ else()
endif()
+#
+# Enable profiler (default=none)
+#
+set( PROFILER_OPTIONS "none;gprof" )
+set( ENABLE_PROFILER "none" CACHE STRING "enable profiler: ${PROFILER_OPTIONS} (default=none)" )
+set_property( CACHE ENABLE_PROFILER PROPERTY STRINGS ${PROFILER_OPTIONS} )
+if( ENABLE_PROFILER STREQUAL "none" )
+ # no profiler
+
+elseif( ENABLE_PROFILER STREQUAL "gprof" )
+ if( CMAKE_C_COMPILER_ID STREQUAL "GNU" )
+ if( NOT HAVE_GPROF_FLAGS )
+ set_property( CACHE CMAKE_C_FLAGS PROPERTY VALUE "${CMAKE_C_FLAGS} -pg" )
+ set_property( CACHE CMAKE_EXE_LINKER_FLAGS PROPERTY VALUE "${CMAKE_EXE_LINKER_FLAGS} -pg" )
+ set( HAVE_GPROF_FLAGS ON CACHE INTERNAL "" )
+ endif()
+ message( STATUS "Enabled the profiler gprof" )
+ else()
+ message( FATAL_ERROR "Failed to enable the profiler gprof - not GNU" )
+ endif()
+
+else()
+ message( FATAL_ERROR "invalid option ENABLE_PROFILER=${ENABLE_PROFILER} (valid options: ${PROFILER_OPTIONS})" )
+endif()
+
+
#####################################################################
# package stuff
#