jcomp.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*##############################################################################
  2. Copyright (C) 2011 HPCC Systems.
  3. All rights reserved. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ############################################################################## */
  14. #ifndef JCOMP_HPP
  15. #define JCOMP_HPP
  16. #include "jlib.hpp"
  17. #include "jmisc.hpp"
  18. enum CompilerType
  19. {
  20. Vs6CppCompiler = 0,
  21. GccCppCompiler = 1,
  22. MaxCompiler
  23. };
  24. const char * const compilerTypeText[MaxCompiler] = {"vs6", "gcc" };
  25. #ifdef _WIN32
  26. #define DEFAULT_COMPILER Vs6CppCompiler
  27. #else
  28. #define DEFAULT_COMPILER GccCppCompiler
  29. #endif
  30. extern jlib_decl void setCompilerPath(const char * path, const char *ipath, const char *lpath, const char * tmpdir, bool verbose);
  31. extern jlib_decl void setCompilerPath(const char * path, const char *ipath, const char *lpath, const char * tmpdir, CompilerType compiler, bool verbose);
  32. extern jlib_decl bool fileIsOlder(const char *dest, const char *src);
  33. interface ICppCompiler : public IInterface
  34. {
  35. public:
  36. virtual void addCompileOption(const char * option) = 0;
  37. virtual void addDefine(const char * symbolName, const char * value = NULL) = 0;
  38. virtual void addLibrary(const char * libName) = 0;
  39. virtual void addLibraryPath(const char * libPath) = 0;
  40. virtual void addInclude(const char * includePath) = 0;
  41. virtual void addLinkOption(const char * option) = 0;
  42. virtual void addSourceFile(const char * filename) = 0;
  43. virtual bool compile() = 0;
  44. virtual void setDebug(bool _debug) = 0;
  45. virtual void setDebugLibrary(bool _debug) = 0;
  46. virtual void setOnlyCompile(bool _onlyCompile) = 0;
  47. virtual void setCreateExe(bool _createExe) = 0;
  48. virtual void setOptimizeLevel(unsigned level) = 0;
  49. virtual void setTargetBitLength(unsigned bitlength) = 0;
  50. virtual void setMaxCompileThreads(const unsigned max) = 0;
  51. virtual void setCCLogPath(const char* path) = 0;
  52. virtual void setSaveTemps(bool _save) = 0;
  53. virtual void setAbortChecker(IAbortRequestCallback * abortChecker) = 0;
  54. };
  55. extern jlib_decl ICppCompiler * createCompiler(const char * coreName, const char * sourceDir = NULL, const char * targetDir = NULL, bool verbose = true);
  56. extern jlib_decl ICppCompiler * createCompiler(const char * coreName, const char * sourceDir, const char * targetDir, CompilerType compiler, bool verbose);
  57. #endif