[Orxonox-commit 3687] r8368 - in code/trunk: . cmake cmake/tools src

rgrieder at orxonox.net rgrieder at orxonox.net
Sun May 1 03:09:28 CEST 2011


Author: rgrieder
Date: 2011-05-01 03:09:28 +0200 (Sun, 01 May 2011)
New Revision: 8368

Modified:
   code/trunk/CMakeLists.txt
   code/trunk/cmake/CompilerConfigGCC.cmake
   code/trunk/cmake/CompilerConfigMSVC.cmake
   code/trunk/cmake/PackageConfig.cmake
   code/trunk/cmake/PackageConfigOSX.cmake
   code/trunk/cmake/tools/FlagUtilities.cmake
   code/trunk/src/OrxonoxConfig.cmake
   code/trunk/src/OrxonoxConfig.h.in
   code/trunk/src/orxonox-main.vcproj.user.in
   code/trunk/src/orxonox-main.vcxproj.user.in
Log:
Added CMake configuration type "RelForDevs", which replaces "RelWithDebInfo". That latter is now equivalent to "Release", but with symbols.
Also, I removed debug symbol generation for Release and MinSizeRel when compiling with MSVC.

The new configuration should be used as standard Release mode when developing. The other three release configurations are for actual installed binaries (and behave again as the name suggests).

Modified: code/trunk/CMakeLists.txt
===================================================================
--- code/trunk/CMakeLists.txt	2011-04-30 21:38:14 UTC (rev 8367)
+++ code/trunk/CMakeLists.txt	2011-05-01 01:09:28 UTC (rev 8368)
@@ -91,20 +91,33 @@
 # This sets where to look for CMake modules (e.g. "Find*.cmake" files)
 SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_SOURCE_DIR}/cmake/tools)
 
-# Set Debug build to default when not having multi-config generator like msvc
+# Flag variables for extra configuration "RelForDevs" should be hidden
+MARK_AS_ADVANCED(
+  CMAKE_CXX_FLAGS_RELFORDEVS
+  CMAKE_C_FLAGS_RELFORDEVS
+  CMAKE_EXE_LINKER_FLAGS_RELFORDEVS
+  CMAKE_MODULE_LINKER_FLAGS_RELFORDEVS
+  CMAKE_SHARED_LINKER_FLAGS_RELFORDEVS
+)
+
 IF(NOT CMAKE_CONFIGURATION_TYPES)
+  # Set Debug build to default when not having multi-config generator like MSVC or XCODE
   IF(NOT CMAKE_BUILD_TYPE)
     SET(CMAKE_BUILD_TYPE Debug CACHE STRING
-        "Build types are: Debug, Release, MinSizeRel, RelWithDebInfo" FORCE)
+        "Build types are: Debug, RelForDevs, RelWithDebInfo, Release, MinSizeRel" FORCE)
   ENDIF()
   MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE)
 
   MESSAGE(STATUS "*** Build type is ${CMAKE_BUILD_TYPE} ***")
 ELSE()
+  # Make sure no build type is ever set
   IF(CMAKE_BUILD_TYPE)
     SET(CMAKE_BUILD_TYPE CACHE STRING FORCE)
   ENDIF()
-  MARK_AS_ADVANCED(CMAKE_BUILD_TYPE)
+  MARK_AS_ADVANCED(FORCE CMAKE_BUILD_TYPE)
+  # Add our extra configuration "RelForDevs"
+  SET(CMAKE_CONFIGURATION_TYPES "Debug;RelForDevs;RelWithDebInfo;Release;MinSizeRel"
+      CACHE STRING "Semicolon separated list of supported configuration types." FORCE)
 ENDIF()
 
 # Debug builds can not be installed

