Changeset 8362
- Timestamp:
- Apr 30, 2011, 4:02:27 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/cmake/CompilerConfigMSVC.cmake
r8351 r8362 26 26 INCLUDE(FlagUtilities) 27 27 28 ################### Compiler Version ####################29 30 28 # We make use of variadic macros, which is only supported by MSVC 8 and above 31 29 IF(MSVC_VERSION LESS 1400) 32 MESSAGE(FATAL_ERROR "Microsoft Visual Studio versions below 8 (2005) are not supported because of missing compiler extensions.")30 MESSAGE(FATAL_ERROR "Microsoft Visual Studio versions below 8 (2005) are not supported.") 33 31 ENDIF() 34 35 36 ######################## Options ########################37 32 38 33 # Orxonox only supports MSVC 8 and above, which gets asserted above … … 42 37 #################### Compiler Flags ##################### 43 38 44 # -MD Minimal Rebuild 45 # -RTC1 Both basic runtime checks 46 # -MD[d] Multithreaded [debug] DLL 47 # -Zi Program Database 48 # -ZI Program Database for Edit & Continue 39 # CMake default flags : -DWIN32 -D_WINDOWS -W3 -Zm1000 40 # additionally for CXX: -EHsc -GR 41 # We keep these flags but reset the build specific flags 42 SET_COMPILER_FLAGS("" Debug RelWithDebInfo Release MinSizeRel CACHE) 43 44 # Make sure we define all the possible macros for identifying Windows 45 ADD_COMPILER_FLAGS("-D__WIN32__ -D_WIN32" CACHE) 46 # Suppress some annoying warnings 47 ADD_COMPILER_FLAGS("-D_CRT_SECURE_NO_WARNINGS" CACHE) 48 ADD_COMPILER_FLAGS("-D_SCL_SECURE_NO_WARNINGS" CACHE) 49 50 # Use multiprocessed compiling (like "make -j3" on Unix) 51 ADD_COMPILER_FLAGS("-MP" CACHE) 52 53 # Always generate debug symbols (there is really no reason not to) 54 ADD_COMPILER_FLAGS("-Zi" CACHE) 55 56 # Never omit frame pointers to avoid useless stack traces (the performance 57 # loss is almost not measurable) 58 ADD_COMPILER_FLAGS("-Oy-" CACHE) 59 # Enable non standard floating point optimisations 60 ADD_COMPILER_FLAGS("-fp:fast" CACHE) 61 62 # Set build specific flags. 63 # -MD[d] Multithreaded [debug] shared MSVC runtime library 64 # -O[d|2|1] No optimisations, optimise for speed, optimise for size 65 # -Oi[-] Use or disable use of intrinisic functions 66 # -GL Link time code generation (see -LTCG in linker flags) 67 # -RTC1 Both basic runtime checks 68 ADD_COMPILER_FLAGS("-MDd -Od -Oi -D_DEBUG -RTC1" Debug CACHE) 69 ADD_COMPILER_FLAGS("-MD -O2 -Oi -DNDEBUG" RelWithDebInfo CACHE) 70 ADD_COMPILER_FLAGS("-MD -O2 -Oi -DNDEBUG -GL" Release CACHE) 71 ADD_COMPILER_FLAGS("-MD -O1 -Oi- -DNDEBUG -GL" MinSizeRel CACHE) 72 73 74 ####################### Warnings ######################## 75 49 76 # -WX General warning Level X 50 77 # -wdX Disable specific warning X 51 78 # -wnX Set warning level of specific warning X to level n 52 53 # Only add (not set) some general compiler flags.54 # CMake default flags : -DWIN32 -D_WINDOWS -W3 -Zm100055 # additionally for CXX: -EHsc -GR56 # -MP is for multiprocessed compiling57 ADD_COMPILER_FLAGS("-D__WIN32__ -D_WIN32 -MP" CACHE)58 ADD_COMPILER_FLAGS("-D_CRT_SECURE_NO_WARNINGS" CACHE)59 ADD_COMPILER_FLAGS("-D_SCL_SECURE_NO_WARNINGS" CACHE)60 61 # Overwrite CMake default flags here for the individual configurations62 SET_COMPILER_FLAGS("-MDd -Od -Oi -Zi -D_DEBUG -RTC1" Debug CACHE)63 SET_COMPILER_FLAGS("-MD -O2 -DNDEBUG" Release CACHE)64 SET_COMPILER_FLAGS("-MD -O2 -Zi -DNDEBUG" RelWithDebInfo CACHE)65 SET_COMPILER_FLAGS("-MD -O1 -DNDEBUG" MinSizeRel CACHE)66 67 # Enable non standard floating point optimisations68 ADD_COMPILER_FLAGS("-fp:fast" CACHE)69 70 # Use Link time code generation for Release config if ORXONOX_RELEASE is defined71 IF(ORXONOX_RELEASE)72 ADD_COMPILER_FLAGS("-GL" ReleaseAll CACHE)73 ENDIF()74 75 76 ####################### Warnings ########################77 79 78 80 # Increase warning level if requested … … 100 102 ADD_COMPILER_FLAGS("-w44250" CACHE) 101 103 102 # This warns about truncation to 255 characters in debug/browse info103 # ADD_COMPILER_FLAGS("-w44786 -w44503" CACHE)104 105 104 # conversion from 'double' to 'float', possible loss of data 106 105 # conversion from 'ogg_int64_t' to 'long', possible loss of data … … 116 115 # ADD_COMPILER_FLAGS("-w44275" CACHE) 117 116 118 # "C++ Exception Specification ignored"119 # This is because MSVC 6 did not implement all the C++ exception120 # specifications in the ANSI C++ draft.121 # ADD_COMPILER_FLAGS("-w44290" CACHE)122 123 # "no suitable definition provided for explicit template124 # instantiation request" Occurs in VC7 for no justifiable reason.125 # ADD_COMPILER_FLAGS("-w44661" CACHE)126 127 # Deprecation warnings when using CRT calls in VC8128 # These show up on all C runtime lib code in VC8, disable since they clutter129 # the warnings with things we may not be able to do anything about (e.g.130 # generated code from nvparse etc). I doubt very much that these calls131 # will ever be actually removed from VC anyway, it would break too much code.132 # Note: Probably handled by "-DCRT_SECURE_NO_WARNINGS"133 # ADD_COMPILER_FLAGS("-w44996" CACHE)134 135 # "conditional expression constant"136 # ADD_COMPILER_FLAGS("-w4201" CACHE)137 138 117 139 118 ##################### Linker Flags ###################### 140 119 141 120 # CMake default flags: -MANIFEST -STACK:10000000 -machine:I386 142 # and INCREMENTAL and DEBUG for debug versions 143 SET_LINKER_FLAGS("-debug -INCREMENTAL:YES" Debug CACHE) 144 SET_LINKER_FLAGS("-debug" RelWithDebInfo CACHE) 145 SET_LINKER_FLAGS("" Release MinSizeRel CACHE) 121 # We keep these flags but reset the build specific flags 122 SET_LINKER_FLAGS("" Debug RelWithDebInfo Release MinSizeRel CACHE) 146 123 124 # Always generate debug symbols (there is really no reason not to) 125 ADD_LINKER_FLAGS("-DEBUG" CACHE) 126 127 # Never fold multiple functions into a single one because we might compare 128 # function pointers (for instance with network functions) 129 ADD_LINKER_FLAGS("-OPT:NOICF" CACHE) 130 131 # Very old flag that would do some extra Windows 98 alignment optimisations 147 132 ADD_LINKER_FLAGS("-OPT:NOWIN98" MSVC80 CACHE) 148 133 149 # Use Link time code generation for Release config if ORXONOX_RELEASE is defined 150 IF(ORXONOX_RELEASE) 151 ADD_LINKER_FLAGS("-INCREMENTAL:NO -OPT:ICF -OPT:REF -LTCG" ReleaseAll CACHE) 152 # Static linker flags have to be added manually to a target 153 SET(ORXONOX_STATIC_LINKER_FLAGS "/LTCG") 154 ELSE() 155 ADD_LINKER_FLAGS("-INCREMENTAL:YES" RelWithDebInfo CACHE) 156 ADD_LINKER_FLAGS("-INCREMENTAL:NO -OPT:ICF -OPT:REF" Release MinSizeRel CACHE) 157 ENDIF() 134 # Incremental linking speeds up development builds 135 ADD_LINKER_FLAGS("-INCREMENTAL:YES" Debug RelWithDebInfo CACHE) 136 ADD_LINKER_FLAGS("-INCREMENTAL:NO" Release MinSizeRel CACHE) 137 138 # Eliminate unreferenced data 139 ADD_LINKER_FLAGS("-OPT:REF" Release MinSizeRel CACHE) 140 141 # Link time code generation can improve run time performance at the cost of 142 # hugely increased link time (the total build time is about the same though) 143 ADD_LINKER_FLAGS("-LTCG" Release MinSizeRel CACHE)
Note: See TracChangeset
for help on using the changeset viewer.