diff options
Diffstat (limited to 'cmake/compiler')
| -rw-r--r-- | cmake/compiler/clang/settings.cmake | 4 | ||||
| -rw-r--r-- | cmake/compiler/gcc/settings.cmake | 12 | ||||
| -rw-r--r-- | cmake/compiler/icc/settings.cmake | 2 | ||||
| -rw-r--r-- | cmake/compiler/mingw/settings.cmake | 27 | ||||
| -rw-r--r-- | cmake/compiler/msvc/settings.cmake | 20 |
5 files changed, 56 insertions, 9 deletions
diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake index ae07b1fc39b..87f8a2f82c8 100644 --- a/cmake/compiler/clang/settings.cmake +++ b/cmake/compiler/clang/settings.cmake @@ -13,3 +13,7 @@ if(WITH_COREDEBUG) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") message(STATUS "Clang: Debug-flags set (-g3)") endif() + +# -Wno-narrowing needed to suppress a warning in g3d +# -Wno-deprecated-register is needed to suppress 185 gsoap warnings on Unix systems. +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-narrowing -Wno-deprecated-register") diff --git a/cmake/compiler/gcc/settings.cmake b/cmake/compiler/gcc/settings.cmake index 25ee96c8562..acd71e82fd9 100644 --- a/cmake/compiler/gcc/settings.cmake +++ b/cmake/compiler/gcc/settings.cmake @@ -1,6 +1,18 @@ # Set build-directive (used in core to tell which buildtype we used) add_definitions(-D_BUILD_DIRECTIVE='"${CMAKE_BUILD_TYPE}"') +set(GCC_EXPECTED_VERSION 4.7.2) + +if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_EXPECTED_VERSION) + message(FATAL_ERROR "GCC: TrinityCore requires version ${GCC_EXPECTED_VERSION} to build but found ${CMAKE_CXX_COMPILER_VERSION}") +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +message(STATUS "GCC: Enabled c++11 support") + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") +message(STATUS "GCC: Enabled C99 support") + if(PLATFORM EQUAL 32) # Required on 32-bit systems to enable SSE2 (standard on x64) set(SSE_FLAGS "-msse2 -mfpmath=sse") diff --git a/cmake/compiler/icc/settings.cmake b/cmake/compiler/icc/settings.cmake index 58eb63b081d..133bc15e59e 100644 --- a/cmake/compiler/icc/settings.cmake +++ b/cmake/compiler/icc/settings.cmake @@ -1,5 +1,5 @@ # Set build-directive (used in core to tell which buildtype we used) -add_definitions(-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}") +add_definitions(-D_BUILD_DIRECTIVE="'${CMAKE_BUILD_TYPE}'") if(PLATFORM EQUAL 32) add_definitions(-axSSE2) diff --git a/cmake/compiler/mingw/settings.cmake b/cmake/compiler/mingw/settings.cmake new file mode 100644 index 00000000000..68156bd0b6b --- /dev/null +++ b/cmake/compiler/mingw/settings.cmake @@ -0,0 +1,27 @@ +# set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + +# Set build-directive (used in core to tell which buildtype we used) +add_definitions(-D_BUILD_DIRECTIVE=\\"${CMAKE_BUILD_TYPE}\\") + +if(PLATFORM EQUAL 32) + # Required on 32-bit systems to enable SSE2 (standard on x64) + 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: SFMT enabled, SSE2 flags forced") + +if( WITH_WARNINGS ) + set(WARNING_FLAGS "-W -Wall -Wextra -Winit-self -Winvalid-pch -Wfatal-errors") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} -Woverloaded-virtual") + message(STATUS "GCC: 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 "GCC: Debug-flags set (-g3)") +endif() diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake index d758d466407..b68a0de1ace 100644 --- a/cmake/compiler/msvc/settings.cmake +++ b/cmake/compiler/msvc/settings.cmake @@ -1,6 +1,12 @@ # set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +set(MSVC_EXPECTED_VERSION 18.0) + +if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS MSVC_EXPECTED_VERSION) + message(FATAL_ERROR "MSVC: TrinityCore requires version ${MSVC_EXPECTED_VERSION} (MSVC 2013) to build but found ${CMAKE_CXX_COMPILER_VERSION}") +endif() + # set up output paths ofr static libraries etc (commented out - shown here as an example only) #set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) #set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) @@ -42,19 +48,17 @@ message(STATUS "MSVC: Disabled NON-SECURE warnings") add_definitions(-D_CRT_NONSTDC_NO_WARNINGS) message(STATUS "MSVC: Disabled POSIX warnings") -# disable warnings in Visual Studio 8 and above if not wanted if(NOT WITH_WARNINGS) - if(MSVC AND NOT CMAKE_GENERATOR MATCHES "Visual Studio 7") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619") - message(STATUS "MSVC: Disabled generic compiletime warnings") - endif() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619 /wd4512") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996 /wd4355 /wd4244 /wd4985 /wd4267 /wd4619 /wd4512") + message(STATUS "MSVC: Disabled generic compiletime warnings") endif() # Specify the maximum PreCompiled Header memory allocation limit -# Fixes a compiler-problem when using PCH - the /Ym flag is adjusted by the compiler in MSVC2012, hence we need to set an upper limit with /Zm to avoid disrupancies) +# Fixes a compiler-problem when using PCH - the /Ym flag is adjusted by the compiler in MSVC2012, hence we need to set an upper limit with /Zm to avoid discrepancies) # (And yes, this is a verified , unresolved bug with MSVC... *sigh*) -string(REPLACE "/Zm1000" "/Zm500" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) +string(REGEX REPLACE "/Zm[0-9]+ *" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zm500" CACHE STRING "" FORCE) # Enable and treat as errors the following warnings to easily detect virtual function signature failures: # 'function' : member function does not override any base class virtual member function |
