* CMake: added option ENABLE_EXTRA_DEBUG_CODE.

* CMake: added option ENABLE_PROFILER.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14915 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
flaviojs 2011-07-19 06:35:09 +00:00
parent e52305234c
commit a7f392b812
2 changed files with 44 additions and 6 deletions

View File

@ -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
#

View File

@ -10,6 +10,8 @@ Date Added
* Changed itemtype from inline to static inline to avoid error with the SunOS compiler.
* CMake: added option ENABLE_MEMMGR. (builtin memory manager)
* CMake: added option ENABLE_MEMORY. (memory library)
* CMake: added option ENABLE_EXTRA_DEBUG_CODE.
* CMake: added option ENABLE_PROFILER.
2011/07/15
* Changed the warning message of when setrlimit fails to be more explicit. [FlavioJS]
* CMake: added tests for big endian, typecast to union and monotonic clock.