VS IDE integration: use full Windows include paths in VS projects
It turns out that VS IDE's "Peek definition" (and other functions that
navigate to sources) fail if the short ("DOS") path to the file is given
in project's includes: see issue at
https://developercommunity.visualstudio.com/content/problem/139659/vc-peek-definition-fails-to-navigate-to-windows-ki.html
This patch converts the include paths to full Windows paths, to avoid the
problem. Also, since IDE starts working correctly with this change, this
patch removes inclusion of "inherited" paths "$(IncludePath)", which are
the paths added by Visual Studio itself. Since we do specify all include
paths explicitly, that is not required, and avoids confusion.
Change-Id: Ide2d948f8c7b050b02f550342144fede4fcafb82
Reviewed-on: https://gerrit.libreoffice.org/53731
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
+14
-1
@@ -19,6 +19,8 @@ import json
|
||||
import xml.etree.ElementTree as ET
|
||||
import xml.dom.minidom as minidom
|
||||
import traceback
|
||||
import subprocess
|
||||
from sys import platform
|
||||
|
||||
|
||||
class GbuildLinkTarget:
|
||||
@@ -827,6 +829,13 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator):
|
||||
f.write('EndGlobal\n')
|
||||
print('')
|
||||
|
||||
@staticmethod
|
||||
def to_long_names(shortnames):
|
||||
if platform == "cygwin":
|
||||
return (subprocess.check_output(["cygpath", "-wal"] + shortnames).decode("utf-8", "strict").rstrip()).split("\n")
|
||||
else:
|
||||
return shortnames
|
||||
|
||||
@staticmethod
|
||||
def defs_list(defs):
|
||||
defines_list = []
|
||||
@@ -888,6 +897,10 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator):
|
||||
Label='LocalAppDataPlatform')
|
||||
|
||||
ET.SubElement(proj_node, '{%s}PropertyGroup' % ns, Label='UserMacros')
|
||||
# VS IDE (at least "Peek definition") is allergic to paths like "C:/PROGRA~2/WI3CF2~1/10/Include/10.0.14393.0/um"; see
|
||||
# https://developercommunity.visualstudio.com/content/problem/139659/vc-peek-definition-fails-to-navigate-to-windows-ki.html
|
||||
# We need to convert to long paths here. Do this once, since it's time-consuming operation.
|
||||
include_path_node_text = ';'.join(self.to_long_names(target.include))
|
||||
for cfg_name, cfg_targets in self.configurations.items():
|
||||
conf_node = ET.SubElement(proj_node, '{%s}PropertyGroup' % ns,
|
||||
Condition="'$(Configuration)|$(Platform)'=='%s|%s'" % (cfg_name, platform))
|
||||
@@ -908,7 +921,7 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator):
|
||||
nmake_defs_node = ET.SubElement(conf_node, '{%s}NMakePreprocessorDefinitions' % ns)
|
||||
nmake_defs_node.text = ';'.join(self.defs_list(target.defs) + ['$(NMakePreprocessorDefinitions)'])
|
||||
include_path_node = ET.SubElement(conf_node, '{%s}IncludePath' % ns)
|
||||
include_path_node.text = ';'.join(target.include + ['$(IncludePath)'])
|
||||
include_path_node.text = include_path_node_text
|
||||
|
||||
ET.SubElement(proj_node, '{%s}ItemDefinitionGroup' % ns)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user