It is now possible to use CMake on windows for proper build (PCH support included)

Merged PCH header into gamePCH since they became the same after these changes

--HG--
branch : trunk
rename : src/server/game/PrecompiledHeaders/NixCorePCH.cpp => src/server/game/PrecompiledHeaders/gamePCH.cpp
rename : src/server/game/PrecompiledHeaders/NixCorePCH.h => src/server/game/PrecompiledHeaders/gamePCH.h
This commit is contained in:
Shauren
2010-06-30 13:10:13 +02:00
parent b0d5071598
commit 2ea043484d
13 changed files with 390 additions and 39 deletions

View File

@@ -31,6 +31,11 @@ endif()
include(CheckIncludeFiles)
include(cmake/FindPCHSupport.cmake)
if(WIN32)
set(ACE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/externals)
endif()
include(cmake/FindACE.cmake)
include(cmake/FindMySQL.cmake)
include(cmake/FindOpenSSL.cmake)

View File

@@ -281,11 +281,11 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _input)
SET(oldProps "")
endif(${oldProps} MATCHES NOTFOUND)
SET(newProperties "${oldProps} /Yu\"${_input}\" /FI\"${_input}\"")
SET(newProperties "${oldProps} /Yu\"${_input}.h\" /FI\"${_input}.h\"")
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
#also inlude ${oldProps} to have the same compile options
SET_SOURCE_FILES_PROPERTIES(${${_targetName}_pch} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_input}\"")
SET_SOURCE_FILES_PROPERTIES(${_input}.cpp PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_input}.h\"")
else(CMAKE_GENERATOR MATCHES Visual*)

View File

