Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

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

Download this file

Project.hpp    110 lines (96 with data), 4.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
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
/*========================================================================
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; }
const std::string& LibraryFilePath() const { return libraryFilePath; }
const std::string& AssemblyFilePath() const { return assemblyFilePath; }
void SetAssemblyFilePath(const std::string& assemblyFilePath_);
void SetExecutableFileName(const std::string& executableFileName_);
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_);
void AddCSourceFilePath(const std::string& cSourceFilePath_);
void AddTextFilePath(const std::string& textFilePath_);
void AddBitCodeFilePath(const std::string& bitCodeFilePathy);
bool IsUpToDate() const;
const std::vector<std::string>& SourceFilePaths() const { return sourceFilePaths; }
const std::vector<std::string>& AsmSourceFilePaths() const { return asmSourceFilePaths; }
const std::vector<std::string>& CSourceFilePaths() const { return cSourceFilePaths; }
void CompileCFiles(const std::string& optimizationLevel);
void GenerateCode(const std::string& optimizationLevel, bool generateNativeAssemblySourceCode, bool printIrCodeAfterEachPass, const std::string& config);
void GenerateLibraryFile(const std::set<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; }
void AddLibrary(LibraryPtr library);
LibraryPtr GetLibrary(const std::string& libraryName) const;
void Clean();
private:
bool disposed;
std::string name;
std::string filePath;
std::string config;
path base;
path outputBase;
Target target;
std::string libraryFilePath;
std::string assemblyFilePath;
path executablePath;
std::string executableFilePath;
typedef std::map<std::string, ConfigurationPtr> ConfigurationMap;
typedef ConfigurationMap::const_iterator ConfigurationMapIt;
ConfigurationMap configurations;
std::vector<std::string> libraryReferencePaths;
std::vector<std::string> objectFilePaths;
std::vector<std::string> sourceFilePaths;
std::vector<std::string> asmSourceFilePaths;
std::vector<std::string> cSourceFilePaths;
std::vector<std::string> textFilePaths;
std::vector<std::string> bitCodeFilePaths;
std::vector<LibraryPtr> libraries;
typedef std::map<std::string, LibraryPtr> LibraryMap;
typedef LibraryMap::const_iterator LibraryMapIt;
LibraryMap libraryMap;
std::set<ProjectPtr> dependents;
TemplateRepositoryPtr templateRepository;
bool ExecutableUpToDate() const;
};
bool GeneratingLibraryDeclarations();
ProjectPtr GetCurrentProject();
void SetCurrentProject(ProjectPtr project);
} } // namespace Cm::Core
#endif // CM_CORE_PROJECT_INCLUDED