| 1 | // This may look like C code, but it is really -*- C++ -*-
 | 
|---|
| 2 | // Gestionnaire de compilation-linker C++ - R. Ansari 10/2000
 | 
|---|
| 3 | // LAL (Orsay) / IN2P3-CNRS  DAPNIA/SPP (Saclay) / CEA
 | 
|---|
| 4 | 
 | 
|---|
| 5 | #ifndef CXXCOMPILERLINKER_SEEN
 | 
|---|
| 6 | #define CXXCOMPILERLINKER_SEEN
 | 
|---|
| 7 | 
 | 
|---|
| 8 | #include "machdefs.h"
 | 
|---|
| 9 | #include <string>
 | 
|---|
| 10 | 
 | 
|---|
| 11 | 
 | 
|---|
| 12 | namespace SOPHYA {
 | 
|---|
| 13 | 
 | 
|---|
| 14 | //! C++ compiler - linker
 | 
|---|
| 15 |  
 | 
|---|
| 16 | class CxxCompilerLinker {
 | 
|---|
| 17 | public:
 | 
|---|
| 18 |   CxxCompilerLinker(bool fglibsophya=true, bool fglibextsophya=true, 
 | 
|---|
| 19 |                                           bool fglibpi=false);  
 | 
|---|
| 20 |   virtual               ~CxxCompilerLinker();
 | 
|---|
| 21 | 
 | 
|---|
| 22 |   virtual int           Compile(string const & name, string & oname);
 | 
|---|
| 23 |   virtual int           BuildSO(string const & oname, string & soname);
 | 
|---|
| 24 | 
 | 
|---|
| 25 |   //! Adds compilation options \c opt . Appended to the present option string.
 | 
|---|
| 26 |   inline void           AddCompileOptions(string const & opt)
 | 
|---|
| 27 |   { compOptions += " " + opt; }
 | 
|---|
| 28 |   //! Sets the compilation options.
 | 
|---|
| 29 |   inline void           SetCompileOptions(string const & opt = "")
 | 
|---|
| 30 |   { compOptions = opt; }
 | 
|---|
| 31 |   //! Returns the currently defined compilation options.
 | 
|---|
| 32 |   inline string         GetCompileOptions()
 | 
|---|
| 33 |   { return compOptions; }
 | 
|---|
| 34 | 
 | 
|---|
| 35 |   //! Adds link options \c opt . Appended to the present option string.
 | 
|---|
| 36 |   inline void           AddLinkOptions(string const & opt)
 | 
|---|
| 37 |   { linkOptions += " " + opt; }
 | 
|---|
| 38 |   //! Sets the link options.
 | 
|---|
| 39 |   inline void           SetLinkOptions(string const & opt = "")
 | 
|---|
| 40 |   { linkOptions = opt; }
 | 
|---|
| 41 |   inline string         GetLinkOptions()
 | 
|---|
| 42 |   //! Returns the currently defined link options.
 | 
|---|
| 43 |   { return linkOptions; }
 | 
|---|
| 44 | 
 | 
|---|
| 45 |   //! Sets the temporary directory path.
 | 
|---|
| 46 |   inline void           SetTmpDir(string const & tmpdir)
 | 
|---|
| 47 |   { tmpDir = tmpdir; }
 | 
|---|
| 48 |   //! returns the currently defined temporary directory path.
 | 
|---|
| 49 |   inline string         GetTmpDir()
 | 
|---|
| 50 |   { return tmpDir; }
 | 
|---|
| 51 |   
 | 
|---|
| 52 |   //! Activate (or deactivate) the verbose mode.
 | 
|---|
| 53 |   inline void           SetVerbose(bool fg=false)
 | 
|---|
| 54 |   { verbose = fg; }
 | 
|---|
| 55 | 
 | 
|---|
| 56 | protected :
 | 
|---|
| 57 |   string  tmpDir;
 | 
|---|
| 58 |   string  compCmd;
 | 
|---|
| 59 |   string  linkCmd;
 | 
|---|
| 60 |   string  compOptions;
 | 
|---|
| 61 |   string  linkOptions;
 | 
|---|
| 62 |   string  cppFlags;  
 | 
|---|
| 63 |   bool    verbose;
 | 
|---|
| 64 | };
 | 
|---|
| 65 | 
 | 
|---|
| 66 | } // namespace SOPHYA
 | 
|---|
| 67 | 
 | 
|---|
| 68 | #endif
 | 
|---|