summaryrefslogtreecommitdiffstats
path: root/CCSource.cc
blob: 6158176a50d36666615c3a91da0ecaf89429afd4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include "CCSource.h"
#include "FileSystemUtilities.h"
#include "Project.h"
#include "ToolChain.h"

#include <vector>

CCSource::CCSource(const std::string& aName)
: Name(aName), ConsideredCompiling(false), CompiledCorrectly(false)
{
}

CCSource::~CCSource()
{
}

void CCSource::compilationFinished(bool Correctly)
{
	CompiledCorrectly = Correctly;
}

void CCSource::setName(const std::string& N)
{
	Name = N;
}

std::string CCSource::name() const
{
	return Name;
}

std::string CCSource::dependencyName() const
{
	return DependencyName;
}

void CCSource::setDependencyName(const std::string& n)
{
	DependencyName = n;
}

std::string CCSource::sourceName() const
{
	std::string SourceBase(configuration().sourcePath());
	if (Name.find(".") == std::string::npos)
		return pathAppend(SourceBase,Name + ".cc");
	return pathAppend(SourceBase,Name);
}

std::string CCSource::objectName() const
{
	return ObjectName;
}

void CCSource::setObjectName(const std::string& oName)
{
	ObjectName = oName;
}

bool CCSource::objectFileIsCorrect()
{
	return CompiledCorrectly;
}

ProcessController* CCSource::createNextTask()
{
	if (ConsideredCompiling)
		return 0;
	ConsideredCompiling = true;
	SharedPtr<ToolChain> Current(ToolChain::createByName(configuration().toolChain()));
	Current->initResultNames(*this);
	return Current->createCompilation(*this);
}

GeneratedCCSource::GeneratedCCSource(SharedPtr<Generator> aGen)
: CCSource(""), theGenerator(aGen->copy())
{
	setName(theGenerator->output());
}

ProcessController* GeneratedCCSource::createNextTask()
{
	if (theGenerator->ready())
		return CCSource::createNextTask();
	return theGenerator->createNextTask();
}