Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pickup/cmake/CompilerConfigMSVC.cmake @ 5897

Last change on this file since 5897 was 5695, checked in by rgrieder, 15 years ago

Merged resource2 branch back to trunk.

IMPORTANT NOTE:
Upon this merge you need to specifically call your data directory "data_extern" when checking it out (when you don't provide a name, it will be just called 'trunk').
The new CMake variable is EXTERNAL_DATA_DIRECTORY. DATA_DIRECTORY now points to the one the source part of the repository.
UPDATE YOUR DATA DIRECTORY AS WELL!!!

  • Property svn:eol-style set to native
File size: 5.4 KB
Line 
1 #
2 #             ORXONOX - the hottest 3D action shooter ever to exist
3 #                             > www.orxonox.net <
4 #
5 #        This program is free software; you can redistribute it and/or
6 #         modify it under the terms of the GNU General Public License
7 #        as published by the Free Software Foundation; either version 2
8 #            of the License, or (at your option) any later version.
9 #
10 #       This program is distributed in the hope that it will be useful,
11 #        but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #                 GNU General Public License for more details.
14 #
15 #   You should have received a copy of the GNU General Public License along
16 #      with this program; if not, write to the Free Software Foundation,
17 #     Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 #
19 #
20 #  Author:
21 #    Reto Grieder
22 #  Description:
23 #    Sets the right compiler and linker flags for the Microsoft Compiler.
24 #
25
26INCLUDE(FlagUtilities)
27
28################### Compiler Version ####################
29
30# We make use of variadic macros, which is only supported by MSVC 8 and above
31IF(MSVC_VERSION LESS 1400)
32  MESSAGE(FATAL_ERROR "Microsoft Visual Studio versions below 8 (2005) are not supported because of missing compiler extensions.")
33ENDIF()
34
35
36######################## Options ########################
37
38# Currently VLD has a problem with MSVC9 although it actually is supported
39IF(MSVC80)
40  OPTION(VISUAL_LEAK_DETECTOR_ENABLE "Memory leak detector" off)
41ENDIF()
42# Make sure the value is "on" or "off" for vld.ini
43IF(VISUAL_LEAK_DETECTOR_ENABLE)
44  SET(VISUAL_LEAK_DETECTOR_ENABLE on)
45ELSE()
46  SET(VISUAL_LEAK_DETECTOR_ENABLE off)
47ENDIF()
48
49# Orxonox only supports MSVC 8 and above, which gets asserted above
50SET(PCH_COMPILER_SUPPORT TRUE)
51
52
53#################### Compiler Flags #####################
54
55# -MD    Minimal Rebuild
56# -RTC1  Both basic runtime checks
57# -MD[d] Multithreaded [debug] DLL
58# -Zi    Program Database
59# -ZI    Program Database for Edit & Continue
60# -WX    General warning Level X
61# -wdX   Disable specific warning X
62# -wnX   Set warning level of specific warning X to level n
63
64# Overwrite CMake default flags first. Be careful with this
65# Only add (not set) the general compiler flags.
66# CMake default flags : -DWIN32 -D_WINDOWS -W3 -Zm1000
67# additionally for CXX: -EHsc -GR
68ADD_COMPILER_FLAGS("-D__WIN32__ -D_WIN32"      CACHE)
69ADD_COMPILER_FLAGS("-D_CRT_SECURE_NO_WARNINGS" CACHE)
70
71# Overwrite CMake default flags here.
72SET_COMPILER_FLAGS("-MDd -Od -Zi -D_DEBUG -Gm -RTC1" Debug          CACHE)
73SET_COMPILER_FLAGS("-MD  -O2     -DNDEBUG -MP2"      Release        CACHE)
74SET_COMPILER_FLAGS("-MD  -O2 -Zi -DNDEBUG -MP2"      RelWithDebInfo CACHE)
75SET_COMPILER_FLAGS("-MD  -O1     -DNDEBUG -MP2"      MinSizeRel     CACHE)
76
77# Use Link time code generation for Release config if ORXONOX_RELEASE is defined
78IF(ORXONOX_RELEASE)
79  ADD_COMPILER_FLAGS("-GL" ReleaseAll CACHE)
80ENDIF()
81
82
83####################### Warnings ########################
84
85# Increase warning level if requested
86IF(EXTRA_COMPILER_WARNINGS)
87  REMOVE_COMPILER_FLAGS("-W1 -W2 -W3" CACHE)
88  ADD_COMPILER_FLAGS   ("-W4" CACHE)
89ELSE()
90  REMOVE_COMPILER_FLAGS("-W1 -W2 -W4" CACHE)
91  ADD_COMPILER_FLAGS   ("-W3" CACHE)
92ENDIF()
93
94# "<type> needs to have dll-interface to be used by clients'
95# Happens on STL member variables which are not public
96ADD_COMPILER_FLAGS("-w44251" CACHE)
97ADD_COMPILER_FLAGS("-w44275" CACHE) # For inheritance
98
99# Multiple assignment operators specified
100ADD_COMPILER_FLAGS("-w44522" CACHE)
101
102# Forcing values to bool
103ADD_COMPILER_FLAGS("-w44800" CACHE)
104
105# This warns about truncation to 255 characters in debug/browse info
106# ADD_COMPILER_FLAGS("-w44786 -w44503" CACHE)
107
108# conversion from 'double' to 'float', possible loss of data
109# conversion from 'ogg_int64_t' to 'long', possible loss of data
110# ADD_COMPILER_FLAGS("-w44244" CACHE)
111
112# "conversion from 'size_t' to 'unsigned int', possible loss of data
113# ADD_COMPILER_FLAGS("-w44267" CACHE)
114
115# "truncation from 'double' to 'float'
116# ADD_COMPILER_FLAGS("-w44305" CACHE)
117
118# "non dll-interface class used as base for dll-interface class"
119# ADD_COMPILER_FLAGS("-w44275" CACHE)
120
121# "C++ Exception Specification ignored"
122# This is because MSVC 6 did not implement all the C++ exception
123# specifications in the ANSI C++ draft.
124# ADD_COMPILER_FLAGS("-w44290" CACHE)
125
126# "no suitable definition provided for explicit template
127# instantiation request" Occurs in VC7 for no justifiable reason.
128# ADD_COMPILER_FLAGS("-w44661" CACHE)
129
130# Deprecation warnings when using CRT calls in VC8
131# These show up on all C runtime lib code in VC8, disable since they clutter
132# the warnings with things we may not be able to do anything about (e.g.
133# generated code from nvparse etc). I doubt very much that these calls
134# will ever be actually removed from VC anyway, it would break too much code.
135# Note: Probably handled by "-DCRT_SECURE_NO_WARNINGS"
136# ADD_COMPILER_FLAGS("-w44996" CACHE)
137
138# "conditional expression constant"
139# ADD_COMPILER_FLAGS("-w4201" CACHE)
140
141
142##################### Linker Flags ######################
143
144# CMake default flags: -MANIFEST -STACK:10000000 -machine:I386
145# and INCREMENTAL and DEBUG for debug versions
146ADD_LINKER_FLAGS("-OPT:REF -OPT:ICF" Release MinSizeRel CACHE)
147ADD_LINKER_FLAGS("-OPT:NOWIN98" MSVC80 CACHE)
148
149# Use Link time code generation for Release config if ORXONOX_RELEASE is defined
150IF(ORXONOX_RELEASE)
151  ADD_LINKER_FLAGS("-LTCG" ReleaseAll CACHE)
152ENDIF()
Note: See TracBrowser for help on using the repository browser.