A bit WIP since I'm going to fix the fact that qconfig.pri generated by configure.exe doesn't set QMAKE_DEFAULT_LIBDIRS or QMAKE_DEFAULT_INCDIRS
5144 lines
186 KiB
Diff
5144 lines
186 KiB
Diff
From 38fdea0e2175a597a7b46a5c0f8e24d5fecd65e1 Mon Sep 17 00:00:00 2001
|
|
From: Jake Petroules <jake.petroules@petroules.com>
|
|
Date: Sat, 29 Nov 2014 18:12:45 +0000
|
|
Subject: [PATCH 2/5] WIP: Xcode generator.
|
|
|
|
Task-number: QBS-32
|
|
|
|
Change-Id: I5ce5cc3148aa801d75a1f64b778fe7334de43af9
|
|
---
|
|
src/app/qbs/commandlinefrontend.cpp | 27 ++
|
|
src/app/qbs/commandlinefrontend.h | 1 +
|
|
src/app/qbs/parser/command.cpp | 35 +++
|
|
src/app/qbs/parser/command.h | 13 +
|
|
src/app/qbs/parser/commandlineoption.cpp | 23 ++
|
|
src/app/qbs/parser/commandlineoption.h | 18 +-
|
|
src/app/qbs/parser/commandlineoptionpool.cpp | 8 +
|
|
src/app/qbs/parser/commandlineoptionpool.h | 1 +
|
|
src/app/qbs/parser/commandlineparser.cpp | 10 +
|
|
src/app/qbs/parser/commandlineparser.h | 2 +
|
|
src/app/qbs/parser/commandpool.cpp | 3 +
|
|
src/app/qbs/parser/commandtype.h | 2 +-
|
|
src/lib/corelib/api/api.pri | 2 +
|
|
src/lib/corelib/api/generator.cpp | 50 ++++
|
|
src/lib/corelib/api/generator.h | 61 +++++
|
|
src/lib/corelib/api/project.cpp | 2 +
|
|
src/lib/corelib/qbs.h | 2 +
|
|
src/lib/corelib/tools/generateoptions.cpp | 91 +++++++
|
|
src/lib/corelib/tools/generateoptions.h | 58 +++++
|
|
src/lib/corelib/tools/generatorpluginmanager.cpp | 128 ++++++++++
|
|
src/lib/corelib/tools/generatorpluginmanager.h | 69 ++++++
|
|
src/lib/corelib/tools/scannerpluginmanager.cpp | 3 +
|
|
src/lib/corelib/tools/tools.pri | 4 +
|
|
src/plugins/generator/generator.pro | 2 +
|
|
src/plugins/generator/generatorplugin.h | 46 ++++
|
|
src/plugins/generator/xcode/main.cpp | 45 ++++
|
|
.../generator/xcode/opensteppropertylist.cpp | 186 ++++++++++++++
|
|
src/plugins/generator/xcode/opensteppropertylist.h | 71 ++++++
|
|
src/plugins/generator/xcode/pbx.h | 53 ++++
|
|
src/plugins/generator/xcode/pbxbuildfile.cpp | 72 ++++++
|
|
src/plugins/generator/xcode/pbxbuildfile.h | 64 +++++
|
|
src/plugins/generator/xcode/pbxbuildphase.cpp | 77 ++++++
|
|
src/plugins/generator/xcode/pbxbuildphase.h | 60 +++++
|
|
src/plugins/generator/xcode/pbxcontainer.cpp | 53 ++++
|
|
src/plugins/generator/xcode/pbxcontainer.h | 57 +++++
|
|
src/plugins/generator/xcode/pbxfileencoding.h | 57 +++++
|
|
src/plugins/generator/xcode/pbxfilereference.cpp | 73 ++++++
|
|
src/plugins/generator/xcode/pbxfilereference.h | 54 ++++
|
|
src/plugins/generator/xcode/pbxfiletype.cpp | 41 +++
|
|
src/plugins/generator/xcode/pbxfiletype.h | 47 ++++
|
|
src/plugins/generator/xcode/pbxgroup.cpp | 114 +++++++++
|
|
src/plugins/generator/xcode/pbxgroup.h | 69 ++++++
|
|
src/plugins/generator/xcode/pbxlegacytarget.cpp | 127 ++++++++++
|
|
src/plugins/generator/xcode/pbxlegacytarget.h | 73 ++++++
|
|
src/plugins/generator/xcode/pbxnativetarget.cpp | 83 +++++++
|
|
src/plugins/generator/xcode/pbxnativetarget.h | 61 +++++
|
|
src/plugins/generator/xcode/pbxobject.cpp | 69 ++++++
|
|
src/plugins/generator/xcode/pbxobject.h | 59 +++++
|
|
src/plugins/generator/xcode/pbxproducttype.cpp | 56 +++++
|
|
src/plugins/generator/xcode/pbxproducttype.h | 52 ++++
|
|
src/plugins/generator/xcode/pbxproject.cpp | 218 ++++++++++++++++
|
|
src/plugins/generator/xcode/pbxproject.h | 80 ++++++
|
|
src/plugins/generator/xcode/pbxreference.cpp | 107 ++++++++
|
|
src/plugins/generator/xcode/pbxreference.h | 70 ++++++
|
|
.../generator/xcode/pbxsourcesbuildphase.cpp | 47 ++++
|
|
src/plugins/generator/xcode/pbxsourcesbuildphase.h | 49 ++++
|
|
src/plugins/generator/xcode/pbxsourcetree.cpp | 50 ++++
|
|
src/plugins/generator/xcode/pbxsourcetree.h | 52 ++++
|
|
src/plugins/generator/xcode/pbxtarget.cpp | 139 +++++++++++
|
|
src/plugins/generator/xcode/pbxtarget.h | 86 +++++++
|
|
.../generator/xcode/xcbuildconfiguration.cpp | 82 ++++++
|
|
src/plugins/generator/xcode/xcbuildconfiguration.h | 67 +++++
|
|
.../generator/xcode/xcconfigurationlist.cpp | 142 +++++++++++
|
|
src/plugins/generator/xcode/xcconfigurationlist.h | 63 +++++
|
|
src/plugins/generator/xcode/xcode.pro | 58 +++++
|
|
src/plugins/generator/xcode/xcodegenerator.cpp | 96 +++++++
|
|
src/plugins/generator/xcode/xcodegenerator.h | 53 ++++
|
|
.../generator/xcode/xcodenativegenerator.cpp | 136 ++++++++++
|
|
src/plugins/generator/xcode/xcodenativegenerator.h | 53 ++++
|
|
.../generator/xcode/xcodesimplegenerator.cpp | 275 +++++++++++++++++++++
|
|
src/plugins/generator/xcode/xcodesimplegenerator.h | 53 ++++
|
|
src/plugins/plugins.pro | 2 +-
|
|
72 files changed, 4409 insertions(+), 3 deletions(-)
|
|
create mode 100644 src/lib/corelib/api/generator.cpp
|
|
create mode 100644 src/lib/corelib/api/generator.h
|
|
create mode 100644 src/lib/corelib/tools/generateoptions.cpp
|
|
create mode 100644 src/lib/corelib/tools/generateoptions.h
|
|
create mode 100644 src/lib/corelib/tools/generatorpluginmanager.cpp
|
|
create mode 100644 src/lib/corelib/tools/generatorpluginmanager.h
|
|
create mode 100644 src/plugins/generator/generator.pro
|
|
create mode 100644 src/plugins/generator/generatorplugin.h
|
|
create mode 100644 src/plugins/generator/xcode/main.cpp
|
|
create mode 100644 src/plugins/generator/xcode/opensteppropertylist.cpp
|
|
create mode 100644 src/plugins/generator/xcode/opensteppropertylist.h
|
|
create mode 100644 src/plugins/generator/xcode/pbx.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxbuildfile.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxbuildfile.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxbuildphase.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxbuildphase.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxcontainer.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxcontainer.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxfileencoding.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxfilereference.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxfilereference.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxfiletype.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxfiletype.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxgroup.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxgroup.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxlegacytarget.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxlegacytarget.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxnativetarget.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxnativetarget.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxobject.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxobject.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxproducttype.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxproducttype.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxproject.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxproject.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxreference.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxreference.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxsourcesbuildphase.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxsourcesbuildphase.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxsourcetree.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxsourcetree.h
|
|
create mode 100644 src/plugins/generator/xcode/pbxtarget.cpp
|
|
create mode 100644 src/plugins/generator/xcode/pbxtarget.h
|
|
create mode 100644 src/plugins/generator/xcode/xcbuildconfiguration.cpp
|
|
create mode 100644 src/plugins/generator/xcode/xcbuildconfiguration.h
|
|
create mode 100644 src/plugins/generator/xcode/xcconfigurationlist.cpp
|
|
create mode 100644 src/plugins/generator/xcode/xcconfigurationlist.h
|
|
create mode 100644 src/plugins/generator/xcode/xcode.pro
|
|
create mode 100644 src/plugins/generator/xcode/xcodegenerator.cpp
|
|
create mode 100644 src/plugins/generator/xcode/xcodegenerator.h
|
|
create mode 100644 src/plugins/generator/xcode/xcodenativegenerator.cpp
|
|
create mode 100644 src/plugins/generator/xcode/xcodenativegenerator.h
|
|
create mode 100644 src/plugins/generator/xcode/xcodesimplegenerator.cpp
|
|
create mode 100644 src/plugins/generator/xcode/xcodesimplegenerator.h
|
|
|
|
diff --git a/src/app/qbs/commandlinefrontend.cpp b/src/app/qbs/commandlinefrontend.cpp
|
|
index d85c66d..f68320e 100644
|
|
--- a/src/app/qbs/commandlinefrontend.cpp
|
|
+++ b/src/app/qbs/commandlinefrontend.cpp
|
|
@@ -39,6 +39,7 @@
|
|
#include <api/runenvironment.h>
|
|
#include <logging/translator.h>
|
|
#include <tools/qbsassert.h>
|
|
+#include <tools/generatorpluginmanager.h>
|
|
|
|
#include <QDir>
|
|
#include <QMetaObject>
|
|
@@ -332,6 +333,9 @@ void CommandLineFrontend::handleProjectsResolved()
|
|
if (m_cancelStatus != CancelStatusNone)
|
|
throw ErrorInfo(Tr::tr("Execution canceled."));
|
|
switch (m_parser.command()) {
|
|
+ case GenerateCommandType:
|
|
+ generate();
|
|
+ break;
|
|
case ResolveCommandType:
|
|
qApp->quit();
|
|
break;
|
|
@@ -452,6 +456,29 @@ void CommandLineFrontend::build()
|
|
m_currentBuildEffort = 0;
|
|
}
|
|
|
|
+void CommandLineFrontend::generate()
|
|
+{
|
|
+ const QString generatorName = m_parser.generateOptions().generatorName();
|
|
+ if (generatorName.isEmpty()) {
|
|
+ throw ErrorInfo(Tr::tr("Invalid use of command '%1': No generator given.\nUsage: %2")
|
|
+ .arg(m_parser.commandName(), m_parser.commandDescription()));
|
|
+ }
|
|
+
|
|
+ Q_ASSERT(m_projects.count() == 1);
|
|
+ const Project project = m_projects.first();
|
|
+ if (Generator *generator = GeneratorPluginManager::generatorWithName(generatorName))
|
|
+ {
|
|
+ generator->generate(project);
|
|
+ delete generator;
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ throw ErrorInfo(Tr::tr("No generator named '%1'").arg(generatorName));
|
|
+ }
|
|
+
|
|
+ qApp->quit();
|
|
+}
|
|
+
|
|
int CommandLineFrontend::runTarget()
|
|
{
|
|
try {
|
|
diff --git a/src/app/qbs/commandlinefrontend.h b/src/app/qbs/commandlinefrontend.h
|
|
index f7b4d47..401dee4 100644
|
|
--- a/src/app/qbs/commandlinefrontend.h
|
|
+++ b/src/app/qbs/commandlinefrontend.h
|
|
@@ -80,6 +80,7 @@ private:
|
|
void makeClean();
|
|
int runShell();
|
|
void build();
|
|
+ void generate();
|
|
int runTarget();
|
|
void updateTimestamps();
|
|
void connectBuildJobs();
|
|
diff --git a/src/app/qbs/parser/command.cpp b/src/app/qbs/parser/command.cpp
|
|
index e97d301..bf70d06 100644
|
|
--- a/src/app/qbs/parser/command.cpp
|
|
+++ b/src/app/qbs/parser/command.cpp
|
|
@@ -188,6 +188,41 @@ QList<CommandLineOption::Type> ResolveCommand::supportedOptions() const
|
|
return resolveOptions();
|
|
}
|
|
|
|
+QString GenerateCommand::shortDescription() const
|
|
+{
|
|
+ return Tr::tr("Generate files for a different build system.");
|
|
+}
|
|
+
|
|
+QString GenerateCommand::longDescription() const
|
|
+{
|
|
+ QString description = Tr::tr("qbs %1 [options] [[variant] [property:value] ...] ...\n")
|
|
+ .arg(representation());
|
|
+ description += Tr::tr("Generates project files to build the project using a different build system.");
|
|
+ return description += supportedOptionsDescription();
|
|
+}
|
|
+
|
|
+QString GenerateCommand::representation() const
|
|
+{
|
|
+ return QLatin1String("generate");
|
|
+}
|
|
+
|
|
+static QList<CommandLineOption::Type> generateOptions()
|
|
+{
|
|
+ return QList<CommandLineOption::Type>()
|
|
+ << CommandLineOption::FileOptionType
|
|
+ << CommandLineOption::LogLevelOptionType
|
|
+ << CommandLineOption::VerboseOptionType
|
|
+ << CommandLineOption::QuietOptionType
|
|
+ << CommandLineOption::ShowProgressOptionType
|
|
+ << CommandLineOption::LogTimeOptionType
|
|
+ << CommandLineOption::GeneratorOptionType;
|
|
+}
|
|
+
|
|
+QList<CommandLineOption::Type> GenerateCommand::supportedOptions() const
|
|
+{
|
|
+ return generateOptions();
|
|
+}
|
|
+
|
|
QString BuildCommand::shortDescription() const
|
|
{
|
|
return Tr::tr("Build (parts of) a project. This is the default command.");
|
|
diff --git a/src/app/qbs/parser/command.h b/src/app/qbs/parser/command.h
|
|
index 4cfa67f..2c88876 100644
|
|
--- a/src/app/qbs/parser/command.h
|
|
+++ b/src/app/qbs/parser/command.h
|
|
@@ -81,6 +81,19 @@ private:
|
|
QList<CommandLineOption::Type> supportedOptions() const;
|
|
};
|
|
|
|
+class GenerateCommand : public Command
|
|
+{
|
|
+public:
|
|
+ GenerateCommand(CommandLineOptionPool &optionPool) : Command(optionPool) {}
|
|
+
|
|
+private:
|
|
+ CommandType type() const { return GenerateCommandType; }
|
|
+ QString shortDescription() const;
|
|
+ QString longDescription() const;
|
|
+ QString representation() const;
|
|
+ QList<CommandLineOption::Type> supportedOptions() const;
|
|
+};
|
|
+
|
|
class BuildCommand : public Command
|
|
{
|
|
public:
|
|
diff --git a/src/app/qbs/parser/commandlineoption.cpp b/src/app/qbs/parser/commandlineoption.cpp
|
|
index e138c95..cb4fbea 100644
|
|
--- a/src/app/qbs/parser/commandlineoption.cpp
|
|
+++ b/src/app/qbs/parser/commandlineoption.cpp
|
|
@@ -115,6 +115,29 @@ void BuildDirectoryOption::doParse(const QString &representation, QStringList &i
|
|
m_projectBuildDirectory = getArgument(representation, input);
|
|
}
|
|
|
|
+QString GeneratorOption::description(CommandType command) const
|
|
+{
|
|
+ Q_UNUSED(command);
|
|
+ return Tr::tr("%1|%2 <directory>\n"
|
|
+ "\tUse the given build system generator.\n")
|
|
+ .arg(longRepresentation(), shortRepresentation());
|
|
+}
|
|
+
|
|
+QString GeneratorOption::shortRepresentation() const
|
|
+{
|
|
+ return QLatin1String("-g");
|
|
+}
|
|
+
|
|
+QString GeneratorOption::longRepresentation() const
|
|
+{
|
|
+ return QLatin1String("--generator");
|
|
+}
|
|
+
|
|
+void GeneratorOption::doParse(const QString &representation, QStringList &input)
|
|
+{
|
|
+ m_generatorName = getArgument(representation, input);
|
|
+}
|
|
+
|
|
static QString loglevelLongRepresentation() { return QLatin1String("--log-level"); }
|
|
|
|
QString VerboseOption::description(CommandType command) const
|
|
diff --git a/src/app/qbs/parser/commandlineoption.h b/src/app/qbs/parser/commandlineoption.h
|
|
index 40a8b90..6e3c664 100644
|
|
--- a/src/app/qbs/parser/commandlineoption.h
|
|
+++ b/src/app/qbs/parser/commandlineoption.h
|
|
@@ -54,7 +54,8 @@ public:
|
|
ForceOptionType,
|
|
ForceTimestampCheckOptionType,
|
|
LogTimeOptionType,
|
|
- SettingsDirOptionType
|
|
+ SettingsDirOptionType,
|
|
+ GeneratorOptionType
|
|
};
|
|
|
|
virtual ~CommandLineOption();
|
|
@@ -106,6 +107,21 @@ private:
|
|
QString m_projectBuildDirectory;
|
|
};
|
|
|
|
+class GeneratorOption : public CommandLineOption
|
|
+{
|
|
+public:
|
|
+ QString generatorName() const { return m_generatorName; }
|
|
+
|
|
+private:
|
|
+ QString description(CommandType command) const;
|
|
+ QString shortRepresentation() const;
|
|
+ QString longRepresentation() const;
|
|
+ void doParse(const QString &representation, QStringList &input);
|
|
+
|
|
+private:
|
|
+ QString m_generatorName;
|
|
+};
|
|
+
|
|
class CountingOption : public CommandLineOption
|
|
{
|
|
public:
|
|
diff --git a/src/app/qbs/parser/commandlineoptionpool.cpp b/src/app/qbs/parser/commandlineoptionpool.cpp
|
|
index bd8895f..5b98ebf 100644
|
|
--- a/src/app/qbs/parser/commandlineoptionpool.cpp
|
|
+++ b/src/app/qbs/parser/commandlineoptionpool.cpp
|
|
@@ -98,6 +98,9 @@ CommandLineOption *CommandLineOptionPool::getOption(CommandLineOption::Type type
|
|
case CommandLineOption::SettingsDirOptionType:
|
|
option = new SettingsDirOption;
|
|
break;
|
|
+ case CommandLineOption::GeneratorOptionType:
|
|
+ option = new GeneratorOption;
|
|
+ break;
|
|
default:
|
|
qFatal("Unknown option type %d", type);
|
|
}
|
|
@@ -201,4 +204,9 @@ SettingsDirOption *CommandLineOptionPool::settingsDirOption() const
|
|
return static_cast<SettingsDirOption *>(getOption(CommandLineOption::SettingsDirOptionType));
|
|
}
|
|
|
|
+GeneratorOption *CommandLineOptionPool::generatorOption() const
|
|
+{
|
|
+ return static_cast<GeneratorOption *>(getOption(CommandLineOption::GeneratorOptionType));
|
|
+}
|
|
+
|
|
} // namespace qbs
|
|
diff --git a/src/app/qbs/parser/commandlineoptionpool.h b/src/app/qbs/parser/commandlineoptionpool.h
|
|
index 13c2af2..93ff3d5 100644
|
|
--- a/src/app/qbs/parser/commandlineoptionpool.h
|
|
+++ b/src/app/qbs/parser/commandlineoptionpool.h
|
|
@@ -61,6 +61,7 @@ public:
|
|
ForceTimeStampCheckOption *forceTimestampCheckOption() const;
|
|
LogTimeOption *logTimeOption() const;
|
|
SettingsDirOption *settingsDirOption() const;
|
|
+ GeneratorOption *generatorOption() const;
|
|
|
|
private:
|
|
mutable QHash<CommandLineOption::Type, CommandLineOption *> m_options;
|
|
diff --git a/src/app/qbs/parser/commandlineparser.cpp b/src/app/qbs/parser/commandlineparser.cpp
|
|
index 7ee9537..f333c70 100644
|
|
--- a/src/app/qbs/parser/commandlineparser.cpp
|
|
+++ b/src/app/qbs/parser/commandlineparser.cpp
|
|
@@ -41,6 +41,7 @@
|
|
#include <tools/buildoptions.h>
|
|
#include <tools/cleanoptions.h>
|
|
#include <tools/error.h>
|
|
+#include <tools/generateoptions.h>
|
|
#include <tools/hostosinfo.h>
|
|
#include <tools/installoptions.h>
|
|
#include <tools/preferences.h>
|
|
@@ -157,6 +158,14 @@ CleanOptions CommandLineParser::cleanOptions() const
|
|
return options;
|
|
}
|
|
|
|
+GenerateOptions CommandLineParser::generateOptions() const
|
|
+{
|
|
+ Q_ASSERT(command() == GenerateCommandType);
|
|
+ GenerateOptions options;
|
|
+ options.setGeneratorName(d->optionPool.generatorOption()->generatorName());
|
|
+ return options;
|
|
+}
|
|
+
|
|
InstallOptions CommandLineParser::installOptions() const
|
|
{
|
|
Q_ASSERT(command() == InstallCommandType || command() == RunCommandType);
|
|
@@ -360,6 +369,7 @@ Command *CommandLineParser::CommandLineParserPrivate::commandFromString(const QS
|
|
QList<Command *> CommandLineParser::CommandLineParserPrivate::allCommands() const
|
|
{
|
|
return QList<Command *>()
|
|
+ << commandPool.getCommand(GenerateCommandType)
|
|
<< commandPool.getCommand(ResolveCommandType)
|
|
<< commandPool.getCommand(BuildCommandType)
|
|
<< commandPool.getCommand(CleanCommandType)
|
|
diff --git a/src/app/qbs/parser/commandlineparser.h b/src/app/qbs/parser/commandlineparser.h
|
|
index 3ed9dbb..4f5af96 100644
|
|
--- a/src/app/qbs/parser/commandlineparser.h
|
|
+++ b/src/app/qbs/parser/commandlineparser.h
|
|
@@ -38,6 +38,7 @@
|
|
namespace qbs {
|
|
class BuildOptions;
|
|
class CleanOptions;
|
|
+class GenerateOptions;
|
|
class InstallOptions;
|
|
class Settings;
|
|
|
|
@@ -58,6 +59,7 @@ public:
|
|
QString projectBuildDirectory() const;
|
|
BuildOptions buildOptions() const;
|
|
CleanOptions cleanOptions() const;
|
|
+ GenerateOptions generateOptions() const;
|
|
InstallOptions installOptions() const;
|
|
bool force() const;
|
|
bool forceTimestampCheck() const;
|
|
diff --git a/src/app/qbs/parser/commandpool.cpp b/src/app/qbs/parser/commandpool.cpp
|
|
index edf7013..9f261e0 100644
|
|
--- a/src/app/qbs/parser/commandpool.cpp
|
|
+++ b/src/app/qbs/parser/commandpool.cpp
|
|
@@ -50,6 +50,9 @@ qbs::Command *CommandPool::getCommand(CommandType type) const
|
|
case ResolveCommandType:
|
|
command = new ResolveCommand(m_optionPool);
|
|
break;
|
|
+ case GenerateCommandType:
|
|
+ command = new GenerateCommand(m_optionPool);
|
|
+ break;
|
|
case BuildCommandType:
|
|
command = new BuildCommand(m_optionPool);
|
|
break;
|
|
diff --git a/src/app/qbs/parser/commandtype.h b/src/app/qbs/parser/commandtype.h
|
|
index 83b2ae5..5c9b6e6 100644
|
|
--- a/src/app/qbs/parser/commandtype.h
|
|
+++ b/src/app/qbs/parser/commandtype.h
|
|
@@ -35,7 +35,7 @@ namespace qbs {
|
|
enum CommandType {
|
|
ResolveCommandType, BuildCommandType, CleanCommandType, RunCommandType, ShellCommandType,
|
|
StatusCommandType, UpdateTimestampsCommandType,
|
|
- InstallCommandType, HelpCommandType
|
|
+ InstallCommandType, HelpCommandType, GenerateCommandType
|
|
};
|
|
|
|
} // namespace qbs
|
|
diff --git a/src/lib/corelib/api/api.pri b/src/lib/corelib/api/api.pri
|
|
index 18b3b47..9f2638c 100644
|
|
--- a/src/lib/corelib/api/api.pri
|
|
+++ b/src/lib/corelib/api/api.pri
|
|
@@ -1,5 +1,6 @@
|
|
HEADERS += \
|
|
$$PWD/internaljobs.h \
|
|
+ $$PWD/generator.h \
|
|
$$PWD/projectdata.h \
|
|
$$PWD/runenvironment.h \
|
|
$$PWD/jobs.h \
|
|
@@ -13,6 +14,7 @@ HEADERS += \
|
|
|
|
SOURCES += \
|
|
$$PWD/internaljobs.cpp \
|
|
+ $$PWD/generator.cpp \
|
|
$$PWD/runenvironment.cpp \
|
|
$$PWD/projectdata.cpp \
|
|
$$PWD/jobs.cpp \
|
|
diff --git a/src/lib/corelib/api/generator.cpp b/src/lib/corelib/api/generator.cpp
|
|
new file mode 100644
|
|
index 0000000..3274b3b
|
|
--- /dev/null
|
|
+++ b/src/lib/corelib/api/generator.cpp
|
|
@@ -0,0 +1,50 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+#include "generator.h"
|
|
+
|
|
+#include <QSharedData>
|
|
+
|
|
+namespace qbs {
|
|
+
|
|
+/*!
|
|
+ * \class Generator
|
|
+ * \brief The \c Generator class is an abstract base class for generators which generate arbitrary
|
|
+ * output given a resolved Qbs project.
|
|
+ */
|
|
+
|
|
+Generator::Generator()
|
|
+{
|
|
+}
|
|
+
|
|
+Generator::~Generator()
|
|
+{
|
|
+}
|
|
+
|
|
+} // namespace qbs
|
|
diff --git a/src/lib/corelib/api/generator.h b/src/lib/corelib/api/generator.h
|
|
new file mode 100644
|
|
index 0000000..7f8ba97
|
|
--- /dev/null
|
|
+++ b/src/lib/corelib/api/generator.h
|
|
@@ -0,0 +1,61 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+#ifndef QBS_GENERATOR_H
|
|
+#define QBS_GENERATOR_H
|
|
+
|
|
+#include "../language/forward_decls.h"
|
|
+#include "../tools/qbs_export.h"
|
|
+
|
|
+namespace qbs {
|
|
+
|
|
+#include <QString>
|
|
+
|
|
+class Project;
|
|
+
|
|
+class QBS_EXPORT Generator
|
|
+{
|
|
+protected:
|
|
+ Generator();
|
|
+
|
|
+public:
|
|
+ virtual ~Generator();
|
|
+
|
|
+ /*!
|
|
+ * Returns the name of the generator used to create the external build system files.
|
|
+ * The default is empty.
|
|
+ */
|
|
+ virtual QString generatorName() const = 0;
|
|
+
|
|
+ virtual void generate(const Project &project) = 0;
|
|
+};
|
|
+
|
|
+} // namespace qbs
|
|
+
|
|
+#endif // QBS_GENERATOR_H
|
|
diff --git a/src/lib/corelib/api/project.cpp b/src/lib/corelib/api/project.cpp
|
|
index 040bc1b..694208b 100644
|
|
--- a/src/lib/corelib/api/project.cpp
|
|
+++ b/src/lib/corelib/api/project.cpp
|
|
@@ -57,6 +57,7 @@
|
|
#include <tools/cleanoptions.h>
|
|
#include <tools/error.h>
|
|
#include <tools/fileinfo.h>
|
|
+#include <tools/generatorpluginmanager.h>
|
|
#include <tools/installoptions.h>
|
|
#include <tools/preferences.h>
|
|
#include <tools/processresult.h>
|
|
@@ -97,6 +98,7 @@ static void loadPlugins(const QStringList &_pluginPaths, const Logger &logger)
|
|
pluginPaths << pluginPath;
|
|
}
|
|
}
|
|
+ GeneratorPluginManager::instance()->loadPlugins(pluginPaths, logger);
|
|
ScannerPluginManager::instance()->loadPlugins(pluginPaths, logger);
|
|
|
|
qRegisterMetaType<ErrorInfo>("qbs::ErrorInfo");
|
|
diff --git a/src/lib/corelib/qbs.h b/src/lib/corelib/qbs.h
|
|
index 26b5eab..c1e0b4f 100644
|
|
--- a/src/lib/corelib/qbs.h
|
|
+++ b/src/lib/corelib/qbs.h
|
|
@@ -30,6 +30,7 @@
|
|
#ifndef QBS_H
|
|
#define QBS_H
|
|
|
|
+#include "api/generator.h"
|
|
#include "api/jobs.h"
|
|
#include "api/languageinfo.h"
|
|
#include "api/project.h"
|
|
@@ -40,6 +41,7 @@
|
|
#include "tools/buildoptions.h"
|
|
#include "tools/cleanoptions.h"
|
|
#include "tools/error.h"
|
|
+#include "tools/generateoptions.h"
|
|
#include "tools/installoptions.h"
|
|
#include "tools/preferences.h"
|
|
#include "tools/profile.h"
|
|
diff --git a/src/lib/corelib/tools/generateoptions.cpp b/src/lib/corelib/tools/generateoptions.cpp
|
|
new file mode 100644
|
|
index 0000000..1198cb4
|
|
--- /dev/null
|
|
+++ b/src/lib/corelib/tools/generateoptions.cpp
|
|
@@ -0,0 +1,91 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+#include "generateoptions.h"
|
|
+
|
|
+#include <QDir>
|
|
+#include <QSharedData>
|
|
+
|
|
+namespace qbs {
|
|
+namespace Internal {
|
|
+
|
|
+class GenerateOptionsPrivate : public QSharedData
|
|
+{
|
|
+public:
|
|
+ GenerateOptionsPrivate()
|
|
+ : generatorName()
|
|
+ {}
|
|
+
|
|
+ QString generatorName;
|
|
+};
|
|
+
|
|
+} // namespace Internal
|
|
+
|
|
+/*!
|
|
+ * \class GenerateOptions
|
|
+ * \brief The \c GenerateOptions class comprises parameters that influence the behavior of
|
|
+ * generate operations.
|
|
+ */
|
|
+
|
|
+GenerateOptions::GenerateOptions() : d(new Internal::GenerateOptionsPrivate)
|
|
+{
|
|
+}
|
|
+
|
|
+GenerateOptions::GenerateOptions(const GenerateOptions &other) : d(other.d)
|
|
+{
|
|
+}
|
|
+
|
|
+GenerateOptions &GenerateOptions::operator=(const GenerateOptions &other)
|
|
+{
|
|
+ d = other.d;
|
|
+ return *this;
|
|
+}
|
|
+
|
|
+GenerateOptions::~GenerateOptions()
|
|
+{
|
|
+}
|
|
+
|
|
+/*!
|
|
+ * Returns the name of the generator used to create the external build system files.
|
|
+ * The default is empty.
|
|
+ */
|
|
+QString GenerateOptions::generatorName() const
|
|
+{
|
|
+ return d->generatorName;
|
|
+}
|
|
+
|
|
+/*!
|
|
+ * \brief Sets the name of the generator used to create the external build system files.
|
|
+ */
|
|
+void GenerateOptions::setGeneratorName(const QString &generatorName)
|
|
+{
|
|
+ d->generatorName = generatorName;
|
|
+}
|
|
+
|
|
+} // namespace qbs
|
|
diff --git a/src/lib/corelib/tools/generateoptions.h b/src/lib/corelib/tools/generateoptions.h
|
|
new file mode 100644
|
|
index 0000000..bb5c1c4
|
|
--- /dev/null
|
|
+++ b/src/lib/corelib/tools/generateoptions.h
|
|
@@ -0,0 +1,58 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+#ifndef QBS_GENERATEOPTIONS_H
|
|
+#define QBS_GENERATEOPTIONS_H
|
|
+
|
|
+#include "qbs_export.h"
|
|
+
|
|
+#include <QSharedDataPointer>
|
|
+#include <QString>
|
|
+
|
|
+namespace qbs {
|
|
+namespace Internal { class GenerateOptionsPrivate; }
|
|
+
|
|
+class QBS_EXPORT GenerateOptions
|
|
+{
|
|
+public:
|
|
+ GenerateOptions();
|
|
+ GenerateOptions(const GenerateOptions &other);
|
|
+ GenerateOptions &operator=(const GenerateOptions &other);
|
|
+ ~GenerateOptions();
|
|
+
|
|
+ QString generatorName() const;
|
|
+ void setGeneratorName(const QString &generatorName);
|
|
+
|
|
+private:
|
|
+ QSharedDataPointer<Internal::GenerateOptionsPrivate> d;
|
|
+};
|
|
+
|
|
+} // namespace qbs
|
|
+
|
|
+#endif // QBS_GENERATEOPTIONS_H
|
|
diff --git a/src/lib/corelib/tools/generatorpluginmanager.cpp b/src/lib/corelib/tools/generatorpluginmanager.cpp
|
|
new file mode 100644
|
|
index 0000000..5ac94fd
|
|
--- /dev/null
|
|
+++ b/src/lib/corelib/tools/generatorpluginmanager.cpp
|
|
@@ -0,0 +1,128 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "generatorpluginmanager.h"
|
|
+
|
|
+#include <api/generator.h>
|
|
+
|
|
+#include <logging/logger.h>
|
|
+#include <logging/translator.h>
|
|
+#include <tools/hostosinfo.h>
|
|
+
|
|
+#include <plugins/generator/generatorplugin.h>
|
|
+
|
|
+#include <QCoreApplication>
|
|
+#include <QDirIterator>
|
|
+#include <QLibrary>
|
|
+
|
|
+namespace qbs {
|
|
+namespace Internal {
|
|
+
|
|
+GeneratorPluginManager::~GeneratorPluginManager()
|
|
+{
|
|
+ foreach (QLibrary * const lib, m_libs) {
|
|
+ lib->unload();
|
|
+ delete lib;
|
|
+ }
|
|
+}
|
|
+
|
|
+GeneratorPluginManager *GeneratorPluginManager::instance()
|
|
+{
|
|
+ static GeneratorPluginManager generatorPlugin;
|
|
+ return &generatorPlugin;
|
|
+}
|
|
+
|
|
+GeneratorPluginManager::GeneratorPluginManager()
|
|
+{
|
|
+}
|
|
+
|
|
+QStringList GeneratorPluginManager::loadedPluginNames()
|
|
+{
|
|
+ return instance()->m_generators.keys();
|
|
+}
|
|
+
|
|
+Generator *GeneratorPluginManager::generatorWithName(const QString &generatorName)
|
|
+{
|
|
+ return instance()->m_generators.value(generatorName);
|
|
+}
|
|
+
|
|
+void GeneratorPluginManager::loadPlugins(const QStringList &pluginPaths, const Logger &logger)
|
|
+{
|
|
+ QStringList filters;
|
|
+
|
|
+ if (HostOsInfo::isWindowsHost())
|
|
+ filters << "*.dll";
|
|
+ else if (HostOsInfo::isOsxHost())
|
|
+ filters << "*.dylib";
|
|
+ else
|
|
+ filters << "*.so";
|
|
+
|
|
+ foreach (const QString &pluginPath, pluginPaths) {
|
|
+ logger.qbsTrace() << QString::fromLocal8Bit("pluginmanager: loading plugins from '%1'.")
|
|
+ .arg(QDir::toNativeSeparators(pluginPath));
|
|
+ QDirIterator it(pluginPath, filters, QDir::Files);
|
|
+ while (it.hasNext()) {
|
|
+ const QString fileName = it.next();
|
|
+ if (!fileName.contains(QLatin1String("_generator")))
|
|
+ continue;
|
|
+
|
|
+ QScopedPointer<QLibrary> lib(new QLibrary(fileName));
|
|
+ if (!lib->load()) {
|
|
+ logger.qbsWarning() << Tr::tr("pluginmanager: couldn't load plugin '%1': %2")
|
|
+ .arg(QDir::toNativeSeparators(fileName), lib->errorString());
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ getGenerators_f getGenerators = reinterpret_cast<getGenerators_f>(lib->resolve("getGenerators"));
|
|
+ if (!getGenerators) {
|
|
+ logger.qbsWarning() << Tr::tr("pluginmanager: couldn't resolve "
|
|
+ "symbol in '%1'.").arg(QDir::toNativeSeparators(fileName));
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ Generator **plugins = getGenerators();
|
|
+ if (plugins == 0) {
|
|
+ logger.qbsWarning() << Tr::tr("pluginmanager: no generators "
|
|
+ "returned from '%1'.").arg(QDir::toNativeSeparators(fileName));
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ logger.qbsTrace() << QString::fromLocal8Bit("pluginmanager: scanner plugin '%1' "
|
|
+ "loaded.").arg(QDir::toNativeSeparators(fileName));
|
|
+
|
|
+ for (int i = 0; plugins[i] != 0; ++i)
|
|
+ m_generators[plugins[i]->generatorName()] = plugins[i];
|
|
+ m_libs.append(lib.take());
|
|
+ }
|
|
+ }
|
|
+}
|
|
+
|
|
+} // namespace Internal
|
|
+} // namespace qbs
|
|
diff --git a/src/lib/corelib/tools/generatorpluginmanager.h b/src/lib/corelib/tools/generatorpluginmanager.h
|
|
new file mode 100644
|
|
index 0000000..4f6351b
|
|
--- /dev/null
|
|
+++ b/src/lib/corelib/tools/generatorpluginmanager.h
|
|
@@ -0,0 +1,69 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef QBS_GENERATORPLUGINMANAGER_H
|
|
+#define QBS_GENERATORPLUGINMANAGER_H
|
|
+
|
|
+#include <language/filetags.h>
|
|
+
|
|
+#include <QHash>
|
|
+#include <QString>
|
|
+#include <QStringList>
|
|
+
|
|
+QT_BEGIN_NAMESPACE
|
|
+class QLibrary;
|
|
+QT_END_NAMESPACE
|
|
+
|
|
+namespace qbs {
|
|
+class Generator;
|
|
+namespace Internal {
|
|
+class Logger;
|
|
+
|
|
+class QBS_EXPORT GeneratorPluginManager
|
|
+{
|
|
+public:
|
|
+ ~GeneratorPluginManager();
|
|
+ static GeneratorPluginManager *instance();
|
|
+ static QStringList loadedPluginNames();
|
|
+ static Generator *generatorWithName(const QString &generatorName);
|
|
+ void loadPlugins(const QStringList &paths, const Logger &logger);
|
|
+
|
|
+private:
|
|
+ GeneratorPluginManager();
|
|
+
|
|
+private:
|
|
+ QList<QLibrary *> m_libs;
|
|
+ QHash<QString, Generator*> m_generators;
|
|
+};
|
|
+
|
|
+} // namespace Internal
|
|
+} // namespace qbs
|
|
+
|
|
+#endif
|
|
diff --git a/src/lib/corelib/tools/scannerpluginmanager.cpp b/src/lib/corelib/tools/scannerpluginmanager.cpp
|
|
index bed8d42..7f76ef3 100644
|
|
--- a/src/lib/corelib/tools/scannerpluginmanager.cpp
|
|
+++ b/src/lib/corelib/tools/scannerpluginmanager.cpp
|
|
@@ -81,6 +81,9 @@ void ScannerPluginManager::loadPlugins(const QStringList &pluginPaths, const Log
|
|
QDirIterator it(pluginPath, filters, QDir::Files);
|
|
while (it.hasNext()) {
|
|
const QString fileName = it.next();
|
|
+ if (!fileName.contains(QLatin1String("_scanner")))
|
|
+ continue;
|
|
+
|
|
QScopedPointer<QLibrary> lib(new QLibrary(fileName));
|
|
if (!lib->load()) {
|
|
logger.qbsWarning() << Tr::tr("Pluginmanager: Cannot load plugin '%1': %2")
|
|
diff --git a/src/lib/corelib/tools/tools.pri b/src/lib/corelib/tools/tools.pri
|
|
index 50775ce..aebab08 100644
|
|
--- a/src/lib/corelib/tools/tools.pri
|
|
+++ b/src/lib/corelib/tools/tools.pri
|
|
@@ -8,6 +8,8 @@ HEADERS += \
|
|
$$PWD/executablefinder.h \
|
|
$$PWD/fileinfo.h \
|
|
$$PWD/filetime.h \
|
|
+ $$PWD/generateoptions.h \
|
|
+ $$PWD/generatorpluginmanager.h \
|
|
$$PWD/id.h \
|
|
$$PWD/persistence.h \
|
|
$$PWD/scannerpluginmanager.h \
|
|
@@ -39,6 +41,8 @@ SOURCES += \
|
|
$$PWD/error.cpp \
|
|
$$PWD/executablefinder.cpp \
|
|
$$PWD/fileinfo.cpp \
|
|
+ $$PWD/generateoptions.cpp \
|
|
+ $$PWD/generatorpluginmanager.cpp \
|
|
$$PWD/id.cpp \
|
|
$$PWD/persistence.cpp \
|
|
$$PWD/scannerpluginmanager.cpp \
|
|
diff --git a/src/plugins/generator/generator.pro b/src/plugins/generator/generator.pro
|
|
new file mode 100644
|
|
index 0000000..6531408
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/generator.pro
|
|
@@ -0,0 +1,2 @@
|
|
+TEMPLATE = subdirs
|
|
+SUBDIRS = xcode
|
|
diff --git a/src/plugins/generator/generatorplugin.h b/src/plugins/generator/generatorplugin.h
|
|
new file mode 100644
|
|
index 0000000..e456ff4
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/generatorplugin.h
|
|
@@ -0,0 +1,46 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef GENERATORPLUGIN_H
|
|
+#define GENERATORPLUGIN_H
|
|
+
|
|
+#include <api/generator.h>
|
|
+
|
|
+#ifdef __cplusplus
|
|
+extern "C" {
|
|
+#endif
|
|
+
|
|
+typedef qbs::Generator **(*getGenerators_f)();
|
|
+
|
|
+#ifdef __cplusplus
|
|
+}
|
|
+#endif
|
|
+
|
|
+#endif // GENERATORPLUGIN_H
|
|
diff --git a/src/plugins/generator/xcode/main.cpp b/src/plugins/generator/xcode/main.cpp
|
|
new file mode 100644
|
|
index 0000000..86a97f2
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/main.cpp
|
|
@@ -0,0 +1,45 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "xcodenativegenerator.h"
|
|
+#include "xcodesimplegenerator.h"
|
|
+
|
|
+static qbs::Generator* generators[] = {
|
|
+ new qbs::XcodeNativeGenerator(),
|
|
+ new qbs::XcodeSimpleGenerator(),
|
|
+ NULL
|
|
+};
|
|
+
|
|
+extern "C" {
|
|
+ qbs::Generator **getGenerators()
|
|
+ {
|
|
+ return generators;
|
|
+ }
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/opensteppropertylist.cpp b/src/plugins/generator/xcode/opensteppropertylist.cpp
|
|
new file mode 100644
|
|
index 0000000..b10bceb
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/opensteppropertylist.cpp
|
|
@@ -0,0 +1,186 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "opensteppropertylist.h"
|
|
+
|
|
+const QChar OpenStepPropertyList::NewlineToken = QLatin1Char('\n');
|
|
+const QChar OpenStepPropertyList::DictionaryBeginToken = QLatin1Char('{');
|
|
+const QChar OpenStepPropertyList::DictionarySeparatorToken = QLatin1Char(';');
|
|
+const QChar OpenStepPropertyList::DictionaryEndToken = QLatin1Char('}');
|
|
+const QChar OpenStepPropertyList::ArrayBeginToken = QLatin1Char('(');
|
|
+const QChar OpenStepPropertyList::ArraySeparatorToken = QLatin1Char(',');
|
|
+const QChar OpenStepPropertyList::ArrayEndToken = QLatin1Char(')');
|
|
+const QChar OpenStepPropertyList::QuotedStringBeginToken = QLatin1Char('"');
|
|
+const QChar OpenStepPropertyList::QuotedStringEndToken = QLatin1Char('"');
|
|
+const QChar OpenStepPropertyList::DataBeginToken = QLatin1Char('<');
|
|
+const QChar OpenStepPropertyList::DataEndToken = QLatin1Char('>');
|
|
+const QChar OpenStepPropertyList::IndentationToken = QLatin1Char('\t');
|
|
+
|
|
+static QString formatString(const QString &string)
|
|
+{
|
|
+ bool isQuoted = string.isEmpty();
|
|
+ if (!isQuoted)
|
|
+ {
|
|
+ for (int i = 0; i < string.size(); ++i)
|
|
+ {
|
|
+ if (!string[i].isLetterOrNumber() || string[i] > 127)
|
|
+ {
|
|
+ isQuoted = true;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ QString outString = string;
|
|
+ outString.replace(QLatin1String("\""), QLatin1String("\\\""));
|
|
+
|
|
+ if (isQuoted)
|
|
+ outString.prepend(OpenStepPropertyList::QuotedStringBeginToken);
|
|
+ if (isQuoted)
|
|
+ outString.append(OpenStepPropertyList::QuotedStringEndToken);
|
|
+
|
|
+ return outString;
|
|
+}
|
|
+
|
|
+QString OpenStepPropertyList::toString(const QVariantMap &propertyList)
|
|
+{
|
|
+ return toString(propertyList, 0) + NewlineToken;
|
|
+}
|
|
+
|
|
+QString OpenStepPropertyList::toString(const QVariantMap &propertyList, int indentationLevel)
|
|
+{
|
|
+ QString string(indentationLevel, IndentationToken);
|
|
+ string += DictionaryBeginToken;
|
|
+ string += NewlineToken;
|
|
+
|
|
+ foreach (const QString &key, propertyList.keys())
|
|
+ {
|
|
+ if (key == QLatin1String("__comment__"))
|
|
+ continue;
|
|
+
|
|
+ const QVariant &object = propertyList[key];
|
|
+ string += QString(indentationLevel + 1, IndentationToken);
|
|
+ string += formatString(key);
|
|
+
|
|
+ QString comment = object.toMap()[QLatin1String("__comment__")].toString();
|
|
+ if (!comment.isEmpty())
|
|
+ string += QLatin1String(" /* ") + comment.replace(QLatin1String("*/"), QLatin1String("* /")) + QLatin1String(" */");
|
|
+
|
|
+ string += QLatin1String(" = ");
|
|
+
|
|
+ if (object.type() == QVariant::Map || object.type() == QVariant::List ||
|
|
+ object.type() == QVariant::StringList || object.type() == QVariant::ByteArray)
|
|
+ string += toString(object, indentationLevel + 1).trimmed();
|
|
+ else
|
|
+ string += toString(object, 0);
|
|
+
|
|
+ string += DictionarySeparatorToken;
|
|
+ string += NewlineToken;
|
|
+ }
|
|
+
|
|
+ string += QString(indentationLevel, IndentationToken) + DictionaryEndToken;
|
|
+ return string;
|
|
+}
|
|
+
|
|
+QString OpenStepPropertyList::toString(const QList<QVariant> &propertyList)
|
|
+{
|
|
+ return toString(propertyList, 0) + NewlineToken;
|
|
+}
|
|
+
|
|
+QString OpenStepPropertyList::toString(const QList<QVariant> &propertyList, int indentationLevel)
|
|
+{
|
|
+ QString string(indentationLevel, IndentationToken);
|
|
+ string += ArrayBeginToken;
|
|
+ string += NewlineToken;
|
|
+
|
|
+ for (int i = 0; i < propertyList.size(); ++i)
|
|
+ {
|
|
+ const QVariant &object = propertyList[i];
|
|
+ string += toString(object, indentationLevel + 1);
|
|
+ string += ArraySeparatorToken;
|
|
+ string += NewlineToken;
|
|
+ }
|
|
+
|
|
+ string += QString(indentationLevel, IndentationToken) + ArrayEndToken;
|
|
+ return string;
|
|
+}
|
|
+
|
|
+QString OpenStepPropertyList::toString(const QVariant &object, int indentationLevel)
|
|
+{
|
|
+ switch (object.type())
|
|
+ {
|
|
+ case QVariant::Bool:
|
|
+ return object.toBool() ? QLatin1String("1") : QLatin1String("0");
|
|
+ case QVariant::ByteArray:
|
|
+ return toString(object.toByteArray(), indentationLevel);
|
|
+ case QVariant::Date:
|
|
+ case QVariant::DateTime:
|
|
+ case QVariant::Time:
|
|
+ return toString(object.toDateTime(), indentationLevel);
|
|
+ case QVariant::Double:
|
|
+ return QString::number(object.toDouble());
|
|
+ case QVariant::Int:
|
|
+ return QString::number(object.toInt());
|
|
+ case QVariant::List:
|
|
+ case QVariant::StringList:
|
|
+ return toString(object.toList(), indentationLevel);
|
|
+ case QVariant::LongLong:
|
|
+ return QString::number(object.toLongLong());
|
|
+ case QVariant::Map:
|
|
+ return toString(object.toMap(), indentationLevel);
|
|
+ case QVariant::String:
|
|
+ return toString(object.toString(), indentationLevel);
|
|
+ case QVariant::UInt:
|
|
+ return QString::number(object.toUInt());
|
|
+ case QVariant::ULongLong:
|
|
+ return QString::number(object.toULongLong());
|
|
+ default:
|
|
+ throw "Unsupported property list object type";
|
|
+ }
|
|
+}
|
|
+
|
|
+QString OpenStepPropertyList::toString(const QByteArray &object, int indentationLevel)
|
|
+{
|
|
+ QString string(indentationLevel, IndentationToken);
|
|
+ string += DataBeginToken + QString::fromLatin1(object.toHex()) + DataEndToken;
|
|
+ return string;
|
|
+}
|
|
+
|
|
+QString OpenStepPropertyList::toString(const QDateTime &object, int indentationLevel)
|
|
+{
|
|
+ return toString(object.toUTC().toString(Qt::ISODate), indentationLevel);
|
|
+}
|
|
+
|
|
+QString OpenStepPropertyList::toString(const QString &object, int indentationLevel)
|
|
+{
|
|
+ QString string(indentationLevel, IndentationToken);
|
|
+ string += formatString(object);
|
|
+ return string;
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/opensteppropertylist.h b/src/plugins/generator/xcode/opensteppropertylist.h
|
|
new file mode 100644
|
|
index 0000000..ed50aa3
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/opensteppropertylist.h
|
|
@@ -0,0 +1,71 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef OPENSTEPPROPERTYLIST_H
|
|
+#define OPENSTEPPROPERTYLIST_H
|
|
+
|
|
+#include <QByteArray>
|
|
+#include <QDateTime>
|
|
+#include <QList>
|
|
+#include <QString>
|
|
+#include <QVariant>
|
|
+
|
|
+class OpenStepPropertyList
|
|
+{
|
|
+ Q_DISABLE_COPY(OpenStepPropertyList)
|
|
+public:
|
|
+ static const QChar NewlineToken;
|
|
+ static const QChar DictionaryBeginToken;
|
|
+ static const QChar DictionarySeparatorToken;
|
|
+ static const QChar DictionaryEndToken;
|
|
+ static const QChar ArrayBeginToken;
|
|
+ static const QChar ArraySeparatorToken;
|
|
+ static const QChar ArrayEndToken;
|
|
+ static const QChar QuotedStringBeginToken;
|
|
+ static const QChar QuotedStringEndToken;
|
|
+ static const QChar DataBeginToken;
|
|
+ static const QChar DataEndToken;
|
|
+ static const QChar IndentationToken;
|
|
+
|
|
+ static QString toString(const QVariantMap &propertyList);
|
|
+ static QString toString(const QList<QVariant> &propertyList);
|
|
+
|
|
+private:
|
|
+ OpenStepPropertyList();
|
|
+
|
|
+ static QString toString(const QVariantMap &propertyList, int indentationLevel);
|
|
+ static QString toString(const QList<QVariant> &propertyList, int indentationLevel);
|
|
+ static QString toString(const QVariant &object, int indentationLevel);
|
|
+ static QString toString(const QByteArray &object, int indentationLevel);
|
|
+ static QString toString(const QDateTime &object, int indentationLevel);
|
|
+ static QString toString(const QString &object, int indentationLevel);
|
|
+};
|
|
+
|
|
+#endif // OPENSTEPPROPERTYLIST_H
|
|
diff --git a/src/plugins/generator/xcode/pbx.h b/src/plugins/generator/xcode/pbx.h
|
|
new file mode 100644
|
|
index 0000000..fda52e7
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbx.h
|
|
@@ -0,0 +1,53 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBX_H
|
|
+#define PBX_H
|
|
+
|
|
+#include "opensteppropertylist.h"
|
|
+#include "pbxbuildfile.h"
|
|
+#include "pbxbuildphase.h"
|
|
+#include "pbxcontainer.h"
|
|
+#include "pbxfileencoding.h"
|
|
+#include "pbxfilereference.h"
|
|
+#include "pbxfiletype.h"
|
|
+#include "pbxgroup.h"
|
|
+#include "pbxlegacytarget.h"
|
|
+#include "pbxnativetarget.h"
|
|
+#include "pbxobject.h"
|
|
+#include "pbxproducttype.h"
|
|
+#include "pbxproject.h"
|
|
+#include "pbxreference.h"
|
|
+#include "pbxsourcetree.h"
|
|
+#include "pbxtarget.h"
|
|
+#include "xcbuildconfiguration.h"
|
|
+#include "xcconfigurationlist.h"
|
|
+
|
|
+#endif // PBX_H
|
|
diff --git a/src/plugins/generator/xcode/pbxbuildfile.cpp b/src/plugins/generator/xcode/pbxbuildfile.cpp
|
|
new file mode 100644
|
|
index 0000000..4f49ead
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxbuildfile.cpp
|
|
@@ -0,0 +1,72 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxbuildfile.h"
|
|
+#include "pbxfilereference.h"
|
|
+
|
|
+class PBXBuildFilePrivate
|
|
+{
|
|
+public:
|
|
+ PBXBuildFilePrivate();
|
|
+ PBXFileReference *reference;
|
|
+};
|
|
+
|
|
+PBXBuildFilePrivate::PBXBuildFilePrivate()
|
|
+ : reference()
|
|
+{
|
|
+}
|
|
+
|
|
+PBXBuildFile::PBXBuildFile(QObject *parent) :
|
|
+ PBXObject(parent), d(new PBXBuildFilePrivate)
|
|
+{
|
|
+}
|
|
+
|
|
+PBXBuildFile::~PBXBuildFile()
|
|
+{
|
|
+ delete d;
|
|
+}
|
|
+
|
|
+QString PBXBuildFile::isa() const
|
|
+{
|
|
+ return QLatin1String("PBXBuildFile");
|
|
+}
|
|
+
|
|
+QVariantMap PBXBuildFile::toMap() const
|
|
+{
|
|
+ QVariantMap self = PBXObject::toMap();
|
|
+ if (d->reference)
|
|
+ self.insert(QLatin1String("fileRef"), d->reference->identifier());
|
|
+ return self;
|
|
+}
|
|
+
|
|
+void PBXBuildFile::setFileReference(PBXFileReference *reference)
|
|
+{
|
|
+ d->reference = reference;
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxbuildfile.h b/src/plugins/generator/xcode/pbxbuildfile.h
|
|
new file mode 100644
|
|
index 0000000..1bee93b
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxbuildfile.h
|
|
@@ -0,0 +1,64 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXBUILDFILE_H
|
|
+#define PBXBUILDFILE_H
|
|
+
|
|
+#include "pbxobject.h"
|
|
+#include <QObject>
|
|
+
|
|
+class PBXFileReference;
|
|
+
|
|
+class PBXBuildFilePrivate;
|
|
+
|
|
+/*!
|
|
+ * \brief The PBXBuildFile class represents a file reference that is used in a build phase.
|
|
+ * Its primary purpose is to allow additional build settings to be applied at the file level.
|
|
+ */
|
|
+class PBXBuildFile : public PBXObject
|
|
+{
|
|
+ Q_OBJECT
|
|
+public:
|
|
+ explicit PBXBuildFile(QObject *parent = 0);
|
|
+ virtual ~PBXBuildFile();
|
|
+
|
|
+ QString isa() const;
|
|
+ QVariantMap toMap() const;
|
|
+
|
|
+ void setFileReference(PBXFileReference *reference);
|
|
+
|
|
+ QString absolutePath() const;
|
|
+ QStringList attributes() const;
|
|
+
|
|
+private:
|
|
+ PBXBuildFilePrivate *d;
|
|
+};
|
|
+
|
|
+#endif // PBXBUILDFILE_H
|
|
diff --git a/src/plugins/generator/xcode/pbxbuildphase.cpp b/src/plugins/generator/xcode/pbxbuildphase.cpp
|
|
new file mode 100644
|
|
index 0000000..d1cad2c
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxbuildphase.cpp
|
|
@@ -0,0 +1,77 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxbuildfile.h"
|
|
+#include "pbxbuildphase.h"
|
|
+#include "pbxfilereference.h"
|
|
+
|
|
+class PBXBuildPhasePrivate
|
|
+{
|
|
+public:
|
|
+ QList<PBXBuildFile *> buildFiles;
|
|
+};
|
|
+
|
|
+PBXBuildPhase::PBXBuildPhase(QObject *parent) :
|
|
+ PBXObject(parent), d(new PBXBuildPhasePrivate)
|
|
+{
|
|
+}
|
|
+
|
|
+PBXBuildPhase::~PBXBuildPhase()
|
|
+{
|
|
+ delete d;
|
|
+}
|
|
+
|
|
+QVariantMap PBXBuildPhase::toMap() const
|
|
+{
|
|
+ QVariantMap self = PBXObject::toMap();
|
|
+ self.insert(QLatin1String("buildActionMask"), 2147483647);
|
|
+
|
|
+ QStringList fileReferenceList;
|
|
+ foreach (PBXBuildFile *buildFile, buildFiles())
|
|
+ fileReferenceList += buildFile->identifier();
|
|
+ self.insert(QLatin1String("files"), fileReferenceList);
|
|
+
|
|
+ self.insert(QLatin1String("runOnlyForDeploymentPostprocessing"), 0);
|
|
+
|
|
+ return self;
|
|
+}
|
|
+
|
|
+QList<PBXBuildFile *> PBXBuildPhase::buildFiles() const
|
|
+{
|
|
+ return d->buildFiles;
|
|
+}
|
|
+
|
|
+bool PBXBuildPhase::addReference(PBXFileReference *reference)
|
|
+{
|
|
+ PBXBuildFile *buildFile = new PBXBuildFile(this);
|
|
+ buildFile->setFileReference(reference);
|
|
+ d->buildFiles.append(buildFile);
|
|
+ return true;
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxbuildphase.h b/src/plugins/generator/xcode/pbxbuildphase.h
|
|
new file mode 100644
|
|
index 0000000..25ac5e2
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxbuildphase.h
|
|
@@ -0,0 +1,60 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXBUILDPHASE_H
|
|
+#define PBXBUILDPHASE_H
|
|
+
|
|
+#include "pbxobject.h"
|
|
+#include <QObject>
|
|
+
|
|
+class PBXBuildFile;
|
|
+class PBXFileReference;
|
|
+
|
|
+class PBXBuildPhasePrivate;
|
|
+
|
|
+class PBXBuildPhase : public PBXObject
|
|
+{
|
|
+ Q_OBJECT
|
|
+public:
|
|
+ explicit PBXBuildPhase(QObject *parent = 0);
|
|
+ virtual ~PBXBuildPhase();
|
|
+
|
|
+ QVariantMap toMap() const;
|
|
+
|
|
+ QList<PBXBuildFile *> buildFiles() const;
|
|
+
|
|
+ bool addReference(PBXFileReference *reference);
|
|
+ bool containsFileReferenceIdenticalTo(PBXFileReference *reference);
|
|
+
|
|
+private:
|
|
+ PBXBuildPhasePrivate *d;
|
|
+};
|
|
+
|
|
+#endif // PBXBUILDPHASE_H
|
|
diff --git a/src/plugins/generator/xcode/pbxcontainer.cpp b/src/plugins/generator/xcode/pbxcontainer.cpp
|
|
new file mode 100644
|
|
index 0000000..10a2470
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxcontainer.cpp
|
|
@@ -0,0 +1,53 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxcontainer.h"
|
|
+#include "pbxgroup.h"
|
|
+
|
|
+class PBXContainerPrivate
|
|
+{
|
|
+public:
|
|
+ PBXGroup group;
|
|
+};
|
|
+
|
|
+PBXContainer::PBXContainer(QObject *parent) :
|
|
+ PBXObject(parent), d(new PBXContainerPrivate)
|
|
+{
|
|
+}
|
|
+
|
|
+PBXContainer::~PBXContainer()
|
|
+{
|
|
+ delete d;
|
|
+}
|
|
+
|
|
+PBXGroup *PBXContainer::rootGroup() const
|
|
+{
|
|
+ return &d->group;
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxcontainer.h b/src/plugins/generator/xcode/pbxcontainer.h
|
|
new file mode 100644
|
|
index 0000000..f920f56
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxcontainer.h
|
|
@@ -0,0 +1,57 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXCONTAINER_H
|
|
+#define PBXCONTAINER_H
|
|
+
|
|
+#include "pbxobject.h"
|
|
+#include <QObject>
|
|
+
|
|
+class PBXFileReference;
|
|
+class PBXGroup;
|
|
+
|
|
+class PBXContainerPrivate;
|
|
+
|
|
+class PBXContainer : public PBXObject
|
|
+{
|
|
+ Q_OBJECT
|
|
+public:
|
|
+ explicit PBXContainer(QObject *parent = 0);
|
|
+ virtual ~PBXContainer();
|
|
+
|
|
+ PBXGroup *rootGroup() const;
|
|
+
|
|
+ PBXFileReference *fileReferenceForPath(const QString &path);
|
|
+
|
|
+private:
|
|
+ PBXContainerPrivate *d;
|
|
+};
|
|
+
|
|
+#endif // PBXCONTAINER_H
|
|
diff --git a/src/plugins/generator/xcode/pbxfileencoding.h b/src/plugins/generator/xcode/pbxfileencoding.h
|
|
new file mode 100644
|
|
index 0000000..852dac5
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxfileencoding.h
|
|
@@ -0,0 +1,57 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXFILEENCODING_H
|
|
+#define PBXFILEENCODING_H
|
|
+
|
|
+namespace PBX
|
|
+{
|
|
+ typedef enum {
|
|
+ Default = 0,
|
|
+ UTF8 = 4,
|
|
+ UTF16 = 10,
|
|
+ UTF16_BE = 0x90000100,
|
|
+ UTF16_LE = 0x94000100,
|
|
+ Western = 30,
|
|
+ Japanese = 0x80000001,
|
|
+ TraditionalChinese = 0x80000002,
|
|
+ Korean = 0x80000003,
|
|
+ Arabic = 0x80000004,
|
|
+ Hebrew = 0x80000005,
|
|
+ Greek = 0x80000006,
|
|
+ Cyrillic = 0x80000007,
|
|
+ SimplifiedChinese = 0x80000019,
|
|
+ CentralEuropean = 0x8000001D,
|
|
+ Turkish = 0x80000023,
|
|
+ Icelandic = 0x80000025
|
|
+ } PBXFileEncoding;
|
|
+}
|
|
+
|
|
+#endif // PBXFILEENCODING_H
|
|
diff --git a/src/plugins/generator/xcode/pbxfilereference.cpp b/src/plugins/generator/xcode/pbxfilereference.cpp
|
|
new file mode 100644
|
|
index 0000000..68f165a
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxfilereference.cpp
|
|
@@ -0,0 +1,73 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxfileencoding.h"
|
|
+#include "pbxfilereference.h"
|
|
+#include "pbxfiletype.h"
|
|
+#include "pbxgroup.h"
|
|
+#include "pbxsourcetree.h"
|
|
+#include <QFileInfo>
|
|
+
|
|
+class PBXFileReferencePrivate
|
|
+{
|
|
+public:
|
|
+};
|
|
+
|
|
+PBXFileReference::PBXFileReference(QObject *parent) :
|
|
+ PBXReference(parent), d(new PBXFileReferencePrivate)
|
|
+{
|
|
+}
|
|
+
|
|
+PBXFileReference::~PBXFileReference()
|
|
+{
|
|
+ delete d;
|
|
+}
|
|
+
|
|
+QString PBXFileReference::isa() const
|
|
+{
|
|
+ return QLatin1String("PBXFileReference");
|
|
+}
|
|
+
|
|
+QVariantMap PBXFileReference::toMap() const
|
|
+{
|
|
+ QVariantMap self = PBXReference::toMap();
|
|
+ self.insert(QLatin1String("fileEncoding"), PBX::Default);
|
|
+ //self.insert(QLatin1String("explicitFileType"), PBXFileType::typeForFileExtension(QFileInfo(path()).extension())); // PBXFileType
|
|
+ //self.insert(QLatin1String("includeInIndex"), 0);
|
|
+ //self.insert(QLatin1String("lastKnownFileType"), PBXFileType::typeForFileExtension(QFileInfo(path()).extension())); // PBXFileType
|
|
+ return self;
|
|
+}
|
|
+
|
|
+QString PBXFileReference::comment() const
|
|
+{
|
|
+ PBXGroup *group = dynamic_cast<PBXGroup *>(parent());
|
|
+ Q_ASSERT(group);
|
|
+ return QString(QLatin1String("%1 in %2")).arg(name()).arg(group->name());
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxfilereference.h b/src/plugins/generator/xcode/pbxfilereference.h
|
|
new file mode 100644
|
|
index 0000000..9ce5ed7
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxfilereference.h
|
|
@@ -0,0 +1,54 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXFILEREFERENCE_H
|
|
+#define PBXFILEREFERENCE_H
|
|
+
|
|
+#include "pbxreference.h"
|
|
+
|
|
+class PBXFileReferencePrivate;
|
|
+
|
|
+class PBXFileReference : public PBXReference
|
|
+{
|
|
+ Q_OBJECT
|
|
+public:
|
|
+ explicit PBXFileReference(QObject *parent = 0);
|
|
+ virtual ~PBXFileReference();
|
|
+
|
|
+ QString isa() const;
|
|
+ QVariantMap toMap() const;
|
|
+
|
|
+ QString comment() const;
|
|
+
|
|
+private:
|
|
+ PBXFileReferencePrivate *d;
|
|
+};
|
|
+
|
|
+#endif // PBXFILEREFERENCE_H
|
|
diff --git a/src/plugins/generator/xcode/pbxfiletype.cpp b/src/plugins/generator/xcode/pbxfiletype.cpp
|
|
new file mode 100644
|
|
index 0000000..3a57c29
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxfiletype.cpp
|
|
@@ -0,0 +1,41 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxfiletype.h"
|
|
+
|
|
+PBXFileType::PBXFileType(QObject *parent) :
|
|
+ QObject(parent)
|
|
+{
|
|
+}
|
|
+
|
|
+QString PBXFileType::typeForFileExtension(const QString &fileExtension)
|
|
+{
|
|
+ return QString();
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxfiletype.h b/src/plugins/generator/xcode/pbxfiletype.h
|
|
new file mode 100644
|
|
index 0000000..3818872
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxfiletype.h
|
|
@@ -0,0 +1,47 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXFILETYPE_H
|
|
+#define PBXFILETYPE_H
|
|
+
|
|
+#include <QObject>
|
|
+
|
|
+class PBXFileType : public QObject
|
|
+{
|
|
+ Q_OBJECT
|
|
+public:
|
|
+ explicit PBXFileType(QObject *parent = 0);
|
|
+
|
|
+ static QStringList allTypes();
|
|
+ static QStringList fileExtensionsForType(const QString &type);
|
|
+ static QString typeForFileExtension(const QString &fileExtension);
|
|
+};
|
|
+
|
|
+#endif // PBXFILETYPE_H
|
|
diff --git a/src/plugins/generator/xcode/pbxgroup.cpp b/src/plugins/generator/xcode/pbxgroup.cpp
|
|
new file mode 100644
|
|
index 0000000..a27e879
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxgroup.cpp
|
|
@@ -0,0 +1,114 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxfilereference.h"
|
|
+#include "pbxgroup.h"
|
|
+
|
|
+class PBXGroupPrivate
|
|
+{
|
|
+public:
|
|
+ QList<PBXReference *> children;
|
|
+};
|
|
+
|
|
+PBXGroup::PBXGroup(QObject *parent) :
|
|
+ PBXReference(parent), d(new PBXGroupPrivate)
|
|
+{
|
|
+}
|
|
+
|
|
+PBXGroup::~PBXGroup()
|
|
+{
|
|
+ delete d;
|
|
+}
|
|
+
|
|
+PBXGroup *PBXGroup::groupWithName(const QString &name, PBXGroup *parentGroup)
|
|
+{
|
|
+ PBXGroup *group = new PBXGroup();
|
|
+ group->setName(name);
|
|
+
|
|
+ if (parentGroup) {
|
|
+ group->setParent(parentGroup);
|
|
+ parentGroup->addItem(group);
|
|
+ }
|
|
+
|
|
+ return group;
|
|
+}
|
|
+
|
|
+QString PBXGroup::isa() const
|
|
+{
|
|
+ return QLatin1String("PBXGroup");
|
|
+}
|
|
+
|
|
+QVariantMap PBXGroup::toMap() const
|
|
+{
|
|
+ QVariantMap self = PBXReference::toMap();
|
|
+
|
|
+ QStringList childIdentifiers;
|
|
+ foreach (PBXReference *reference, d->children)
|
|
+ childIdentifiers += reference->identifier();
|
|
+
|
|
+ self.insert(QLatin1String("children"), childIdentifiers);
|
|
+
|
|
+ return self;
|
|
+}
|
|
+
|
|
+QList<PBXReference *> PBXGroup::children() const
|
|
+{
|
|
+ return d->children;
|
|
+}
|
|
+
|
|
+void PBXGroup::addItem(PBXReference *item)
|
|
+{
|
|
+ d->children.append(item);
|
|
+}
|
|
+
|
|
+void PBXGroup::insertItem(PBXReference *item, int index)
|
|
+{
|
|
+ d->children.insert(index, item);
|
|
+}
|
|
+
|
|
+void PBXGroup::removeItem(PBXReference *item)
|
|
+{
|
|
+ d->children.removeOne(item);
|
|
+}
|
|
+
|
|
+QList<PBXFileReference *> PBXGroup::addFiles(const QStringList &files, bool copy, bool createGroupsRecursively)
|
|
+{
|
|
+ QList<PBXFileReference *> fileRefs;
|
|
+ foreach (const QString &filePath, files)
|
|
+ {
|
|
+ PBXFileReference *fileReference = new PBXFileReference(this);
|
|
+ fileReference->setPath(filePath);
|
|
+ fileReference->setName(filePath.mid(filePath.lastIndexOf('/') + 1));
|
|
+ d->children.append(fileReference);
|
|
+ fileRefs.append(fileReference);
|
|
+ }
|
|
+
|
|
+ return fileRefs;
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxgroup.h b/src/plugins/generator/xcode/pbxgroup.h
|
|
new file mode 100644
|
|
index 0000000..660e489
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxgroup.h
|
|
@@ -0,0 +1,69 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXGROUP_H
|
|
+#define PBXGROUP_H
|
|
+
|
|
+#include "pbxreference.h"
|
|
+
|
|
+class PBXFileReference;
|
|
+
|
|
+class PBXGroupPrivate;
|
|
+
|
|
+class PBXGroup : public PBXReference
|
|
+{
|
|
+ Q_OBJECT
|
|
+public:
|
|
+ explicit PBXGroup(QObject *parent = 0);
|
|
+ virtual ~PBXGroup();
|
|
+
|
|
+ static PBXGroup *groupWithName(const QString &name, PBXGroup *parentGroup = 0);
|
|
+
|
|
+ QString isa() const;
|
|
+ QVariantMap toMap() const;
|
|
+
|
|
+ QList<PBXReference *> children() const;
|
|
+
|
|
+ bool containsItem(PBXReference *item) const;
|
|
+
|
|
+ void addItem(PBXReference *item);
|
|
+ void insertItem(PBXReference *item, int index);
|
|
+ void removeItem(PBXReference *item);
|
|
+
|
|
+ /*!
|
|
+ * \param files list of absolute paths
|
|
+ */
|
|
+ QList<PBXFileReference *> addFiles(const QStringList &files, bool copy, bool createGroupsRecursively);
|
|
+
|
|
+private:
|
|
+ PBXGroupPrivate *d;
|
|
+};
|
|
+
|
|
+#endif // PBXGROUP_H
|
|
diff --git a/src/plugins/generator/xcode/pbxlegacytarget.cpp b/src/plugins/generator/xcode/pbxlegacytarget.cpp
|
|
new file mode 100644
|
|
index 0000000..e18c97e
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxlegacytarget.cpp
|
|
@@ -0,0 +1,127 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxfilereference.h"
|
|
+#include "pbxlegacytarget.h"
|
|
+
|
|
+class PBXLegacyTargetPrivate
|
|
+{
|
|
+public:
|
|
+ QString buildToolPath;
|
|
+ QString buildArgumentsString;
|
|
+ QString buildWorkingDirectory;
|
|
+ bool passBuildSettingsInEnvironment;
|
|
+ PBXFileReference *productReference;
|
|
+};
|
|
+
|
|
+PBXLegacyTarget::PBXLegacyTarget(QObject *parent) :
|
|
+ PBXTarget(parent), d(new PBXLegacyTargetPrivate)
|
|
+{
|
|
+ d->buildToolPath = QLatin1String("/bin/bash");
|
|
+ d->buildArgumentsString = QLatin1String("$(ACTION)");
|
|
+ d->buildWorkingDirectory = QLatin1String("$BUILT_PRODUCTS_DIR");
|
|
+ d->passBuildSettingsInEnvironment = true;
|
|
+ d->productReference = NULL;
|
|
+}
|
|
+
|
|
+PBXLegacyTarget::~PBXLegacyTarget()
|
|
+{
|
|
+ delete d;
|
|
+}
|
|
+
|
|
+QString PBXLegacyTarget::isa() const
|
|
+{
|
|
+ return QLatin1String("PBXLegacyTarget");
|
|
+}
|
|
+
|
|
+QVariantMap PBXLegacyTarget::toMap() const
|
|
+{
|
|
+ QVariantMap self = PBXTarget::toMap();
|
|
+
|
|
+ self.insert(QLatin1String("buildToolPath"), d->buildToolPath);
|
|
+ self.insert(QLatin1String("buildArgumentsString"), d->buildArgumentsString);
|
|
+ self.insert(QLatin1String("buildWorkingDirectory"), d->buildWorkingDirectory);
|
|
+ self.insert(QLatin1String("passBuildSettingsInEnvironment"), d->passBuildSettingsInEnvironment);
|
|
+
|
|
+ if (d->productReference)
|
|
+ self.insert(QLatin1String("productReference"), d->productReference->identifier());
|
|
+
|
|
+ return self;
|
|
+}
|
|
+
|
|
+QString PBXLegacyTarget::buildToolPath() const
|
|
+{
|
|
+ return d->buildToolPath;
|
|
+}
|
|
+
|
|
+void PBXLegacyTarget::setBuildToolPath(const QString &buildToolPath)
|
|
+{
|
|
+ d->buildToolPath = buildToolPath;
|
|
+}
|
|
+
|
|
+QString PBXLegacyTarget::buildArgumentsString() const
|
|
+{
|
|
+ return d->buildArgumentsString;
|
|
+}
|
|
+
|
|
+void PBXLegacyTarget::setBuildArgumentsString(const QString &buildArgumentsString)
|
|
+{
|
|
+ d->buildArgumentsString = buildArgumentsString;
|
|
+}
|
|
+
|
|
+QString PBXLegacyTarget::buildWorkingDirectory() const
|
|
+{
|
|
+ return d->buildWorkingDirectory;
|
|
+}
|
|
+
|
|
+void PBXLegacyTarget::setBuildWorkingDirectory(const QString &buildWorkingDirectory)
|
|
+{
|
|
+ d->buildWorkingDirectory = buildWorkingDirectory;
|
|
+}
|
|
+
|
|
+bool PBXLegacyTarget::passBuildSettingsInEnvironment() const
|
|
+{
|
|
+ return d->passBuildSettingsInEnvironment;
|
|
+}
|
|
+
|
|
+void PBXLegacyTarget::setPassBuildSettingsInEnvironment(bool passBuildSettingsInEnvironment)
|
|
+{
|
|
+ d->passBuildSettingsInEnvironment = passBuildSettingsInEnvironment;
|
|
+}
|
|
+
|
|
+PBXFileReference *PBXLegacyTarget::productReference() const
|
|
+{
|
|
+ return d->productReference;
|
|
+}
|
|
+
|
|
+void PBXLegacyTarget::setProductReference(PBXFileReference *productReference)
|
|
+{
|
|
+ d->productReference = productReference;
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxlegacytarget.h b/src/plugins/generator/xcode/pbxlegacytarget.h
|
|
new file mode 100644
|
|
index 0000000..4006b3b
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxlegacytarget.h
|
|
@@ -0,0 +1,73 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXLEGACYTARGET_H
|
|
+#define PBXLEGACYTARGET_H
|
|
+
|
|
+#include "pbxtarget.h"
|
|
+
|
|
+class PBXFileReference;
|
|
+
|
|
+class PBXLegacyTargetPrivate;
|
|
+
|
|
+class PBXLegacyTarget : public PBXTarget
|
|
+{
|
|
+ Q_OBJECT
|
|
+ Q_DISABLE_COPY(PBXLegacyTarget)
|
|
+public:
|
|
+ explicit PBXLegacyTarget(QObject *parent = 0);
|
|
+ virtual ~PBXLegacyTarget();
|
|
+
|
|
+ QString isa() const;
|
|
+ QVariantMap toMap() const;
|
|
+
|
|
+ QString buildToolPath() const;
|
|
+ void setBuildToolPath(const QString &buildToolPath);
|
|
+
|
|
+ QString buildArgumentsString() const;
|
|
+ void setBuildArgumentsString(const QString &buildArgumentsString);
|
|
+
|
|
+ QString buildWorkingDirectory() const;
|
|
+ void setBuildWorkingDirectory(const QString &buildWorkingDirectory);
|
|
+
|
|
+ bool passBuildSettingsInEnvironment() const;
|
|
+ void setPassBuildSettingsInEnvironment(bool passBuildSettingsInEnvironment);
|
|
+
|
|
+ /*!
|
|
+ * File reference to the target's output file.
|
|
+ */
|
|
+ PBXFileReference *productReference() const;
|
|
+ void setProductReference(PBXFileReference *productReference);
|
|
+
|
|
+private:
|
|
+ PBXLegacyTargetPrivate *d;
|
|
+};
|
|
+
|
|
+#endif // PBXLEGACYTARGET_H
|
|
diff --git a/src/plugins/generator/xcode/pbxnativetarget.cpp b/src/plugins/generator/xcode/pbxnativetarget.cpp
|
|
new file mode 100644
|
|
index 0000000..781dc67
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxnativetarget.cpp
|
|
@@ -0,0 +1,83 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxbuildphase.h"
|
|
+#include "pbxfilereference.h"
|
|
+#include "pbxnativetarget.h"
|
|
+#include "xcconfigurationlist.h"
|
|
+
|
|
+class PBXNativeTargetPrivate
|
|
+{
|
|
+public:
|
|
+ PBXNativeTargetPrivate();
|
|
+ PBXFileReference *productReference;
|
|
+};
|
|
+
|
|
+PBXNativeTargetPrivate::PBXNativeTargetPrivate()
|
|
+ : productReference()
|
|
+{
|
|
+}
|
|
+
|
|
+PBXNativeTarget::PBXNativeTarget(QObject *parent) :
|
|
+ PBXTarget(parent), d(new PBXNativeTargetPrivate)
|
|
+{
|
|
+}
|
|
+
|
|
+PBXNativeTarget::~PBXNativeTarget()
|
|
+{
|
|
+ delete d;
|
|
+}
|
|
+
|
|
+QString PBXNativeTarget::isa() const
|
|
+{
|
|
+ return QLatin1String("PBXNativeTarget");
|
|
+}
|
|
+
|
|
+QVariantMap PBXNativeTarget::toMap() const
|
|
+{
|
|
+ QVariantMap self = PBXTarget::toMap();
|
|
+
|
|
+ self.insert(QLatin1String("productInstallPath"), QLatin1String("$(HOME)/Applications"));
|
|
+
|
|
+ if (d->productReference)
|
|
+ self.insert(QLatin1String("productReference"), d->productReference->identifier());
|
|
+
|
|
+ return self;
|
|
+}
|
|
+
|
|
+PBXFileReference *PBXNativeTarget::productReference() const
|
|
+{
|
|
+ return d->productReference;
|
|
+}
|
|
+
|
|
+void PBXNativeTarget::setProductReference(PBXFileReference *productReference)
|
|
+{
|
|
+ d->productReference = productReference;
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxnativetarget.h b/src/plugins/generator/xcode/pbxnativetarget.h
|
|
new file mode 100644
|
|
index 0000000..d2ee90f
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxnativetarget.h
|
|
@@ -0,0 +1,61 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXNATIVETARGET_H
|
|
+#define PBXNATIVETARGET_H
|
|
+
|
|
+#include "pbxtarget.h"
|
|
+
|
|
+class PBXFileReference;
|
|
+
|
|
+class PBXNativeTargetPrivate;
|
|
+
|
|
+class PBXNativeTarget : public PBXTarget
|
|
+{
|
|
+ Q_OBJECT
|
|
+ Q_DISABLE_COPY(PBXNativeTarget)
|
|
+public:
|
|
+ explicit PBXNativeTarget(QObject *parent = 0);
|
|
+ ~PBXNativeTarget();
|
|
+
|
|
+ QString isa() const;
|
|
+ QVariantMap toMap() const;
|
|
+
|
|
+ /*!
|
|
+ * File reference to the target's output file.
|
|
+ */
|
|
+ PBXFileReference *productReference() const;
|
|
+ void setProductReference(PBXFileReference *productReference);
|
|
+
|
|
+private:
|
|
+ PBXNativeTargetPrivate *d;
|
|
+};
|
|
+
|
|
+#endif // PBXNATIVETARGET_H
|
|
diff --git a/src/plugins/generator/xcode/pbxobject.cpp b/src/plugins/generator/xcode/pbxobject.cpp
|
|
new file mode 100644
|
|
index 0000000..b5fcd13
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxobject.cpp
|
|
@@ -0,0 +1,69 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxobject.h"
|
|
+#include <QString>
|
|
+#include <QUuid>
|
|
+
|
|
+class PBXObjectPrivate
|
|
+{
|
|
+public:
|
|
+ QString identifier;
|
|
+};
|
|
+
|
|
+PBXObject::PBXObject(QObject *parent)
|
|
+ : QObject(parent), d(new PBXObjectPrivate)
|
|
+{
|
|
+}
|
|
+
|
|
+PBXObject::~PBXObject()
|
|
+{
|
|
+ delete d;
|
|
+}
|
|
+
|
|
+QString PBXObject::identifier() const
|
|
+{
|
|
+ if (d->identifier.isEmpty())
|
|
+ d->identifier = QUuid::createUuid().toByteArray().left(12).toHex().toUpper();
|
|
+ return d->identifier;
|
|
+}
|
|
+
|
|
+QVariantMap PBXObject::toMap() const
|
|
+{
|
|
+ QVariantMap self;
|
|
+ self.insert(QLatin1String("__comment__"), comment());
|
|
+ self.insert(QLatin1String("isa"), isa());
|
|
+ return self;
|
|
+}
|
|
+
|
|
+QString PBXObject::comment() const
|
|
+{
|
|
+ return QString();
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxobject.h b/src/plugins/generator/xcode/pbxobject.h
|
|
new file mode 100644
|
|
index 0000000..73ebdec
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxobject.h
|
|
@@ -0,0 +1,59 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXOBJECT_H
|
|
+#define PBXOBJECT_H
|
|
+
|
|
+#include <QObject>
|
|
+#include <QString>
|
|
+#include <QVariant>
|
|
+
|
|
+class PBXObjectPrivate;
|
|
+
|
|
+class PBXObject : public QObject
|
|
+{
|
|
+ Q_OBJECT
|
|
+ Q_DISABLE_COPY(PBXObject)
|
|
+protected:
|
|
+ explicit PBXObject(QObject *parent = 0);
|
|
+
|
|
+public:
|
|
+ virtual ~PBXObject();
|
|
+
|
|
+ QString identifier() const;
|
|
+ virtual QString isa() const = 0;
|
|
+ virtual QVariantMap toMap() const;
|
|
+ virtual QString comment() const;
|
|
+
|
|
+private:
|
|
+ PBXObjectPrivate *d;
|
|
+};
|
|
+
|
|
+#endif // PBXOBJECT_H
|
|
diff --git a/src/plugins/generator/xcode/pbxproducttype.cpp b/src/plugins/generator/xcode/pbxproducttype.cpp
|
|
new file mode 100644
|
|
index 0000000..4f0bc00
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxproducttype.cpp
|
|
@@ -0,0 +1,56 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxproducttype.h"
|
|
+
|
|
+QString PBX::productTypeString(PBX::PBXProductType productType)
|
|
+{
|
|
+ switch (productType)
|
|
+ {
|
|
+ case Application:
|
|
+ return QLatin1String("com.apple.product-type.application");
|
|
+ case Tool:
|
|
+ return QLatin1String("com.apple.product-type.tool");
|
|
+ case LibraryStatic:
|
|
+ return QLatin1String("com.apple.product-type.library.static");
|
|
+ case LibraryDynamic:
|
|
+ return QLatin1String("com.apple.product-type.library.dynamic");
|
|
+ case Framework:
|
|
+ return QLatin1String("com.apple.product-type.framework");
|
|
+ case Bundle:
|
|
+ return QLatin1String("com.apple.product-type.bundle");
|
|
+ case KernelExtension:
|
|
+ return QLatin1String("com.apple.product-type.kernel-extension");
|
|
+ case KernelExtensionIOKit:
|
|
+ return QLatin1String("com.apple.product-type.kernel-extension.iokit");
|
|
+ }
|
|
+
|
|
+ return QString();
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxproducttype.h b/src/plugins/generator/xcode/pbxproducttype.h
|
|
new file mode 100644
|
|
index 0000000..4d48f3c
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxproducttype.h
|
|
@@ -0,0 +1,52 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXPRODUCTTYPE_H
|
|
+#define PBXPRODUCTTYPE_H
|
|
+
|
|
+#include <QString>
|
|
+
|
|
+namespace PBX
|
|
+{
|
|
+ typedef enum {
|
|
+ Application = 1,
|
|
+ Tool,
|
|
+ LibraryStatic,
|
|
+ LibraryDynamic,
|
|
+ Framework,
|
|
+ Bundle,
|
|
+ KernelExtension,
|
|
+ KernelExtensionIOKit
|
|
+ } PBXProductType;
|
|
+
|
|
+ QString productTypeString(PBXProductType productType);
|
|
+}
|
|
+
|
|
+#endif // PBXPRODUCTTYPE_H
|
|
diff --git a/src/plugins/generator/xcode/pbxproject.cpp b/src/plugins/generator/xcode/pbxproject.cpp
|
|
new file mode 100644
|
|
index 0000000..cbbfef2
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxproject.cpp
|
|
@@ -0,0 +1,218 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "opensteppropertylist.h"
|
|
+#include "pbxbuildphase.h"
|
|
+#include "pbxbuildfile.h"
|
|
+#include "pbxgroup.h"
|
|
+#include "pbxproject.h"
|
|
+#include "pbxtarget.h"
|
|
+#include "xcbuildconfiguration.h"
|
|
+#include "xcconfigurationlist.h"
|
|
+#include <QFile>
|
|
+#include <QVariant>
|
|
+
|
|
+class PBXProjectPrivate
|
|
+{
|
|
+public:
|
|
+ QString name;
|
|
+ QString projectAbsolutePath;
|
|
+ QString projectDirPath;
|
|
+ PBXGroup *productRefGroup;
|
|
+ QList<PBXTarget *> targets;
|
|
+ XCConfigurationList *configurationList;
|
|
+};
|
|
+
|
|
+PBXProject::PBXProject(const QString &projectAbsolutePath, QObject *parent) :
|
|
+ PBXContainer(parent), d(new PBXProjectPrivate)
|
|
+{
|
|
+ d->projectAbsolutePath = projectAbsolutePath;
|
|
+ d->configurationList = new XCConfigurationList(this);
|
|
+
|
|
+ d->productRefGroup = new PBXGroup(rootGroup());
|
|
+ d->productRefGroup->setName(QLatin1String("Products"));
|
|
+ d->productRefGroup->setSourceTree(PBX::Group);
|
|
+}
|
|
+
|
|
+PBXProject::~PBXProject()
|
|
+{
|
|
+ delete d;
|
|
+}
|
|
+
|
|
+QString PBXProject::isa() const
|
|
+{
|
|
+ return QLatin1String("PBXProject");
|
|
+}
|
|
+
|
|
+QVariantMap PBXProject::toMap() const
|
|
+{
|
|
+ // HACK: Make sure "Products" group is always at the bottom
|
|
+ rootGroup()->removeItem(d->productRefGroup);
|
|
+ rootGroup()->addItem(d->productRefGroup);
|
|
+
|
|
+ QVariantMap self = PBXObject::toMap();
|
|
+ self.insert(QLatin1String("buildConfigurationList"), buildConfigurationList()->identifier());
|
|
+ self.insert(QLatin1String("compatibilityVersion"), QLatin1String("Xcode 3.2"));
|
|
+ self.insert(QLatin1String("developmentRegion"), QLatin1String("English"));
|
|
+ self.insert(QLatin1String("hasScannedForEncodings"), QLatin1String("1"));
|
|
+ self.insert(QLatin1String("knownRegions"), QStringList() << QLatin1String("en"));
|
|
+ self.insert(QLatin1String("mainGroup"), rootGroup()->identifier());
|
|
+ self.insert(QLatin1String("productRefGroup"), productRefGroup()->identifier());
|
|
+ self.insert(QLatin1String("projectDirPath"), d->projectDirPath);
|
|
+ self.insert(QLatin1String("projectReferences"), QLatin1String("")); // array of map { ProductGroup:, ProjectRef: }?
|
|
+ self.insert(QLatin1String("projectRoot"), QLatin1String(""));
|
|
+
|
|
+ QStringList targetIdentifiers;
|
|
+ foreach (PBXTarget *target, targets())
|
|
+ targetIdentifiers << target->identifier();
|
|
+ self.insert(QLatin1String("targets"), targetIdentifiers);
|
|
+
|
|
+ return self;
|
|
+}
|
|
+
|
|
+PBXGroup *PBXProject::productRefGroup() const
|
|
+{
|
|
+ return d->productRefGroup;
|
|
+}
|
|
+
|
|
+QList<PBXTarget *> PBXProject::targets() const
|
|
+{
|
|
+ return d->targets;
|
|
+}
|
|
+
|
|
+PBXTarget *PBXProject::targetNamed(const QString &targetName) const
|
|
+{
|
|
+ foreach (PBXTarget *target, d->targets)
|
|
+ {
|
|
+ if (target->name() == targetName)
|
|
+ return target;
|
|
+ }
|
|
+
|
|
+ return NULL;
|
|
+}
|
|
+
|
|
+void PBXProject::addTarget(PBXTarget *target)
|
|
+{
|
|
+ d->targets.append(target);
|
|
+}
|
|
+
|
|
+QString PBXProject::name() const
|
|
+{
|
|
+ return d->name;
|
|
+}
|
|
+
|
|
+void PBXProject::setName(const QString &name)
|
|
+{
|
|
+ d->name = name;
|
|
+}
|
|
+
|
|
+QString PBXProject::projectDirPath() const
|
|
+{
|
|
+ return d->projectDirPath;
|
|
+}
|
|
+
|
|
+void PBXProject::setProjectDirPath(const QString &projectDirPath)
|
|
+{
|
|
+ d->projectDirPath = projectDirPath;
|
|
+}
|
|
+
|
|
+XCConfigurationList *PBXProject::buildConfigurationList() const
|
|
+{
|
|
+ return d->configurationList;
|
|
+}
|
|
+
|
|
+static void writeGroup(QVariantMap &objects, PBXGroup *group)
|
|
+{
|
|
+ objects.insert(group->identifier(), group->toMap());
|
|
+ foreach (PBXReference *child, group->children())
|
|
+ {
|
|
+ PBXGroup *group = dynamic_cast<PBXGroup *>(child);
|
|
+ if (group)
|
|
+ writeGroup(objects, group);
|
|
+ else
|
|
+ objects.insert(child->identifier(), child->toMap());
|
|
+ }
|
|
+}
|
|
+
|
|
+bool PBXProject::writeToFileSystemProjectFile(bool projectWrite, bool userWrite, bool checkNeedsRevert)
|
|
+{
|
|
+ QVariantMap objects;
|
|
+ objects.insert(identifier(), toMap());
|
|
+
|
|
+ // Add the project's root group (i.e. the root node in the file tree which contains everything)
|
|
+ writeGroup(objects, rootGroup());
|
|
+
|
|
+ // Add the project's build configuration list and build configurations to the object map
|
|
+ objects.insert(d->configurationList->identifier(), d->configurationList->toMap());
|
|
+ foreach (XCBuildConfiguration *configuration, d->configurationList->buildConfigurations())
|
|
+ objects.insert(configuration->identifier(), configuration->toMap());
|
|
+
|
|
+ // Add the build targets to the object map
|
|
+ foreach (PBXTarget *target, targets())
|
|
+ {
|
|
+ objects.insert(target->identifier(), target->toMap());
|
|
+
|
|
+ // Add the target's build configuration list and build configurations to the object map
|
|
+ objects.insert(target->buildConfigurationList()->identifier(), target->buildConfigurationList()->toMap());
|
|
+ foreach (XCBuildConfiguration *configuration, target->buildConfigurationList()->buildConfigurations())
|
|
+ objects.insert(configuration->identifier(), configuration->toMap());
|
|
+
|
|
+ // Add the target's build phases...
|
|
+ foreach (PBXBuildPhase *buildPhase, target->buildPhases())
|
|
+ {
|
|
+ objects.insert(buildPhase->identifier(), buildPhase->toMap());
|
|
+
|
|
+ // And each of the files within
|
|
+ foreach (PBXBuildFile *buildFile, buildPhase->buildFiles())
|
|
+ {
|
|
+ objects.insert(buildFile->identifier(), buildFile->toMap());
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ // add all subobjects to objects map!
|
|
+
|
|
+ // Build the root pbxproj object map
|
|
+ QVariantMap map;
|
|
+ map.insert(QLatin1String("archiveVersion"), QLatin1String("1"));
|
|
+ map.insert(QLatin1String("classes"), QVariantMap());
|
|
+ map.insert(QLatin1String("objectVersion"), QLatin1String("46"));
|
|
+ map.insert(QLatin1String("objects"), objects);
|
|
+ map.insert(QLatin1String("rootObject"), identifier());
|
|
+
|
|
+ QFile file(d->projectAbsolutePath);
|
|
+ if (file.open(QIODevice::WriteOnly))
|
|
+ {
|
|
+ file.write(QByteArray("// !$*UTF8*$!\n"));
|
|
+ file.write(OpenStepPropertyList::toString(map).toUtf8());
|
|
+ }
|
|
+
|
|
+ return file.error() == QFile::NoError;
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxproject.h b/src/plugins/generator/xcode/pbxproject.h
|
|
new file mode 100644
|
|
index 0000000..36fa77e
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxproject.h
|
|
@@ -0,0 +1,80 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXPROJECT_H
|
|
+#define PBXPROJECT_H
|
|
+
|
|
+#include "pbxcontainer.h"
|
|
+
|
|
+class PBXTarget;
|
|
+class XCConfigurationList;
|
|
+
|
|
+class PBXProjectPrivate;
|
|
+
|
|
+class PBXProject : public PBXContainer
|
|
+{
|
|
+ Q_OBJECT
|
|
+ Q_DISABLE_COPY(PBXProject)
|
|
+public:
|
|
+ explicit PBXProject(const QString &projectAbsolutePath, QObject *parent = 0);
|
|
+ ~PBXProject();
|
|
+
|
|
+ QString isa() const;
|
|
+ QVariantMap toMap() const;
|
|
+
|
|
+ /*!
|
|
+ * Group in the root of the Xcode file tree which contains references to product target files.
|
|
+ *
|
|
+ * For example, this will contain references to output application and library executables.
|
|
+ */
|
|
+ PBXGroup *productRefGroup() const;
|
|
+
|
|
+ static bool isProjectWrapperExtension(const QString &extension);
|
|
+ static PBXProject *projectWithFile(const QString &projectAbsolutePath);
|
|
+
|
|
+ QList<PBXTarget *> targets() const;
|
|
+ PBXTarget *targetNamed(const QString &targetName) const;
|
|
+
|
|
+ void addTarget(PBXTarget *target);
|
|
+
|
|
+ QString name() const;
|
|
+ void setName(const QString &name);
|
|
+
|
|
+ QString projectDirPath() const;
|
|
+ void setProjectDirPath(const QString &projectDirPath);
|
|
+
|
|
+ XCConfigurationList *buildConfigurationList() const;
|
|
+ bool writeToFileSystemProjectFile(bool projectWrite, bool userWrite, bool checkNeedsRevert);
|
|
+
|
|
+private:
|
|
+ PBXProjectPrivate *d;
|
|
+};
|
|
+
|
|
+#endif // PBXPROJECT_H
|
|
diff --git a/src/plugins/generator/xcode/pbxreference.cpp b/src/plugins/generator/xcode/pbxreference.cpp
|
|
new file mode 100644
|
|
index 0000000..2d3d648
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxreference.cpp
|
|
@@ -0,0 +1,107 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxreference.h"
|
|
+
|
|
+class PBXReferencePrivate
|
|
+{
|
|
+public:
|
|
+ PBXReferencePrivate();
|
|
+ QString name;
|
|
+ QString path;
|
|
+ PBX::PBXSourceTree sourceTree;
|
|
+};
|
|
+
|
|
+PBXReferencePrivate::PBXReferencePrivate()
|
|
+ : name(), sourceTree()
|
|
+{
|
|
+}
|
|
+
|
|
+PBXReference::PBXReference(QObject *parent) :
|
|
+ PBXObject(parent), d(new PBXReferencePrivate)
|
|
+{
|
|
+}
|
|
+
|
|
+PBXReference::~PBXReference()
|
|
+{
|
|
+ delete d;
|
|
+}
|
|
+
|
|
+QVariantMap PBXReference::toMap() const
|
|
+{
|
|
+ QVariantMap self = PBXObject::toMap();
|
|
+ self.insert(QLatin1String("name"), name());
|
|
+
|
|
+ // Xcode crashes if path is empty, even though it should never be
|
|
+ if (!d->path.isEmpty())
|
|
+ self.insert(QLatin1String("path"), d->path); // relative path including the file name
|
|
+
|
|
+ self.insert(QLatin1String("sourceTree"), PBX::sourceTreeString(sourceTree()));
|
|
+ return self;
|
|
+}
|
|
+
|
|
+/*!
|
|
+ * \brief PBXReference::name
|
|
+ * \return display name of file or group, usually the same as the name of the file or directory.
|
|
+ */
|
|
+QString PBXReference::name() const
|
|
+{
|
|
+ return d->name;
|
|
+}
|
|
+
|
|
+void PBXReference::setName(const QString &name)
|
|
+{
|
|
+ d->name = name;
|
|
+}
|
|
+
|
|
+QString PBXReference::path() const
|
|
+{
|
|
+ return d->path;
|
|
+}
|
|
+
|
|
+void PBXReference::setPath(const QString &filePath)
|
|
+{
|
|
+ d->path = filePath;
|
|
+}
|
|
+
|
|
+PBX::PBXSourceTree PBXReference::sourceTree() const
|
|
+{
|
|
+ return d->sourceTree;
|
|
+}
|
|
+
|
|
+void PBXReference::setSourceTree(PBX::PBXSourceTree sourceTree)
|
|
+{
|
|
+ d->sourceTree = sourceTree;
|
|
+}
|
|
+
|
|
+QString PBXReference::comment() const
|
|
+{
|
|
+ return name();
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxreference.h b/src/plugins/generator/xcode/pbxreference.h
|
|
new file mode 100644
|
|
index 0000000..26b393c
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxreference.h
|
|
@@ -0,0 +1,70 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXREFERENCE_H
|
|
+#define PBXREFERENCE_H
|
|
+
|
|
+#include "pbxobject.h"
|
|
+#include "pbxsourcetree.h"
|
|
+#include <QObject>
|
|
+
|
|
+class PBXReferencePrivate;
|
|
+
|
|
+// Mono calls this PBXFileElement?
|
|
+class PBXReference : public PBXObject
|
|
+{
|
|
+ Q_OBJECT
|
|
+ Q_DISABLE_COPY(PBXReference)
|
|
+protected:
|
|
+ explicit PBXReference(QObject *parent = 0);
|
|
+ virtual ~PBXReference();
|
|
+
|
|
+public:
|
|
+ QVariantMap toMap() const;
|
|
+
|
|
+ QString name() const;
|
|
+ void setName(const QString &name);
|
|
+
|
|
+ /*!
|
|
+ * File path of the referenced file, relative based on the value of \a sourceTree.
|
|
+ */
|
|
+ QString path() const;
|
|
+ void setPath(const QString &path);
|
|
+
|
|
+ PBX::PBXSourceTree sourceTree() const;
|
|
+ void setSourceTree(PBX::PBXSourceTree sourceTree);
|
|
+
|
|
+ QString comment() const;
|
|
+
|
|
+private:
|
|
+ PBXReferencePrivate *d;
|
|
+};
|
|
+
|
|
+#endif // PBXREFERENCE_H
|
|
diff --git a/src/plugins/generator/xcode/pbxsourcesbuildphase.cpp b/src/plugins/generator/xcode/pbxsourcesbuildphase.cpp
|
|
new file mode 100644
|
|
index 0000000..8253287
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxsourcesbuildphase.cpp
|
|
@@ -0,0 +1,47 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxsourcesbuildphase.h"
|
|
+
|
|
+PBXSourcesBuildPhase::PBXSourcesBuildPhase(QObject *parent) :
|
|
+ PBXBuildPhase(parent)
|
|
+{
|
|
+}
|
|
+
|
|
+QString PBXSourcesBuildPhase::isa() const
|
|
+{
|
|
+ return QLatin1String("PBXSourcesBuildPhase");
|
|
+}
|
|
+
|
|
+QVariantMap PBXSourcesBuildPhase::toMap() const
|
|
+{
|
|
+ QVariantMap self = PBXBuildPhase::toMap();
|
|
+ return self;
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxsourcesbuildphase.h b/src/plugins/generator/xcode/pbxsourcesbuildphase.h
|
|
new file mode 100644
|
|
index 0000000..d5d6f7d
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxsourcesbuildphase.h
|
|
@@ -0,0 +1,49 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXSOURCESBUILDPHASE_H
|
|
+#define PBXSOURCESBUILDPHASE_H
|
|
+
|
|
+#include "pbxbuildphase.h"
|
|
+
|
|
+/*!
|
|
+ * \brief The PBXSourcesBuildPhase class represents the build phase in which source files are compiled.
|
|
+ */
|
|
+class PBXSourcesBuildPhase : public PBXBuildPhase
|
|
+{
|
|
+ Q_OBJECT
|
|
+public:
|
|
+ explicit PBXSourcesBuildPhase(QObject *parent = 0);
|
|
+
|
|
+ QString isa() const;
|
|
+ QVariantMap toMap() const;
|
|
+};
|
|
+
|
|
+#endif // PBXSOURCESBUILDPHASE_H
|
|
diff --git a/src/plugins/generator/xcode/pbxsourcetree.cpp b/src/plugins/generator/xcode/pbxsourcetree.cpp
|
|
new file mode 100644
|
|
index 0000000..1bea8d6
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxsourcetree.cpp
|
|
@@ -0,0 +1,50 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxsourcetree.h"
|
|
+
|
|
+QString PBX::sourceTreeString(PBX::PBXSourceTree tree)
|
|
+{
|
|
+ switch (tree)
|
|
+ {
|
|
+ case Absolute:
|
|
+ return QLatin1String("<absolute>");
|
|
+ case Group:
|
|
+ return QLatin1String("<group>");
|
|
+ case SourceRoot:
|
|
+ return QLatin1String("SOURCE_ROOT");
|
|
+ case BuildProductDir:
|
|
+ return QLatin1String("BUILT_PRODUCTS_DIR");
|
|
+ case SdkRoot:
|
|
+ return QLatin1String("SDKROOT");
|
|
+ }
|
|
+
|
|
+ return QString();
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxsourcetree.h b/src/plugins/generator/xcode/pbxsourcetree.h
|
|
new file mode 100644
|
|
index 0000000..7f77592
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxsourcetree.h
|
|
@@ -0,0 +1,52 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXSOURCETREE_H
|
|
+#define PBXSOURCETREE_H
|
|
+
|
|
+#include <QString>
|
|
+
|
|
+namespace PBX
|
|
+{
|
|
+ /*!
|
|
+ * Location that the file reference's path is relative to.
|
|
+ */
|
|
+ typedef enum {
|
|
+ Absolute,
|
|
+ Group,
|
|
+ SourceRoot,
|
|
+ BuildProductDir,
|
|
+ SdkRoot
|
|
+ } PBXSourceTree;
|
|
+
|
|
+ QString sourceTreeString(PBXSourceTree tree);
|
|
+}
|
|
+
|
|
+#endif // PBXSOURCETREE_H
|
|
diff --git a/src/plugins/generator/xcode/pbxtarget.cpp b/src/plugins/generator/xcode/pbxtarget.cpp
|
|
new file mode 100644
|
|
index 0000000..5b15959
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxtarget.cpp
|
|
@@ -0,0 +1,139 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxsourcesbuildphase.h"
|
|
+#include "pbxtarget.h"
|
|
+#include "xcbuildconfiguration.h"
|
|
+#include "xcconfigurationlist.h"
|
|
+
|
|
+class PBXTargetPrivate
|
|
+{
|
|
+public:
|
|
+ PBXTargetPrivate();
|
|
+ QString name;
|
|
+ QString productName;
|
|
+ PBX::PBXProductType productType;
|
|
+ XCConfigurationList *configurationList;
|
|
+ PBXSourcesBuildPhase *sourcesBuildPhase;
|
|
+};
|
|
+
|
|
+PBXTargetPrivate::PBXTargetPrivate()
|
|
+ : name(), productType(), configurationList(), sourcesBuildPhase()
|
|
+{
|
|
+}
|
|
+
|
|
+PBXTarget::PBXTarget(QObject *parent) :
|
|
+ PBXObject(parent), d(new PBXTargetPrivate)
|
|
+{
|
|
+ d->configurationList = new XCConfigurationList(this);
|
|
+ d->sourcesBuildPhase = new PBXSourcesBuildPhase(this);
|
|
+}
|
|
+
|
|
+PBXTarget::~PBXTarget()
|
|
+{
|
|
+ delete d;
|
|
+}
|
|
+
|
|
+QVariantMap PBXTarget::toMap() const
|
|
+{
|
|
+ QVariantMap self = PBXObject::toMap();
|
|
+ self.insert(QLatin1String("name"), name());
|
|
+ self.insert(QLatin1String("productName"), productName());
|
|
+ self.insert(QLatin1String("productType"), PBX::productTypeString(d->productType));
|
|
+
|
|
+ self.insert(QLatin1String("buildConfigurationList"), buildConfigurationList()->identifier());
|
|
+
|
|
+ QStringList buildPhaseReferences;
|
|
+ foreach (PBXBuildPhase *buildPhase, buildPhases())
|
|
+ buildPhaseReferences += buildPhase->identifier();
|
|
+ self.insert(QLatin1String("buildPhases"), buildPhaseReferences);
|
|
+
|
|
+ self.insert(QLatin1String("dependencies"), QStringList());
|
|
+
|
|
+ return self;
|
|
+}
|
|
+
|
|
+QString PBXTarget::name() const
|
|
+{
|
|
+ return d->name;
|
|
+}
|
|
+
|
|
+void PBXTarget::setName(const QString &name)
|
|
+{
|
|
+ d->name = name;
|
|
+}
|
|
+
|
|
+QString PBXTarget::productName() const
|
|
+{
|
|
+ return d->productName;
|
|
+}
|
|
+
|
|
+void PBXTarget::setProductName(const QString &productName)
|
|
+{
|
|
+ d->productName = productName;
|
|
+}
|
|
+
|
|
+PBX::PBXProductType PBXTarget::productType() const
|
|
+{
|
|
+ return d->productType;
|
|
+}
|
|
+
|
|
+void PBXTarget::setProductType(PBX::PBXProductType productType)
|
|
+{
|
|
+ d->productType = productType;
|
|
+}
|
|
+
|
|
+XCConfigurationList *PBXTarget::buildConfigurationList() const
|
|
+{
|
|
+ return d->configurationList;
|
|
+}
|
|
+
|
|
+void PBXTarget::setBuildSetting(const QString &key, const QVariant &value)
|
|
+{
|
|
+ foreach (XCBuildConfiguration *configuration, d->configurationList->buildConfigurations())
|
|
+ configuration->setBuildSetting(key, value);
|
|
+}
|
|
+
|
|
+QList<PBXBuildPhase *> PBXTarget::buildPhases() const
|
|
+{
|
|
+ QList<PBXBuildPhase *> phases;
|
|
+ phases.append(d->sourcesBuildPhase);
|
|
+ return phases;
|
|
+}
|
|
+
|
|
+PBXBuildPhase *PBXTarget::defaultSourceCodeBuildPhase()
|
|
+{
|
|
+ return d->sourcesBuildPhase;
|
|
+}
|
|
+
|
|
+QString PBXTarget::comment() const
|
|
+{
|
|
+ return name();
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/pbxtarget.h b/src/plugins/generator/xcode/pbxtarget.h
|
|
new file mode 100644
|
|
index 0000000..6b8f5b3
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/pbxtarget.h
|
|
@@ -0,0 +1,86 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef PBXTARGET_H
|
|
+#define PBXTARGET_H
|
|
+
|
|
+#include "pbxobject.h"
|
|
+#include "pbxproducttype.h"
|
|
+#include <QObject>
|
|
+
|
|
+class PBXBuildPhase;
|
|
+class XCConfigurationList;
|
|
+
|
|
+class PBXTargetPrivate;
|
|
+
|
|
+class PBXTarget : public PBXObject
|
|
+{
|
|
+ Q_OBJECT
|
|
+ Q_DISABLE_COPY(PBXTarget)
|
|
+public:
|
|
+ explicit PBXTarget(QObject *parent = 0);
|
|
+ ~PBXTarget();
|
|
+
|
|
+ QVariantMap toMap() const;
|
|
+
|
|
+ QString name() const;
|
|
+ void setName(const QString &name);
|
|
+
|
|
+ QString productName() const;
|
|
+ void setProductName(const QString &productName);
|
|
+
|
|
+ PBX::PBXProductType productType() const;
|
|
+ void setProductType(PBX::PBXProductType productType);
|
|
+
|
|
+ /*!
|
|
+ * List of the target's build configurations. This is never NULL.
|
|
+ */
|
|
+ XCConfigurationList *buildConfigurationList() const;
|
|
+
|
|
+ QString expandedValue(const QString &string, void *buildParameters) const;
|
|
+
|
|
+ void setBuildSetting(const QString &key, const QVariant &value);
|
|
+
|
|
+ QList<PBXBuildPhase *> buildPhases() const;
|
|
+ PBXBuildPhase *buildPhaseOfClass(void *clazz) const;
|
|
+ void addBuildPhase(PBXBuildPhase *buildPhase);
|
|
+ PBXBuildPhase *defaultFrameworksBuildPhase();
|
|
+ PBXBuildPhase *defaultLinkBuildPhase();
|
|
+ PBXBuildPhase *defaultSourceCodeBuildPhase();
|
|
+ PBXBuildPhase *defaultResourceBuildPhase();
|
|
+ PBXBuildPhase *defaultHeaderBuildPhase();
|
|
+
|
|
+ QString comment() const;
|
|
+
|
|
+private:
|
|
+ PBXTargetPrivate *d;
|
|
+};
|
|
+
|
|
+#endif // PBXTARGET_H
|
|
diff --git a/src/plugins/generator/xcode/xcbuildconfiguration.cpp b/src/plugins/generator/xcode/xcbuildconfiguration.cpp
|
|
new file mode 100644
|
|
index 0000000..8711d1f
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/xcbuildconfiguration.cpp
|
|
@@ -0,0 +1,82 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "xcbuildconfiguration.h"
|
|
+
|
|
+class XCBuildConfigurationPrivate
|
|
+{
|
|
+public:
|
|
+ QString name;
|
|
+ QVariantMap buildSettings;
|
|
+};
|
|
+
|
|
+XCBuildConfiguration::XCBuildConfiguration(QObject *parent) :
|
|
+ PBXObject(parent), d(new XCBuildConfigurationPrivate)
|
|
+{
|
|
+}
|
|
+
|
|
+XCBuildConfiguration::~XCBuildConfiguration()
|
|
+{
|
|
+ delete d;
|
|
+}
|
|
+
|
|
+QString XCBuildConfiguration::isa() const
|
|
+{
|
|
+ return QLatin1String("XCBuildConfiguration");
|
|
+}
|
|
+
|
|
+QVariantMap XCBuildConfiguration::toMap() const
|
|
+{
|
|
+ QVariantMap self = PBXObject::toMap();
|
|
+ self.insert(QLatin1String("baseConfigurationReference"), QLatin1String(""));
|
|
+ self.insert(QLatin1String("buildSettings"), d->buildSettings);
|
|
+ self.insert(QLatin1String("name"), d->name);
|
|
+ return self;
|
|
+}
|
|
+
|
|
+QString XCBuildConfiguration::name() const
|
|
+{
|
|
+ return d->name;
|
|
+}
|
|
+
|
|
+void XCBuildConfiguration::setName(const QString &name)
|
|
+{
|
|
+ d->name = name;
|
|
+}
|
|
+
|
|
+void XCBuildConfiguration::setBuildSetting(const QString &key, const QVariant &value)
|
|
+{
|
|
+ d->buildSettings.insert(key, value);
|
|
+}
|
|
+
|
|
+QString XCBuildConfiguration::comment() const
|
|
+{
|
|
+ return name();
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/xcbuildconfiguration.h b/src/plugins/generator/xcode/xcbuildconfiguration.h
|
|
new file mode 100644
|
|
index 0000000..ac17d79
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/xcbuildconfiguration.h
|
|
@@ -0,0 +1,67 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef XCBUILDCONFIGURATION_H
|
|
+#define XCBUILDCONFIGURATION_H
|
|
+
|
|
+#include "pbxobject.h"
|
|
+#include <QObject>
|
|
+
|
|
+class PBXFileReference;
|
|
+
|
|
+class XCBuildConfigurationPrivate;
|
|
+
|
|
+class XCBuildConfiguration : public PBXObject
|
|
+{
|
|
+ Q_OBJECT
|
|
+public:
|
|
+ explicit XCBuildConfiguration(QObject *parent = 0);
|
|
+ ~XCBuildConfiguration();
|
|
+
|
|
+ QString isa() const;
|
|
+ QVariantMap toMap() const;
|
|
+
|
|
+ QString name() const;
|
|
+ void setName(const QString &name);
|
|
+
|
|
+ static bool isValidBaseConfigurationFile(PBXFileReference *reference);
|
|
+
|
|
+ void setBaseConfigurationReference(PBXFileReference *reference);
|
|
+ PBXFileReference *baseConfigurationReference();
|
|
+
|
|
+ void setBuildSetting(const QString &key, const QVariant &value);
|
|
+
|
|
+ QString comment() const;
|
|
+
|
|
+private:
|
|
+ XCBuildConfigurationPrivate *d;
|
|
+};
|
|
+
|
|
+#endif // XCBUILDCONFIGURATION_H
|
|
diff --git a/src/plugins/generator/xcode/xcconfigurationlist.cpp b/src/plugins/generator/xcode/xcconfigurationlist.cpp
|
|
new file mode 100644
|
|
index 0000000..b8c8b7b
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/xcconfigurationlist.cpp
|
|
@@ -0,0 +1,142 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "pbxproject.h"
|
|
+#include "pbxtarget.h"
|
|
+#include "xcbuildconfiguration.h"
|
|
+#include "xcconfigurationlist.h"
|
|
+
|
|
+class XCConfigurationListPrivate
|
|
+{
|
|
+public:
|
|
+ XCConfigurationListPrivate();
|
|
+ QList<XCBuildConfiguration *> buildConfigurations;
|
|
+ XCBuildConfiguration *defaultBuildConfiguration;
|
|
+};
|
|
+
|
|
+XCConfigurationListPrivate::XCConfigurationListPrivate()
|
|
+ : buildConfigurations(), defaultBuildConfiguration()
|
|
+{
|
|
+}
|
|
+
|
|
+XCConfigurationList::XCConfigurationList(QObject *parent) :
|
|
+ PBXObject(parent), d(new XCConfigurationListPrivate)
|
|
+{
|
|
+}
|
|
+
|
|
+XCConfigurationList::~XCConfigurationList()
|
|
+{
|
|
+ delete d;
|
|
+}
|
|
+
|
|
+QString XCConfigurationList::isa() const
|
|
+{
|
|
+ return QLatin1String("XCConfigurationList");
|
|
+}
|
|
+
|
|
+QVariantMap XCConfigurationList::toMap() const
|
|
+{
|
|
+ QVariantMap self = PBXObject::toMap();
|
|
+
|
|
+ QStringList buildConfigurationReferences;
|
|
+ foreach (XCBuildConfiguration *configuration, buildConfigurations())
|
|
+ buildConfigurationReferences += configuration->identifier();
|
|
+ self.insert(QLatin1String("buildConfigurations"), buildConfigurationReferences);
|
|
+
|
|
+ if (d->defaultBuildConfiguration)
|
|
+ {
|
|
+ self.insert(QLatin1String("defaultConfigurationIsVisible"), 0);
|
|
+ self.insert(QLatin1String("defaultConfigurationName"), d->defaultBuildConfiguration->name());
|
|
+ }
|
|
+
|
|
+ return self;
|
|
+}
|
|
+
|
|
+QList<XCBuildConfiguration *> XCConfigurationList::buildConfigurations() const
|
|
+{
|
|
+ return d->buildConfigurations;
|
|
+}
|
|
+
|
|
+XCBuildConfiguration *XCConfigurationList::addBuildConfiguration(const QString &name)
|
|
+{
|
|
+ XCBuildConfiguration *buildConfiguration = new XCBuildConfiguration();
|
|
+ buildConfiguration->setName(name);
|
|
+ d->buildConfigurations.append(buildConfiguration);
|
|
+ return buildConfiguration;
|
|
+}
|
|
+
|
|
+void XCConfigurationList::removeBuildConfiguration(const QString &name)
|
|
+{
|
|
+ for (int i = 0; i < d->buildConfigurations.size(); ++i)
|
|
+ {
|
|
+ if (d->buildConfigurations[i]->name() == name)
|
|
+ {
|
|
+ XCBuildConfiguration *configuration = d->buildConfigurations.takeAt(i);
|
|
+ if (d->defaultBuildConfiguration == configuration)
|
|
+ d->defaultBuildConfiguration = NULL;
|
|
+ delete configuration;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+}
|
|
+
|
|
+void XCConfigurationList::setDefaultBuildConfiguration(const QString &name)
|
|
+{
|
|
+ foreach (XCBuildConfiguration *configuration, d->buildConfigurations)
|
|
+ {
|
|
+ if (configuration->name() == name)
|
|
+ {
|
|
+ d->defaultBuildConfiguration = configuration;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+}
|
|
+
|
|
+QString XCConfigurationList::comment() const
|
|
+{
|
|
+ QString parentIsa;
|
|
+ QString parentName;
|
|
+
|
|
+ PBXTarget *target = dynamic_cast<PBXTarget *>(parent());
|
|
+ PBXProject *project = dynamic_cast<PBXProject *>(parent());
|
|
+
|
|
+ if (target)
|
|
+ {
|
|
+ parentIsa = target->isa();
|
|
+ parentName = target->name();
|
|
+ }
|
|
+ else if (project)
|
|
+ {
|
|
+ parentIsa = project->isa();
|
|
+ parentName = project->name();
|
|
+ }
|
|
+
|
|
+ return QString(QLatin1String("Build configuration list for %1 \"%2\"")).arg(parentIsa).arg(parentName);
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/xcconfigurationlist.h b/src/plugins/generator/xcode/xcconfigurationlist.h
|
|
new file mode 100644
|
|
index 0000000..9ae1221
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/xcconfigurationlist.h
|
|
@@ -0,0 +1,63 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef XCCONFIGURATIONLIST_H
|
|
+#define XCCONFIGURATIONLIST_H
|
|
+
|
|
+#include "pbxobject.h"
|
|
+#include <QObject>
|
|
+
|
|
+class XCBuildConfiguration;
|
|
+
|
|
+class XCConfigurationListPrivate;
|
|
+
|
|
+class XCConfigurationList : public PBXObject
|
|
+{
|
|
+ Q_OBJECT
|
|
+public:
|
|
+ explicit XCConfigurationList(QObject *parent = 0);
|
|
+ ~XCConfigurationList();
|
|
+
|
|
+ QString isa() const;
|
|
+ QVariantMap toMap() const;
|
|
+
|
|
+ QList<XCBuildConfiguration *> buildConfigurations() const;
|
|
+
|
|
+ XCBuildConfiguration *addBuildConfiguration(const QString &name);
|
|
+ void removeBuildConfiguration(const QString &name);
|
|
+ void setDefaultBuildConfiguration(const QString &name);
|
|
+
|
|
+ QString comment() const;
|
|
+
|
|
+private:
|
|
+ XCConfigurationListPrivate *d;
|
|
+};
|
|
+
|
|
+#endif // XCCONFIGURATIONLIST_H
|
|
diff --git a/src/plugins/generator/xcode/xcode.pro b/src/plugins/generator/xcode/xcode.pro
|
|
new file mode 100644
|
|
index 0000000..45e27ba
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/xcode.pro
|
|
@@ -0,0 +1,58 @@
|
|
+include(../../plugins.pri)
|
|
+
|
|
+TARGET = qbs_xcode_generator
|
|
+
|
|
+QT = core
|
|
+
|
|
+QBSLIBDIR = $$OUT_PWD/../../../../lib
|
|
+include($$PWD/../../../lib/corelib/use_corelib.pri)
|
|
+
|
|
+HEADERS += \
|
|
+ ../generatorplugin.h \
|
|
+ opensteppropertylist.h \
|
|
+ pbx.h \
|
|
+ pbxbuildfile.h \
|
|
+ pbxbuildphase.h \
|
|
+ pbxcontainer.h \
|
|
+ pbxfileencoding.h \
|
|
+ pbxfilereference.h \
|
|
+ pbxfiletype.h \
|
|
+ pbxgroup.h \
|
|
+ pbxnativetarget.h \
|
|
+ pbxobject.h \
|
|
+ pbxproducttype.h \
|
|
+ pbxproject.h \
|
|
+ pbxreference.h \
|
|
+ pbxsourcesbuildphase.h \
|
|
+ pbxsourcetree.h \
|
|
+ pbxtarget.h \
|
|
+ xcbuildconfiguration.h \
|
|
+ xcconfigurationlist.h \
|
|
+ xcodegenerator.h \
|
|
+ xcodenativegenerator.h \
|
|
+ xcodesimplegenerator.h \
|
|
+ pbxlegacytarget.h
|
|
+
|
|
+SOURCES += \
|
|
+ main.cpp \
|
|
+ opensteppropertylist.cpp \
|
|
+ pbxbuildfile.cpp \
|
|
+ pbxbuildphase.cpp \
|
|
+ pbxcontainer.cpp \
|
|
+ pbxfilereference.cpp \
|
|
+ pbxfiletype.cpp \
|
|
+ pbxgroup.cpp \
|
|
+ pbxnativetarget.cpp \
|
|
+ pbxobject.cpp \
|
|
+ pbxproducttype.cpp \
|
|
+ pbxproject.cpp \
|
|
+ pbxreference.cpp \
|
|
+ pbxsourcesbuildphase.cpp \
|
|
+ pbxsourcetree.cpp \
|
|
+ pbxtarget.cpp \
|
|
+ xcbuildconfiguration.cpp \
|
|
+ xcconfigurationlist.cpp \
|
|
+ xcodegenerator.cpp \
|
|
+ xcodenativegenerator.cpp \
|
|
+ xcodesimplegenerator.cpp \
|
|
+ pbxlegacytarget.cpp
|
|
diff --git a/src/plugins/generator/xcode/xcodegenerator.cpp b/src/plugins/generator/xcode/xcodegenerator.cpp
|
|
new file mode 100644
|
|
index 0000000..ea53d0e
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/xcodegenerator.cpp
|
|
@@ -0,0 +1,96 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "xcodegenerator.h"
|
|
+
|
|
+#include <qbs.h>
|
|
+
|
|
+namespace qbs {
|
|
+
|
|
+XcodeGenerator::XcodeGenerator()
|
|
+{
|
|
+}
|
|
+
|
|
+/*!
|
|
+ * Finds the "root" group in a Qbs product.
|
|
+ *
|
|
+ * This is the group which has the same name as the product and corresponds to
|
|
+ * the files which do not appear in a Group in the Qbs source file.
|
|
+ */
|
|
+static GroupData findRootGroup(const ProductData &product)
|
|
+{
|
|
+ Q_ASSERT(product.groups().size() > 0);
|
|
+ foreach (const GroupData groupData, product.groups())
|
|
+ {
|
|
+ if (groupData.name() == product.name())
|
|
+ return groupData;
|
|
+ }
|
|
+
|
|
+ Q_ASSERT_X(false, __FILE__, "couldn't find root group in qbs product");
|
|
+}
|
|
+
|
|
+QString XcodeGenerator::xcodeExecutablePrefix(const ProductData &product)
|
|
+{
|
|
+ // TODO: Use value from qbs module?
|
|
+ switch (xcodeProductType(product))
|
|
+ {
|
|
+ case PBX::LibraryDynamic:
|
|
+ case PBX::LibraryStatic:
|
|
+ return QLatin1String("lib");
|
|
+ default:
|
|
+ return QString();
|
|
+ }
|
|
+}
|
|
+
|
|
+/*!
|
|
+ * Returns the Xcode product type identifier corresponding to the Qbs product type name.
|
|
+ */
|
|
+PBX::PBXProductType XcodeGenerator::xcodeProductType(const ProductData &product)
|
|
+{
|
|
+ const GroupData groupData = findRootGroup(product);
|
|
+ QStringList productType = groupData.properties().getProperty(QLatin1String("type")).toStringList();
|
|
+
|
|
+ if (productType.contains(QLatin1String("applicationbundle")))
|
|
+ return PBX::Application;
|
|
+ if (productType.contains(QLatin1String("application")))
|
|
+ return PBX::Tool;
|
|
+ if (productType.contains(QLatin1String("dynamiclibrary")))
|
|
+ return PBX::LibraryDynamic;
|
|
+ if (productType.contains(QLatin1String("staticlibrary")))
|
|
+ return PBX::LibraryStatic;
|
|
+ if (productType.contains(QLatin1String("frameworkbundle")))
|
|
+ return PBX::Framework;
|
|
+ if (productType.contains(QLatin1String("bundle")))
|
|
+ return PBX::Bundle;
|
|
+
|
|
+ return (PBX::PBXProductType)0;
|
|
+}
|
|
+
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/xcodegenerator.h b/src/plugins/generator/xcode/xcodegenerator.h
|
|
new file mode 100644
|
|
index 0000000..e2bc712
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/xcodegenerator.h
|
|
@@ -0,0 +1,53 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef QBS_XCODEGENERATOR_H
|
|
+#define QBS_XCODEGENERATOR_H
|
|
+
|
|
+#include <api/generator.h>
|
|
+#include "pbxproducttype.h"
|
|
+
|
|
+namespace qbs {
|
|
+
|
|
+class ProductData;
|
|
+
|
|
+class XcodeGenerator : public qbs::Generator
|
|
+{
|
|
+protected:
|
|
+ XcodeGenerator();
|
|
+
|
|
+public:
|
|
+ static QString xcodeExecutablePrefix(const ProductData &product);
|
|
+ static PBX::PBXProductType xcodeProductType(const ProductData &product);
|
|
+};
|
|
+
|
|
+}
|
|
+
|
|
+#endif // QBS_XCODEGENERATOR_H
|
|
diff --git a/src/plugins/generator/xcode/xcodenativegenerator.cpp b/src/plugins/generator/xcode/xcodenativegenerator.cpp
|
|
new file mode 100644
|
|
index 0000000..5457c3f
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/xcodenativegenerator.cpp
|
|
@@ -0,0 +1,136 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "xcodenativegenerator.h"
|
|
+
|
|
+#include <qbs.h>
|
|
+#include <logging/logger.h>
|
|
+#include <logging/translator.h>
|
|
+#include <pbx.h>
|
|
+
|
|
+#include <QDebug>
|
|
+#include <QDir>
|
|
+#include <QFileInfo>
|
|
+
|
|
+namespace qbs {
|
|
+
|
|
+using namespace Internal;
|
|
+
|
|
+XcodeNativeGenerator::XcodeNativeGenerator()
|
|
+{
|
|
+}
|
|
+
|
|
+QString XcodeNativeGenerator::generatorName() const
|
|
+{
|
|
+ return QLatin1String("xcode");
|
|
+}
|
|
+
|
|
+void XcodeNativeGenerator::generate(const Project &project)
|
|
+{
|
|
+ const QString buildDirectory = project.projectData().buildDirectory();
|
|
+ QDir dir(buildDirectory);
|
|
+ Q_ASSERT(dir.isAbsolute() && dir.exists());
|
|
+
|
|
+ const QString &projectFileName = project.projectData().name() + QLatin1String(".xcodeproj");
|
|
+ if (!dir.cd(projectFileName))
|
|
+ if (!dir.mkdir(projectFileName) || !dir.cd(projectFileName))
|
|
+ throw ErrorInfo(Tr::tr("failed to make project directory"));
|
|
+
|
|
+ PBXProject xcodeProject(dir.absoluteFilePath(QLatin1String("project.pbxproj")));
|
|
+ xcodeProject.setName(project.projectData().name());
|
|
+ xcodeProject.setProjectDirPath(project.projectData().location().fileName());
|
|
+ xcodeProject.buildConfigurationList()->addBuildConfiguration(QLatin1String("Debug"));
|
|
+ xcodeProject.buildConfigurationList()->addBuildConfiguration(QLatin1String("Release"));
|
|
+
|
|
+ // Add all the Qbs products as Xcode targets
|
|
+ foreach (const ProductData &product, project.projectData().allProducts())
|
|
+ {
|
|
+ PBXLegacyTarget *xcodeTarget = new PBXLegacyTarget(&xcodeProject);
|
|
+ xcodeTarget->setName(product.name());
|
|
+ xcodeTarget->setProductType(xcodeProductType(product));
|
|
+ xcodeTarget->setBuildToolPath(QCoreApplication::applicationFilePath()); // TODO: Probably not a good idea...
|
|
+ xcodeTarget->setBuildArgumentsString(QLatin1String("$(ACTION) -f \"") + project.projectData().location().fileName() + QLatin1String("\" -p \"") + product.name() + QLatin1String("\""));
|
|
+ xcodeTarget->setBuildWorkingDirectory(xcodeProject.projectDirPath());
|
|
+ xcodeTarget->buildConfigurationList()->addBuildConfiguration(QLatin1String("Debug"));
|
|
+ xcodeTarget->buildConfigurationList()->addBuildConfiguration(QLatin1String("Release"));
|
|
+
|
|
+ // Create a root PBX group for the target's files and other groups
|
|
+ PBXGroup *xcodeProductGroup = PBXGroup::groupWithName(product.name(), xcodeProject.rootGroup());
|
|
+
|
|
+ // Set up all the groups
|
|
+ foreach (const GroupData &groupData, product.groups())
|
|
+ {
|
|
+ PBXGroup *group = xcodeProductGroup;
|
|
+ if (groupData.name() == product.name()) {
|
|
+ // This group has the same name as the product itself so we'll just add the files
|
|
+ // directly to the "product" group we created earlier instead of creating a new one
|
|
+ //populateXcodeTargetProperties(xcodeTarget, product, groupData);
|
|
+ } else {
|
|
+ // Create a group for this group
|
|
+ group = PBXGroup::groupWithName(groupData.name(), xcodeProductGroup);
|
|
+ }
|
|
+
|
|
+ // Add the source files to the group
|
|
+ group->setSourceTree(PBX::Group);
|
|
+ //populateXcodeGroup(&xcodeProject, group, groupData, xcodeTarget);
|
|
+ }
|
|
+
|
|
+ // TODO: find a way to decide which target artifact becomes the target's product reference
|
|
+ Q_ASSERT(product.targetArtifacts().size() <= 1);
|
|
+
|
|
+ // Add references for each target artifact in root "Products" group
|
|
+ foreach (const TargetArtifact &artifact, product.targetArtifacts())
|
|
+ {
|
|
+ QList<PBXFileReference *> refs = xcodeProject.productRefGroup()->addFiles(QStringList() << artifact.filePath(), false, false);
|
|
+ foreach (PBXFileReference *ref, refs)
|
|
+ {
|
|
+ ref->setSourceTree(PBX::BuildProductDir);
|
|
+
|
|
+ // reason for the assert <= 1
|
|
+ xcodeTarget->setProductReference(ref);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ xcodeProject.addTarget(xcodeTarget);
|
|
+ }
|
|
+
|
|
+ // TODO: For some reason this property confuses Xcode. Seems to indicate the path that relative
|
|
+ // paths are resolved against, but maybe it's referring to the .xcodeproj?
|
|
+ // We'll use the root group instead to get what we want
|
|
+ xcodeProject.rootGroup()->setPath(xcodeProject.projectDirPath());
|
|
+ xcodeProject.setProjectDirPath("");
|
|
+
|
|
+ if (xcodeProject.writeToFileSystemProjectFile(true, true, true))
|
|
+ qDebug() << "Generated" << qPrintable(projectFileName);
|
|
+ else
|
|
+ throw ErrorInfo(Tr::tr("Failed to generate %1").arg(projectFileName));
|
|
+}
|
|
+
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/xcodenativegenerator.h b/src/plugins/generator/xcode/xcodenativegenerator.h
|
|
new file mode 100644
|
|
index 0000000..d964b94
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/xcodenativegenerator.h
|
|
@@ -0,0 +1,53 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef QBS_XCODENATIVEGENERATOR_H
|
|
+#define QBS_XCODENATIVEGENERATOR_H
|
|
+
|
|
+#include "xcodegenerator.h"
|
|
+#include <QString>
|
|
+
|
|
+namespace qbs {
|
|
+
|
|
+class Project;
|
|
+
|
|
+class XcodeNativeGenerator : public XcodeGenerator
|
|
+{
|
|
+public:
|
|
+ XcodeNativeGenerator();
|
|
+
|
|
+ QString generatorName() const;
|
|
+
|
|
+ void generate(const Project &project);
|
|
+};
|
|
+
|
|
+}
|
|
+
|
|
+#endif // QBS_XCODENATIVEGENERATOR_H
|
|
diff --git a/src/plugins/generator/xcode/xcodesimplegenerator.cpp b/src/plugins/generator/xcode/xcodesimplegenerator.cpp
|
|
new file mode 100644
|
|
index 0000000..306d46d
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/xcodesimplegenerator.cpp
|
|
@@ -0,0 +1,275 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#include "xcodesimplegenerator.h"
|
|
+
|
|
+#include <qbs.h>
|
|
+#include <logging/logger.h>
|
|
+#include <logging/translator.h>
|
|
+#include <pbx.h>
|
|
+
|
|
+#include <QDebug>
|
|
+#include <QDir>
|
|
+#include <QFileInfo>
|
|
+
|
|
+namespace qbs {
|
|
+
|
|
+using namespace Internal;
|
|
+
|
|
+struct XcodeSetting {
|
|
+ QString xcodeName;
|
|
+ QString qbsModule;
|
|
+ QString qbsName;
|
|
+ bool isList;
|
|
+
|
|
+ XcodeSetting(const QString &xcodeName, const QString &qbsModule,
|
|
+ const QString &qbsName, bool isList);
|
|
+};
|
|
+
|
|
+XcodeSetting::XcodeSetting(const QString &xcodeName, const QString &qbsModule,
|
|
+ const QString &qbsName, bool isList = false)
|
|
+ : xcodeName(xcodeName), qbsModule(qbsModule), qbsName(qbsName), isList(isList)
|
|
+{
|
|
+}
|
|
+
|
|
+XcodeSimpleGenerator::XcodeSimpleGenerator()
|
|
+{
|
|
+}
|
|
+
|
|
+QString XcodeSimpleGenerator::generatorName() const
|
|
+{
|
|
+ return QLatin1String("xcode-simple");
|
|
+}
|
|
+
|
|
+QList<XcodeSetting> xcodeSettingsMap()
|
|
+{
|
|
+ const QString cpp = QLatin1String("cpp");
|
|
+
|
|
+ QList<XcodeSetting> settings;
|
|
+ settings += XcodeSetting(QLatin1String("GCC_PREPROCESSOR_DEFINITIONS"), cpp, QLatin1String("defines"), true);
|
|
+ settings += XcodeSetting(QLatin1String("HEADER_SEARCH_PATHS"), cpp, QLatin1String("includePaths"), true);
|
|
+ settings += XcodeSetting(QLatin1String("MACOSX_DEPLOYMENT_TARGET"), cpp, QLatin1String("minimumOsxVersion"));
|
|
+ settings += XcodeSetting(QLatin1String("OTHER_LDFLAGS"), cpp, QLatin1String("linkerFlags"), true);
|
|
+ return settings;
|
|
+}
|
|
+
|
|
+static void populateXcodeTargetProperties(PBXNativeTarget *xcodeTarget, const qbs::ProductData &productData, const qbs::GroupData &groupData)
|
|
+{
|
|
+ // Get the "target name" (Qbs terminology) and use it to set the "product name" (Xcode terminology)
|
|
+ xcodeTarget->setProductName(groupData.properties().getProperty(QLatin1String("targetName")).toString());
|
|
+ if (xcodeTarget->productName().isEmpty())
|
|
+ xcodeTarget->setProductName(xcodeTarget->name());
|
|
+ xcodeTarget->setBuildSetting(QLatin1String("PRODUCT_NAME"), xcodeTarget->productName());
|
|
+
|
|
+ QString exePrefix = XcodeGenerator::xcodeExecutablePrefix(productData);
|
|
+ if (!exePrefix.isEmpty())
|
|
+ xcodeTarget->setBuildSetting(QLatin1String("EXECUTABLE_PREFIX"), exePrefix);
|
|
+
|
|
+ QString architecture = groupData.properties().getModuleProperty(QLatin1String("qbs"), QLatin1String("architecture")).toString();
|
|
+ if (!architecture.isEmpty()) {
|
|
+ QString arch = architecture;
|
|
+ if (arch == QLatin1String("x86"))
|
|
+ arch = QLatin1String("i386");
|
|
+
|
|
+ xcodeTarget->setBuildSetting(QLatin1String("ARCHS"), arch);
|
|
+ }
|
|
+
|
|
+ QString sysroot = groupData.properties().getModuleProperty(QLatin1String("qbs"), QLatin1String("sysroot")).toString();
|
|
+ if (!sysroot.isEmpty()) {
|
|
+ xcodeTarget->setBuildSetting(QLatin1String("SDKROOT"), sysroot);
|
|
+ }
|
|
+
|
|
+ QStringList platform = groupData.properties().getModulePropertiesAsStringList(QLatin1String("qbs"), QLatin1String("targetOS"));
|
|
+ if (platform.contains(QLatin1String("osx"))) {
|
|
+ if (sysroot.isEmpty())
|
|
+ xcodeTarget->setBuildSetting(QLatin1String("SDKROOT"), QLatin1String("macosx"));
|
|
+ xcodeTarget->setBuildSetting(QLatin1String("SUPPORTED_PLATFORMS"), QStringList() << QLatin1String("macosx"));
|
|
+ } else if (platform.contains(QLatin1String("ios"))) {
|
|
+ if (sysroot.isEmpty())
|
|
+ xcodeTarget->setBuildSetting(QLatin1String("SDKROOT"), QLatin1String("iphoneos"));
|
|
+ xcodeTarget->setBuildSetting(QLatin1String("SUPPORTED_PLATFORMS"), QStringList() << QLatin1String("iphonesimulator") << QLatin1String("iphoneos"));
|
|
+ } else {
|
|
+ throw ErrorInfo(Tr::tr("Unsupported platform for Xcode project: [%1]").arg(platform.join(QLatin1String(","))));
|
|
+ }
|
|
+
|
|
+ foreach (const XcodeSetting &setting, xcodeSettingsMap()) {
|
|
+ if (setting.isList) {
|
|
+ QVariantList list = groupData.properties().getModuleProperties(setting.qbsModule, setting.qbsName);
|
|
+ if (!list.isEmpty()) {
|
|
+ const QString inheritProperty = QLatin1String("$(") + setting.xcodeName + QLatin1String(")");
|
|
+ list.append(inheritProperty);
|
|
+ xcodeTarget->setBuildSetting(setting.xcodeName, list);
|
|
+ }
|
|
+ } else {
|
|
+ const QVariant variant = groupData.properties().getModuleProperty(setting.qbsModule, setting.qbsName);
|
|
+ if (!variant.isNull()) {
|
|
+ xcodeTarget->setBuildSetting(setting.xcodeName, variant);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+}
|
|
+
|
|
+static void populateXcodeGroup(PBXProject *xcodeProject, PBXGroup *xcodeGroup, const qbs::GroupData &groupData, PBXTarget *xcodeTarget)
|
|
+{
|
|
+ QString rootPath = xcodeProject->projectDirPath();
|
|
+ if (!rootPath.endsWith(QLatin1Char('/')))
|
|
+ rootPath += QLatin1Char('/');
|
|
+
|
|
+ QStringList relativeFilePaths;
|
|
+ foreach (QString filePath, groupData.allFilePaths()) {
|
|
+ if (filePath.startsWith(rootPath))
|
|
+ filePath.remove(0, rootPath.size());
|
|
+ relativeFilePaths += filePath;
|
|
+ }
|
|
+
|
|
+ // Add all the files in the group as file references so they show up in the project tree
|
|
+ QList<PBXFileReference *> fileRefs = xcodeGroup->addFiles(relativeFilePaths, false, false);
|
|
+ foreach (PBXFileReference *ref, fileRefs) {
|
|
+ if (!ref->path().startsWith(QLatin1Char('/'))) {
|
|
+ ref->setSourceTree(PBX::Group);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ // If the group is enabled, then we'll actually BUILD them in addition to merely listing them
|
|
+ if (groupData.isEnabled())
|
|
+ {
|
|
+ foreach (PBXFileReference *ref, fileRefs)
|
|
+ xcodeTarget->defaultSourceCodeBuildPhase()->addReference(ref);
|
|
+ }
|
|
+
|
|
+ //group->setPath(groupData.properties().getProperty(QLatin1String("prefix")).toString());
|
|
+ //qDebug() << groupData.properties().allProperties();
|
|
+}
|
|
+
|
|
+void XcodeSimpleGenerator::generate(const Project &project)
|
|
+{
|
|
+ const QString buildDirectory = project.projectData().buildDirectory();
|
|
+ QDir dir(buildDirectory);
|
|
+ Q_ASSERT(dir.isAbsolute() && dir.exists());
|
|
+
|
|
+ const QString &projectFileName = project.projectData().name() + QLatin1String(".xcodeproj");
|
|
+ if (!dir.cd(projectFileName))
|
|
+ if (!dir.mkdir(projectFileName) || !dir.cd(projectFileName))
|
|
+ throw ErrorInfo(Tr::tr("failed to make project directory"));
|
|
+
|
|
+ PBXProject xcodeProject(dir.absoluteFilePath(QLatin1String("project.pbxproj")));
|
|
+ xcodeProject.setName(project.projectData().name());
|
|
+ xcodeProject.setProjectDirPath(project.projectData().location().fileName());
|
|
+ xcodeProject.buildConfigurationList()->addBuildConfiguration(QLatin1String("Debug"));
|
|
+ xcodeProject.buildConfigurationList()->addBuildConfiguration(QLatin1String("Release"));
|
|
+
|
|
+ // Add all the Qbs products as Xcode targets
|
|
+ foreach (const ProductData &product, project.projectData().allProducts())
|
|
+ {
|
|
+ PBXNativeTarget *xcodeTarget = new PBXNativeTarget(&xcodeProject);
|
|
+ xcodeTarget->setName(product.name());
|
|
+ xcodeTarget->setProductType(xcodeProductType(product));
|
|
+ xcodeTarget->buildConfigurationList()->addBuildConfiguration(QLatin1String("Debug"));
|
|
+ xcodeTarget->buildConfigurationList()->addBuildConfiguration(QLatin1String("Release"));
|
|
+
|
|
+ // Create a root PBX group for the target's files and other groups
|
|
+ PBXGroup *xcodeProductGroup = PBXGroup::groupWithName(product.name(), xcodeProject.rootGroup());
|
|
+
|
|
+ // Set up all the groups
|
|
+ foreach (const GroupData &groupData, product.groups())
|
|
+ {
|
|
+ PBXGroup *group = xcodeProductGroup;
|
|
+ if (groupData.name() == product.name()) {
|
|
+ // This group has the same name as the product itself so we'll just add the files
|
|
+ // directly to the "product" group we created earlier instead of creating a new one
|
|
+ populateXcodeTargetProperties(xcodeTarget, product, groupData);
|
|
+ } else {
|
|
+ // Create a group for this group
|
|
+ group = PBXGroup::groupWithName(groupData.name(), xcodeProductGroup);
|
|
+ }
|
|
+
|
|
+ // Add the source files to the group
|
|
+ group->setSourceTree(PBX::Group);
|
|
+ populateXcodeGroup(&xcodeProject, group, groupData, xcodeTarget);
|
|
+ }
|
|
+
|
|
+ // TODO: find a way to decide which target artifact becomes the target's product reference
|
|
+ Q_ASSERT(product.targetArtifacts().size() <= 1);
|
|
+
|
|
+ // Add references for each target artifact in root "Products" group
|
|
+ foreach (const TargetArtifact &artifact, product.targetArtifacts())
|
|
+ {
|
|
+ // Chop off the Qbs build dir from the artifact path, because they will actually end
|
|
+ // up in Xcode's build directory, not the build directory Qbs would use
|
|
+ QString realArtifactPath = artifact.filePath();
|
|
+ if (realArtifactPath.startsWith(buildDirectory))
|
|
+ realArtifactPath.remove(0, buildDirectory.size());
|
|
+
|
|
+ if (realArtifactPath.startsWith(QLatin1Char('/')))
|
|
+ realArtifactPath.remove(0, 1);
|
|
+
|
|
+ QList<PBXFileReference *> refs = xcodeProject.productRefGroup()->addFiles(QStringList() << realArtifactPath, false, false);
|
|
+ foreach (PBXFileReference *ref, refs)
|
|
+ {
|
|
+ ref->setSourceTree(PBX::BuildProductDir);
|
|
+
|
|
+ // reason for the assert <= 1
|
|
+ xcodeTarget->setProductReference(ref);
|
|
+ }
|
|
+ }
|
|
+
|
|
+ xcodeProject.addTarget(xcodeTarget);
|
|
+ }
|
|
+
|
|
+ QMapIterator<QString, QVariant> i(project.projectConfiguration());
|
|
+ while (i.hasNext())
|
|
+ {
|
|
+ i.next();
|
|
+ QString moduleName = i.key();
|
|
+ QVariantMap moduleProperties = i.value().toMap();
|
|
+
|
|
+ QMapIterator<QString, QVariant> j(moduleProperties);
|
|
+ while (j.hasNext())
|
|
+ {
|
|
+ j.next();
|
|
+ QString propertyName = j.key();
|
|
+ QVariant propertyValue = j.value();
|
|
+ // Do stuff with project properties...
|
|
+ }
|
|
+ }
|
|
+
|
|
+ // TODO: For some reason this property confuses Xcode. Seems to indicate the path that relative
|
|
+ // paths are resolved against, but maybe it's referring to the .xcodeproj?
|
|
+ // We'll use the root group instead to get what we want
|
|
+ xcodeProject.rootGroup()->setPath(xcodeProject.projectDirPath());
|
|
+ xcodeProject.setProjectDirPath("");
|
|
+
|
|
+ if (xcodeProject.writeToFileSystemProjectFile(true, true, true))
|
|
+ qDebug() << "Generated" << qPrintable(projectFileName);
|
|
+ else
|
|
+ throw ErrorInfo(Tr::tr("Failed to generate %1").arg(projectFileName));
|
|
+}
|
|
+
|
|
+}
|
|
diff --git a/src/plugins/generator/xcode/xcodesimplegenerator.h b/src/plugins/generator/xcode/xcodesimplegenerator.h
|
|
new file mode 100644
|
|
index 0000000..e5cce26
|
|
--- /dev/null
|
|
+++ b/src/plugins/generator/xcode/xcodesimplegenerator.h
|
|
@@ -0,0 +1,53 @@
|
|
+/****************************************************************************
|
|
+**
|
|
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
+** Copyright (C) 2014 Petroules Corporation.
|
|
+** Contact: http://www.qt-project.org/legal
|
|
+**
|
|
+** This file is part of the Qt Build Suite.
|
|
+**
|
|
+** 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 Digia. For licensing terms and
|
|
+** conditions see http://qt.digia.com/licensing. For further information
|
|
+** use the contact form at http://qt.digia.com/contact-us.
|
|
+**
|
|
+** GNU Lesser General Public License Usage
|
|
+** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
+** General Public License version 2.1 as published by the Free Software
|
|
+** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
+** packaging of this file. Please review the following information to
|
|
+** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
+**
|
|
+** In addition, as a special exception, Digia gives you certain additional
|
|
+** rights. These rights are described in the Digia Qt LGPL Exception
|
|
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
+**
|
|
+****************************************************************************/
|
|
+
|
|
+#ifndef QBS_XCODESIMPLEGENERATOR_H
|
|
+#define QBS_XCODESIMPLEGENERATOR_H
|
|
+
|
|
+#include "xcodegenerator.h"
|
|
+#include <QString>
|
|
+
|
|
+namespace qbs {
|
|
+
|
|
+class Project;
|
|
+
|
|
+class XcodeSimpleGenerator : public XcodeGenerator
|
|
+{
|
|
+public:
|
|
+ XcodeSimpleGenerator();
|
|
+
|
|
+ QString generatorName() const;
|
|
+
|
|
+ void generate(const Project &project);
|
|
+};
|
|
+
|
|
+}
|
|
+
|
|
+#endif // QBS_XCODESIMPLEGENERATOR_H
|
|
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
|
|
index d3823ae..9fe2e6b 100644
|
|
--- a/src/plugins/plugins.pro
|
|
+++ b/src/plugins/plugins.pro
|
|
@@ -1,2 +1,2 @@
|
|
TEMPLATE = subdirs
|
|
-SUBDIRS = scanner
|
|
+SUBDIRS = generator scanner
|
|
--
|
|
2.3.5
|
|
|