NCBI C++ Toolkit Cross Reference

  C++/src/build-system/project_tree_builder/msvc_makefile.hpp


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 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425
#ifndef PROJECT_TREE_BULDER__MSVC_MAKEFILE__HPP #define PROJECT_TREE_BULDER__MSVC_MAKEFILE__HPP /* $Id: msvc_makefile.hpp 57233 2013-02-19 14:41:19Z gouriano $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Author: Viatcheslav Gorelenkov * */ #include "ptb_registry.hpp" #include "proj_item.hpp" #include "msvc_prj_utils.hpp" #include <corelib/ncbiobj.hpp> #include <corelib/ncbienv.hpp> BEGIN_NCBI_SCOPE /// /// Interface of master msvc makefile class IMsvcMetaMakefile { public: virtual ~IMsvcMetaMakefile() {} virtual string GetConfigurationOpt (const string& opt, const SConfigInfo& config) const = 0; virtual string GetCompilerOpt (const string& opt, const SConfigInfo& config) const = 0; virtual string GetLinkerOpt (const string& opt, const SConfigInfo& config) const = 0; virtual string GetLibrarianOpt(const string& opt, const SConfigInfo& config) const = 0; virtual string GetResourceCompilerOpt (const string& opt, const SConfigInfo& config) const = 0; }; /// /// Interface of msvc project makefile class IMsvcProjectMakefile { public: virtual ~IMsvcProjectMakefile() {} virtual bool IsExcludeProject (bool default_val) const = 0; virtual void GetAdditionalSourceFiles (const SConfigInfo& config, list<string>* files) const = 0; virtual void GetAdditionalLIB (const SConfigInfo& config, list<string>* lib_ids) const = 0; virtual void GetExcludedSourceFiles (const SConfigInfo& config, list<string>* files) const = 0; virtual void GetExcludedLIB (const SConfigInfo& config, list<string>* lib_ids) const = 0; virtual void GetAdditionalIncludeDirs (const SConfigInfo& config, list<string>* files) const = 0; virtual void GetHeadersInInclude (const SConfigInfo& config, list<string>* files) const = 0; virtual void GetHeadersInSrc (const SConfigInfo& config, list<string>* files) const = 0; virtual void GetInlinesInInclude (const SConfigInfo& config, list<string>* files) const = 0; virtual void GetInlinesInSrc (const SConfigInfo& config, list<string>* files) const = 0; virtual void GetCustomBuildInfo (list<SCustomBuildInfo>* info) const = 0; virtual void GetResourceFiles (const SConfigInfo& config, list<string>* files) const = 0; virtual void GetExtraFiles (map<string, list<string> >* files) const = 0; }; ///////////////////////////////////////////////////////////////////////////// /// /// CMsvcMetaMakefile -- /// /// Abstraction of global settings for building of C++ projects. /// /// Provides information about default compiler, linker and librarian /// settinngs. class CMsvcMetaMakefile : public CObject, public IMsvcMetaMakefile { public: CMsvcMetaMakefile(const string& file_path); bool IsEmpty (void) const; static string TranslateOpt(const string& value, const string& section, const string& opt); static string TranslateCommand(const string& value); // IMsvcMetaMakefile virtual string GetConfigurationOpt (const string& opt, const SConfigInfo& config) const; virtual string GetCompilerOpt (const string& opt, const SConfigInfo& config) const; virtual string GetLinkerOpt (const string& opt, const SConfigInfo& config) const; virtual string GetLibrarianOpt(const string& opt, const SConfigInfo& config) const; virtual string GetResourceCompilerOpt (const string& opt, const SConfigInfo& config) const; string GetConfigOpt( const string& section, const string& opt, const SConfigInfo& config) const; bool IsPchEnabled (void) const; string GetUsePchThroughHeader (const string& project_id, const string& source_file_full_path, const string& tree_src_dir) const; string GetPchUsageDefine (void) const; string GetDefaultPch(void) const { return GetPchInfo().m_DefaultPch; } protected: CPtbRegistry m_MakeFile; string m_MakeFileBaseDir; string m_FilePath; struct SPchInfo { bool m_UsePch; typedef map<string, string> TSubdirPchfile; TSubdirPchfile m_PchUsageMap; typedef list<string> TDontUsePch; TDontUsePch m_DontUsePchList; string m_DefaultPch; string m_PchUsageDefine; }; const SPchInfo& GetPchInfo(void) const; private: auto_ptr<SPchInfo> m_PchInfo; CMsvcMetaMakefile(const CMsvcMetaMakefile&); CMsvcMetaMakefile& operator= (const CMsvcMetaMakefile&); }; ///////////////////////////////////////////////////////////////////////////// /// /// CMsvcProjectMakefile -- /// /// Abstraction of project MSVC specific settings /// /// Provides information about project include/exclude to build, /// additional/excluded files and project specific compiler, linker /// and librarian settinngs. class CMsvcProjectMakefile : public CMsvcMetaMakefile, public IMsvcProjectMakefile { public: CMsvcProjectMakefile(const string& file_path, bool compound=false); string GetGUID(void) const; bool Redefine(const string& value, list<string>& redef) const; bool Redefine(const list<string>& value, list<string>& redef) const; void Append( list<string>& values, const string& def) const; void Append( list<string>& values, const list<string>& def) const; // IMsvcProjectMakefile virtual bool IsExcludeProject (bool default_val) const; virtual void GetAdditionalSourceFiles(const SConfigInfo& config, list<string>* files) const; virtual void GetAdditionalLIB (const SConfigInfo& config, list<string>* lib_ids) const; virtual void GetExcludedSourceFiles (const SConfigInfo& config, list<string>* files) const; virtual void GetExcludedLIB (const SConfigInfo& config, list<string>* lib_ids) const; virtual void GetAdditionalIncludeDirs(const SConfigInfo& config, list<string>* files) const; virtual void GetHeadersInInclude (const SConfigInfo& config, list<string>* files) const; virtual void GetHeadersInSrc (const SConfigInfo& config, list<string>* files) const; virtual void GetInlinesInInclude (const SConfigInfo& config, list<string>* files) const; virtual void GetInlinesInSrc (const SConfigInfo& config, list<string>* files) const; virtual void GetCustomBuildInfo (list<SCustomBuildInfo>* info) const; virtual void GetResourceFiles (const SConfigInfo& config, list<string>* files) const; virtual void GetExtraFiles (map<string, list<string> >* files) const; void GetCustomScriptInfo (SCustomScriptInfo& info) const; string m_ProjectBaseDir; bool m_Compound; // ie, consists of hosted components (DLL) private: void x_GetHeaders(const SConfigInfo& config, const string& entry, list<string>* files) const; //Prohibited to CMsvcProjectMakefile(void); CMsvcProjectMakefile(const CMsvcProjectMakefile&); CMsvcProjectMakefile& operator= (const CMsvcProjectMakefile&); }; /// /// Abstraction of rule for generation of project settings /// based on component usage class CMsvcProjectRuleMakefile : public CMsvcProjectMakefile { public: CMsvcProjectRuleMakefile(const string& file_path, bool compound); int GetRulePriority(const SConfigInfo& config) const; private: //Prohibited to CMsvcProjectRuleMakefile(void); CMsvcProjectRuleMakefile(const CMsvcProjectRuleMakefile&); CMsvcProjectRuleMakefile& operator= (const CMsvcProjectRuleMakefile&); }; /// /// Combining of rules and project makefile class CMsvcCombinedProjectMakefile : public IMsvcMetaMakefile, public IMsvcProjectMakefile { public: CMsvcCombinedProjectMakefile(CProjItem::TProjType project_type, const CMsvcProjectMakefile* project_makefile, const string& rules_basedir, const list<string> requires_list); virtual ~CMsvcCombinedProjectMakefile(void); // IMsvcMetaMakefile virtual string GetConfigurationOpt (const string& opt, const SConfigInfo& config) const; virtual string GetCompilerOpt (const string& opt, const SConfigInfo& config) const; virtual string GetLinkerOpt (const string& opt, const SConfigInfo& config) const; virtual string GetLibrarianOpt(const string& opt, const SConfigInfo& config) const; virtual string GetResourceCompilerOpt (const string& opt, const SConfigInfo& config) const; // IMsvcProjectMakefile virtual bool IsExcludeProject (bool default_val) const; virtual void GetAdditionalSourceFiles(const SConfigInfo& config, list<string>* files) const; virtual void GetAdditionalLIB (const SConfigInfo& config, list<string>* lib_ids) const; virtual void GetExcludedSourceFiles (const SConfigInfo& config, list<string>* files) const; virtual void GetExcludedLIB (const SConfigInfo& config, list<string>* lib_ids) const; virtual void GetAdditionalIncludeDirs(const SConfigInfo& config, list<string>* files) const; virtual void GetHeadersInInclude (const SConfigInfo& config, list<string>* files) const; virtual void GetHeadersInSrc (const SConfigInfo& config, list<string>* files) const; virtual void GetInlinesInInclude (const SConfigInfo& config, list<string>* files) const; virtual void GetInlinesInSrc (const SConfigInfo& config, list<string>* files) const; virtual void GetCustomBuildInfo (list<SCustomBuildInfo>* info) const; virtual void GetResourceFiles (const SConfigInfo& config, list<string>* files) const; virtual void GetExtraFiles (map<string, list<string> >* files) const; void GetCustomScriptInfo (SCustomScriptInfo& info) const; private: typedef const CMsvcProjectMakefile* TProjectMakefile; TProjectMakefile m_ProjectMakefile; typedef CRef<CMsvcProjectRuleMakefile> TRule; typedef list<TRule> TRules; TRules m_Rules; //Prohibited to CMsvcCombinedProjectMakefile(void); CMsvcCombinedProjectMakefile(const CMsvcCombinedProjectMakefile&); CMsvcCombinedProjectMakefile& operator= (const CMsvcCombinedProjectMakefile&); }; /// Create project makefile name string CreateMsvcProjectMakefileName(const string& project_name, CProjItem::TProjType type); string CreateMsvcProjectMakefileName(const CProjItem& project); /// Get option with taking into account 2 makefiles : matafile and project_file /// Configuration string GetConfigurationOpt (const IMsvcMetaMakefile& meta_file, const IMsvcMetaMakefile& project_file, const string& opt, const SConfigInfo& config); /// Compiler string GetCompilerOpt (const IMsvcMetaMakefile& meta_file, const IMsvcMetaMakefile& project_file, const string& opt, const SConfigInfo& config); /// Linker string GetLinkerOpt (const IMsvcMetaMakefile& meta_file, const IMsvcMetaMakefile& project_file, const string& opt, const SConfigInfo& config); /// Librarian string GetLibrarianOpt (const IMsvcMetaMakefile& meta_file, const IMsvcMetaMakefile& project_file, const string& opt, const SConfigInfo& config); /// ResourceCompiler string GetResourceCompilerOpt(const IMsvcMetaMakefile& meta_file, const IMsvcMetaMakefile& project_file, const string& opt, const SConfigInfo& config); END_NCBI_SCOPE #endif //PROJECT_TREE_BULDER__MSVC_MAKEFILE__HPP

source navigation ]   [ diff markup ]   [ identifier search ]   [ freetext search ]   [ file search ]  

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.