Permalink
Browse files

Core/Build: Enable Clang PCH support and OS X specific features

Core: Fix warnings here and there
  • Loading branch information...
1 parent 90c9580 commit 333b8e5159ada2f1b8cbfd1dd8eb9072754477d7 @Spp- Spp- committed Nov 9, 2012
Showing with 517 additions and 952 deletions.
  1. +3 −1 .gitignore
  2. +15 −0 cmake/compiler/clang/settings.cmake
  3. +10 −10 cmake/compiler/gcc/settings.cmake
  4. +0 −2 cmake/compiler/xcode/settings.cmake
  5. +0 −180 cmake/macros/FindOpenSSL.cmake
  6. +94 −305 cmake/macros/FindPCHSupport.cmake
  7. +5 −3 cmake/platform/osx/settings.cmake
  8. +1 −0 cmake/platform/unix/settings.cmake
  9. +9 −31 src/server/authserver/CMakeLists.txt
  10. +3 −3 src/server/authserver/Server/AuthSocket.cpp
  11. +1 −1 src/server/authserver/Server/RealmSocket.cpp
  12. +1 −1 src/server/authserver/Server/RealmSocket.h
  13. +11 −17 src/server/collision/CMakeLists.txt
  14. +1 −1 src/server/collision/RegularGrid.h
  15. +0 −1 src/server/game/Achievements/AchievementMgr.cpp
  16. +2 −0 src/server/game/Battlefield/Battlefield.h
  17. +4 −4 src/server/game/Battlefield/Zones/BattlefieldWG.h
  18. +11 −18 src/server/game/CMakeLists.txt
  19. +138 −142 src/server/game/DataStores/DBCEnums.h
  20. +2 −2 src/server/game/Handlers/ChatHandler.cpp
  21. +6 −6 src/server/game/Handlers/PetHandler.cpp
  22. +1 −1 src/server/game/Maps/MapUpdater.cpp
  23. +4 −10 src/server/game/Movement/MovementGenerator.h
  24. +11 −11 src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
  25. +4 −4 src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.h
  26. +12 −12 src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp
  27. +4 −4 src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.h
  28. +4 −4 src/server/game/Movement/MovementGenerators/HomeMovementGenerator.cpp
  29. +4 −4 src/server/game/Movement/MovementGenerators/HomeMovementGenerator.h
  30. +12 −12 src/server/game/Movement/MovementGenerators/PointMovementGenerator.cpp
  31. +4 −4 src/server/game/Movement/MovementGenerators/PointMovementGenerator.h
  32. +5 −5 src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
  33. +4 −4 src/server/game/Movement/MovementGenerators/RandomMovementGenerator.h
  34. +23 −23 src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp
  35. +7 −7 src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.h
  36. +9 −9 src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp
  37. +8 −8 src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h
  38. +1 −1 src/server/game/Server/WorldSession.h
  39. +3 −3 src/server/game/Texts/CreatureTextMgr.cpp
  40. +6 −6 src/server/game/Texts/CreatureTextMgr.h
  41. +10 −18 src/server/scripts/CMakeLists.txt
  42. +1 −1 src/server/scripts/Commands/cs_wp.cpp
  43. +2 −2 src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp
  44. +1 −1 src/server/scripts/Northrend/wintergrasp.cpp
  45. +26 −26 src/server/shared/AutoPtr.h
  46. +10 −15 src/server/shared/CMakeLists.txt
  47. +2 −2 src/server/shared/Cryptography/BigNumber.cpp
  48. +2 −2 src/server/shared/Cryptography/BigNumber.h
  49. +5 −1 src/server/shared/Database/PreparedStatement.h
  50. +0 −1 src/server/shared/Database/QueryResult.h
  51. +1 −1 src/server/shared/Threading/DelayExecutor.cpp
  52. +1 −1 src/server/shared/Threading/DelayExecutor.h
  53. +13 −21 src/server/worldserver/CMakeLists.txt
