msvc_tools_implement.hpp
来自「ncbi源码」· HPP 代码 · 共 759 行 · 第 1/2 页
HPP
759 行
/* * =========================================================================== * PRODUCTION $Log: msvc_tools_implement.hpp,v $ * PRODUCTION Revision 1000.2 2004/06/16 17:05:10 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.14 * PRODUCTION * =========================================================================== */#ifndef PROJECT_TREE_BUILDER__TOOLS_IMPLEMENT__HPP#define PROJECT_TREE_BUILDER__TOOLS_IMPLEMENT__HPP/* $Id: msvc_tools_implement.hpp,v 1000.2 2004/06/16 17:05:10 gouriano Exp $ * =========================================================================== * * 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 <string>#include <app/project_tree_builder/msvc_project_context.hpp>#include <app/project_tree_builder/msvc_traits.hpp>#include <app/project_tree_builder/msvc_prj_utils.hpp>#include <corelib/ncbienv.hpp>BEGIN_NCBI_SCOPE/////////////////////////////////////////////////////////////////////////////////// CConfigurationImpl --////// Implementation of IConfiguration interface.////// Accepts trait class as a template parameter.template <class ConfTrait> class CConfigurationImpl : public IConfiguration{public: CConfigurationImpl( const string& output_directory, const string& configuration_name ) :m_OutputDirectory (output_directory), m_ConfigurationName(configuration_name) { } virtual string Name(void) const { return ConfigName(m_ConfigurationName); } virtual string OutputDirectory(void) const { return m_OutputDirectory; } virtual string IntermediateDirectory(void) const { return m_ConfigurationName; } virtual string ConfigurationType(void) const { return ConfTrait::ConfigurationType(); } virtual string CharacterSet(void) const { return "2"; }private: string m_OutputDirectory; string m_ConfigurationName; CConfigurationImpl(void); CConfigurationImpl(const CConfigurationImpl&); CConfigurationImpl& operator= (const CConfigurationImpl&);};static string s_GetDefaultPreprocessorDefinitions (const SConfigInfo& config, CMsvcPrjGeneralContext::TTargetType target_type){ string defines = config.m_Debug ? "_DEBUG;" : "NDEBUG;" ; switch (target_type) { case CMsvcPrjGeneralContext::eLib: defines += "WIN32;_LIB;"; break; case CMsvcPrjGeneralContext::eExe: defines += "WIN32;_CONSOLE;"; break; case CMsvcPrjGeneralContext::eDll: defines += "WIN32;_WINDOWS;_USRDLL;"; break; } return defines;}/////////////////////////////////////////////////////////////////////////////////// CCompilerToolImpl --////// Implementation of ICompilerTool interface.////// Uses msvc makefiles informationclass CCompilerToolImpl : public ICompilerTool{public: typedef CMsvcPrjGeneralContext::TTargetType TTargetType; CCompilerToolImpl(const string& additional_include_dirs, const IMsvcMetaMakefile& project_makefile, const string& runtimeLibraryOption, const IMsvcMetaMakefile& meta_makefile, const SConfigInfo& config, TTargetType target_type, const list<string>& defines) :m_AdditionalIncludeDirectories(additional_include_dirs), m_MsvcProjectMakefile (project_makefile), m_RuntimeLibraryOption (runtimeLibraryOption), m_MsvcMetaMakefile (meta_makefile), m_Config (config), m_TargetType (target_type), m_Defines (defines) { } virtual string Name(void) const { return "VCCLCompilerTool"; }#define SUPPORT_COMPILER_OPTION(opt) \ virtual string opt(void) const \ { \ return GetCompilerOpt(m_MsvcMetaMakefile, \ m_MsvcProjectMakefile, \ #opt, \ m_Config ); \ } SUPPORT_COMPILER_OPTION(Optimization) virtual string AdditionalIncludeDirectories(void) const { return m_AdditionalIncludeDirectories; } //SUPPORT_COMPILER_OPTION(PreprocessorDefinitions) virtual string PreprocessorDefinitions(void) const { string defines = s_GetDefaultPreprocessorDefinitions(m_Config, m_TargetType); ITERATE(list<string>, p, m_Defines) { const string& define = *p; defines += define; defines += ';'; } defines += GetCompilerOpt(m_MsvcMetaMakefile, m_MsvcProjectMakefile, "PreprocessorDefinitions", m_Config ); return defines; } SUPPORT_COMPILER_OPTION(MinimalRebuild) SUPPORT_COMPILER_OPTION(BasicRuntimeChecks) virtual string RuntimeLibrary(void) const { return m_RuntimeLibraryOption; } SUPPORT_COMPILER_OPTION(RuntimeTypeInfo) SUPPORT_COMPILER_OPTION(UsePrecompiledHeader) SUPPORT_COMPILER_OPTION(WarningLevel) SUPPORT_COMPILER_OPTION(Detect64BitPortabilityProblems) SUPPORT_COMPILER_OPTION(DebugInformationFormat) SUPPORT_COMPILER_OPTION(CompileAs) SUPPORT_COMPILER_OPTION(InlineFunctionExpansion) SUPPORT_COMPILER_OPTION(OmitFramePointers) SUPPORT_COMPILER_OPTION(StringPooling) SUPPORT_COMPILER_OPTION(EnableFunctionLevelLinking) //Latest additions SUPPORT_COMPILER_OPTION(OptimizeForProcessor) SUPPORT_COMPILER_OPTION(StructMemberAlignment) SUPPORT_COMPILER_OPTION(CallingConvention) SUPPORT_COMPILER_OPTION(IgnoreStandardIncludePath) SUPPORT_COMPILER_OPTION(ExceptionHandling) SUPPORT_COMPILER_OPTION(BufferSecurityCheck) SUPPORT_COMPILER_OPTION(DisableSpecificWarnings) SUPPORT_COMPILER_OPTION(UndefinePreprocessorDefinitions) SUPPORT_COMPILER_OPTION(AdditionalOptions) SUPPORT_COMPILER_OPTION(GlobalOptimizations) SUPPORT_COMPILER_OPTION(FavorSizeOrSpeed) SUPPORT_COMPILER_OPTION(BrowseInformation)private: string m_AdditionalIncludeDirectories; const IMsvcMetaMakefile& m_MsvcProjectMakefile; string m_RuntimeLibraryOption; const IMsvcMetaMakefile& m_MsvcMetaMakefile; SConfigInfo m_Config; list<string> m_Defines; TTargetType m_TargetType; // No value-type semantics CCompilerToolImpl(void); CCompilerToolImpl(const CCompilerToolImpl&); CCompilerToolImpl& operator= (const CCompilerToolImpl&);};/////////////////////////////////////////////////////////////////////////////////// CLinkerToolImpl --////// Implementation of ILinkerTool interface.////// Accepts trait classes as a template parameters.template <class ConfTrait > class CLinkerToolImpl : public ILinkerTool{public: CLinkerToolImpl(const string& additional_options, const string& additional_library_directories, const string& project_id, const IMsvcMetaMakefile& project_makefile, const IMsvcMetaMakefile& meta_makefile, const SConfigInfo& config) :m_AdditionalOptions (additional_options), m_AdditionalLibraryDirectories(additional_library_directories), m_ProjectId (project_id), m_MsvcProjectMakefile (project_makefile), m_MsvcMetaMakefile (meta_makefile), m_Config (config) { } virtual string Name(void) const { return "VCLinkerTool"; } virtual string AdditionalOptions(void) const { return m_AdditionalOptions + " " + GetLinkerOpt(m_MsvcMetaMakefile, m_MsvcProjectMakefile, "AdditionalOptions", m_Config ); } virtual string OutputFile(void) const { string output_file = GetLinkerOpt(m_MsvcMetaMakefile, m_MsvcProjectMakefile, "OutputFile", m_Config ); if( !output_file.empty() ) return output_file; return string("$(OutDir)/") + m_ProjectId + ConfTrait::TargetExtension(); }#define SUPPORT_LINKER_OPTION(opt) \ virtual string opt(void) const \ { \ return GetLinkerOpt(m_MsvcMetaMakefile, \ m_MsvcProjectMakefile, \ #opt, \ m_Config ); \ } SUPPORT_LINKER_OPTION(LinkIncremental) SUPPORT_LINKER_OPTION(GenerateDebugInformation) virtual string ProgramDatabaseFile(void) const { return string("$(OutDir)/") + m_ProjectId + ".pdb"; } SUPPORT_LINKER_OPTION(SubSystem) virtual string ImportLibrary(void) const { return string("$(OutDir)/") + m_ProjectId + ".lib"; } SUPPORT_LINKER_OPTION(TargetMachine) SUPPORT_LINKER_OPTION(OptimizeReferences) SUPPORT_LINKER_OPTION(EnableCOMDATFolding) SUPPORT_LINKER_OPTION(IgnoreAllDefaultLibraries) SUPPORT_LINKER_OPTION(IgnoreDefaultLibraryNames) virtual string AdditionalLibraryDirectories(void) const { return m_AdditionalLibraryDirectories; }private: string m_AdditionalOptions; string m_AdditionalLibraryDirectories; string m_ProjectId; SConfigInfo m_Config; const IMsvcMetaMakefile& m_MsvcProjectMakefile; const IMsvcMetaMakefile& m_MsvcMetaMakefile; CLinkerToolImpl(void); CLinkerToolImpl(const CLinkerToolImpl&); CLinkerToolImpl& operator= (const CLinkerToolImpl&);};#define SUPPORT_DUMMY_OPTION(opt) \ virtual string opt(void) const \ { \ return ""; \ }/////////////////////////////////////////////////////////////////////////////////// CLinkerToolDummyImpl --////// Implementation of ILinkerTool interface.////// Dummy (name-only) implementation.class CLinkerToolDummyImpl : public ILinkerTool // for LIB targets:{public: CLinkerToolDummyImpl() { } virtual string Name(void) const { return "VCLinkerTool"; } SUPPORT_DUMMY_OPTION(AdditionalOptions) SUPPORT_DUMMY_OPTION(OutputFile) SUPPORT_DUMMY_OPTION(LinkIncremental) SUPPORT_DUMMY_OPTION(GenerateDebugInformation) SUPPORT_DUMMY_OPTION(ProgramDatabaseFile) SUPPORT_DUMMY_OPTION(SubSystem) SUPPORT_DUMMY_OPTION(ImportLibrary) SUPPORT_DUMMY_OPTION(TargetMachine) SUPPORT_DUMMY_OPTION(OptimizeReferences) SUPPORT_DUMMY_OPTION(EnableCOMDATFolding) virtual string IgnoreAllDefaultLibraries(void) const
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?