Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5963


Ignore:
Timestamp:
Oct 18, 2009, 11:39:32 PM (15 years ago)
Author:
rgrieder
Message:

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 ;)

Location:
code/trunk/cmake
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/cmake/CompilerConfigMSVC.cmake

    r5929 r5963  
    6868ADD_COMPILER_FLAGS("-D__WIN32__ -D_WIN32"      CACHE)
    6969ADD_COMPILER_FLAGS("-D_CRT_SECURE_NO_WARNINGS" CACHE)
     70
     71# We need this flag to hack-disable IntelliSense for certain files/projects
     72# Our precompiled headers should not be larger than 50MB anyway
     73# because otherwise they get rendered useless due to too many file fragments
     74REMOVE_COMPILER_FLAGS("-Zm1000" CACHE)
    7075
    7176# Overwrite CMake default flags here.
  • code/trunk/cmake/SourceFileUtilities.cmake

    r5929 r5963  
    4848      ENDIF()
    4949      IF(NOT DISABLE_COMPILATIONS)
     50        SET(_compilation_file ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name})
    5051        SET(_include_string)
    5152        FOREACH(_file2 ${_compilation})
    5253          SET(_include_string "${_include_string}#include \"${_file2}\"\n")
    5354        ENDFOREACH(_file2)
    54         IF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name})
    55           FILE(READ ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name} _include_string_file)
     55        IF(EXISTS )
     56          FILE(READ ${_compilation_file} _include_string_file)
    5657        ENDIF()
    5758        IF(NOT _include_string STREQUAL "${_include_string_file}")
    58           FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name} "${_include_string}")
     59          FILE(WRITE ${_compilation_file} "${_include_string}")
    5960        ENDIF()
    60         LIST(APPEND _fullpath_sources ${CMAKE_CURRENT_BINARY_DIR}/${_compilation_name})
     61        LIST(APPEND _fullpath_sources ${_compilation_file})
     62        # MSVC hack that excludes the compilations from the intellisense database
     63        # (There is a bug with the "-" instead of "/". Only works for "Zm#" argument)
     64        IF(MSVC)
     65          SET_SOURCE_FILES_PROPERTIES(${_compilation_file} PROPERTIES COMPILE_FLAGS "-Zm1000")
     66        ENDIF()
    6167      ENDIF()
    6268      SET(_compilation_name)
  • code/trunk/cmake/TargetUtilities.cmake

    r5929 r5963  
    181181  ENDFOREACH(_file)
    182182
     183
     184
    183185  # Add the library/executable
    184186  IF("${_target_type}" STREQUAL "LIBRARY")
     
    190192  ENDIF()
    191193
     194
     195
    192196  # Change library prefix to "lib"
    193197  IF(MSVC AND ${_target_type} STREQUAL "LIBRARY")
     
    195199      PREFIX "lib"
    196200    )
     201  ENDIF()
     202
     203  # MSVC hack to exclude external library sources from the intellisense database
     204  # (IntelliSense stops working when adding "-Zm1000" as compile flag. "/Zm1000"
     205  # would not work because of the slash)
     206  IF(_arg_ORXONOX_EXTERNAL AND MSVC)
     207    SET_TARGET_PROPERTIES(${_target_name} PROPERTIES COMPILE_FLAGS "-Zm1000")
    197208  ENDIF()
    198209
Note: See TracChangeset for help on using the changeset viewer.