- Added gprof support. Pass -DPROFILE=1 to cmake when using a Debug or RelWithDebInfo

CMAKE_BUILD_TYPE. (It seems to like to hang when generating arith.h for gdtoa when you
  do this, but killing the make process and restarting it seems to fix that.)

SVN r1531 (trunk)
This commit is contained in:
Randy Heit 2009-04-08 22:26:09 +00:00
parent 5db6a5516b
commit 3dc01e77f7
3 changed files with 22 additions and 5 deletions

View file

@ -6,8 +6,12 @@ IF( NOT CMAKE_BUILD_TYPE )
FORCE )
ENDIF( NOT CMAKE_BUILD_TYPE )
set( ZDOOM_OUTPUT_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Directory where zdoom.pk3 and the executable will be created" )
set( ZDOOM_EXE_NAME "zdoom" CACHE FILEPATH "Name of the executable to create" )
set( ZDOOM_OUTPUT_DIR ${CMAKE_BINARY_DIR} CACHE PATH "Directory where zdoom.pk3 and the executable will be created." )
set( ZDOOM_EXE_NAME "zdoom" CACHE FILEPATH "Name of the executable to create." )
if( CMAKE_COMPILER_IS_GNUCXX )
set( PROFILE CACHE 0 BOOL "Enable profiling with gprof for Debug and RelWithDebInfo build types." )
endif( CMAKE_COMPILER_IS_GNUCXX )
find_package( JPEG )
find_package( ZLIB )
@ -59,6 +63,13 @@ set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${REL_C_FLAGS}" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${REL_C_FLAGS}" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${DEB_C_FLAGS} -D_DEBUG" )
if( CMAKE_COMPILER_IS_GNUCXX AND PROFILE )
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -pg" )
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg" )
set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -pg" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -pg" )
endif( CMAKE_COMPILER_IS_GNUCXX AND PROFILE )
if( ZLIB_FOUND )
message( STATUS "Using system zlib" )
else( ZLIB_FOUND )

View file

@ -5,7 +5,10 @@ include( CheckCXXCompilerFlag )
set( CMAKE_BUILD_TYPE "RelWithDebInfo" )
if( CMAKE_COMPILER_IS_GNUCXX )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fomit-frame-pointer" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
if( NOT PROFILE )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fomit-frame-pointer" )
endif( NOT PROFILE )
check_cxx_compiler_flag( -Wno-array-bounds HAVE_NO_ARRAY_BOUNDS )
if( HAVE_NO_ARRAY_BOUNDS )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-array-bounds" )

View file

@ -32,7 +32,7 @@ set( MINOR_VERSIONS "50" "49" "48" "47" "46" "45" "44" "43" "42" "41"
"27" "26" "25" "24" "23" "22" "21" "20" "21" "19" "18" "17" "16"
"15" "14" "13" "12" "11" "10" "09" "08" "07" "06" "05" "04" "03"
"02" "01" "00" )
set( MAJOR_VERSIONS "22" "20" )
set( MAJOR_VERSIONS "24" "22" "20" )
set( FMOD_DIR_VERSIONS ${FMOD_DIR_VERSIONS} "../fmod" )
foreach( majver ${MAJOR_VERSIONS} )
foreach( minver ${MINOR_VERSIONS} )
@ -301,7 +301,10 @@ endif( NOT NO_ASM )
# Set up flags for GCC
if( CMAKE_COMPILER_IS_GNUCXX )
set( REL_CXX_FLAGS "-fno-rtti -fomit-frame-pointer" )
set( REL_CXX_FLAGS "-fno-rtti" )
if( NOT PROFILE )
set( REL_CXX_FLAGS "${REL_CXX_FLAGS} -fomit-frame-pointer" )
endif( NOT PROFILE )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${REL_CXX_FLAGS}" )
set( CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${REL_CXX_FLAGS}" )
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${REL_CXX_FLAGS}" )