From 42efab068179b6479d97b704ad79b4c0fa21be29 Mon Sep 17 00:00:00 2001 From: Mathias Gottschlag Date: Sat, 21 Mar 2009 20:36:19 +0100 Subject: [PATCH] Added support for profiling Horde3D and removed some trailing whitespaces. --- CMakeLists.txt | 31 ++++++++++++++++++-------- Horde3D/Source/Horde3DEngine/CMakeLists.txt | 12 +++++++-- Horde3D/Source/Horde3DUtils/CMakeLists.txt | 15 +++++++++--- 3 files changed, 41 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c718588..fda916e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,17 @@ ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4) project(Horde3D) +# Profiling target +option(HORDE3D_PROFILE "Build with profiling enabled" OFF) +if(HORDE3D_PROFILE) + IF(MSVC) + ELSE(MSVC) + SET(CMAKE_BUILD_TYPE Profile) + SET(CMAKE_CXX_FLAGS_PROFILE -pg) + SET(CMAKE_C_FLAGS_PROFILE -pg) + ENDIF(MSVC) +ENDIF(HORDE3D_PROFILE) + # accumulate list of sources of extension modules # this can not be done inside the Extensions folder since cmake can only pass variables to subdirectories, never upwards... set(HORDE3D_EXTENSION_SOURCES) @@ -56,39 +67,39 @@ if(HORDE3D_BUILD_WATER) ) endif(HORDE3D_BUILD_WATER) -IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4) +IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4) IF(WIN32) IF(MSVC) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Horde3D/Binaries - CACHE STRING "Where binaries and .dll files go" FORCE) + CACHE STRING "Where binaries and .dll files go" FORCE) ELSE(MSVC) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Horde3D/Binaries/Win32 - CACHE STRING "Where binaries and .dll files go" FORCE) + CACHE STRING "Where binaries and .dll files go" FORCE) ENDIF(MSVC) ELSE(WIN32) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/Horde3D/Binaries/${CMAKE_SYSTEM_NAME} CACHE STRING "Where binaries and .dll files go" FORCE) ENDIF(WIN32) -ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4) +ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4) IF(WIN32) IF(MSVC) SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Horde3D/Binaries CACHE STRING "Where executable files go" FORCE) ELSE(MSVC) SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Horde3D/Binaries/Win32 - CACHE STRING "Where executable files go" FORCE) + CACHE STRING "Where executable files go" FORCE) ENDIF(MSVC) IF(MSVC) SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Horde3D/Binaries - CACHE STRING "Where dll files go" FORCE) + CACHE STRING "Where dll files go" FORCE) ELSE(MSVC) SET(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Horde3D/Binaries/Win32 - CACHE STRING "Where dll files go" FORCE) - ENDIF(MSVC) + CACHE STRING "Where dll files go" FORCE) + ENDIF(MSVC) ELSE(WIN32) SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Horde3D/Binaries/${CMAKE_SYSTEM_NAME} - CACHE STRING "Where executable files go" FORCE) - ENDIF(WIN32) + CACHE STRING "Where executable files go" FORCE) + ENDIF(WIN32) ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.4) # create egExtensions.cpp diff --git a/Horde3D/Source/Horde3DEngine/CMakeLists.txt b/Horde3D/Source/Horde3DEngine/CMakeLists.txt index b6ad1e1..c9c177d 100644 --- a/Horde3D/Source/Horde3DEngine/CMakeLists.txt +++ b/Horde3D/Source/Horde3DEngine/CMakeLists.txt @@ -57,9 +57,15 @@ set(HORDE3D_SOURCES add_definitions(-DCMAKE ) -add_library(Horde3D SHARED - ${HORDE3D_SOURCES} - ) +if(${CMAKE_BUILD_TYPE} MATCHES "Profile") + add_library(Horde3D STATIC + ${HORDE3D_SOURCES} + ) +else(${CMAKE_BUILD_TYPE} MATCHES "Profile") + add_library(Horde3D SHARED + ${HORDE3D_SOURCES} + ) +endif(${CMAKE_BUILD_TYPE} MATCHES "Profile") if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") diff --git a/Horde3D/Source/Horde3DUtils/CMakeLists.txt b/Horde3D/Source/Horde3DUtils/CMakeLists.txt index 0ac8531..0ec98f7 100644 --- a/Horde3D/Source/Horde3DUtils/CMakeLists.txt +++ b/Horde3D/Source/Horde3DUtils/CMakeLists.txt @@ -2,11 +2,18 @@ include_directories(../Shared) include_directories(../../Bindings/C++) +if(${CMAKE_BUILD_TYPE} MATCHES "Profile") + add_library(Horde3DUtils STATIC + main.cpp + ) +else(${CMAKE_BUILD_TYPE} MATCHES "Profile") + add_library(Horde3DUtils SHARED + main.cpp + ) +endif(${CMAKE_BUILD_TYPE} MATCHES "Profile") + + -add_library(Horde3DUtils SHARED - main.cpp - ) - target_link_libraries(Horde3DUtils Horde3D) if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") -- 1.6.0.4