Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChain.java2
-rw-r--r--build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java10
-rw-r--r--build/org.eclipse.cdt.cmake-feature/.project17
-rw-r--r--build/org.eclipse.cdt.cmake-feature/build.properties1
-rw-r--r--build/org.eclipse.cdt.cmake-feature/feature.properties29
-rw-r--r--build/org.eclipse.cdt.cmake-feature/feature.xml34
-rw-r--r--build/org.eclipse.cdt.cmake-feature/pom.xml18
-rw-r--r--build/org.eclipse.cdt.cmake.core/.classpath7
-rw-r--r--build/org.eclipse.cdt.cmake.core/.project28
-rw-r--r--build/org.eclipse.cdt.cmake.core/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--build/org.eclipse.cdt.cmake.core/META-INF/MANIFEST.MF17
-rw-r--r--build/org.eclipse.cdt.cmake.core/about.html24
-rw-r--r--build/org.eclipse.cdt.cmake.core/build.properties6
-rw-r--r--build/org.eclipse.cdt.cmake.core/plugin.xml89
-rw-r--r--build/org.eclipse.cdt.cmake.core/pom.xml17
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeNature.java48
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java73
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Activator.java61
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java88
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationFactory.java82
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuilder.java66
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptor.java49
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptorType.java39
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLocalLaunchConfigurationProvider.java111
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLocalRunLaunchConfigDelegate.java37
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeScannerInfoProvider.java45
-rw-r--r--build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeTemplateGenerator.java62
-rw-r--r--build/org.eclipse.cdt.cmake.core/templates/simple/CMakeLists.txt3
-rw-r--r--build/org.eclipse.cdt.cmake.core/templates/simple/main.cpp4
-rw-r--r--build/org.eclipse.cdt.cmake.ui/.classpath7
-rw-r--r--build/org.eclipse.cdt.cmake.ui/.project28
-rw-r--r--build/org.eclipse.cdt.cmake.ui/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF15
-rw-r--r--build/org.eclipse.cdt.cmake.ui/about.html24
-rw-r--r--build/org.eclipse.cdt.cmake.ui/build.properties6
-rw-r--r--build/org.eclipse.cdt.cmake.ui/icons/newcc_app.gifbin0 -> 630 bytes
-rw-r--r--build/org.eclipse.cdt.cmake.ui/plugin.xml17
-rw-r--r--build/org.eclipse.cdt.cmake.ui/pom.xml17
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java50
-rw-r--r--build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeProjectWizard.java45
-rw-r--r--pom.xml4
41 files changed, 1293 insertions, 1 deletions
diff --git a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChain.java b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChain.java
index fbf0a4ac8e6..186fb7db4df 100644
--- a/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChain.java
+++ b/build/org.eclipse.cdt.build.core/src/org/eclipse/cdt/build/core/IToolChain.java
@@ -27,6 +27,8 @@ public interface IToolChain {
String getName();
+ String getCommand();
+
boolean supports(ILaunchTarget target);
IExtendedScannerInfo getScannerInfo(String command, List<String> args, List<String> includePaths,
diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
index 8af950559f4..75c7b3d1c10 100644
--- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
+++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/GCCToolChain.java
@@ -46,8 +46,9 @@ import org.osgi.service.prefs.Preferences;
*/
public class GCCToolChain implements IToolChain {
- private IToolChainType type;
+ private final IToolChainType type;
private final String name;
+ private String command;
private String version;
private String target;
@@ -55,11 +56,13 @@ public class GCCToolChain implements IToolChain {
this.type = type;
getVersion(path.resolve(command).toString());
this.name = command + '-' + version;
+ this.command = command;
}
protected GCCToolChain(IToolChainType type, String name) {
this.type = type;
this.name = name;
+ // TODO need to pull the other info out of preferences
}
@Override
@@ -72,6 +75,11 @@ public class GCCToolChain implements IToolChain {
return name;
}
+ @Override
+ public String getCommand() {
+ return command;
+ }
+
private static Pattern versionPattern = Pattern.compile(".*(gcc|LLVM) version .*"); //$NON-NLS-1$
private static Pattern targetPattern = Pattern.compile("Target: (.*)"); //$NON-NLS-1$
diff --git a/build/org.eclipse.cdt.cmake-feature/.project b/build/org.eclipse.cdt.cmake-feature/.project
new file mode 100644
index 00000000000..4bfc1eda8ff
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake-feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.cdt.cmake-feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/build/org.eclipse.cdt.cmake-feature/build.properties b/build/org.eclipse.cdt.cmake-feature/build.properties
new file mode 100644
index 00000000000..64f93a9f0b7
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake-feature/build.properties
@@ -0,0 +1 @@
+bin.includes = feature.xml
diff --git a/build/org.eclipse.cdt.cmake-feature/feature.properties b/build/org.eclipse.cdt.cmake-feature/feature.properties
new file mode 100644
index 00000000000..3703525e4d7
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake-feature/feature.properties
@@ -0,0 +1,29 @@
+###############################################################################
+# Copyright (c) 2015 QNX Software Systems and others
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+# features.properties
+# contains externalized strings for feature.xml
+# "%foo" in feature.xml corresponds to the key "foo" in this file
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file should be translated.
+
+# "featureName" property - name of the feature
+featureName=C/C++ CMake Support
+
+# "providerName" property - name of the company that provides the feature
+providerName=Eclipse CDT
+
+# "description" property - description of the feature
+description=Support for projects built using CMake
+
+# copyright
+copyright=\
+Copyright (c) 2015 QNX Software Systems and others.\n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html
diff --git a/build/org.eclipse.cdt.cmake-feature/feature.xml b/build/org.eclipse.cdt.cmake-feature/feature.xml
new file mode 100644
index 00000000000..faa10624dfb
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake-feature/feature.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.cdt.cmake"
+ label="%featureName"
+ version="1.0.0.qualifier"
+ provider-name="%providerName">
+
+ <description>
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <plugin
+ id="org.eclipse.cdt.cmake.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.cdt.cmake.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/build/org.eclipse.cdt.cmake-feature/pom.xml b/build/org.eclipse.cdt.cmake-feature/pom.xml
new file mode 100644
index 00000000000..661dbc01945
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake-feature/pom.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.cdt</groupId>
+ <artifactId>cdt-parent</artifactId>
+ <version>8.8.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.eclipse.cdt.features</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ <artifactId>org.eclipse.cdt.cmake</artifactId>
+ <packaging>eclipse-feature</packaging>
+</project>
diff --git a/build/org.eclipse.cdt.cmake.core/.classpath b/build/org.eclipse.cdt.cmake.core/.classpath
new file mode 100644
index 00000000000..eca7bdba8f0
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/build/org.eclipse.cdt.cmake.core/.project b/build/org.eclipse.cdt.cmake.core/.project
new file mode 100644
index 00000000000..f5c8e485e7b
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.cdt.cmake.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/build/org.eclipse.cdt.cmake.core/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.cmake.core/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0c68a61dca8
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/build/org.eclipse.cdt.cmake.core/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.cmake.core/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..3cacc90d5e9
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CDT CMake Core
+Bundle-SymbolicName: org.eclipse.cdt.cmake.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.cdt.cmake.core.internal.Activator
+Bundle-Vendor: Eclipse CDT
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources;bundle-version="3.11.0",
+ org.freemarker;bundle-version="2.3.22",
+ org.eclipse.debug.core;bundle-version="3.10.0",
+ org.eclipse.launchbar.core;bundle-version="2.0.0",
+ org.eclipse.cdt.core;bundle-version="5.12.0",
+ org.eclipse.cdt.build.core;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.cdt.cmake.core
diff --git a/build/org.eclipse.cdt.cmake.core/about.html b/build/org.eclipse.cdt.cmake.core/about.html
new file mode 100644
index 00000000000..d7c511887d6
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/about.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head>
+
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 22, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body></html> \ No newline at end of file
diff --git a/build/org.eclipse.cdt.cmake.core/build.properties b/build/org.eclipse.cdt.cmake.core/build.properties
new file mode 100644
index 00000000000..bdcc25a2886
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.xml
diff --git a/build/org.eclipse.cdt.cmake.core/plugin.xml b/build/org.eclipse.cdt.cmake.core/plugin.xml
new file mode 100644
index 00000000000..c71cca8788c
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/plugin.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ id="cmakeNature"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run
+ class="org.eclipse.cdt.cmake.core.CMakeNature">
+ </run>
+ </runtime>
+ <builder
+ id="org.eclipse.cdt.cmake.core.cmakeBuilder">
+ </builder>
+ </extension>
+ <extension
+ id="cmakeBuilder"
+ name="CMake Builder"
+ point="org.eclipse.core.resources.builders">
+ <builder
+ callOnEmptyDelta="true"
+ hasNature="true"
+ isConfigurable="true"
+ supportsConfigurations="true">
+ <run
+ class="org.eclipse.cdt.cmake.core.internal.CMakeBuilder">
+ </run>
+ </builder>
+ </extension>
+ <extension
+ point="org.eclipse.launchbar.core.launchBarContributions">
+ <descriptorType
+ class="org.eclipse.cdt.cmake.core.internal.CMakeLaunchDescriptorType"
+ id="org.eclipse.cdt.cmake.core.descriptorType"
+ priority="org.eclipse.cdt.cmake.core.descriptorType">
+ <enablement>
+ <instanceof
+ value="org.eclipse.core.resources.IProject">
+ </instanceof>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.core.resources.projectNature"
+ value="org.eclipse.cdt.cmake.core.cmakeNature">
+ </test>
+ </enablement>
+ <enablement>
+ <instanceof
+ value="org.eclipse.core.resources.IProject">
+ </instanceof>
+ <test
+ property="org.eclipse.core.resources.projectNature">
+ </test>
+ </enablement>
+ </descriptorType>
+ <configProvider
+ class="org.eclipse.cdt.cmake.core.internal.CMakeLocalLaunchConfigurationProvider"
+ descriptorType="org.eclipse.cdt.cmake.core.descriptorType"
+ priority="10">
+ </configProvider>
+ </extension>
+ <extension
+ point="org.eclipse.debug.core.launchConfigurationTypes">
+ <launchConfigurationType
+ delegate="org.eclipse.cdt.cmake.core.internal.CMakeLocalRunLaunchConfigDelegate"
+ id="org.eclipse.cdt.cmake.core.localLunchConfigurationType"
+ modes="run"
+ name="CMake Local Application"
+ public="true">
+ </launchConfigurationType>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.core.resources.IBuildConfiguration"
+ class="org.eclipse.cdt.cmake.core.internal.CMakeBuildConfigurationFactory">
+ <adapter
+ type="org.eclipse.cdt.cmake.core.internal.CMakeBuildConfiguration">
+ </adapter>
+ </factory>
+ </extension>
+ <extension
+ point="org.eclipse.cdt.core.ScannerInfoProvider2">
+ <provider
+ builder="org.eclipse.cdt.cmake.core.cmakeBuilder"
+ class="org.eclipse.cdt.cmake.core.internal.CMakeScannerInfoProvider">
+ </provider>
+ </extension>
+
+</plugin>
diff --git a/build/org.eclipse.cdt.cmake.core/pom.xml b/build/org.eclipse.cdt.cmake.core/pom.xml
new file mode 100644
index 00000000000..b8037822038
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/pom.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.cdt</groupId>
+ <artifactId>cdt-parent</artifactId>
+ <version>8.8.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <version>1.0.0-SNAPSHOT</version>
+ <artifactId>org.eclipse.cdt.cmake.core</artifactId>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeNature.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeNature.java
new file mode 100644
index 00000000000..0e774d55f3c
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeNature.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core;
+
+import org.eclipse.cdt.cmake.core.internal.Activator;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectNature;
+import org.eclipse.core.runtime.CoreException;
+
+public class CMakeNature implements IProjectNature {
+
+ public static final String ID = Activator.getId() + ".cmakeNature"; //$NON-NLS-1$
+
+ private IProject project;
+
+ public static boolean hasNature(IProject project) {
+ try {
+ return project.hasNature(ID);
+ } catch (CoreException e) {
+ Activator.log(e);
+ return false;
+ }
+ }
+
+ @Override
+ public void configure() throws CoreException {
+ }
+
+ @Override
+ public void deconfigure() throws CoreException {
+ }
+
+ @Override
+ public IProject getProject() {
+ return project;
+ }
+
+ @Override
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java
new file mode 100644
index 00000000000..8ce37d691a5
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeProjectGenerator.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.cdt.cmake.core.internal.CMakeBuilder;
+import org.eclipse.cdt.cmake.core.internal.CMakeTemplateGenerator;
+import org.eclipse.cdt.core.CCProjectNature;
+import org.eclipse.cdt.core.CProjectNature;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.model.IPathEntry;
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class CMakeProjectGenerator {
+
+ private final IProject project;
+
+ public CMakeProjectGenerator(IProject project) {
+ this.project = project;
+ }
+
+ public void generate(IProgressMonitor monitor) throws CoreException {
+ // Generate the files
+ IFolder sourceFolder = project.getFolder("src"); //$NON-NLS-1$
+ if (!sourceFolder.exists()) {
+ sourceFolder.create(true, true, monitor);
+ }
+
+ CMakeTemplateGenerator templateGen = new CMakeTemplateGenerator();
+ Map<String, Object> fmModel = new HashMap<>();
+ fmModel.put("projectName", project.getName()); //$NON-NLS-1$
+
+ IFile sourceFile = sourceFolder.getFile("main.cpp"); //$NON-NLS-1$
+ templateGen.generateFile(fmModel, "simple/main.cpp", sourceFile, monitor); //$NON-NLS-1$
+ sourceFile = project.getFile("CMakeLists.txt"); //$NON-NLS-1$
+ templateGen.generateFile(fmModel, "simple/CMakeLists.txt", sourceFile, monitor); //$NON-NLS-1$
+
+ // Set up the project
+ IProjectDescription projDesc = project.getDescription();
+ String[] oldIds = projDesc.getNatureIds();
+ String[] newIds = new String[oldIds.length + 3];
+ System.arraycopy(oldIds, 0, newIds, 0, oldIds.length);
+ newIds[newIds.length - 3] = CProjectNature.C_NATURE_ID;
+ newIds[newIds.length - 2] = CCProjectNature.CC_NATURE_ID;
+ newIds[newIds.length - 1] = CMakeNature.ID;
+ projDesc.setNatureIds(newIds);
+
+ ICommand command = projDesc.newCommand();
+ command.setBuilderName(CMakeBuilder.ID);
+ command.setBuilding(IncrementalProjectBuilder.AUTO_BUILD, false);
+ projDesc.setBuildSpec(new ICommand[] { command });
+
+ project.setDescription(projDesc, monitor);
+
+ IPathEntry[] entries = new IPathEntry[] { CoreModel.newOutputEntry(sourceFolder.getFullPath()) };
+ CoreModel.getDefault().create(project).setRawPathEntries(entries, monitor);
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Activator.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Activator.java
new file mode 100644
index 00000000000..0f78429c888
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/Activator.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+public class Activator extends Plugin {
+
+ private static Activator plugin;
+
+ public void start(BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ Activator.plugin = this;
+ }
+
+ public void stop(BundleContext bundleContext) throws Exception {
+ super.stop(bundleContext);
+ Activator.plugin = null;
+ }
+
+ public static Activator getPlugin() {
+ return plugin;
+ }
+
+ public static String getId() {
+ return plugin.getBundle().getSymbolicName();
+ }
+
+ public static void log(Throwable e) {
+ if (e instanceof CoreException) {
+ plugin.getLog().log(((CoreException) e).getStatus());
+ } else {
+ plugin.getLog().log(errorStatus(e.getLocalizedMessage(), e));
+ }
+ }
+
+ public static void error(String message, Throwable cause) {
+ plugin.getLog().log(errorStatus(message, cause));
+ }
+
+ public static IStatus errorStatus(String message, Throwable cause) {
+ return new Status(IStatus.ERROR, getId(), message, cause);
+ }
+
+ public static <T> T getService(Class<T> service) {
+ BundleContext context = plugin.getBundle().getBundleContext();
+ ServiceReference<T> ref = context.getServiceReference(service);
+ return ref != null ? context.getService(ref) : null;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
new file mode 100644
index 00000000000..239e519397b
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfiguration.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.Collections;
+
+import org.eclipse.cdt.build.core.CBuildConfiguration;
+import org.eclipse.cdt.build.core.IToolChain;
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.model.ILanguage;
+import org.eclipse.cdt.core.model.LanguageManager;
+import org.eclipse.cdt.core.parser.IExtendedScannerInfo;
+import org.eclipse.cdt.core.parser.IScannerInfo;
+import org.eclipse.core.resources.IBuildConfiguration;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+
+public class CMakeBuildConfiguration extends CBuildConfiguration {
+
+ public CMakeBuildConfiguration(IBuildConfiguration config) {
+ super(config);
+ }
+
+ public CMakeBuildConfiguration(IBuildConfiguration config, IToolChain toolChain) {
+ super(config, toolChain);
+ }
+
+ private IFolder getBuildFolder() {
+ String configName = getBuildConfiguration().getName();
+ if (configName.isEmpty()) {
+ configName = "default"; //$NON-NLS-1$
+ }
+
+ try {
+ // TODO should really be passing a monitor in here or create this in
+ // a better spot. should also throw the core exception
+ IFolder buildRootFolder = getProject().getFolder("build"); //$NON-NLS-1$
+ if (!buildRootFolder.exists()) {
+ buildRootFolder.create(IResource.FORCE | IResource.DERIVED, true, new NullProgressMonitor());
+ }
+ IFolder buildFolder = buildRootFolder.getFolder(configName);
+ if (!buildFolder.exists()) {
+ buildFolder.create(true, true, new NullProgressMonitor());
+ }
+ return buildFolder;
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ return null;
+ }
+
+ public Path getBuildDirectory() {
+ return getBuildFolder().getLocation().toFile().toPath();
+ }
+
+ @Override
+ public IScannerInfo getScannerInfo(IResource resource) throws IOException {
+ IScannerInfo info = super.getScannerInfo(resource);
+ if (info == null) {
+ ILanguage language = LanguageManager.getInstance()
+ .getLanguage(CCorePlugin.getContentType(getProject(), resource.getName()), getProject()); // $NON-NLS-1$
+ Path dir = Paths.get(getProject().getLocationURI());
+
+ // TODO this is where we need to pass the compile options for this
+ // file.
+
+ IExtendedScannerInfo extendedInfo = getToolChain().getScannerInfo(getToolChain().getCommand(),
+ Arrays.asList("-c", new File(resource.getLocationURI()).getAbsolutePath()), //$NON-NLS-1$
+ Collections.emptyList(), resource, dir);
+ putScannerInfo(language, extendedInfo);
+ info = extendedInfo;
+ }
+ return info;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationFactory.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationFactory.java
new file mode 100644
index 00000000000..f527069ab50
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuildConfigurationFactory.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core.internal;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.cdt.build.core.IToolChain;
+import org.eclipse.cdt.build.core.IToolChainManager;
+import org.eclipse.core.resources.IBuildConfiguration;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.launchbar.core.target.ILaunchTarget;
+import org.eclipse.launchbar.core.target.ILaunchTargetManager;
+
+public class CMakeBuildConfigurationFactory implements IAdapterFactory {
+
+ private static IToolChainManager toolChainManager = Activator.getService(IToolChainManager.class);
+ private static Map<IBuildConfiguration, CMakeBuildConfiguration> cache = new HashMap<>();
+
+ @Override
+ public Class<?>[] getAdapterList() {
+ return new Class<?>[] { CMakeBuildConfiguration.class };
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(Object adaptableObject, Class<T> adapterType) {
+ if (adapterType.equals(CMakeBuildConfiguration.class) && adaptableObject instanceof IBuildConfiguration) {
+ IBuildConfiguration config = (IBuildConfiguration) adaptableObject;
+ synchronized (cache) {
+ CMakeBuildConfiguration cmakeConfig = cache.get(config);
+ if (cmakeConfig == null) {
+ if (!config.getName().equals(IBuildConfiguration.DEFAULT_CONFIG_NAME)) {
+ cmakeConfig = new CMakeBuildConfiguration(config);
+ cache.put(config, cmakeConfig);
+ return (T) cmakeConfig;
+ } else {
+ // Default to local
+ ILaunchTargetManager targetManager = Activator.getService(ILaunchTargetManager.class);
+ ILaunchTarget localTarget = targetManager
+ .getLaunchTargetsOfType(ILaunchTargetManager.localLaunchTargetTypeId)[0];
+ Collection<IToolChain> toolChains = toolChainManager.getToolChainsSupporting(localTarget);
+ if (!toolChains.isEmpty()) {
+ // TODO propery handle when we have more than one
+ cmakeConfig = new CMakeBuildConfiguration(config, toolChains.iterator().next());
+ cache.put(config, cmakeConfig);
+ return (T) cmakeConfig;
+ }
+
+ // Just find a combination that works
+ for (ILaunchTarget target : targetManager.getLaunchTargets()) {
+ if (!target.equals(localTarget)) {
+ toolChains = toolChainManager.getToolChainsSupporting(target);
+ if (!toolChains.isEmpty()) {
+ // TODO propery handle when we have more
+ // than one
+ cmakeConfig = new CMakeBuildConfiguration(config, toolChains.iterator().next());
+ cache.put(config, cmakeConfig);
+ return (T) cmakeConfig;
+ }
+ }
+ }
+
+ // TODO if we don't have a target, need another way to
+ // match whatever qtInstalls we have with matching
+ // toolchains
+ }
+ } else {
+ return (T) cmakeConfig;
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuilder.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuilder.java
new file mode 100644
index 00000000000..8ccc61d862c
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeBuilder.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core.internal;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.cdt.build.core.IConsoleService;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class CMakeBuilder extends IncrementalProjectBuilder {
+
+ public static final String ID = Activator.getId() + ".cmakeBuilder"; //$NON-NLS-1$
+
+ @Override
+ protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor) throws CoreException {
+ IProject project = getProject();
+ try {
+ IConsoleService console = Activator.getService(IConsoleService.class);
+ CMakeBuildConfiguration cmakeConfig = project.getActiveBuildConfig()
+ .getAdapter(CMakeBuildConfiguration.class);
+ Path buildDir = cmakeConfig.getBuildDirectory();
+
+ if (!Files.exists(buildDir.resolve("Makefile"))) { //$NON-NLS-1$
+ // TODO assuming cmake is in the path here, probably need a
+ // preference in case it isn't.
+ List<String> command = Arrays.asList("cmake", //$NON-NLS-1$
+ new File(project.getLocationURI()).getAbsolutePath());
+ ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile());
+ cmakeConfig.getToolChain().setEnvironment(processBuilder.environment());
+ Process process = processBuilder.start();
+ console.writeOutput(String.join(" ", command) + '\n'); //$NON-NLS-1$
+ console.monitor(process, null, buildDir);
+ }
+
+ // TODO need to figure out which builder to call. Hardcoding to make
+ // for now.
+ List<String> command = Arrays.asList("make");
+ ProcessBuilder processBuilder = new ProcessBuilder(command).directory(buildDir.toFile()); // $NON-NLS-1$
+ cmakeConfig.getToolChain().setEnvironment(processBuilder.environment());
+ Process process = processBuilder.start();
+ console.writeOutput(String.join(" ", command) + '\n'); //$NON-NLS-1$
+ console.monitor(process, null, buildDir);
+
+ project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ return new IProject[] { project };
+ } catch (IOException e) {
+ throw new CoreException(Activator.errorStatus("Building " + project.getName(), e));
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptor.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptor.java
new file mode 100644
index 00000000000..cd1cff81eee
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptor.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core.internal;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.launchbar.core.ILaunchDescriptor;
+import org.eclipse.launchbar.core.ILaunchDescriptorType;
+
+public class CMakeLaunchDescriptor extends PlatformObject implements ILaunchDescriptor {
+
+ private final CMakeLaunchDescriptorType type;
+ private final IProject project;
+
+ public CMakeLaunchDescriptor(CMakeLaunchDescriptorType type, IProject project) {
+ this.type = type;
+ this.project = project;
+ }
+
+ @Override
+ public String getName() {
+ return project.getName();
+ }
+
+ @Override
+ public ILaunchDescriptorType getType() {
+ return type;
+ }
+
+ public IProject getProject() {
+ return project;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter.equals(IProject.class)) {
+ return (T) project;
+ } else {
+ return super.getAdapter(adapter);
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptorType.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptorType.java
new file mode 100644
index 00000000000..4a66f37d933
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLaunchDescriptorType.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.cdt.cmake.core.CMakeNature;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.launchbar.core.ILaunchDescriptor;
+import org.eclipse.launchbar.core.ILaunchDescriptorType;
+
+public class CMakeLaunchDescriptorType implements ILaunchDescriptorType {
+
+ private Map<IProject, CMakeLaunchDescriptor> descriptors = new HashMap<>();
+
+ @Override
+ public ILaunchDescriptor getDescriptor(Object launchObject) throws CoreException {
+ if (launchObject instanceof IProject) {
+ IProject project = (IProject) launchObject;
+ if (CMakeNature.hasNature(project)) {
+ CMakeLaunchDescriptor desc = descriptors.get(project);
+ if (desc == null) {
+ desc = new CMakeLaunchDescriptor(this, project);
+ descriptors.put(project, desc);
+ }
+ return desc;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLocalLaunchConfigurationProvider.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLocalLaunchConfigurationProvider.java
new file mode 100644
index 00000000000..55d40734a0c
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLocalLaunchConfigurationProvider.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.launchbar.core.AbstractLaunchConfigProvider;
+import org.eclipse.launchbar.core.ILaunchDescriptor;
+import org.eclipse.launchbar.core.target.ILaunchTarget;
+import org.eclipse.launchbar.core.target.ILaunchTargetManager;
+
+public class CMakeLocalLaunchConfigurationProvider extends AbstractLaunchConfigProvider {
+
+ private Map<IProject, ILaunchConfiguration> configs = new HashMap<>();
+
+ @Override
+ public boolean supports(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException {
+ return ILaunchTargetManager.localLaunchTargetTypeId.equals(target.getTypeId());
+ }
+
+ @Override
+ public ILaunchConfigurationType getLaunchConfigurationType(ILaunchDescriptor descriptor, ILaunchTarget target)
+ throws CoreException {
+ return DebugPlugin.getDefault().getLaunchManager()
+ .getLaunchConfigurationType(CMakeLocalRunLaunchConfigDelegate.TYPE_ID);
+ }
+
+ // TODO the rest here is the same as the Qt provider. Opportunity to create
+ // a common super class
+
+ @Override
+ public ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target)
+ throws CoreException {
+ ILaunchConfiguration config = null;
+ IProject project = descriptor.getAdapter(IProject.class);
+ if (project != null) {
+ config = configs.get(project);
+ if (config == null) {
+ config = createLaunchConfiguration(descriptor, target);
+ // launch config added will get called below to add it to the
+ // configs map
+ }
+ }
+ return config;
+ }
+
+ @Override
+ protected void populateLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target,
+ ILaunchConfigurationWorkingCopy workingCopy) throws CoreException {
+ super.populateLaunchConfiguration(descriptor, target, workingCopy);
+
+ // Set the project and the connection
+ CMakeLaunchDescriptor qtDesc = (CMakeLaunchDescriptor) descriptor;
+ workingCopy.setMappedResources(new IResource[] { qtDesc.getProject() });
+ }
+
+ @Override
+ public boolean launchConfigurationAdded(ILaunchConfiguration configuration) throws CoreException {
+ if (ownsLaunchConfiguration(configuration)) {
+ IProject project = configuration.getMappedResources()[0].getProject();
+ configs.put(project, configuration);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public boolean launchConfigurationRemoved(ILaunchConfiguration configuration) throws CoreException {
+ for (Entry<IProject, ILaunchConfiguration> entry : configs.entrySet()) {
+ if (configuration.equals(entry.getValue())) {
+ configs.remove(entry.getKey());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException {
+ // TODO not sure I care
+ return false;
+ }
+
+ @Override
+ public void launchDescriptorRemoved(ILaunchDescriptor descriptor) throws CoreException {
+ IProject project = descriptor.getAdapter(IProject.class);
+ if (project != null) {
+ configs.remove(project);
+ }
+ }
+
+ @Override
+ public void launchTargetRemoved(ILaunchTarget target) throws CoreException {
+ // nothing to do since the Local connection can't be removed
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLocalRunLaunchConfigDelegate.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLocalRunLaunchConfigDelegate.java
new file mode 100644
index 00000000000..2bb8db73679
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeLocalRunLaunchConfigDelegate.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core.internal;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.eclipse.launchbar.core.target.launch.LaunchConfigurationTargetedDelegate;
+
+public class CMakeLocalRunLaunchConfigDelegate extends LaunchConfigurationTargetedDelegate
+ implements ILaunchConfigurationDelegate {
+
+ public static final String TYPE_ID = "org.eclipse.cdt.cmake.core.localLunchConfigurationType"; //$NON-NLS-1$
+
+ @Override
+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor)
+ throws CoreException {
+ // TODO need to find the binary and launch it.
+ }
+
+ @Override
+ protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException {
+ // 1. Extract project from configuration
+ // TODO dependencies too.
+ IProject project = configuration.getMappedResources()[0].getProject();
+ return new IProject[] { project };
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeScannerInfoProvider.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeScannerInfoProvider.java
new file mode 100644
index 00000000000..634d3c8412d
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeScannerInfoProvider.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core.internal;
+
+import java.io.IOException;
+
+import org.eclipse.cdt.core.parser.IScannerInfo;
+import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
+import org.eclipse.cdt.core.parser.IScannerInfoProvider;
+import org.eclipse.core.resources.IBuildConfiguration;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+
+public class CMakeScannerInfoProvider implements IScannerInfoProvider {
+
+ @Override
+ public IScannerInfo getScannerInformation(IResource resource) {
+ try {
+ IProject project = resource.getProject();
+ IBuildConfiguration config = project.getActiveBuildConfig();
+ CMakeBuildConfiguration cmakeConfig = config.getAdapter(CMakeBuildConfiguration.class);
+ if (cmakeConfig != null) {
+ return cmakeConfig.getScannerInfo(resource);
+ }
+ } catch (CoreException | IOException e) {
+ Activator.log(e);
+ }
+ return null;
+ }
+
+ @Override
+ public void subscribe(IResource resource, IScannerInfoChangeListener listener) {
+ }
+
+ @Override
+ public void unsubscribe(IResource resource, IScannerInfoChangeListener listener) {
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeTemplateGenerator.java b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeTemplateGenerator.java
new file mode 100644
index 00000000000..f611e5b827c
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakeTemplateGenerator.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.core.internal;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+
+import freemarker.template.Configuration;
+import freemarker.template.Template;
+import freemarker.template.TemplateException;
+
+public class CMakeTemplateGenerator {
+
+ private final Configuration config;
+
+ public CMakeTemplateGenerator() throws CoreException {
+ config = new Configuration(Configuration.VERSION_2_3_22);
+ URL templateDirURL = FileLocator.find(Activator.getPlugin().getBundle(), new Path("/templates"), null); //$NON-NLS-1$
+ try {
+ config.setDirectoryForTemplateLoading(new File(FileLocator.toFileURL(templateDirURL).toURI()));
+ } catch (IOException | URISyntaxException e) {
+ throw new CoreException(Activator.errorStatus("Template configuration", e));
+ }
+ }
+
+ public void generateFile(final Object model, String templateFile, final IFile outputFile, IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ final Template template = config.getTemplate(templateFile);
+ try (StringWriter writer = new StringWriter()) {
+ template.process(model, writer);
+ try (ByteArrayInputStream in = new ByteArrayInputStream(
+ writer.getBuffer().toString().getBytes(StandardCharsets.UTF_8))) {
+ if (outputFile.exists()) {
+ outputFile.setContents(in, true, true, monitor);
+ } else {
+ outputFile.create(in, true, monitor);
+ }
+ }
+ }
+ } catch (IOException | TemplateException e) {
+ throw new CoreException(Activator.errorStatus("Processing template " + templateFile, e));
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.core/templates/simple/CMakeLists.txt b/build/org.eclipse.cdt.cmake.core/templates/simple/CMakeLists.txt
new file mode 100644
index 00000000000..7f201943264
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/templates/simple/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required (VERSION 2.6)
+project (${projectName})
+add_executable(${projectName} src/main.cpp)
diff --git a/build/org.eclipse.cdt.cmake.core/templates/simple/main.cpp b/build/org.eclipse.cdt.cmake.core/templates/simple/main.cpp
new file mode 100644
index 00000000000..c493b4a5566
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.core/templates/simple/main.cpp
@@ -0,0 +1,4 @@
+
+int main(int argc, char **argv) {
+ return 0;
+}
diff --git a/build/org.eclipse.cdt.cmake.ui/.classpath b/build/org.eclipse.cdt.cmake.ui/.classpath
new file mode 100644
index 00000000000..eca7bdba8f0
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.ui/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/build/org.eclipse.cdt.cmake.ui/.project b/build/org.eclipse.cdt.cmake.ui/.project
new file mode 100644
index 00000000000..c65bf192fcd
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.ui/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.cdt.cmake.ui</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/build/org.eclipse.cdt.cmake.ui/.settings/org.eclipse.jdt.core.prefs b/build/org.eclipse.cdt.cmake.ui/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..0c68a61dca8
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.ui/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..646ba27efe6
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.ui/META-INF/MANIFEST.MF
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CDT CMake UI
+Bundle-SymbolicName: org.eclipse.cdt.cmake.ui;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.cdt.cmake.ui.internal.Activator
+Bundle-Vendor: Eclipse CDT
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources;bundle-version="3.11.0",
+ org.eclipse.ui,
+ org.eclipse.ui.ide,
+ org.eclipse.cdt.build.ui;bundle-version="1.0.0",
+ org.eclipse.cdt.cmake.core
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Bundle-ActivationPolicy: lazy
diff --git a/build/org.eclipse.cdt.cmake.ui/about.html b/build/org.eclipse.cdt.cmake.ui/about.html
new file mode 100644
index 00000000000..d7c511887d6
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.ui/about.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>About</title></head>
+
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 22, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body></html> \ No newline at end of file
diff --git a/build/org.eclipse.cdt.cmake.ui/build.properties b/build/org.eclipse.cdt.cmake.ui/build.properties
new file mode 100644
index 00000000000..bdcc25a2886
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.ui/build.properties
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.xml
diff --git a/build/org.eclipse.cdt.cmake.ui/icons/newcc_app.gif b/build/org.eclipse.cdt.cmake.ui/icons/newcc_app.gif
new file mode 100644
index 00000000000..4b39411daf5
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.ui/icons/newcc_app.gif
Binary files differ
diff --git a/build/org.eclipse.cdt.cmake.ui/plugin.xml b/build/org.eclipse.cdt.cmake.ui/plugin.xml
new file mode 100644
index 00000000000..04262b00495
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.ui/plugin.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ category="org.eclipse.cdt.ui.newCWizards"
+ class="org.eclipse.cdt.cmake.ui.internal.NewCMakeProjectWizard"
+ finalPerspective="org.eclipse.cdt.ui.CPerspective"
+ icon="icons/newcc_app.gif"
+ id="org.eclipse.cdt.cmake.ui.newProjectWizard"
+ name="CMake Project"
+ project="true">
+ </wizard>
+ </extension>
+
+</plugin>
diff --git a/build/org.eclipse.cdt.cmake.ui/pom.xml b/build/org.eclipse.cdt.cmake.ui/pom.xml
new file mode 100644
index 00000000000..981d204f6bc
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.ui/pom.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.eclipse.cdt</groupId>
+ <artifactId>cdt-parent</artifactId>
+ <version>8.8.0-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <version>1.0.0-SNAPSHOT</version>
+ <artifactId>org.eclipse.cdt.cmake.ui</artifactId>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java
new file mode 100644
index 00000000000..a8318124293
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/Activator.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2015 QNX Software Systems and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.cdt.cmake.ui.internal;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+public class Activator extends AbstractUIPlugin {
+
+ private static Activator plugin;
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public static Activator getPlugin() {
+ return plugin;
+ }
+
+ public static String getId() {
+ return plugin.getBundle().getSymbolicName();
+ }
+
+ public static IStatus errorStatus(String message, Throwable cause) {
+ return new Status(IStatus.ERROR, getId(), message, cause);
+ }
+
+ public static void log(Exception e) {
+ if (e instanceof CoreException) {
+ plugin.getLog().log(((CoreException) e).getStatus());
+ } else {
+ plugin.getLog().log(errorStatus(e.getLocalizedMessage(), e));
+ }
+ }
+
+}
diff --git a/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeProjectWizard.java b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeProjectWizard.java
new file mode 100644
index 00000000000..f49597c783f
--- /dev/null
+++ b/build/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/NewCMakeProjectWizard.java
@@ -0,0 +1,45 @@
+/**
+ * The activator class controls the plug-in life cycle
+ */
+package org.eclipse.cdt.cmake.ui.internal;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.cdt.cmake.core.CMakeProjectGenerator;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
+import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
+
+public class NewCMakeProjectWizard extends BasicNewProjectResourceWizard {
+
+ @Override
+ public boolean performFinish() {
+ if (!super.performFinish()) {
+ return false;
+ }
+
+ IRunnableWithProgress op = new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ monitor.beginTask("Generating project", 1);
+ CMakeProjectGenerator generator = new CMakeProjectGenerator(getNewProject());
+ generator.generate(monitor);
+ monitor.done();
+ } catch (CoreException e) {
+ Activator.log(e);
+ }
+ }
+ });
+
+ try {
+ getContainer().run(false, true, op);
+ } catch (InvocationTargetException | InterruptedException e) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/pom.xml b/pom.xml
index 9208c69e2be..1be8f0698ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -218,6 +218,10 @@
<!--module>qt/org.eclipse.cdt.qt.core.tests</module-->
<module>qt/org.eclipse.cdt.qt.ui.tests</module>
<module>qt/org.eclipse.cdt.qt-feature</module>
+
+ <module>build/org.eclipse.cdt.cmake.core</module>
+ <module>build/org.eclipse.cdt.cmake.ui</module>
+ <module>build/org.eclipse.cdt.cmake-feature</module>
<module>xlc/org.eclipse.cdt.errorparsers.xlc.tests</module>

Back to the top