[r302]: cmajor++ / Cm / Cm.Core / Project.hpp Maximize Restore History

Download this file

Project.hpp    89 lines (76 with data), 3.7 kB

 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
87
88
/*========================================================================
Copyright (c) 2012-2013 Seppo Laakko
http://sourceforge.net/projects/cmajor/
Distributed under the GNU General Public License, version 3 (GPLv3).
(See accompanying LICENSE.txt or http://www.gnu.org/licenses/gpl.html)
========================================================================*/
#ifndef CM_CORE_PROJECT_INCLUDED
#define CM_CORE_PROJECT_INCLUDED
#include <Cm.Core/TemplateRepository.hpp>
#include <Cm.Core/Configuration.hpp>
#include <set>
#include <boost/filesystem.hpp>
namespace Cm { namespace Core {
class Object;
typedef std::shared_ptr<Object> ObjectPtr;
using boost::filesystem::path;
enum class Target
{
program, library
};
class Project;
typedef std::shared_ptr<Project> ProjectPtr;
class Project
{
public:
Project(const std::string& name_, const std::string& filePath_, const std::string& config_);
void Dispose();
const std::string& Name() const { return name; }
const path& BasePath() const { return base; }
const path& OutputBasePath() const { return outputBase; }
void SetTarget(Target target_) { target = target_; }
Target GetTarget() const { return target; }
void SetLibraryFilePath(const std::string& libraryFilePath_);
const std::string& LibraryFilePath() const { return libraryFilePath; }
const std::string& AssemblyFilePath() const { return assemblyFilePath; }
void SetAssemblyFilePath(const std::string& assemblyFilePath_);
void AddConfiguration(ConfigurationPtr config);
ConfigurationPtr GetConfiguration(const std::string& configName) const;
const std::vector<std::string>& LibraryReferencePaths() const { return libraryReferencePaths; }
void AddLibraryReferencePath(const std::string& libraryReferencePath);
void AddLibraryReferencePath(const std::string& libraryReferencePath, bool front);
void AddSourceFilePath(const std::string& sourceFilePath_);
void AddAsmSourceFilePath(const std::string& asmSourceFilePath_);
bool IsUpToDate() const;
bool ExecutableUpToDate(const std::string config) const;
const std::vector<std::string>& SourceFilePaths() const { return sourceFilePaths; }
const std::vector<std::string>& AsmSourceFilePaths() const { return asmSourceFilePaths; }
void GenerateCode(const std::string& optimizationLevel, bool generateNativeAssemblySourceCode, bool printIrCodeAfterEachPass, const std::string& config);
void GenerateLibraryFile(const std::vector<CompilationUnitPtr> compilationUnits);
void AddToDependents(ProjectPtr project) { dependents.insert(project); }
const std::set<ProjectPtr>& Dependents() const { return dependents; }
CompilationUnitPtr CreateMain();
CompilationUnitPtr CreateExceptionTable();
TemplateRepositoryPtr GetTemplateRepository() const { return templateRepository; }
private:
bool disposed;
std::string name;
std::string filePath;
std::string config;
path base;
path outputBase;
Target target;
std::string libraryFilePath;
std::string assemblyFilePath;
typedef std::map<std::string, ConfigurationPtr> ConfigurationMap;
typedef ConfigurationMap::const_iterator ConfigurationMapIt;
ConfigurationMap configurations;
std::vector<std::string> libraryReferencePaths;
std::vector<std::string> sourceFilePaths;
std::vector<std::string> asmSourceFilePaths;
std::set<ProjectPtr> dependents;
TemplateRepositoryPtr templateRepository;
};
bool GeneratingLibraryDeclarations();
} } // namespace Cm::Core
#endif // CM_CORE_PROJECT_INCLUDED