summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-05-02 13:29:21 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2018-05-02 16:31:59 +0200
commitea1f50894ac3e681213b874af08217ae25d0433a (patch)
tree8e32b3e6ca12b59e842dd7b507434ed17d171c7e /bin
parentb18953565b68e46289ad85927d79f5978a51078b (diff)
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>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gbuild-to-ide15
1 files changed, 14 insertions, 1 deletions
diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index 8507de280d83..90a732d7c614 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -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:
@@ -828,6 +830,13 @@ class VisualStudioIntegrationGenerator(IdeIntegrationGenerator):
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 = []
# List defines
@@ -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)