Home | History | Annotate | Download | only in MC
      1 //===- MCLDOptions.h ------------------------------------------------------===//
      2 //
      3 //                     The MCLinker Project
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 #ifndef MCLD_OPTIONS_H
     10 #define MCLD_OPTIONS_H
     11 #ifdef ENABLE_UNITTEST
     12 #include <gtest.h>
     13 #endif
     14 #include "mcld/Support/RealPath.h"
     15 #include "mcld/MC/SearchDirs.h"
     16 #include "mcld/Support/FileSystem.h"
     17 
     18 namespace mcld
     19 {
     20 class Input;
     21 
     22 /** \class ScriptOptions
     23  *
     24  */
     25 class ScriptOption
     26 {
     27 };
     28 
     29 /** \class GeneralOptions
     30  *  \brief GeneralOptions collects the options that not be one of the
     31  *     - input files
     32  *     - attribute of input files
     33  *     - script options
     34  */
     35 class GeneralOptions
     36 {
     37 public:
     38   /// default link script
     39   bool hasDefaultLDScript() const;
     40   const char* defaultLDScript() const;
     41   void setDefaultLDScript(const std::string& pFilename);
     42 
     43   /// sysroot
     44   const sys::fs::Path& sysroot() const
     45   { return m_Sysroot; }
     46 
     47   void setSysroot(const sys::fs::Path &pPath);
     48 
     49   /// search directory
     50   SearchDirs& directories()
     51   { return m_SearchDirs; }
     52 
     53   const SearchDirs& directories() const
     54   { return m_SearchDirs; }
     55 
     56   /// trace
     57   void setTrace(bool pEnableTrace = true)
     58   { m_bTrace = pEnableTrace; }
     59 
     60   bool trace() const
     61   { return m_bTrace; }
     62 
     63   void setVerbose(bool pVerbose = true)
     64   { m_bVerbose = pVerbose; }
     65 
     66   bool verbose() const
     67   { return m_bVerbose; }
     68 
     69   void setBsymbolic(bool pBsymbolic = false)
     70   { m_Bsymbolic = pBsymbolic; }
     71 
     72   bool Bsymbolic() const
     73   { return m_Bsymbolic; }
     74 
     75   bool hasEntry() const
     76   { return !m_Entry.empty(); }
     77 
     78   void setEntry(const std::string& pEntry)
     79   { m_Entry = pEntry; }
     80 
     81   const std::string& entry() const
     82   { return m_Entry; }
     83 
     84 private:
     85   Input* m_pDefaultBitcode;
     86   std::string m_DefaultLDScript;
     87   sys::fs::RealPath m_Sysroot;
     88   SearchDirs m_SearchDirs;
     89   bool m_bTrace;
     90   bool m_bVerbose;
     91   bool m_Bsymbolic;
     92   std::string m_Entry;
     93 };
     94 
     95 } // namespace of mcld
     96 
     97 #endif
     98 
     99