X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Ftools%2Frbuild%2Frbuild.h;h=f6b9df7edf8781eea7590a3bbfedfdbe49430bfd;hp=20c9899f2fdafe2643640e64136f0620843cecd5;hb=3802b8636c17bc1915a2bdc9ad8672efe11c27af;hpb=03e2b1ec91eba81d49f3673c7af9c5db58c0027a diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h index 20c9899f2fd..f6b9df7edf8 100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@ -35,9 +35,13 @@ #endif/*WIN32*/ #endif/*_MSC_VER*/ +#include + #include "ssprintf.h" #include "exception.h" -#include "XML.h" +#include "xml.h" + +class Backend; // forward declaration typedef std::vector string_list; @@ -66,6 +70,7 @@ extern char cBadSep; #define MS_VS_DEF_VERSION "7.10" +class Directory; class Project; class IfableData; class Module; @@ -92,10 +97,38 @@ class PchFile; class StubbedComponent; class StubbedSymbol; class CompilationUnit; +class FileLocation; +class AutoRegister; class SourceFileTest; +typedef std::map directory_map; + +class Directory +{ +public: + std::string name; + directory_map subdirs; + Directory ( const std::string& name ); + void Add ( const char* subdir ); + void GenerateTree ( const std::string& parent, + bool verbose ); + std::string EscapeSpaces ( std::string path ); + void CreateRule ( FILE* f, + const std::string& parent ); +private: + bool mkdir_p ( const char* path ); + std::string ReplaceVariable ( std::string name, + std::string value, + std::string path ); + std::string GetEnvironmentVariable ( const std::string& name ); + void ResolveVariablesInPath ( char* buf, + std::string path ); + bool CreateDirectory ( std::string path ); +}; + + class Configuration { public: @@ -105,10 +138,13 @@ public: bool CleanAsYouGo; bool AutomaticDependencies; bool CheckDependenciesForModuleOnly; + bool CompilationUnitsEnabled; std::string CheckDependenciesForModuleOnlyModule; std::string VSProjectVersion; + std::string VSConfigurationType; bool MakeHandlesInstallDirectories; bool GenerateProxyMakefilesInSourceTree; + bool InstallFiles; }; class Environment @@ -149,31 +185,39 @@ public: std::vector defines; std::vector libraries; std::vector properties; + std::vector modules; std::vector compilerFlags; std::vector ifs; ~IfableData(); void ProcessXML(); + void ExtractModules( std::vector &modules ); }; class Project { std::string xmlfile; XMLElement *node, *head; + Backend* _backend; public: + const Configuration& configuration; std::string name; std::string makefile; XMLIncludes xmlbuildfiles; - std::vector modules; std::vector linkerFlags; std::vector cdfiles; std::vector installfiles; + std::vector modules; IfableData non_if_data; - Project ( const std::string& filename ); + Project ( const Configuration& configuration, + const std::string& filename ); ~Project (); + void SetBackend ( Backend* backend ) { _backend = backend; } + Backend& GetBackend() { return *_backend; } void WriteConfigurationFile (); void ExecuteInvocations (); + void ProcessXML ( const std::string& path ); Module* LocateModule ( const std::string& name ); const Module* LocateModule ( const std::string& name ) const; @@ -218,7 +262,8 @@ enum ModuleType Test = 15, RpcServer = 16, RpcClient = 17, - Alias = 18 + Alias = 18, + BootProgram = 19 }; enum HostType @@ -239,12 +284,14 @@ public: std::string extension; std::string entrypoint; std::string baseaddress; + std::string payload; std::string path; ModuleType type; ImportLibrary* importLibrary; bool mangledSymbols; bool isUnicode; Bootstrap* bootstrap; + AutoRegister* autoRegister; IfableData non_if_data; std::vector invocations; std::vector dependencies; @@ -277,6 +324,7 @@ public: std::string GetBasePath () const; // "path" std::string GetPath () const; // "path/foo.exe" std::string GetPathWithPrefix ( const std::string& prefix ) const; // "path/prefixfoo.exe" + std::string GetPathToBaseDir() const; // "../" offset to rootdirectory void GetTargets ( string_list& ) const; std::string GetInvocationTarget ( const int index ) const; bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const; @@ -353,7 +401,6 @@ public: bool _isPreCompiledHeader ); void ProcessXML(); - bool IsGeneratedFile () const; }; @@ -788,16 +835,93 @@ private: class CompilationUnit { public: - const Project& project; + const Project* project; const Module* module; - const XMLElement& node; + const XMLElement* node; + std::string name; std::vector files; - CompilationUnit ( const Project& project, + CompilationUnit ( File* file ); + CompilationUnit ( const Project* project, const Module* module, - const XMLElement& node ); + const XMLElement* node ); ~CompilationUnit (); void ProcessXML(); + bool IsGeneratedFile () const; + bool HasFileWithExtension ( const std::string& extension ) const; + bool IsFirstFile () const; + FileLocation* GetFilename ( Directory* intermediateDirectory ) const; + std::string GetSwitches () const; +}; + + +class CompilationUnitSupportCode +{ +public: + const Project& project; + + CompilationUnitSupportCode ( const Project& project ); + ~CompilationUnitSupportCode (); + void Generate ( bool verbose ); +private: + void GenerateForModule ( Module& module, + bool verbose ); + std::string GetCompilationUnitFilename ( Module& module, + CompilationUnit& compilationUnit ); + void WriteCompilationUnitFile ( Module& module, + CompilationUnit& compilationUnit ); +}; + + +class FileLocation +{ +public: + Directory* directory; + std::string filename; + FileLocation ( Directory* directory, + std::string filename ); +}; + + +enum AutoRegisterType +{ + DllRegisterServer, + DllInstall, + Both +}; + +class AutoRegister +{ +public: + const Project& project; + const Module* module; + const XMLElement& node; + std::string infSection; + AutoRegisterType type; + AutoRegister ( const Project& project_, + const Module* module_, + const XMLElement& node_ ); + ~AutoRegister (); + void ProcessXML(); +private: + bool IsSupportedModuleType ( ModuleType type ); + AutoRegisterType GetAutoRegisterType( std::string type ); + void Initialize (); +}; + + +class SysSetupGenerator +{ +public: + const Project& project; + SysSetupGenerator ( const Project& project ); + ~SysSetupGenerator (); + void Generate (); +private: + std::string GetDirectoryId ( const Module& module ); + std::string GetFlags ( const Module& module ); + void Generate ( HINF inf, + const Module& module ); }; @@ -810,6 +934,11 @@ Right ( const std::string& s, size_t n ); extern std::string Replace ( const std::string& s, const std::string& find, const std::string& with ); +extern std::string +ChangeSeparator ( const std::string& s, + const char fromSeparator, + const char toSeparator ); + extern std::string FixSeparator ( const std::string& s ); @@ -842,4 +971,7 @@ GetFilename ( const std::string& filename ); extern std::string NormalizeFilename ( const std::string& filename ); +extern std::string +ToLower ( std::string filename ); + #endif /* __RBUILD_H */