Modified: code/trunk/cmake/CompilerConfigGCC.cmake
===================================================================
--- code/trunk/cmake/CompilerConfigGCC.cmake	2011-04-30 21:38:14 UTC (rev 8367)
+++ code/trunk/cmake/CompilerConfigGCC.cmake	2011-05-01 01:09:28 UTC (rev 8368)
@@ -51,8 +51,9 @@
 # These flags get added to the flags above
 SET_COMPILER_FLAGS("    -g -ggdb -D_DEBUG" Debug          CACHE)
 SET_COMPILER_FLAGS("             -DNDEBUG" ReleaseAll     CACHE)
+ADD_COMPILER_FLAGS("-O2 -g -ggdb"          RelForDevs     CACHE)
+ADD_COMPILER_FLAGS("-O3 -g -ggdb"          RelWithDebInfo CACHE)
 ADD_COMPILER_FLAGS("-O3"                   Release        CACHE)
-ADD_COMPILER_FLAGS("-O2 -g -ggdb"          RelWithDebInfo CACHE)
 ADD_COMPILER_FLAGS("-Os"                   MinSizeRel     CACHE)
 
 # CMake doesn't seem to set the PIC flags right on certain 64 bit systems
@@ -111,8 +112,7 @@
 
 # Add compiler and linker flags for MinGW
 IF (MINGW)
-  ADD_COMPILER_FLAGS("-gstabs+" Debug          CACHE)
-  ADD_COMPILER_FLAGS("-gstabs+" RelWithDebInfo CACHE)
+  ADD_COMPILER_FLAGS("-gstabs+" Debug RelForDevs RelWithDebInfo CACHE)
 
   ADD_LINKER_FLAGS("-enable-auto-import" CACHE)
 ENDIF()

Modified: code/trunk/cmake/CompilerConfigMSVC.cmake
===================================================================
--- code/trunk/cmake/CompilerConfigMSVC.cmake	2011-04-30 21:38:14 UTC (rev 8367)
+++ code/trunk/cmake/CompilerConfigMSVC.cmake	2011-05-01 01:09:28 UTC (rev 8368)
@@ -39,7 +39,7 @@
 # CMake default flags : -DWIN32 -D_WINDOWS -W3 -Zm1000
 # additionally for CXX: -EHsc -GR
 # We keep these flags but reset the build specific flags
-SET_COMPILER_FLAGS("" Debug RelWithDebInfo Release MinSizeRel CACHE)
+SET_COMPILER_FLAGS("" Debug RelForDevs RelWithDebInfo Release MinSizeRel CACHE)
 
 # Make sure we define all the possible macros for identifying Windows
 ADD_COMPILER_FLAGS("-D__WIN32__ -D_WIN32"  CACHE)
@@ -50,9 +50,6 @@
 # Use multiprocessed compiling (like "make -j3" on Unix)
 ADD_COMPILER_FLAGS("-MP" CACHE)
 
-# Always generate debug symbols (there is really no reason not to)
-ADD_COMPILER_FLAGS("-Zi" CACHE)
-
 # Never omit frame pointers to avoid useless stack traces (the performance
 # loss is almost not measurable)
 ADD_COMPILER_FLAGS("-Oy-" CACHE)
@@ -61,14 +58,16 @@
 
 # Set build specific flags.
 # -MD[d]    Multithreaded [debug] shared MSVC runtime library
+# -Zi       Generate debug symbols
 # -O[d|2|1] No optimisations, optimise for speed, optimise for size
 # -Oi[-]    Use or disable use of intrinisic functions
 # -GL       Link time code generation (see -LTCG in linker flags)
 # -RTC1     Both basic runtime checks
-ADD_COMPILER_FLAGS("-MDd -Od -Oi  -D_DEBUG -RTC1" Debug          CACHE)
-ADD_COMPILER_FLAGS("-MD  -O2 -Oi  -DNDEBUG"       RelWithDebInfo CACHE)
-ADD_COMPILER_FLAGS("-MD  -O2 -Oi  -DNDEBUG -GL"   Release        CACHE)
-ADD_COMPILER_FLAGS("-MD  -O1 -Oi- -DNDEBUG -GL"   MinSizeRel     CACHE)
+ADD_COMPILER_FLAGS("-MDd -Zi -Od -Oi  -D_DEBUG -RTC1" Debug          CACHE)
+ADD_COMPILER_FLAGS("-MD  -Zi -O2 -Oi  -DNDEBUG"       RelForDevs     CACHE)
+ADD_COMPILER_FLAGS("-MD  -Zi -O2 -Oi  -DNDEBUG -GL"   RelWithDebInfo CACHE)
+ADD_COMPILER_FLAGS("-MD      -O2 -Oi  -DNDEBUG -GL"   Release        CACHE)
+ADD_COMPILER_FLAGS("-MD      -O1 -Oi- -DNDEBUG -GL"   MinSizeRel     CACHE)
 
 
 ####################### Warnings ########################
@@ -119,11 +118,8 @@
 
 # CMake default flags: -MANIFEST -STACK:10000000 -machine:I386
 # We keep these flags but reset the build specific flags
-SET_LINKER_FLAGS("" Debug RelWithDebInfo Release MinSizeRel CACHE)
+SET_LINKER_FLAGS("" Debug RelForDevs RelWithDebInfo Release MinSizeRel CACHE)
 
-# Always generate debug symbols (there is really no reason not to)
-ADD_LINKER_FLAGS("-DEBUG" CACHE)
-
 # Never fold multiple functions into a single one because we might compare
 # function pointers (for instance with network functions)
 ADD_LINKER_FLAGS("-OPT:NOICF" CACHE)
@@ -131,13 +127,16 @@
 # Very old flag that would do some extra Windows 98 alignment optimisations
 ADD_LINKER_FLAGS("-OPT:NOWIN98" MSVC80 CACHE)
 
+# Generate debug symbols
+ADD_LINKER_FLAGS("-DEBUG" Debug RelForDevs RelWithDebInfo CACHE)
+
 # Incremental linking speeds up development builds
-ADD_LINKER_FLAGS("-INCREMENTAL:YES" Debug   RelWithDebInfo CACHE)
-ADD_LINKER_FLAGS("-INCREMENTAL:NO"  Release MinSizeRel     CACHE)
+ADD_LINKER_FLAGS("-INCREMENTAL:YES" Debug   RelForDevs                CACHE)
+ADD_LINKER_FLAGS("-INCREMENTAL:NO"  Release RelWithDebInfo MinSizeRel CACHE)
 
 # Eliminate unreferenced data
-ADD_LINKER_FLAGS("-OPT:REF" Release MinSizeRel CACHE)
+ADD_LINKER_FLAGS("-OPT:REF" Release RelWithDebInfo MinSizeRel CACHE)
 
 # Link time code generation can improve run time performance at the cost of
 # hugely increased link time (the total build time is about the same though)
-ADD_LINKER_FLAGS("-LTCG" Release MinSizeRel CACHE)
+ADD_LINKER_FLAGS("-LTCG" Release RelWithDebInfo MinSizeRel CACHE)

Modified: code/trunk/cmake/PackageConfig.cmake
===================================================================
--- code/trunk/cmake/PackageConfig.cmake	2011-04-30 21:38:14 UTC (rev 8367)
+++ code/trunk/cmake/PackageConfig.cmake	2011-05-01 01:09:28 UTC (rev 8368)
@@ -80,7 +80,7 @@
       INSTALL(
         FILES ${DEP_BINARY_DIR}/${_file}
         DESTINATION bin
-        CONFIGURATIONS Release RelWithDebInfo MinSizeRel
+        CONFIGURATIONS RelForDevs Release RelWithDebInfo MinSizeRel
       )
     ENDFOREACH(_file)
   ELSE()
@@ -89,7 +89,7 @@
     INSTALL(
       DIRECTORY ${DEP_BINARY_DIR}/
       DESTINATION bin
-      CONFIGURATIONS Release RelWithDebInfo MinSizeRel
+      CONFIGURATIONS RelForDevs Release RelWithDebInfo MinSizeRel
       REGEX "_[Dd]\\.[a-zA-Z0-9+-]+$|-mt-gd-|^.*\\.pdb$" EXCLUDE
     )
   ENDIF()

Modified: code/trunk/cmake/PackageConfigOSX.cmake
===================================================================
--- code/trunk/cmake/PackageConfigOSX.cmake	2011-04-30 21:38:14 UTC (rev 8367)
+++ code/trunk/cmake/PackageConfigOSX.cmake	2011-05-01 01:09:28 UTC (rev 8368)
@@ -97,7 +97,7 @@
   INSTALL(
     DIRECTORY ${DEP_BINARY_DIR}/
     DESTINATION bin
-    CONFIGURATIONS Release RelWithDebInfo MinSizeRel
+    CONFIGURATIONS RelForDevs Release RelWithDebInfo MinSizeRel
     REGEX "_[Dd]\\.[a-zA-Z0-9+-]+$|-mt-gd-|^.*\\.pdb$" EXCLUDE
   )
 ENDIF()

Modified: code/trunk/cmake/tools/FlagUtilities.cmake
===================================================================
--- code/trunk/cmake/tools/FlagUtilities.cmake	2011-04-30 21:38:14 UTC (rev 8367)
+++ code/trunk/cmake/tools/FlagUtilities.cmake	2011-05-01 01:09:28 UTC (rev 8368)
@@ -21,7 +21,7 @@
  #    Reto Grieder
  #  Description:
  #    Sets the compiler/linker flags. After the flags you can specify more args:
- #    Release, Debug, RelWithDebInfo, MinSizeRel: Build configs (inclusive)
+ #    Release, Debug, RelWithDebInfo, MinSizeRel, RelForDevs: Build configs
  #    ReleaseAll: Sets the flags of all three release builds
  #    CACHE: Values are witten with SET_CACHE_ADVANCED
  #    FORCE: When writing to the cache, the values are set anyway
@@ -35,8 +35,8 @@
  #  Example:
  #    REMOVE_COMPILER_FLAGS("/Gm "asdf" -q"test -foo" CXX ReleaseAll NOT UNIX)
  #    This will only remove the CXX (C++) flags on a non Unix system for the
- #    Release, RelWithDebInfo and MinSizeRel configurations. The macros should
- #    be able to cope with "test -foo" as string argument for a flag.
+ #    Release, RelWithDebInfo, MinSizeRel, RelForDevs configurations. The macros
+ #    should be able to cope with "test -foo" as string argument for a flag.
  #
 
 INCLUDE(SeparateFlags)
@@ -88,12 +88,12 @@
   FOREACH(_arg ${ARGN})
     IF(_arg MATCHES "${_key_regex}")
       LIST(APPEND _langs "${_arg}")
-    ELSEIF(   _arg MATCHES "^(Debug|Release|MinSizeRel|RelWithDebInfo)$"
-           OR _arg MATCHES "^(DEBUG|RELEASE|MINSIZEREL|RELWITHDEBINFO)$")
+    ELSEIF(   _arg MATCHES "^(Debug|Release|MinSizeRel|RelWithDebInfo|RelForDevs)$"
+           OR _arg MATCHES "^(DEBUG|RELEASE|MINSIZEREL|RELWITHDEBINFO|RelForDevs)$")
       STRING(TOUPPER "${_arg}" _upper_arg)
       LIST(APPEND _build_types ${_upper_arg})
     ELSEIF(_arg STREQUAL "ReleaseAll")
-      LIST(APPEND _build_types RELEASE MINSIZEREL RELWITHDEBINFO)
+      LIST(APPEND _build_types RELEASE MINSIZEREL RELWITHDEBINFO RELFORDEVS)
     ELSEIF(_arg STREQUAL "CACHE")
       SET(_write_to_cache TRUE)
     ELSEIF(_arg STREQUAL "FORCE")

