Changeset View
Changeset View
Standalone View
Standalone View
projectmanagers/cmake/cmakeutils.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
49 | 49 | | |||
50 | using namespace KDevelop; | 50 | using namespace KDevelop; | ||
51 | 51 | | |||
52 | namespace Config | 52 | namespace Config | ||
53 | { | 53 | { | ||
54 | namespace Old | 54 | namespace Old | ||
55 | { | 55 | { | ||
56 | static const QString currentBuildDirKey = QStringLiteral("CurrentBuildDir"); | 56 | static const QString currentBuildDirKey = QStringLiteral("CurrentBuildDir"); | ||
57 | static const QString oldcmakeExecutableKey = QStringLiteral("CMake Binary"); // Todo: Remove at some point | ||||
57 | static const QString currentBuildTypeKey = QStringLiteral("CurrentBuildType"); | 58 | static const QString currentBuildTypeKey = QStringLiteral("CurrentBuildType"); | ||
58 | static const QString currentInstallDirKey = QStringLiteral("CurrentInstallDir"); | 59 | static const QString currentInstallDirKey = QStringLiteral("CurrentInstallDir"); | ||
59 | static const QString currentEnvironmentKey = QStringLiteral("CurrentEnvironment"); | 60 | static const QString currentEnvironmentKey = QStringLiteral("CurrentEnvironment"); | ||
60 | static const QString currentExtraArgumentsKey = QStringLiteral("Extra Arguments"); | 61 | static const QString currentExtraArgumentsKey = QStringLiteral("Extra Arguments"); | ||
61 | static const QString projectRootRelativeKey = QStringLiteral("ProjectRootRelative"); | 62 | static const QString projectRootRelativeKey = QStringLiteral("ProjectRootRelative"); | ||
62 | static const QString projectBuildDirs = QStringLiteral("BuildDirs"); | 63 | static const QString projectBuildDirs = QStringLiteral("BuildDirs"); | ||
63 | } | 64 | } | ||
64 | 65 | | |||
65 | static const QString buildDirIndexKey_ = QStringLiteral("Current Build Directory Index"); | 66 | static const QString buildDirIndexKey_ = QStringLiteral("Current Build Directory Index"); | ||
66 | static const QString buildDirOverrideIndexKey = QStringLiteral("Temporary Build Directory Index"); | 67 | static const QString buildDirOverrideIndexKey = QStringLiteral("Temporary Build Directory Index"); | ||
67 | static const QString buildDirCountKey = QStringLiteral("Build Directory Count"); | 68 | static const QString buildDirCountKey = QStringLiteral("Build Directory Count"); | ||
68 | 69 | | |||
69 | //the used builddir will change for every runtime | 70 | //the used builddir will change for every runtime | ||
70 | static QString buildDirIndexKey() { | 71 | static QString buildDirIndexKey() { | ||
71 | const QString currentRuntime = ICore::self()->runtimeController()->currentRuntime()->name(); | 72 | const QString currentRuntime = ICore::self()->runtimeController()->currentRuntime()->name(); | ||
72 | return buildDirIndexKey_ + '-' + currentRuntime; | 73 | return buildDirIndexKey_ + '-' + currentRuntime; | ||
73 | } | 74 | } | ||
74 | 75 | | |||
75 | namespace Specific | 76 | namespace Specific | ||
76 | { | 77 | { | ||
77 | static const QString buildDirPathKey = QStringLiteral("Build Directory Path"); | 78 | static const QString buildDirPathKey = QStringLiteral("Build Directory Path"); | ||
78 | // TODO: migrate to more generic & consistent key term "CMake Executable" | 79 | static const QString cmakeExecutableKey = QStringLiteral("CMake Executable"); | ||
79 | static const QString cmakeBuildTypeKey = QStringLiteral("Build Type"); | 80 | static const QString cmakeBuildTypeKey = QStringLiteral("Build Type"); | ||
80 | static const QString cmakeInstallDirKey = QStringLiteral("Install Directory"); | 81 | static const QString cmakeInstallDirKey = QStringLiteral("Install Directory"); | ||
81 | static const QString cmakeEnvironmentKey = QStringLiteral("Environment Profile"); | 82 | static const QString cmakeEnvironmentKey = QStringLiteral("Environment Profile"); | ||
82 | static const QString cmakeArgumentsKey = QStringLiteral("Extra Arguments"); | 83 | static const QString cmakeArgumentsKey = QStringLiteral("Extra Arguments"); | ||
83 | static const QString buildDirRuntime = QStringLiteral("Runtime"); | 84 | static const QString buildDirRuntime = QStringLiteral("Runtime"); | ||
84 | } | 85 | } | ||
85 | 86 | | |||
86 | static const QString groupNameBuildDir = QStringLiteral("CMake Build Directory %1"); | 87 | static const QString groupNameBuildDir = QStringLiteral("CMake Build Directory %1"); | ||
▲ Show 20 Lines • Show All 260 Lines • ▼ Show 20 Line(s) | 347 | { | |||
347 | return baseGroup(project).hasKey( Config::Old::projectRootRelativeKey ); | 348 | return baseGroup(project).hasKey( Config::Old::projectRootRelativeKey ); | ||
348 | } | 349 | } | ||
349 | 350 | | |||
350 | QString currentExtraArguments( KDevelop::IProject* project, int builddir ) | 351 | QString currentExtraArguments( KDevelop::IProject* project, int builddir ) | ||
351 | { | 352 | { | ||
352 | return readBuildDirParameter( project, Config::Specific::cmakeArgumentsKey, QString(), builddir ); | 353 | return readBuildDirParameter( project, Config::Specific::cmakeArgumentsKey, QString(), builddir ); | ||
353 | } | 354 | } | ||
354 | 355 | | |||
356 | QString currentCmakeExecutable( KDevelop::IProject* project, int builddir ) | ||||
357 | { | ||||
358 | return readBuildDirParameter( project, Config::Specific::cmakeExecutableKey, QString(), builddir ); | ||||
359 | } | ||||
360 | | ||||
355 | void setCurrentInstallDir( KDevelop::IProject* project, const KDevelop::Path& path ) | 361 | void setCurrentInstallDir( KDevelop::IProject* project, const KDevelop::Path& path ) | ||
356 | { | 362 | { | ||
357 | writeBuildDirParameter( project, Config::Specific::cmakeInstallDirKey, path.toLocalFile() ); | 363 | writeBuildDirParameter( project, Config::Specific::cmakeInstallDirKey, path.toLocalFile() ); | ||
358 | } | 364 | } | ||
359 | 365 | | |||
360 | void setCurrentBuildType( KDevelop::IProject* project, const QString& type ) | 366 | void setCurrentBuildType( KDevelop::IProject* project, const QString& type ) | ||
361 | { | 367 | { | ||
362 | writeBuildDirParameter( project, Config::Specific::cmakeBuildTypeKey, type ); | 368 | writeBuildDirParameter( project, Config::Specific::cmakeBuildTypeKey, type ); | ||
Show All 9 Lines | 377 | { | |||
372 | writeProjectBaseParameter( project, Config::Old::projectRootRelativeKey, relative ); | 378 | writeProjectBaseParameter( project, Config::Old::projectRootRelativeKey, relative ); | ||
373 | } | 379 | } | ||
374 | 380 | | |||
375 | void setCurrentExtraArguments( KDevelop::IProject* project, const QString& string) | 381 | void setCurrentExtraArguments( KDevelop::IProject* project, const QString& string) | ||
376 | { | 382 | { | ||
377 | writeBuildDirParameter( project, Config::Specific::cmakeArgumentsKey, string ); | 383 | writeBuildDirParameter( project, Config::Specific::cmakeArgumentsKey, string ); | ||
378 | } | 384 | } | ||
379 | 385 | | |||
386 | void setCurrentCmakeExecutable( KDevelop::IProject* project, const QString& string ) | ||||
387 | { | ||||
388 | writeBuildDirParameter( project, Config::Specific::cmakeExecutableKey, string ); | ||||
389 | } | ||||
390 | | ||||
380 | QString currentEnvironment(KDevelop::IProject* project, int builddir) | 391 | QString currentEnvironment(KDevelop::IProject* project, int builddir) | ||
381 | { | 392 | { | ||
382 | return readBuildDirParameter( project, Config::Specific::cmakeEnvironmentKey, QString(), builddir ); | 393 | return readBuildDirParameter( project, Config::Specific::cmakeEnvironmentKey, QString(), builddir ); | ||
383 | } | 394 | } | ||
384 | 395 | | |||
385 | int currentBuildDirIndex( KDevelop::IProject* project ) | 396 | int currentBuildDirIndex( KDevelop::IProject* project ) | ||
386 | { | 397 | { | ||
387 | KConfigGroup baseGrp = baseGroup(project); | 398 | KConfigGroup baseGrp = baseGroup(project); | ||
▲ Show 20 Lines • Show All 301 Lines • Show Last 20 Lines |