[Orxonox-commit 1245] r5963 - code/trunk/cmake
rgrieder at orxonox.net
rgrieder at orxonox.net
Sun Oct 18 23:39:32 CEST 2009
Author: rgrieder
Date: 2009-10-18 23:39:32 +0200 (Sun, 18 Oct 2009)
New Revision: 5963
Modified:
code/trunk/cmake/CompilerConfigMSVC.cmake
code/trunk/cmake/SourceFileUtilities.cmake
code/trunk/cmake/TargetUtilities.cmake
Log:
Improved Visual Studio IntelliSense (tool that suggests function names etc.) performance by excluding all external libraries (headers used in our projects still get parsed) and the compilations (double work otherwise).
Curiously there is no official switch to disable IntelliSense. There's only a local and unofficial version that deals with removing a particular DLL.
However if Microsoft dares to create bugs, we dare to exploit them: Specifying "-Zm1000" instead of "/Zm1000" as compile flag messes with IntelliSense. It once took me half a day to figure that out since the causality between that and "IntelliSense is not working at all for any project" is rather unexpected ;)
Modified: code/trunk/cmake/CompilerConfigMSVC.cmake
===================================================================
--- code/trunk/cmake/CompilerConfigMSVC.cmake 2009-10-16 17:10:03 UTC (rev 5962)
+++ code/trunk/cmake/CompilerConfigMSVC.cmake 2009-10-18 21:39:32 UTC (rev 5963)
@@ -68,6 +68,11 @@
ADD_COMPILER_FLAGS("-D__WIN32__ -D_WIN32" CACHE)
ADD_COMPILER_FLAGS("-D_CRT_SECURE_NO_WARNINGS" CACHE)
+# We need this flag to hack-disable IntelliSense for certain files/projects
+# Our precompiled headers should not be larger than 50MB anyway
+# because otherwise they get rendered useless due to too many file fragments
+REMOVE_COMPILER_FLAGS("-Zm1000" CACHE)
+
# Overwrite CMake default flags here.
SET_COMPILER_FLAGS("-MDd -Od -Zi -D_DEBUG -MP2 -RTC1" Debug CACHE)
SET_COMPILER_FLAGS("-MD -O2 -DNDEBUG -MP2" Release CACHE)
Modified: code/trunk/cmake/SourceFileUtilities.cmake
===================================================================
--- code/trunk/cmake/SourceFileUtilities.cmake 2009-10-16 17:10:03 UTC (rev 5962)
+++ code/trunk/cmake/SourceFileUtilities.cmake 2009-10-18 21:39:32 UTC (rev 5963)
@@ -47,17 +47,23 @@
MESSAGE(FATAL_ERROR "No name provided for source file compilation")
ENDIF()
IF(NOT DISABLE_COMPILATIONS)
+ SET(_compilation_file ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name})
SET(_include_string)
FOREACH(_file2 ${_compilation})
SET(_include_string "${_include_string}#include \"${_file2}\"\n")
ENDFOREACH(_file2)
- IF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name})
- FILE(READ ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name} _include_string_file)
+ IF(EXISTS )
+ FILE(READ ${_compilation_file} _include_string_file)
ENDIF()
IF(NOT _include_string STREQUAL "${_include_string_file}")
- FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name} "${_include_string}")
+ FILE(WRITE ${_compilation_file} "${_include_string}")
ENDIF()
- LIST(APPEND _fullpath_sources ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name})
+ LIST(APPEND _fullpath_sources ${_compilation_file})
+ # MSVC hack that excludes the compilations from the intellisense database
+ # (There is a bug with the "-" instead of "/". Only works for "Zm#" argument)
+ IF(MSVC)
+ SET_SOURCE_FILES_PROPERTIES(${_compilation_file} PROPERTIES COMPILE_FLAGS "-Zm1000")
+ ENDIF()
ENDIF()
SET(_compilation_name)
SET(_compilation)
Modified: code/trunk/cmake/TargetUtilities.cmake
===================================================================
--- code/trunk/cmake/TargetUtilities.cmake 2009-10-16 17:10:03 UTC (rev 5962)
+++ code/trunk/cmake/TargetUtilities.cmake 2009-10-18 21:39:32 UTC (rev 5963)
@@ -180,6 +180,8 @@
ENDIF()
ENDFOREACH(_file)
+
+
# Add the library/executable
IF("${_target_type}" STREQUAL "LIBRARY")
ADD_LIBRARY(${_target_name} ${_arg_STATIC} ${_arg_SHARED}
@@ -189,6 +191,8 @@
${_${_target_name}_files})
ENDIF()
+
+
# Change library prefix to "lib"
IF(MSVC AND ${_target_type} STREQUAL "LIBRARY")
SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
@@ -196,6 +200,13 @@
)
ENDIF()
+ # MSVC hack to exclude external library sources from the intellisense database
+ # (IntelliSense stops working when adding "-Zm1000" as compile flag. "/Zm1000"
+ # would not work because of the slash)
+ IF(_arg_ORXONOX_EXTERNAL AND MSVC)
+ SET_TARGET_PROPERTIES(${_target_name} PROPERTIES COMPILE_FLAGS "-Zm1000")
+ ENDIF()
+
# MODULE B
IF (_arg_MODULE)
SET_TARGET_PROPERTIES(${_target_name} PROPERTIES
More information about the Orxonox-commit
mailing list