mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 01:45:33 +02:00
CMake - check for build files, clean up some UX.
Starting for Ninja, check for build.ninja file on whether to run CMake again. Need to do same for makefiles. Change default to run cmake --build instead of hardcoding ninja or make. Added message to the end of the build to know when it's done. Change-Id: Ibbb352ef7c64f6e1fcbe122ef0b73f2c91bb1aa7
This commit is contained in:
parent
45fb622c51
commit
69404fdf89
3 changed files with 16 additions and 9 deletions
|
@ -109,7 +109,16 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
|||
|
||||
outStream.write(String.format(Messages.CMakeBuildConfiguration_BuildingIn, buildDir.toString()));
|
||||
|
||||
if (!Files.exists(buildDir.resolve("CMakeFiles"))) { //$NON-NLS-1$
|
||||
boolean runCMake;
|
||||
switch (generator) {
|
||||
case "Ninja": //$NON-NLS-1$
|
||||
runCMake = !Files.exists(buildDir.resolve("build.ninja")); //$NON-NLS-1$
|
||||
break;
|
||||
default:
|
||||
runCMake = !Files.exists(buildDir.resolve("CMakeFiles")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
if (runCMake) { // $NON-NLS-1$
|
||||
List<String> command = new ArrayList<>();
|
||||
|
||||
// TODO location of CMake out of preferences if not found here
|
||||
|
@ -155,14 +164,8 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
|||
epm.setOutputStream(console.getOutputStream());
|
||||
|
||||
String buildCommand = getProperty(BUILD_COMMAND);
|
||||
if (buildCommand == null) {
|
||||
if (generator.equals("Ninja")) { //$NON-NLS-1$
|
||||
buildCommand = "ninja"; //$NON-NLS-1$
|
||||
} else {
|
||||
buildCommand = "make"; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
String[] command = buildCommand.split(" "); //$NON-NLS-1$
|
||||
String[] command = buildCommand != null && !buildCommand.trim().isEmpty() ? buildCommand.split(" ") //$NON-NLS-1$
|
||||
: new String[] { "cmake", "--build", "." }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
|
||||
Path cmdPath = findCommand(command[0]);
|
||||
if (cmdPath != null) {
|
||||
|
@ -181,6 +184,8 @@ public class CMakeBuildConfiguration extends CBuildConfiguration {
|
|||
// Load compile_commands.json file
|
||||
processCompileCommandsFile(monitor);
|
||||
|
||||
outStream.write(String.format(Messages.CMakeBuildConfiguration_BuildingComplete, buildDir.toString()));
|
||||
|
||||
return new IProject[] { project };
|
||||
} catch (IOException e) {
|
||||
throw new CoreException(Activator.errorStatus(String.format(Messages.CMakeBuildConfiguration_Building, project.getName()), e));
|
||||
|
|
|
@ -13,6 +13,7 @@ public class Messages extends NLS {
|
|||
private static final String BUNDLE_NAME = "org.eclipse.cdt.cmake.core.internal.messages"; //$NON-NLS-1$
|
||||
public static String CMakeBuildConfiguration_Building;
|
||||
public static String CMakeBuildConfiguration_BuildingIn;
|
||||
public static String CMakeBuildConfiguration_BuildingComplete;
|
||||
public static String CMakeBuildConfiguration_Cleaning;
|
||||
public static String CMakeBuildConfiguration_NotFound;
|
||||
public static String CMakeBuildConfiguration_ProcCompCmds;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
################################################################################
|
||||
CMakeBuildConfiguration_Building=Building %s
|
||||
CMakeBuildConfiguration_BuildingIn=Building in: %s\n
|
||||
CMakeBuildConfiguration_BuildingComplete=Build complete: %s\n
|
||||
CMakeBuildConfiguration_Cleaning=Cleaning %s
|
||||
CMakeBuildConfiguration_NotFound=CMakeFiles not found. Assuming clean.
|
||||
CMakeBuildConfiguration_ProcCompCmds=Processing compile commands %s
|
||||
|
|
Loading…
Add table
Reference in a new issue