Modified: code/trunk/src/OrxonoxConfig.cmake
===================================================================
--- code/trunk/src/OrxonoxConfig.cmake	2011-04-30 21:38:14 UTC (rev 8367)
+++ code/trunk/src/OrxonoxConfig.cmake	2011-05-01 01:09:28 UTC (rev 8368)
@@ -74,6 +74,7 @@
 # XCode and Visual Studio support multiple configurations. In order to tell
 # about the active one we have to define the macro for each configuration
 ADD_COMPILER_FLAGS("-DCMAKE_Debug_BUILD"          Debug)
+ADD_COMPILER_FLAGS("-DCMAKE_RelForDevs_BUILD"     RelForDevs)
 ADD_COMPILER_FLAGS("-DCMAKE_Release_BUILD"        Release)
 ADD_COMPILER_FLAGS("-DCMAKE_RelWithDebInfo_BUILD" RelWithDebInfo)
 ADD_COMPILER_FLAGS("-DCMAKE_MinSizeRel_BUILD"     MinSizeRel)

Modified: code/trunk/src/OrxonoxConfig.h.in
===================================================================
--- code/trunk/src/OrxonoxConfig.h.in	2011-04-30 21:38:14 UTC (rev 8367)
+++ code/trunk/src/OrxonoxConfig.h.in	2011-05-01 01:09:28 UTC (rev 8368)
@@ -178,10 +178,11 @@
 #endif
 */
 
-// Configurations Release and MinSizeRel are designed for redistribution while
-// RelWithDebInfo is more for development
+// Configurations Release, RelWithDebInfo and MinSizeRel are designed for
+// redistribution while RelForDevs is for development purposes
 // ORXONOX_RELEASE simplifies this a little bit
-#if defined(CMAKE_Release_BUILD) || defined(CMAKE_MinSizeRel_BUILD)
+#if defined(CMAKE_Release_BUILD) || defined(CMAKE_MinSizeRel_BUILD) \
+    || defined(CMAKE_RelWithDebInfo_BUILD)
 #  define ORXONOX_RELEASE
 #endif
 

Modified: code/trunk/src/orxonox-main.vcproj.user.in
===================================================================
--- code/trunk/src/orxonox-main.vcproj.user.in	2011-04-30 21:38:14 UTC (rev 8367)
+++ code/trunk/src/orxonox-main.vcproj.user.in	2011-05-01 01:09:28 UTC (rev 8368)
@@ -15,6 +15,15 @@
 			/>
 		</Configuration>
 		<Configuration
+			Name="RelForDevs|${MSVC_PLATFORM}"
+			>
+			<DebugSettings
+				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
+				Environment="PATH=${RUNTIME_LIBRARY_DIRECTORY};%PATH%"
+				EnvironmentMerge="true"
+			/>
+		</Configuration>
+		<Configuration
 			Name="Release|${MSVC_PLATFORM}"
 			>
 			<DebugSettings

Modified: code/trunk/src/orxonox-main.vcxproj.user.in
===================================================================
--- code/trunk/src/orxonox-main.vcxproj.user.in	2011-04-30 21:38:14 UTC (rev 8367)
+++ code/trunk/src/orxonox-main.vcxproj.user.in	2011-05-01 01:09:28 UTC (rev 8368)
@@ -5,6 +5,11 @@
     <LocalDebuggerEnvironment>PATH=${RUNTIME_LIBRARY_DIRECTORY};%PATH%</LocalDebuggerEnvironment>
     <LocalDebuggerWorkingDirectory>$(Outdir)</LocalDebuggerWorkingDirectory>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RelForDevs|${MSVC_PLATFORM}'">
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+    <LocalDebuggerEnvironment>PATH=${RUNTIME_LIBRARY_DIRECTORY};%PATH%</LocalDebuggerEnvironment>
+    <LocalDebuggerWorkingDirectory>$(Outdir)</LocalDebuggerWorkingDirectory>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MinSizeRel|${MSVC_PLATFORM}'">
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
     <LocalDebuggerEnvironment>PATH=${RUNTIME_LIBRARY_DIRECTORY};%PATH%</LocalDebuggerEnvironment>




More information about the Orxonox-commit mailing list