[Libreoffice-commits] core.git: bin/gbuild-to-ide Makefile.in

Noel Grandin noelgrandin at gmail.com
Mon Jan 23 06:03:04 UTC 2017


 Makefile.in       |    1 
 bin/gbuild-to-ide |   68 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 68 insertions(+), 1 deletion(-)

New commits:
commit 115797f070888cbad93656dda8fa01ec6c98a3f5
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Thu Jan 19 20:25:10 2017 +0200

    beginning of support for CodeLite in gbuild-to-ide
    
    Change-Id: I5640ad193f2766400554012383d6c910f2160378
    Reviewed-on: https://gerrit.libreoffice.org/33396
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/Makefile.in b/Makefile.in
index 454755e..d01cbf4 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -415,6 +415,7 @@ $(1)-ide-integration: gbuildtojson $(if $(filter MACOSX,$(OS_FOR_BUILD)),python3
 endef
 
 $(foreach ide,\
+	codelite \
 	debug \
 	kdevelop \
 	vs2013 \
diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
old mode 100755
new mode 100644
index 22a08cd..d4a32b2
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -1,4 +1,4 @@
-#! /usr/bin/env python3
+#! /usr/local/bin/python3
 # -*- Mode: python; tab-width: 4; indent-tabs-mode: t -*-
 #
 # This file is part of the LibreOffice project.
@@ -1624,6 +1624,71 @@ DEFINES += %(defines)s
 SUBDIRS = %(subdirs)s
 """
 
+class CodeliteIntegrationGenerator(IdeIntegrationGenerator):
+
+    def __init__(self, gbuildparser, ide):
+        IdeIntegrationGenerator.__init__(self, gbuildparser, ide)
+        self.target_by_location = {}
+        for target in set(self.gbuildparser.libs) | set(self.gbuildparser.exes):
+            if target.location not in self.target_by_location:
+                self.target_by_location[target.location] = set()
+            self.target_by_location[target.location] |= set([target])
+
+
+    def emit(self):
+        # create main workspace file
+        codelite_workspace_file = 'lo.workspace1'
+        with open(codelite_workspace_file, 'w+') as f:
+            f.write(self.generate_workspace_content())
+
+    def generate_workspace_content(self):
+        projects1 = ''
+        projects2 = ''
+        projects3 = ''
+        for module in self.gbuildparser.modulenamelist:
+            projects1 += CodeliteIntegrationGenerator.codelite_projects1_template.format(
+                name = module
+            )
+            projects2 += CodeliteIntegrationGenerator.codelite_projects2_template.format(
+                name = module,
+                config = 'Debug'
+            )
+            projects3 += CodeliteIntegrationGenerator.codelite_projects2_template.format(
+                name = module,
+                config = 'Release'
+            )
+        xml = CodeliteIntegrationGenerator.codelite_workspace_template.format(
+            projects1,
+            projects2,
+            projects3
+        )
+        return xml
+
+
+    codelite_workspace_template = """<?xml version="1.0" encoding="UTF-8"?>
+<CodeLite_Workspace Name="lo" Database="" SWTLW="Yes">
+  <WorkspaceParserMacros/>
+  <WorkspaceParserPaths>
+    <Include Path="${{WorkspacePath}}/include"/>
+  </WorkspaceParserPaths>
+    {0}
+  <BuildMatrix>
+    <WorkspaceConfiguration Name="Debug" Selected="yes">
+      <Environment/>
+      {1}
+    </WorkspaceConfiguration>
+    <WorkspaceConfiguration Name="Release" Selected="yes">
+      <Environment/>
+      {2}
+    </WorkspaceConfiguration>
+  </BuildMatrix>
+</CodeLite_Workspace>
+"""
+    codelite_projects1_template = """<Project Name="{name}" Path="{name}/{name}.project" Active="No"/>
+"""
+
+    codelite_projects2_template = """<Project Name="{name}" ConfigName="{config}"/>
+"""
 
 def get_options():
     parser = argparse.ArgumentParser(
@@ -1659,6 +1724,7 @@ if __name__ == '__main__':
         'vs2015': VisualStudioIntegrationGenerator,
         'vim': VimIntegrationGenerator,
         'qtcreator': QtCreatorIntegrationGenerator,
+        'codelite'  : CodeliteIntegrationGenerator,
     }
 
     if args.ide not in generators.keys():


More information about the Libreoffice-commits mailing list