2017-09-28 11:32:39 +02:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
**
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
**
|
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
**
|
|
|
|
** GNU General Public License Usage
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "builddirparameters.h"
|
|
|
|
|
|
|
|
#include "cmakebuildconfiguration.h"
|
|
|
|
#include "cmakekitinformation.h"
|
2019-11-18 15:24:52 +01:00
|
|
|
#include "cmakeprojectplugin.h"
|
|
|
|
#include "cmakespecificsettings.h"
|
2018-05-24 16:57:31 +02:00
|
|
|
#include "cmaketoolmanager.h"
|
2017-09-28 11:32:39 +02:00
|
|
|
|
|
|
|
#include <projectexplorer/kit.h>
|
|
|
|
#include <projectexplorer/kitinformation.h>
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
|
2018-08-30 09:48:33 +02:00
|
|
|
#include <utils/hostosinfo.h>
|
|
|
|
|
2017-09-28 11:32:39 +02:00
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
|
|
namespace CMakeProjectManager {
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
BuildDirParameters::BuildDirParameters() = default;
|
|
|
|
|
|
|
|
BuildDirParameters::BuildDirParameters(CMakeBuildConfiguration *bc)
|
|
|
|
{
|
2019-10-25 09:55:32 +02:00
|
|
|
initialized = bc != nullptr;
|
2017-09-28 11:32:39 +02:00
|
|
|
|
|
|
|
const Kit *k = bc->target()->kit();
|
|
|
|
|
|
|
|
projectName = bc->target()->project()->displayName();
|
|
|
|
|
|
|
|
sourceDirectory = bc->target()->project()->projectDirectory();
|
|
|
|
buildDirectory = bc->buildDirectory();
|
|
|
|
|
|
|
|
environment = bc->environment();
|
2018-08-30 09:48:33 +02:00
|
|
|
// Disable distributed building for configuration runs. CMake does not do those in parallel,
|
|
|
|
// so there is no win in sending data over the network.
|
|
|
|
// Unfortunately distcc does not have a simple environment flag to turn it off:-/
|
|
|
|
if (Utils::HostOsInfo::isAnyUnixHost())
|
|
|
|
environment.set("ICECC", "no");
|
2017-09-28 11:32:39 +02:00
|
|
|
|
2019-11-18 15:24:52 +01:00
|
|
|
CMakeSpecificSettings *settings = CMakeProjectPlugin::projectTypeSpecificSettings();
|
|
|
|
if (!settings->ninjaPath().isEmpty())
|
|
|
|
environment.appendOrSetPath(settings->ninjaPath().toString());
|
|
|
|
|
2019-02-06 12:50:51 +01:00
|
|
|
cmakeToolId = CMakeKitAspect::cmakeToolId(k);
|
2017-09-28 11:32:39 +02:00
|
|
|
|
2020-02-18 18:25:26 +01:00
|
|
|
auto tc = ToolChainKitAspect::cxxToolChain(k);
|
2017-09-28 11:32:39 +02:00
|
|
|
if (tc)
|
|
|
|
cxxToolChainId = tc->id();
|
2020-02-18 18:25:26 +01:00
|
|
|
tc = ToolChainKitAspect::cToolChain(k);
|
2017-09-28 11:32:39 +02:00
|
|
|
if (tc)
|
|
|
|
cToolChainId = tc->id();
|
|
|
|
|
|
|
|
expander = k->macroExpander();
|
|
|
|
|
|
|
|
configuration = bc->configurationForCMake();
|
|
|
|
|
2019-02-06 12:50:51 +01:00
|
|
|
generator = CMakeGeneratorKitAspect::generator(k);
|
|
|
|
extraGenerator = CMakeGeneratorKitAspect::extraGenerator(k);
|
|
|
|
platform = CMakeGeneratorKitAspect::platform(k);
|
|
|
|
toolset = CMakeGeneratorKitAspect::toolset(k);
|
|
|
|
generatorArguments = CMakeGeneratorKitAspect::generatorArguments(k);
|
2017-09-28 11:32:39 +02:00
|
|
|
}
|
|
|
|
|
2019-10-25 09:55:32 +02:00
|
|
|
bool BuildDirParameters::isValid() const { return initialized && cmakeTool(); }
|
2018-05-24 16:57:31 +02:00
|
|
|
|
|
|
|
CMakeTool *BuildDirParameters::cmakeTool() const
|
|
|
|
{
|
|
|
|
return CMakeToolManager::findById(cmakeToolId);
|
|
|
|
}
|
2017-09-28 11:32:39 +02:00
|
|
|
|
|
|
|
BuildDirParameters::BuildDirParameters(const BuildDirParameters &) = default;
|
2019-05-06 23:57:41 +03:00
|
|
|
BuildDirParameters &BuildDirParameters::operator=(const BuildDirParameters &) = default;
|
2017-09-28 11:32:39 +02:00
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
} // namespace CMakeProjectManager
|