@@ -8,17 +8,330 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
file(GLOB sources *.cpp)
# NOTE: Do not use glob here, it would include files we don't want
set(ace_STAT_SRCS
${sources}
PrecompiledHeaders/WinAcePCH.cpp
ACE.cpp
ACE_crc32.cpp
ACE_crc_ccitt.cpp
ace_wchar.cpp
Activation_Queue.cpp
Active_Map_Manager.cpp
Addr.cpp
Argv_Type_Converter.cpp
Assert.cpp
Asynch_IO.cpp
Asynch_IO_Impl.cpp
Asynch_Pseudo_Task.cpp
ATM_Acceptor.cpp
ATM_Addr.cpp
ATM_Connector.cpp
ATM_Params.cpp
ATM_QoS.cpp
ATM_Stream.cpp
Atomic_Op.cpp
Atomic_Op_Sparc.c
Auto_Event.cpp
Barrier.cpp
Base_Thread_Adapter.cpp
Based_Pointer_Repository.cpp
Basic_Stats.cpp
Basic_Types.cpp
Capabilities.cpp
CDR_Base.cpp
CDR_Size.cpp
CDR_Stream.cpp
Cleanup.cpp
Codecs.cpp
Codeset_IBM1047.cpp
Codeset_Registry.cpp
Codeset_Registry_db.cpp
Condition_Recursive_Thread_Mutex.cpp
Condition_Thread_Mutex.cpp
Configuration.cpp
Configuration_Import_Export.cpp
Connection_Recycling_Strategy.cpp
Containers.cpp
Copy_Disabled.cpp
Countdown_Time.cpp
Date_Time.cpp
DEV.cpp
DEV_Addr.cpp
DEV_Connector.cpp
DEV_IO.cpp
Dev_Poll_Reactor.cpp
Dirent.cpp
Dirent_Selector.cpp
DLL.cpp
DLL_Manager.cpp
Dump.cpp
Dynamic.cpp
Dynamic_Message_Strategy.cpp
Dynamic_Service_Base.cpp
Dynamic_Service_Dependency.cpp
Encoding_Converter.cpp
Encoding_Converter_Factory.cpp
Event.cpp
Event_Handler.cpp
FIFO.cpp
FIFO_Recv.cpp
FIFO_Recv_Msg.cpp
FIFO_Send.cpp
FIFO_Send_Msg.cpp
FILE.cpp
FILE_Addr.cpp
FILE_Connector.cpp
FILE_IO.cpp
File_Lock.cpp
Filecache.cpp
Flag_Manip.cpp
Framework_Component.cpp
Functor.cpp
Functor_String.cpp
Get_Opt.cpp
gethrtime.cpp
Handle_Ops.cpp
Handle_Set.cpp
Hashable.cpp
High_Res_Timer.cpp
ICMP_Socket.cpp
INET_Addr.cpp
Init_ACE.cpp
IO_Cntl_Msg.cpp
IO_SAP.cpp
IOStream.cpp
IPC_SAP.cpp
Lib_Find.cpp
Local_Memory_Pool.cpp
Local_Name_Space.cpp
Local_Tokens.cpp
Lock.cpp
Log_Msg.cpp
Log_Msg_Backend.cpp
Log_Msg_Callback.cpp
Log_Msg_IPC.cpp
Log_Msg_NT_Event_Log.cpp
Log_Msg_UNIX_Syslog.cpp
Log_Record.cpp
Logging_Strategy.cpp
LSOCK.cpp
LSOCK_Acceptor.cpp
LSOCK_CODgram.cpp
LSOCK_Connector.cpp
LSOCK_Dgram.cpp
LSOCK_Stream.cpp
Malloc.cpp
Malloc_Allocator.cpp
Manual_Event.cpp
MEM_Acceptor.cpp
MEM_Addr.cpp
MEM_Connector.cpp
MEM_IO.cpp
Mem_Map.cpp
MEM_SAP.cpp
MEM_Stream.cpp
Message_Block.cpp
Message_Queue.cpp
Message_Queue_NT.cpp
Message_Queue_Vx.cpp
Method_Request.cpp
MMAP_Memory_Pool.cpp
Monitor_Admin.cpp
Monitor_Admin_Manager.cpp
Monitor_Base.cpp
Monitor_Control_Action.cpp
Monitor_Control_Types.cpp
Monitor_Point_Registry.cpp
Monitor_Size.cpp
Msg_WFMO_Reactor.cpp
Multihomed_INET_Addr.cpp
Mutex.cpp
Name_Proxy.cpp
Name_Request_Reply.cpp
Name_Space.cpp
Naming_Context.cpp
Netlink_Addr.cpp
Notification_Queue.cpp
Notification_Strategy.cpp
NT_Service.cpp
Obchunk.cpp
Object_Manager.cpp
Object_Manager_Base.cpp
OS_Errno.cpp
OS_Log_Msg_Attributes.cpp
OS_main.cpp
OS_NS_arpa_inet.cpp
OS_NS_ctype.cpp
OS_NS_dirent.cpp
OS_NS_dlfcn.cpp
OS_NS_errno.cpp
OS_NS_fcntl.cpp
OS_NS_math.cpp
OS_NS_netdb.cpp
OS_NS_poll.cpp
OS_NS_pwd.cpp
OS_NS_regex.cpp
OS_NS_signal.cpp
OS_NS_stdio.cpp
OS_NS_stdlib.cpp
OS_NS_string.cpp
OS_NS_strings.cpp
OS_NS_stropts.cpp
OS_NS_sys_mman.cpp
OS_NS_sys_msg.cpp
OS_NS_sys_resource.cpp
OS_NS_sys_select.cpp
OS_NS_sys_sendfile.cpp
OS_NS_sys_shm.cpp
OS_NS_sys_socket.cpp
OS_NS_sys_stat.cpp
OS_NS_sys_time.cpp
OS_NS_sys_uio.cpp
OS_NS_sys_utsname.cpp
OS_NS_sys_wait.cpp
OS_NS_Thread.cpp
OS_NS_time.cpp
OS_NS_unistd.cpp
OS_NS_wchar.cpp
OS_QoS.cpp
OS_Thread_Adapter.cpp
OS_TLI.cpp
Pagefile_Memory_Pool.cpp
Parse_Node.cpp
PI_Malloc.cpp
Ping_Socket.cpp
Pipe.cpp
POSIX_Asynch_IO.cpp
POSIX_CB_Proactor.cpp
POSIX_Proactor.cpp
Priority_Reactor.cpp
Proactor.cpp
Proactor_Impl.cpp
Process.cpp
Process_Manager.cpp
Process_Mutex.cpp
Process_Semaphore.cpp
Profile_Timer.cpp
Reactor.cpp
Reactor_Impl.cpp
Reactor_Notification_Strategy.cpp
Reactor_Timer_Interface.cpp
Read_Buffer.cpp
Recursive_Thread_Mutex.cpp
Recyclable.cpp
Registry.cpp
Registry_Name_Space.cpp
Remote_Name_Space.cpp
Remote_Tokens.cpp
Rtems_init.c
RW_Mutex.cpp
RW_Process_Mutex.cpp
RW_Thread_Mutex.cpp
Sample_History.cpp
Sbrk_Memory_Pool.cpp
Sched_Params.cpp
Select_Reactor_Base.cpp
Semaphore.cpp
Service_Config.cpp
Service_Gestalt.cpp
Service_Manager.cpp
Service_Object.cpp
Service_Repository.cpp
Service_Types.cpp
Shared_Memory.cpp
Shared_Memory_MM.cpp
Shared_Memory_Pool.cpp
Shared_Memory_SV.cpp
Shared_Object.cpp
Sig_Adapter.cpp
Sig_Handler.cpp
Signal.cpp
SOCK.cpp
SOCK_Acceptor.cpp
SOCK_CODgram.cpp
Sock_Connect.cpp
SOCK_Connector.cpp
SOCK_Dgram.cpp
SOCK_Dgram_Bcast.cpp
SOCK_Dgram_Mcast.cpp
SOCK_IO.cpp
SOCK_Netlink.cpp
SOCK_SEQPACK_Acceptor.cpp
SOCK_SEQPACK_Association.cpp
SOCK_SEQPACK_Connector.cpp
SOCK_Stream.cpp
SPIPE.cpp
SPIPE_Acceptor.cpp
SPIPE_Addr.cpp
SPIPE_Connector.cpp
SPIPE_Stream.cpp
SString.cpp
Stack_Trace.cpp
Stats.cpp
String_Base_Const.cpp
SUN_Proactor.cpp
SV_Message.cpp
SV_Message_Queue.cpp
SV_Semaphore_Complex.cpp
SV_Semaphore_Simple.cpp
SV_Shared_Memory.cpp
Svc_Conf_Lexer.cpp
Svc_Conf_y.cpp
Synch_Options.cpp
System_Time.cpp
Task.cpp
Thread.cpp
Thread_Adapter.cpp
Thread_Control.cpp
Thread_Exit.cpp
Thread_Hook.cpp
Thread_Manager.cpp
Thread_Mutex.cpp
Thread_Semaphore.cpp
Throughput_Stats.cpp
Time_Value.cpp
Timeprobe.cpp
TLI.cpp
TLI_Acceptor.cpp
TLI_Connector.cpp
TLI_Stream.cpp
Token.cpp
Token_Collection.cpp
Token_Invariants.cpp
Token_Manager.cpp
Token_Request_Reply.cpp
TP_Reactor.cpp
Trace.cpp
TSS_Adapter.cpp
TTY_IO.cpp
UNIX_Addr.cpp
UPIPE_Acceptor.cpp
UPIPE_Connector.cpp
UPIPE_Stream.cpp
UTF16_Encoding_Converter.cpp
UTF32_Encoding_Converter.cpp
UTF8_Encoding_Converter.cpp
UUID.cpp
WFMO_Reactor.cpp
WIN32_Asynch_IO.cpp
WIN32_Proactor.cpp
XML_Svc_Conf.cpp
XTI_ATM_Mcast.cpp
)
include_directories(
${CMAKE_SOURCE_DIR}/externals
${CMAKE_SOURCE_DIR}/externals/ace/PrecompiledHeaders
${CMAKE_SOURCE_DIR}/externals/zlib
)
# Needed for PCH support
set_source_files_properties(Atomic_Op_Sparc.c Rtems_init.c PROPERTIES LANGUAGE CXX)
add_definitions(-DACE_BUILD_DLL)
add_library(ace STATIC ${ace_STAT_SRCS})
add_library(ace SHARED ${ace_STAT_SRCS})
if(DO_PCH)
add_native_precompiled_header(ace ${CMAKE_SOURCE_DIR}/externals/ace/PrecompiledHeaders/WinAcePCH)
endif()

