-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve CMake build option handling and API (#1046)
Summary: - Add some new API to make it easier for ISVs to provide defaults. - Fully connect UI elements to CMake build process - Add some missing UI elements (such as customizing generator) - CMake generator default within CDT changed to Ninja Details: Add API to set CMake generator default (eg Ninja) ISV can set their desired CMake generator by overriding `CMakeBuildConfiguration.getDefaultProperties`. ISVs can also further fine tune the build process by overriding `CMakeBuildConfiguration.getDefaultProperties` Remove API `IOsOverrides` and related code. `IOsOverrides` was a partial implementation to achieve builds in Docker containers, however the work was not complete and it the extra code was complicating some basic use cases of setting defaults Add support for all generators to CMake build settings UI page by using a Combo instead of radio buttons. The non-deprecated generators that are built-in to CDT populate the Combo, but additional generators can be manually entered in the Combo. Rename clean command to clean target to better reflect its use as the argument passed to cmake's --target command line. Add all target for the argument passed to cmake's --target command line when doing a normal build. Clarify usage of UI overrides and change the UI to be "use defaults" (i.e. invert the checkbox). This is a **breaking** change as it means user projects that were using UI overrides will revert to using defaults. This is done on purpose as so many little things have changed in CMake settings, that reverting to defaults on upgrade seems like a logical decision. In addition *use defaults* matches the other GUIs in Eclipse, for example the MBS build command settings. Populate all defaults in getDefaultProperties() so that all CMake build settings are displayed as used (greyed out) and can be used as a starting point when editing settings. Simplify some of the code in CMakeBuildTab. Fix parsing of extra args so that quoted strings work. Refactored manual tests document and brought it up to date. Correct command line option for CMake's --warn-unused-vars Correct command line option for CMake's --warn-uninitialized Overall this is an API breaking change and the CHANGELOG-API.md has been updated with all the API changes in and around ICMakeProperties, including fixing typos in WarnUninitialized methods. Fixes #1055 Fixes #818 Part of #1000 Co-authored-by: Jonah Graham <jonah@kichwacoders.com>
1 parent
11dfaa4
commit fe74d8d
Showing
30 changed files
with
921 additions
and
1,154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
299 changes: 299 additions & 0 deletions
299
...pse.cdt.cmake.core.tests/src/org/eclipse/cdt/cmake/core/CMakeBuildConfigurationTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,299 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Renesas Electronics Europe. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.cdt.cmake.core; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.contains; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.hamcrest.Matchers.nullValue; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.when; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import org.eclipse.cdt.cmake.core.properties.CMakeGenerator; | ||
import org.eclipse.cdt.cmake.core.properties.ICMakeGenerator; | ||
import org.eclipse.cdt.cmake.core.properties.ICMakeProperties; | ||
import org.eclipse.cdt.core.CCProjectNature; | ||
import org.eclipse.cdt.core.CProjectNature; | ||
import org.eclipse.cdt.core.build.IToolChain; | ||
import org.eclipse.cdt.core.testplugin.ResourceHelper; | ||
import org.eclipse.cdt.core.testplugin.util.BaseTestCase5; | ||
import org.eclipse.cdt.utils.CommandLineUtil; | ||
import org.eclipse.core.resources.IBuildConfiguration; | ||
import org.eclipse.core.resources.IProject; | ||
import org.eclipse.core.resources.IProjectDescription; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* Tests a new API added to the CMake Build Configuration which allows default CMake properties to be set. | ||
* See the new interface {@link ICMakeBuildConfiguration}. | ||
*/ | ||
public class CMakeBuildConfigurationTests extends BaseTestCase5 { | ||
private IBuildConfiguration buildConfig; | ||
private IToolChain mockToolchain; | ||
|
||
@BeforeEach | ||
public void setup() throws Exception { | ||
// Create a CMake project | ||
IProject project = createCMakeProject(); | ||
// Get the default build config from the project (it always has one) | ||
buildConfig = project.getBuildConfig(IBuildConfiguration.DEFAULT_CONFIG_NAME); | ||
// Setup a toolchain ready to use for creating the valid ICBuildConfiguration | ||
mockToolchain = mock(IToolChain.class); | ||
when(mockToolchain.getProperty(IToolChain.ATTR_OS)).thenReturn("osDummy"); | ||
when(mockToolchain.getProperty(IToolChain.ATTR_ARCH)).thenReturn("archDummy"); | ||
when(mockToolchain.getTypeId()).thenReturn("tc_typeId"); | ||
when(mockToolchain.getId()).thenReturn("tcId"); | ||
when(mockToolchain.getBuildConfigNameFragment()).thenReturn("buildConfigName"); | ||
} | ||
|
||
/** | ||
* Test for {@link ICMakeProperties#setGenerator()}. | ||
* | ||
* This test also verifies that what the ISV overrides in getCMakeProperties is what takes effect. | ||
*/ | ||
@Test | ||
public void getCMakePropertiesTestSetGenerator() throws Exception { | ||
CMakeBuildConfiguration cmBuildConfig = new CMakeBuildConfiguration(buildConfig, "cmBuildConfigName", | ||
mockToolchain) { | ||
|
||
@Override | ||
public ICMakeProperties getCMakeProperties() { | ||
ICMakeProperties properties = super.getCMakeProperties(); | ||
properties.setGenerator(CMakeGenerator.WatcomWMake); | ||
return properties; | ||
} | ||
}; | ||
|
||
// Call the new method on ICMakeBuildConfiguration to get the default CMake properties. | ||
ICMakeProperties cMakeProperties = cmBuildConfig.getCMakeProperties(); | ||
assertThat(cMakeProperties.getGenerator(), is(CMakeGenerator.WatcomWMake)); | ||
} | ||
|
||
/** | ||
* Test for {@link ICMakeProperties#setExtraArguments()} | ||
* | ||
* This test also verifies that what the ISV overrides in getCMakeProperties is what takes effect. | ||
*/ | ||
@Test | ||
public void getCMakePropertiesTestSetExtraArguments() throws Exception { | ||
// Create a C Build Configuration using the default build config and an arbitrary name | ||
CMakeBuildConfiguration cmBuildConfig = new CMakeBuildConfiguration(buildConfig, "cmBuildConfigName", | ||
mockToolchain) { | ||
|
||
@Override | ||
public ICMakeProperties getCMakeProperties() { | ||
ICMakeProperties properties = super.getCMakeProperties(); | ||
properties.setExtraArguments( | ||
new ArrayList<>((List.of("-DplatformAgnosticArgsTest0=0", "-DplatformAgnosticArgsTest1=1")))); | ||
return properties; | ||
} | ||
}; | ||
// Call the new method on ICMakeBuildConfiguration to get the default CMake properties. | ||
ICMakeProperties cMakeProperties = cmBuildConfig.getCMakeProperties(); | ||
List<String> extraArguments = cMakeProperties.getExtraArguments(); | ||
assertThat(extraArguments, contains("-DplatformAgnosticArgsTest0=0", "-DplatformAgnosticArgsTest1=1")); | ||
} | ||
|
||
/** | ||
* Test for {@link CMakeBuildConfiguration#getDefaultProperties()} | ||
*/ | ||
@Test | ||
public void getDefaultProperties() throws Exception { | ||
// Create a C Build Configuration using the default build config and an arbitrary name | ||
CMakeBuildConfiguration cmBuildConfig = new CMakeBuildConfiguration(buildConfig, "cmBuildConfigName", | ||
mockToolchain) { | ||
|
||
@Override | ||
public Map<String, String> getDefaultProperties() { | ||
var defs = new HashMap<>(super.getDefaultProperties()); | ||
defs.put(CMAKE_GENERATOR, CMakeGenerator.WatcomWMake.getCMakeName()); | ||
return defs; | ||
} | ||
}; | ||
// Call the new method on ICMakeBuildConfiguration to get the default CMake properties. | ||
ICMakeProperties cMakeProperties = cmBuildConfig.getCMakeProperties(); | ||
assertThat(cMakeProperties.getGenerator(), is(CMakeGenerator.WatcomWMake)); | ||
} | ||
|
||
@Test | ||
public void getDefaultPropertiesTestExtraArgs() throws Exception { | ||
// Create a C Build Configuration using the default build config and an arbitrary name | ||
CMakeBuildConfiguration cmBuildConfig = new CMakeBuildConfiguration(buildConfig, "cmBuildConfigName", | ||
mockToolchain) { | ||
@Override | ||
public Map<String, String> getDefaultProperties() { | ||
var defs = new HashMap<>(super.getDefaultProperties()); | ||
defs.put(CMAKE_ARGUMENTS, "-Dtest0=0 -Dtest1=1"); | ||
return defs; | ||
} | ||
}; | ||
// Call the new method on ICMakeBuildConfiguration to get the default CMake properties. | ||
ICMakeProperties cMakeProperties = cmBuildConfig.getCMakeProperties(); | ||
List<String> extraArguments = cMakeProperties.getExtraArguments(); | ||
assertThat(extraArguments, contains("-Dtest0=0", "-Dtest1=1")); | ||
} | ||
|
||
/** | ||
* Test that a custom cmake generator can be entered and auto-created | ||
*/ | ||
@Test | ||
public void customCMakeGeneratorEntryAuto() throws Exception { | ||
// Create a C Build Configuration using the default build config and an arbitrary name | ||
CMakeBuildConfiguration cmBuildConfig = new CMakeBuildConfiguration(buildConfig, "cmBuildConfigName", | ||
mockToolchain) { | ||
@Override | ||
public Map<String, String> getDefaultProperties() { | ||
var defs = new HashMap<>(super.getDefaultProperties()); | ||
// A custom generator for a custom cmake version | ||
defs.put(CMAKE_GENERATOR, "My Personal Generator"); | ||
return defs; | ||
} | ||
}; | ||
|
||
// Call the new method on ICMakeBuildConfiguration to get the default CMake properties. | ||
ICMakeProperties cMakeProperties = cmBuildConfig.getCMakeProperties(); | ||
assertThat(cMakeProperties.getGenerator().getCMakeName(), is("My Personal Generator")); | ||
assertThat(cMakeProperties.getGenerator().getIgnoreErrOption(), is(nullValue())); | ||
assertThat(cMakeProperties.getGenerator().getMakefileName(), is(nullValue())); | ||
} | ||
|
||
/** | ||
* Test that a custom cmake generator can be entered and manually-created | ||
*/ | ||
@Test | ||
public void customCMakeGeneratorEntryManual() throws Exception { | ||
// Create a C Build Configuration using the default build config and an arbitrary name | ||
CMakeBuildConfiguration cmBuildConfig = new CMakeBuildConfiguration(buildConfig, "cmBuildConfigName", | ||
mockToolchain) { | ||
@Override | ||
public Map<String, String> getDefaultProperties() { | ||
var defs = new HashMap<>(super.getDefaultProperties()); | ||
// A custom generator for a custom cmake version | ||
defs.put(CMAKE_GENERATOR, "My Personal Generator"); | ||
return defs; | ||
} | ||
|
||
@Override | ||
public ICMakeProperties getCMakeProperties() { | ||
ICMakeProperties properties = super.getCMakeProperties(); | ||
if ("My Personal Generator".equals(properties.getGenerator().getCMakeName())) { | ||
var generator = new ICMakeGenerator() { | ||
@Override | ||
public String getMakefileName() { | ||
return "MyMak.mak"; | ||
} | ||
|
||
@Override | ||
public String getIgnoreErrOption() { | ||
return "-mycustom"; | ||
} | ||
|
||
@Override | ||
public String getCMakeName() { | ||
return "My Personal Generator"; | ||
} | ||
}; | ||
properties.setGenerator(generator); | ||
} | ||
return properties; | ||
} | ||
}; | ||
|
||
// Call the new method on ICMakeBuildConfiguration to get the default CMake properties. | ||
ICMakeProperties cMakeProperties = cmBuildConfig.getCMakeProperties(); | ||
assertThat(cMakeProperties.getGenerator().getCMakeName(), is("My Personal Generator")); | ||
assertThat(cMakeProperties.getGenerator().getIgnoreErrOption(), is("-mycustom")); | ||
assertThat(cMakeProperties.getGenerator().getMakefileName(), is("MyMak.mak")); | ||
} | ||
|
||
/** | ||
* Test all and clean targets and cmake command have working defaults | ||
*/ | ||
@Test | ||
public void targetsAndCommandDefaults() throws Exception { | ||
// Create a C Build Configuration using the default build config and an arbitrary name | ||
CMakeBuildConfiguration cmBuildConfig = new CMakeBuildConfiguration(buildConfig, "cmBuildConfigName", | ||
mockToolchain); | ||
|
||
// Call the new method on ICMakeBuildConfiguration to get the default CMake properties. | ||
ICMakeProperties cMakeProperties = cmBuildConfig.getCMakeProperties(); | ||
assertThat(cMakeProperties.getCommand(), is("cmake")); | ||
assertThat(cMakeProperties.getAllTarget(), is("all")); | ||
assertThat(cMakeProperties.getCleanTarget(), is("clean")); | ||
} | ||
|
||
/** | ||
* Test all and clean targets and cmake command can be overridden | ||
*/ | ||
@Test | ||
public void targetsAndCommand() throws Exception { | ||
// Create a C Build Configuration using the default build config and an arbitrary name | ||
CMakeBuildConfiguration cmBuildConfig = new CMakeBuildConfiguration(buildConfig, "cmBuildConfigName", | ||
mockToolchain) { | ||
@Override | ||
public Map<String, String> getDefaultProperties() { | ||
var defs = new HashMap<>(super.getDefaultProperties()); | ||
defs.put(CMAKE_BUILD_COMMAND, "mycmake"); | ||
defs.put(CMAKE_ALL_TARGET, "myall"); | ||
defs.put(CMAKE_CLEAN_TARGET, "myclean"); | ||
return defs; | ||
} | ||
}; | ||
|
||
// Call the new method on ICMakeBuildConfiguration to get the default CMake properties. | ||
ICMakeProperties cMakeProperties = cmBuildConfig.getCMakeProperties(); | ||
assertThat(cMakeProperties.getCommand(), is("mycmake")); | ||
assertThat(cMakeProperties.getAllTarget(), is("myall")); | ||
assertThat(cMakeProperties.getCleanTarget(), is("myclean")); | ||
} | ||
|
||
/** | ||
* Test that extra arguments parse correctly, e.g. handles ". | ||
* | ||
* Note that this test is minimal here as the real functionality is in {@link CommandLineUtil} | ||
* and all the special cases are tested in CommandLineUtilTest. | ||
*/ | ||
@Test | ||
public void extraArgumentsParseCorrectly() throws Exception { | ||
// Create a C Build Configuration using the default build config and an arbitrary name | ||
CMakeBuildConfiguration cmBuildConfig = new CMakeBuildConfiguration(buildConfig, "cmBuildConfigName", | ||
mockToolchain) { | ||
@Override | ||
public Map<String, String> getDefaultProperties() { | ||
var defs = new HashMap<>(super.getDefaultProperties()); | ||
defs.put(CMAKE_ARGUMENTS, "-Da=\"something with space and quotes\" \"-Danother=quoted\""); | ||
return defs; | ||
} | ||
}; | ||
|
||
// Call the new method on ICMakeBuildConfiguration to get the default CMake properties. | ||
ICMakeProperties cMakeProperties = cmBuildConfig.getCMakeProperties(); | ||
assertThat(cMakeProperties.getExtraArguments(), | ||
is(List.of("-Da=something with space and quotes", "-Danother=quoted"))); | ||
} | ||
|
||
private IProject createCMakeProject() throws Exception { | ||
// Create a plain Eclipse project | ||
IProject project = ResourceHelper.createProject(this.getName()); | ||
// Add C/C++ and CMake natures to make it a CMake project | ||
IProjectDescription description = project.getDescription(); | ||
description.setNatureIds( | ||
new String[] { CProjectNature.C_NATURE_ID, CCProjectNature.CC_NATURE_ID, CMakeNature.ID }); | ||
project.setDescription(description, null); | ||
return project; | ||
} | ||
} |
103 changes: 0 additions & 103 deletions
103
...ake.core.tests/src/org/eclipse/cdt/cmake/core/internal/CMakePropertiesControllerTest.java
This file was deleted.
Oops, something went wrong.
98 changes: 0 additions & 98 deletions
98
...make.core.tests/src/org/eclipse/cdt/cmake/core/internal/CMakePropertiesEvolutionTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...e/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/ICMakeBuildConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2025 Renesas Electronics Europe and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.cdt.cmake.core; | ||
|
||
import org.eclipse.cdt.cmake.core.properties.CMakeGenerator; | ||
import org.eclipse.cdt.cmake.core.properties.ICMakeGenerator; | ||
import org.eclipse.cdt.cmake.core.properties.ICMakeProperties; | ||
import org.eclipse.cdt.core.build.ICBuildConfiguration; | ||
|
||
/** | ||
* Encapsulates the CMake specific {@link ICBuildConfiguration} for building CMake projects. | ||
* <p> | ||
* This interface defines the set of properties that can be exposed to a user via the UI. This | ||
* set of properties is converted to a {@link ICMakeBuildConfiguration} when CDT runs CMake's | ||
* build commands. | ||
* | ||
* @since 2.0 | ||
*/ | ||
public interface ICMakeBuildConfiguration { | ||
|
||
/** | ||
* When true, {@link #getCMakeProperties()} should use defaults from {@link #getDefaultProperties()}, | ||
* otherwise uses values from {@link #getProperties()} | ||
*/ | ||
public static final String CMAKE_USE_DEFAULT_CMAKE_SETTINGS = "cmake.use.default.cmake.settings"; //$NON-NLS-1$ | ||
public static final String CMAKE_USE_DEFAULT_CMAKE_SETTINGS_DEFAULT = "true"; //$NON-NLS-1$ | ||
|
||
/** | ||
* The generator to use, typically one of {@link CMakeGenerator}, or if not present in {@link CMakeGenerator} an | ||
* an custom one will be instantiated. Extenders can customize the generator by overriding {@link #getCMakeProperties()} | ||
* and create an {@link ICMakeGenerator} to assign to {@link ICMakeProperties#setGenerator(ICMakeGenerator)} | ||
*/ | ||
public static final String CMAKE_GENERATOR = "cmake.generator"; //$NON-NLS-1$ | ||
public static final String CMAKE_GENERATOR_DEFAULT = "Ninja"; //$NON-NLS-1$ | ||
|
||
/** | ||
* Additional arguments to pass to CMake when running the generator stage. | ||
*/ | ||
public static final String CMAKE_ARGUMENTS = "cmake.arguments"; //$NON-NLS-1$ | ||
public static final String CMAKE_ARGUMENTS_DEFAULT = ""; //$NON-NLS-1$ | ||
|
||
/** | ||
* Custom environment to use when launching CMake | ||
*/ | ||
public static final String CMAKE_ENV = "cmake.environment"; //$NON-NLS-1$ | ||
|
||
/** | ||
* Name of the CMake executable. | ||
*/ | ||
public static final String CMAKE_BUILD_COMMAND = "cmake.command.build"; //$NON-NLS-1$ | ||
public static final String CMAKE_BUILD_COMMAND_DEFAULT = "cmake"; //$NON-NLS-1$ | ||
|
||
/** | ||
* Name of the default target to pass to CMake's build {@code --target} when building. | ||
*/ | ||
public static final String CMAKE_ALL_TARGET = "cmake.target.all"; //$NON-NLS-1$ | ||
public static final String CMAKE_ALL_TARGET_DEFAULT = "all"; //$NON-NLS-1$ | ||
|
||
/** | ||
* Name of the default target to pass to CMake's build {@code --target} when cleaning. | ||
*/ | ||
public static final String CMAKE_CLEAN_TARGET = "cmake.target.clean"; //$NON-NLS-1$ | ||
public static final String CMAKE_CLEAN_TARGET_DEFAULT = "clean"; //$NON-NLS-1$ | ||
|
||
/** | ||
* Converts the {@link ICBuildConfiguration}'s properties, using the keys defined above | ||
* into an {@link ICMakeProperties} that configures the CMake build processes. | ||
* @return A ICMakeProperties object. Must not be null. | ||
*/ | ||
ICMakeProperties getCMakeProperties(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
161 changes: 0 additions & 161 deletions
161
...pse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakePropertiesController.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 0 additions & 33 deletions
33
....eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/IOsOverridesSelector.java
This file was deleted.
Oops, something went wrong.
92 changes: 0 additions & 92 deletions
92
...dt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/properties/AbstractOsOverrides.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
...e.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/properties/WindowsOverrides.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/properties/ICMakeGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2020, 2025 Martin Weber and others. | ||
* | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License 2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.cdt.cmake.core.properties; | ||
|
||
import org.eclipse.cdt.cmake.core.CMakeBuildConfiguration; | ||
|
||
/** | ||
* This class can be implemented by extenders who want to contribute a fully custom | ||
* CMakeGenerator configuration when generating {@link ICMakeProperties} in | ||
* {@link CMakeBuildConfiguration#getCMakeProperties()}; | ||
* | ||
* @since 2.0 | ||
*/ | ||
public interface ICMakeGenerator { | ||
|
||
/** | ||
* Gets the cmake argument that specifies the build-script generator. | ||
* | ||
* @return a non-empty string, which must be a valid argument for cmake's -G | ||
* option. | ||
*/ | ||
String getCMakeName(); | ||
|
||
/** | ||
* Gets the name of the top-level makefile (build-script) which is interpreted | ||
* by the build-script processor. | ||
* | ||
* @return name of the makefile, or {@code null} for CDT to always run CMake. | ||
*/ | ||
String getMakefileName(); | ||
|
||
/** | ||
* Gets the build-script processor´s command argument(s) to ignore build errors. | ||
* | ||
* @return the command option string or {@code null} if no argument is needed. | ||
*/ | ||
String getIgnoreErrOption(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
....cdt.cmake.core/src/org/eclipse/cdt/cmake/core/properties/ICMakePropertiesController.java
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
....eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/properties/IGeneralProperties.java
This file was deleted.
Oops, something went wrong.
66 changes: 0 additions & 66 deletions
66
cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/properties/IOsOverrides.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
cmake/org.eclipse.cdt.cmake.ui.tests/manualTests/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
## Overview | ||
|
||
This document captures the manual tests that should be completed on the | ||
CMake setting. | ||
|
||
## Test cases | ||
The following test cases use a Launch Target set to Local. | ||
|
||
### 1) Operating system defaults used | ||
#### 1.1) Launch Bar Launch Mode=Run, CMake Settings > "Use default CMake settings"=checked | ||
Expected: Build uses default generator (Ninja) | ||
#### 1.2) Launch Bar Launch Mode=Debug, CMake Settings > "Use default CMake settings"=checked | ||
Expected: Build uses default generator (Ninja) | ||
|
||
### 2) Build Settings specific generator used: | ||
Note, the Build Settings tab settings are stored separately for Run mode and Debug mode. | ||
#### 2.1) Launch Bar Launch Mode=Run, CMake Settings > "Use default CMake settings"=unchecked, Generator=Unix Makefiles | ||
Expected: Build uses generator Unix Makefiles | ||
#### 2.2) Launch Bar Launch Mode=Debug, CMake Settings > "Use default CMake settings"=unchecked, Generator=Unix Makefiles | ||
Expected: Build uses generator Unix Makefiles | ||
#### 2.3) Build Settings are remembered | ||
#### 2.4) Build Settings for Run mode can be different to settings stored for Debug | ||
|
||
### 3) Build Settings specific Additional CMake arguments: | ||
#### 3.1) CMake Settings > "Use default CMake settings"=unchecked, Additional CMake arguments are used during build | ||
#### 3.2) CMake Settings > "Use default CMake settings"=checked, Additional CMake arguments are NOT used during build and text box is blank | ||
|
||
### 4) Build Settings specific Build command: | ||
#### 4.1) Enter a custom build command, such as the full path to cmake, and run build | ||
Expected: the custom cmake command is used | ||
|
||
### 5) Build Settings specific all target: | ||
#### 5.1) Enter a custom all target, such as `helloworld`, and run build | ||
Expected: the custom target is used in the cmake command line | ||
|
||
### 6) Build Settings specific all target: | ||
#### 6.1) Enter a custom clean target, such as `help`, and clean project | ||
Expected: the custom target is used in the cmake command line | ||
|
||
### 8) Restart Eclipse | ||
#### 8.1) Perform build, clean and open build settings | ||
Expected: Settings are persisted | ||
|
||
## Setup & prerequisites | ||
### Setup Host | ||
Note, these instructions do not require the following tools to be added to the system path environment variable in the OS before starting Eclipse. This allows a clean environment to be maintained. | ||
|
||
- Install Eclipse/CDT on host. | ||
- Install gcc toolchain and make tools on host. | ||
- On Windows I used msys64 (https://www.msys2.org/), which contains mingw64. | ||
- Install CMake and Ninja on host. | ||
|
||
### In Eclipse, setup tool paths. | ||
|
||
#### Toolchain | ||
When using a recognised gcc toolchain (mingw64 is one of these), CDT automatically registers the toolchain for use within the workbench. | ||
* To check if the toolchain is registered, open Preferences > C/C++ > Core Build Toolchains. In the Available Toolchains list, check if it contains the toolchain you installed on the host. | ||
|
||
For example, when using mingw64 the following toolchain is available: | ||
|
||
Type Name OS Arch | ||
GCC win32 x86_64 C:\msys64\mingw64\bin\gcc.exe win32 x86_64 | ||
Otherwise, register your toolchain by clicking Add... in the User Defined Toolchains list. | ||
|
||
#### CMake & Ninja | ||
* Open Preferences > C/C++ > Build > Environment and click Add... | ||
|
||
In Name enter "PATH" and in Value enter the path to CMake and Ninja, for example | ||
|
||
`C:\Program Files\CMake\bin;C:\Ninja\bin` | ||
|
||
|
||
You probably want to make sure "Append variables to native environment" (default) is selected. | ||
|
||
#### Create a CMake project | ||
* In Eclipse, choose File > C/C++ Project. | ||
* In the New C/C++ Project wizard, choose CMake in the left hand side sash and then CMake Project and click Next. | ||
* Enter a project name, for example helloworld and click Finish. | ||
* In the Project Explorer, expand the generated project. It contains 3 files : | ||
|
||
helloworld.cpp | ||
|
||
CMakeLists.txt | ||
|
||
config.h.in |
83 changes: 4 additions & 79 deletions
83
...sts/manualTests/Bug579242_manual_tests.md → ....ui.tests/manualTests/testrun-20240129.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 4 additions & 5 deletions
9
cmake/org.eclipse.cdt.cmake.ui/src/org/eclipse/cdt/cmake/ui/internal/messages.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters