diff --git a/CMakeLists.txt b/CMakeLists.txt index 4a5518c4e1..60c1cc69d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 ) diff --git a/snes_spc/CMakeLists.txt b/snes_spc/CMakeLists.txt index bc307129c8..13ef63b268 100644 --- a/snes_spc/CMakeLists.txt +++ b/snes_spc/CMakeLists.txt @@ -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" ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 064bdd1189..e172865f1c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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}" )