소스 검색

* 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

flaviojs 14 년 전
부모
커밋
a7f392b812
2개의 변경된 파일44개의 추가작업 그리고 6개의 파일을 삭제
  1. 42 6
      CMakeLists.txt
  2. 2 0
      Changelog-Trunk.txt

+ 42 - 6
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
 #

+ 2 - 0
Changelog-Trunk.txt

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