jcomp.hpp 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef JCOMP_HPP
  14. #define JCOMP_HPP
  15. #include "jlib.hpp"
  16. #include "jmisc.hpp"
  17. enum CompilerType
  18. {
  19. Vs6CppCompiler = 0,
  20. GccCppCompiler = 1,
  21. MaxCompiler
  22. };
  23. const char * const compilerTypeText[MaxCompiler] = {"vs6", "gcc" };
  24. #ifdef _WIN32
  25. #define DEFAULT_COMPILER Vs6CppCompiler
  26. #else
  27. #define DEFAULT_COMPILER GccCppCompiler
  28. #endif
  29. extern jlib_decl void setCompilerPath(const char * path, const char *ipath, const char *lpath, const char * tmpdir, bool verbose);
  30. extern jlib_decl void setCompilerPath(const char * path, const char *ipath, const char *lpath, const char * tmpdir, CompilerType compiler, bool verbose);
  31. extern jlib_decl bool fileIsOlder(const char *dest, const char *src);
  32. interface ICppCompiler : public IInterface
  33. {
  34. public:
  35. virtual void addCompileOption(const char * option) = 0;
  36. virtual void addDefine(const char * symbolName, const char * value = NULL) = 0;
  37. virtual void addLibrary(const char * libName) = 0;
  38. virtual void addLibraryPath(const char * libPath) = 0;
  39. virtual void addInclude(const char * includePath) = 0;
  40. virtual void addLinkOption(const char * option) = 0;
  41. virtual void addSourceFile(const char * filename) = 0;
  42. virtual bool compile() = 0;
  43. virtual void extractErrors(IArrayOf<IError> & errors) = 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 setPrecompileHeader(bool _pch) = 0;
  54. virtual void setAbortChecker(IAbortRequestCallback * abortChecker) = 0;
  55. };
  56. extern jlib_decl ICppCompiler * createCompiler(const char * coreName, const char * sourceDir = NULL, const char * targetDir = NULL, bool verbose = true);
  57. extern jlib_decl ICppCompiler * createCompiler(const char * coreName, const char * sourceDir, const char * targetDir, CompilerType compiler, bool verbose);
  58. #endif