Buildsystem: Add PCH-support for targets shared, collision, authserver and worldserver (your mileage may vary, feedback needed)

- The active configuration for these to be active is GAMEPCH, so don't expect turbospeed if not enabled.

--HG--
branch : trunk
This commit is contained in:
click
2010-08-16 12:14:10 +02:00
parent 29c2520506
commit 105e4e16cc
8 changed files with 112 additions and 23 deletions
+22
View File
@@ -15,7 +15,19 @@ file(GLOB_RECURSE sources_realms Realms/*.cpp Realms/*.h)
file(GLOB_RECURSE sources_server Server/*.cpp Server/*.h)
file(GLOB sources_localdir *.cpp *.h)
if( GAMEPCH )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
endif()
if ( GAMEPCH AND MSVC )
set(authserver_SRCS
PrecompiledHeaders/authPCH.cpp
PrecompiledHeaders/authPCH.h
)
endif()
set(authserver_SRCS
${authserver_SRCS}
${sources_authentication}
${sources_realms}
${sources_server}
@@ -102,3 +114,13 @@ elseif( WIN32 )
install(TARGETS authserver DESTINATION "${CMAKE_INSTALL_PREFIX}")
install(FILES authserver.conf.dist DESTINATION "${CMAKE_INSTALL_PREFIX}")
endif()
# Generate precompiled header
if( GAMEPCH )
if(CMAKE_COMPILER_IS_GNUCXX)
add_precompiled_header(authserver ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/authPCH.h)
elseif(MSVC)
add_native_precompiled_header(authserver ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/authPCH)
endif()
endif()
+22
View File
@@ -8,12 +8,24 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
if( GAMEPCH )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
endif()
file(GLOB_RECURSE sources_Management Management/*.cpp Management/*.h)
file(GLOB_RECURSE sources_Maps Maps/*.cpp Maps/*.h)
file(GLOB_RECURSE sources_Models Models/*.cpp Models/*.h)
file(GLOB sources_localdir *.cpp *.h)
if( GAMEPCH AND MSVC )
set(collision_STAT_SRCS
PrecompiledHeaders/collisionPCH.cpp
PrecompiledHeaders/collisionPCH.h
)
endif()
set(collision_STAT_SRCS
${collision_STAT_SRCS}
${sources_Management}
${sources_Maps}
${sources_Models}
@@ -37,3 +49,13 @@ include_directories(
)
add_library(collision STATIC ${collision_STAT_SRCS})
# Generate precompiled header
if( GAMEPCH )
if(CMAKE_COMPILER_IS_GNUCXX)
add_precompiled_header(collision ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/collisionPCH.h)
elseif(MSVC)
add_native_precompiled_header(collision ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/collisionPCH)
endif()
endif()
+11 -10
View File
@@ -49,7 +49,16 @@ file(GLOB_RECURSE sources_Weather Weather/*.cpp Weather/*.h)
file(GLOB_RECURSE sources_World World/*.cpp World/*.h)
# Create game-libary
if( GAMEPCH AND MSVC )
set(game_STAT_SRCS
PrecompiledHeaders/gamePCH.cpp
PrecompiledHeaders/gamePCH.h
)
endif()
set(game_STAT_SRCS
${game_STAT_SRCS}
${sources_Accounts}
${sources_Achievements}
${sources_Addons}
@@ -87,14 +96,6 @@ set(game_STAT_SRCS
${sources_World}
)
if(MSVC)
set(game_STAT_SRCS
${game_STAT_SRCS}
PrecompiledHeaders/gamePCH.cpp
PrecompiledHeaders/gamePCH.h
)
endif()
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/externals/mersennetwister
@@ -194,8 +195,8 @@ add_dependencies(game genrev)
# Generate precompiled header
if( GAMEPCH )
if(CMAKE_COMPILER_IS_GNUCXX)
add_precompiled_header(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/gamePCH.h)
add_precompiled_header(game ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/gamePCH.h)
elseif(MSVC)
add_native_precompiled_header(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/gamePCH)
add_native_precompiled_header(game ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/gamePCH)
endif()
endif()
+3 -1
View File
@@ -1,5 +1,7 @@
//add here most rarely modified headers to speed up debug build compilation
#include "WorldSocket.h" // must be first to make ACE happy with ACE includes in it
#include "WorldSocket.h" // must be first to make ACE happy with ACE includes in it
#include "Common.h"
#include "MapManager.h"
+10 -10
View File
@@ -24,7 +24,15 @@ if( SCRIPTPCH )
)
endif()
if( SCRIPTPCH AND MSVC )
set(scripts_STAT_SRCS
PrecompiledHeaders/ScriptPCH.cpp
PrecompiledHeaders/ScriptPCH.h
)
endif()
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
${scripts_easternkingdoms}
${scripts_kalimdor}
${scripts_northrend}
@@ -40,14 +48,6 @@ set(scripts_STAT_SRCS
../game/AI/ScriptedAI/ScriptedSimpleAI.cpp
)
if(MSVC)
set(scripts_STAT_SRCS
${scripts_STAT_SRCS}
PrecompiledHeaders/ScriptPCH.cpp
PrecompiledHeaders/ScriptPCH.h
)
endif()
message("-- Added Script Library to SCRIPTS lib")
include_directories(
@@ -146,8 +146,8 @@ add_dependencies(scripts genrev)
# Generate precompiled header
if( SCRIPTPCH )
if(CMAKE_COMPILER_IS_GNUCXX)
add_precompiled_header(scripts ${CMAKE_SOURCE_DIR}/src/server/scripts/PrecompiledHeaders/ScriptPCH.h)
add_precompiled_header(scripts ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/ScriptPCH.h)
elseif(MSVC)
add_native_precompiled_header(scripts ${CMAKE_SOURCE_DIR}/src/server/scripts/PrecompiledHeaders/ScriptPCH)
add_native_precompiled_header(scripts ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/ScriptPCH)
endif()
endif()
+22 -1
View File
@@ -8,6 +8,10 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
if( GAMEPCH )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
endif()
file(GLOB_RECURSE sources_Configuration Configuration/*.cpp Configuration/*.h)
file(GLOB_RECURSE sources_Cryptography Cryptography/*.cpp Cryptography/*.h)
file(GLOB_RECURSE sources_Database Database/*.cpp Database/*.h)
@@ -24,7 +28,15 @@ file(GLOB sources_localdir *.cpp *.h)
# Build shared sourcelist
#
if( GAMEPCH AND MSVC )
set(shared_STAT_SRCS
PrecompiledHeaders/sharedPCH.cpp
PrecompiledHeaders/sharedPCH.h
)
endif()
set(shared_STAT_SRCS
${shared_STAT_SRCS}
${sources_Configuration}
${sources_Cryptography}
${sources_Database}
@@ -62,7 +74,6 @@ include_directories(
${OPENSSL_INCLUDE_DIR}
)
add_library(shared STATIC ${shared_STAT_SRCS})
add_dependencies(shared genrev)
@@ -76,3 +87,13 @@ else()
${ACE_LIBRARY}
)
endif()
# Generate precompiled header
if( GAMEPCH )
if(CMAKE_COMPILER_IS_GNUCXX)
add_precompiled_header(shared ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/sharedPCH.h)
elseif(MSVC)
add_native_precompiled_header(shared ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/sharedPCH)
endif()
endif()
+21
View File
@@ -14,7 +14,19 @@ file(GLOB_RECURSE sources_TCSoap TCSoap/*.cpp TCSoap/*.h)
file(GLOB_RECURSE sources_WorldThread WorldThread/*.cpp WorldThread/*.h)
file(GLOB sources_localdir *.cpp *.h)
if( GAMEPCH )
include_directories(${CMAKE_CURRENT_BINARY_DIR})
endif()
if ( GAMEPCH AND MSVC )
set(worldserver_SRCS
PrecompiledHeaders/worldPCH.cpp
PrecompiledHeaders/worldPCH.h
)
endif()
set(worldserver_SRCS
${worldserver_SRCS}
${sources_CommandLine}
${sources_RemoteAccess}
${sources_TCSoap}
@@ -206,3 +218,12 @@ elseif( WIN32 )
install(TARGETS worldserver DESTINATION "${CMAKE_INSTALL_PREFIX}")
install(FILES worldserver.conf.dist DESTINATION "${CMAKE_INSTALL_PREFIX}")
endif()
# Generate precompiled header
if( GAMEPCH )
if(CMAKE_COMPILER_IS_GNUCXX)
add_precompiled_header(worldserver ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/worldPCH.h)
elseif(MSVC)
add_native_precompiled_header(worldserver ${CMAKE_CURRENT_SOURCE_DIR}/PrecompiledHeaders/worldPCH)
endif()
endif()