View
@@ -7,10 +7,12 @@ build*/
*~
.hg/
*.kdev*
+.DS_Store
+CMakeLists.txt.user
*.bak
*.patch
*.diff
*.REMOTE.*
*.BACKUP.*
*.BASE.*
-*.LOCAL.*
+*.LOCAL.*
@@ -0,0 +1,15 @@
+# Set build-directive (used in core to tell which buildtype we used)
+add_definitions(-D_BUILD_DIRECTIVE='"$(CONFIGURATION)"')
+
+if(WITH_WARNINGS)
+ set(WARNING_FLAGS "-W -Wall -Wextra -Wwrite-strings -Winit-self -Woverloaded-virtual -Wfatal-errors")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}")
+ message(STATUS "Clang: All warnings enabled")
+endif()
+
+if(WITH_COREDEBUG)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
+ message(STATUS "Clang: Debug-flags set (-g3)")
+endif()
@@ -1,24 +1,24 @@
# Set build-directive (used in core to tell which buildtype we used)
add_definitions(-D_BUILD_DIRECTIVE='"${CMAKE_BUILD_TYPE}"')
-add_definitions(-fno-delete-null-pointer-checks)
-
if(PLATFORM EQUAL 32)
# Required on 32-bit systems to enable SSE2 (standard on x64)
- add_definitions(-msse2 -mfpmath=sse)
+ set(SSE_FLAGS "-msse2 -mfpmath=sse")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SSE_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SSE_FLAGS}")
endif()
add_definitions(-DHAVE_SSE2 -D__SSE2__)
-message(STATUS "GCC: SSE2 flags forced")
+message(STATUS "GCC: SFMT enabled, SSE2 flags forced")
if( WITH_WARNINGS )
- add_definitions(-Wall -Wfatal-errors -Wextra)
+ set(WARNING_FLAGS "-W -Wall -Wextra -Wwrite-strings -Winit-self -Woverloaded-virtual -Winvalid-pch -Wfatal-errors")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS}")
message(STATUS "GCC: All warnings enabled")
-else()
- add_definitions(--no-warnings)
- message(STATUS "GCC: All warnings disabled")
endif()
if( WITH_COREDEBUG )
- add_definitions(-ggdb3)
- message(STATUS "GCC: Debug-flags set (-ggdb3)")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
+ message(STATUS "GCC: Debug-flags set (-g3)")
endif()
@@ -1,2 +0,0 @@
-# Set build-directive (used in core to tell which buildtype we used)
-add_definitions(-D_BUILD_DIRECTIVE='"$(CONFIGURATION)"')
@@ -1,180 +0,0 @@
-# - Try to find the OpenSSL encryption library
-# Once done this will define
-#
-# OPENSSL_ROOT_DIR - Set this variable to the root installation of OpenSSL
-#
-# Read-Only variables:
-# OPENSSL_FOUND - system has the OpenSSL library
-# OPENSSL_INCLUDE_DIR - the OpenSSL include directory
-# OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
-
-#=============================================================================
-# Copyright 2006-2009 Kitware, Inc.
-# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
-# Copyright 2009-2010 Mathieu Malaterre <mathieu.malaterre@gmail.com>
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distributed this file outside of CMake, substitute the full
-# License text for the above reference.)
-
-# http://www.slproweb.com/products/Win32OpenSSL.html
-
-SET(_OPENSSL_ROOT_HINTS
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
- )
-
-IF(PLATFORM EQUAL 64)
- SET(_OPENSSL_ROOT_PATHS
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;InstallLocation]"
- "C:/OpenSSL-Win64/"
- "C:/OpenSSL/"
- )
-ELSE()
- SET(_OPENSSL_ROOT_PATHS
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]"
- "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;InstallLocation]"
- "C:/OpenSSL/"
- )
-ENDIF()
-
-FIND_PATH(OPENSSL_ROOT_DIR
- NAMES
- include/openssl/ssl.h
- HINTS
- ${_OPENSSL_ROOT_HINTS}
- PATHS
- ${_OPENSSL_ROOT_PATHS}
-)
-MARK_AS_ADVANCED(OPENSSL_ROOT_DIR)
-
-# Re-use the previous path:
-FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h
- ${OPENSSL_ROOT_DIR}/include
-)
-
-IF(WIN32 AND NOT CYGWIN)
- # MINGW should go here too
- IF(MSVC)
- # /MD and /MDd are the standard values - if someone wants to use
- # others, the libnames have to change here too
- # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
- # TODO: handle /MT and static lib
- # In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix:
- # * MD for dynamic-release
- # * MDd for dynamic-debug
- # * MT for static-release
- # * MTd for static-debug
-
- # Implementation details:
- # We are using the libraries located in the VC subdir instead of the parent directory eventhough :
- # libeay32MD.lib is identical to ../libeay32.lib, and
- # ssleay32MD.lib is identical to ../ssleay32.lib
-
- FIND_LIBRARY(LIB_EAY_DEBUG
- NAMES
- libeay32MDd libeay32
- PATHS
- ${OPENSSL_ROOT_DIR}/lib/VC
- )
-
- FIND_LIBRARY(LIB_EAY_RELEASE
- NAMES
- libeay32MD libeay32
- PATHS
- ${OPENSSL_ROOT_DIR}/lib/VC
- )
-
- FIND_LIBRARY(SSL_EAY_DEBUG
- NAMES
- ssleay32MDd ssleay32 ssl
- PATHS
- ${OPENSSL_ROOT_DIR}/lib/VC
- )
-
- FIND_LIBRARY(SSL_EAY_RELEASE
- NAMES
- ssleay32MD ssleay32 ssl
- PATHS
- ${OPENSSL_ROOT_DIR}/lib/VC
- )
-
- if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
- set( OPENSSL_LIBRARIES
- optimized ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE}
- debug ${SSL_EAY_DEBUG} ${LIB_EAY_DEBUG}
- )
- else()
- set( OPENSSL_LIBRARIES
- ${SSL_EAY_RELEASE}
- ${LIB_EAY_RELEASE}
- )
- endif()
-
- MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE LIB_EAY_DEBUG LIB_EAY_RELEASE)
- ELSEIF(MINGW)
-
- # same player, for MingW
- FIND_LIBRARY(LIB_EAY
- NAMES
- libeay32
- PATHS
- ${OPENSSL_ROOT_DIR}/lib/MinGW
- )
-
- FIND_LIBRARY(SSL_EAY NAMES
- NAMES
- ssleay32
- PATHS
- ${OPENSSL_ROOT_DIR}/lib/MinGW
- )
-
- MARK_AS_ADVANCED(SSL_EAY LIB_EAY)
-
- set( OPENSSL_LIBRARIES
- ${SSL_EAY}
- ${LIB_EAY}
- )
- ELSE(MSVC)
- # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
- FIND_LIBRARY(LIB_EAY
- NAMES
- libeay32
- PATHS
- ${OPENSSL_ROOT_DIR}/lib
- ${OPENSSL_ROOT_DIR}/lib/VC
- )
-
- FIND_LIBRARY(SSL_EAY
- NAMES
- ssleay32
- PATHS
- ${OPENSSL_ROOT_DIR}/lib
- ${OPENSSL_ROOT_DIR}/lib/VC
- )
- MARK_AS_ADVANCED(SSL_EAY LIB_EAY)
-
- SET( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
- ENDIF(MSVC)
-ELSE(WIN32 AND NOT CYGWIN)
- FIND_LIBRARY(OPENSSL_SSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD)
- FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARIES NAMES crypto)
- MARK_AS_ADVANCED(OPENSSL_CRYPTO_LIBRARIES OPENSSL_SSL_LIBRARIES)
-
- SET(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES})
-
-ENDIF(WIN32 AND NOT CYGWIN)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(OpenSSL DEFAULT_MSG
- OPENSSL_LIBRARIES
- OPENSSL_INCLUDE_DIR
-)
-
-MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
Oops, something went wrong.