View File

@@ -44,7 +44,9 @@ add_executable(authserver
add_dependencies(authserver revision.h)
add_definitions(-D_TRINITY_REALM_CONFIG='"${CONF_DIR}/authserver.conf"')
if(NOT WIN32)
add_definitions(-D_TRINITY_REALM_CONFIG='"${CONF_DIR}/authserver.conf"')
endif()
set(authserver_LINK_FLAGS "-pthread ${authserver_LINK_FLAGS}")
@@ -54,6 +56,18 @@ endif()
set_target_properties(authserver PROPERTIES LINK_FLAGS "${authserver_LINK_FLAGS}")
if(WIN32)
target_link_libraries(
authserver
shared
trinitydatabase
trinityauth
trinityconfig
${MYSQL_LIBRARY}
${OPENSSL_LIBRARIES}
${OPENSSL_EXTRA_LIBRARIES}
)
else()
target_link_libraries(
authserver
shared
@@ -64,7 +78,7 @@ target_link_libraries(
${OPENSSL_LIBRARIES}
${OSX_LIBS}
)
endif()
########### install files ###############
install(TARGETS authserver DESTINATION bin)

View File

@@ -11,7 +11,7 @@
######## game ########
# Enable precompiled headers when using the GCC compiler.
if(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
if(DO_PCH)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
endif()
@@ -279,11 +279,22 @@ if(NOT DO_SCRIPTS)
message("-- Added basic scriptAI-engines to GAME library")
endif()
# Add gamePCH.cpp to project on Windows
if(MSVC)
set(game_STAT_SRCS
PrecompiledHeaders/gamePCH.cpp
${game_STAT_SRCS})
endif()
add_library(game STATIC ${game_STAT_SRCS})
add_dependencies(game revision.h)
# Generate precompiled header
if(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
add_precompiled_header(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/NixCorePCH.h)
if(DO_PCH)
if(CMAKE_COMPILER_IS_GNUCXX)
add_precompiled_header(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/gamePCH.h)
elseif(MSVC)
add_native_precompiled_header(game ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/gamePCH)
endif()
endif()

View File

@@ -1 +0,0 @@
#include "NixCorePCH.h"

View File

@@ -1 +0,0 @@
#include "WinCorePCH.h"

View File

@@ -1,14 +0,0 @@
//add here most rarely modified headers to speed up debug build compilation
#include "..\Server\WorldSocket.h" // must be first to make ACE happy with ACE includes in it
#include "..\..\shared\Common.h"
#include "..\Maps\MapManager.h"
#include "..\..\shared\Logging\Log.h"
#include "..\Globals\ObjectAccessor.h"
#include "..\Entities\Object\ObjectDefines.h"
#include "..\..\shared\Database/SQLStorage.h"
#include "..\Protocol\Opcodes.h"
#include "..\Miscellaneous\SharedDefines.h"
#include "..\Globals\ObjectMgr.h"
#include "ScriptPCH.h"

View File

@@ -0,0 +1 @@
#include "gamePCH.h"

View File

@@ -16,15 +16,13 @@ file(GLOB_RECURSE scripts_world World/*.cpp)
file(GLOB_RECURSE scripts_examples Examples/*.cpp)
# Enable precompiled headers when using the GCC compiler.
if(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
if(DO_PCH)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
)
endif()
set(scripts_STAT_SRCS
../game/PrecompiledHeaders/ScriptPCH.cpp
../game/PrecompiledHeaders/ScriptPCH.h
../game/AI/ScriptedAI/ScriptedEscortAI.cpp
../game/AI/ScriptedAI/ScriptedCreature.cpp
../game/AI/ScriptedAI/ScriptedFollowerAI.cpp
@@ -125,11 +123,20 @@ include_directories(
${MYSQL_INCLUDE_DIR}
)
# Add ScriptPCH.cpp to project on Windows
if(MSVC)
set(scripts_STAT_SRCS
../game/PrecompiledHeaders/ScriptPCH.cpp
${scripts_STAT_SRCS})
endif()
add_library(scripts STATIC ${scripts_STAT_SRCS})
# Generate precompiled header
if(DO_PCH AND CMAKE_COMPILER_IS_GNUCXX)
add_precompiled_header(scripts
${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/ScriptPCH.h
)
if(DO_PCH)
if(CMAKE_COMPILER_IS_GNUCXX)
add_precompiled_header(scripts ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/ScriptPCH.h)
elseif(MSVC)
add_native_precompiled_header(scripts ${CMAKE_SOURCE_DIR}/src/server/game/PrecompiledHeaders/ScriptPCH)
endif()
endif()

View File

@@ -20,6 +20,15 @@ set(shared_STAT_SRCS
Common.cpp
)
# Windows specific files
if(WIN32)
set(shared_STAT_SRCS
${shared_STAT_SRCS}
Debugging/WheatyExceptionReport.cpp
Utilities/ServiceWin32.cpp
)
endif()
include_directories(
${ACE_INCLUDE_DIR}
${CMAKE_BINARY_DIR}
@@ -43,10 +52,17 @@ include_directories(
add_library(shared STATIC ${shared_STAT_SRCS})
if(WIN32)
target_link_libraries(
shared
ace
)
else()
target_link_libraries(
shared
${ACE_LIBRARY}
)
endif()
########### trinityconfig ###############

View File

@@ -118,9 +118,9 @@ include_directories(
set(worldserver_LINK_FLAGS "")
add_executable(worldserver ${worldserver_SRCS})
add_definitions(
-D_TRINITY_CORE_CONFIG='"${CONF_DIR}/worldserver.conf"'
)
if(NOT WIN32)
add_definitions(-D_TRINITY_CORE_CONFIG='"${CONF_DIR}/worldserver.conf"')
endif()
add_dependencies(worldserver revision.h)
@@ -152,11 +152,11 @@ if(WIN32)
trinityconfig
collision
g3dlib
jemalloc
${SCRIPT_LIB}
${ACE_LIBRARY}
ace
${MYSQL_LIBRARY}
${OPENSSL_LIBRARIES}
${OPENSSL_EXTRA_LIBRARIES}
)
else()
target_link_libraries(