12 comments on commit 333b8e5

@Spp-
Contributor
Spp- commented on 333b8e5 Nov 9, 2012

Some tweak is needed in /dep files to compile with clang... but didn't wanted to modify those sources atm

@tuxity
Contributor
tuxity commented on 333b8e5 Nov 9, 2012

Possible to have the list of tweaks ? Need to try compilation under OS X

@Subv
Contributor
Subv commented on 333b8e5 Nov 9, 2012

I once tried to get ACE to compile under Clang, just an advise: If you want to keep your sanity, don't even try.
:P

@tuxity
Contributor
tuxity commented on 333b8e5 Nov 9, 2012

Clang is too powerfull for you Subv :p

@Spp-
Contributor
Spp- commented on 333b8e5 Nov 9, 2012

Tuxity, to be honest, idk :) OS X related changes were done by another dev and i shared to TC... but can ask about it (/dep needs tweaking in order to compile under OS X)

@tuxity
Contributor
tuxity commented on 333b8e5 Nov 9, 2012

@Spp- I'm gonna try today ;)

@ScubaVision

Win32, using CMAKE getting this error:
CMake Error at dep/acelite/ace/CMakeLists.txt:336 (add_native_precompiled_header):
Unknown CMake command "add_native_precompiled_header".

@burnham
Contributor
burnham commented on 333b8e5 Nov 9, 2012

Not compile:

  • Install core to : C:/Program Files/TrinityCore
  • Build world/auth : Yes (default)
  • Build with scripts : Yes (default)
  • Build map/vmap tools : No (default)
  • Build core w/PCH : Yes (default)
  • Build scripts w/PCH : Yes (default)
  • Show compile-warnings : No (default)
  • Use coreside debug : No (default)
  • Use MySQL sourcetree : Yes (default)

CMake Error at dep/acelite/ace/CMakeLists.txt:336 (add_native_precompiled_header):
Unknown CMake command "add_native_precompiled_header".

@Merlin2010

Warnings at compile (GCC 4.4.7, FreeBSD 8.2)
In file included from src/server/authserver/Server/AuthSocket.cpp:24:
src/server/shared/Packets/ByteBuffer.h: In member function 'uint32 ByteBuffer::ReadPackedTime()':
src/server/shared/Packets/ByteBuffer.h:517: warning: pointer to a function used in arithmetic
src/server/shared/Packets/ByteBuffer.h:517: warning: invalid conversion from 'char* (*)(int, int)' to 'uint32'

@Aokromes
Member

rerun cmake.

@DDuarte
Member

slowpoke Chipsi, that was fixed in 6bd9062
update and run cmake

@FilipLukac

I've updated my core, and rerun cmake :) don't worry about me, i've solved this problem yesterday, but others have problem

Please sign in to comment.