You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.4 KiB

  1. #include <iostream>
  2. #include "../../libShaderFile.hpp"
  3. #if _WIN64
  4. static const char* LibName = "..\..\..\libShaderFile-x86_64-win64.dll";
  5. #elif _WIN32
  6. static const char* LibName = "..\..\..\libShaderFile-i386-win32.dll";
  7. #elif __linux__ && (__amd64 || __x86_64 || _M_AMD64 || __ppc64__)
  8. static const char* LibName = "../../../libShaderFile-x86_64-linux.so";
  9. #elif __linux__ && (__i386 || _X86_)
  10. static const char* LibName = "../../../libShaderFile-i386-linux.so";
  11. #else
  12. # error 'unknown operation system'
  13. #endif
  14. int main(int argc, char **argv)
  15. {
  16. try
  17. {
  18. if (argc < 3)
  19. {
  20. std::cout << "error: expected input file and generator/class name as parameter" << std::endl;
  21. return 1;
  22. }
  23. // initialize library
  24. lsf::Library lib(LibName);
  25. // create and load shader file
  26. lsf::ShaderFile shaderFile(lib);
  27. shaderFile.loadFromFile(argv[1]);
  28. const lsf::Library& l = shaderFile.getLibrary();
  29. // get generator
  30. lsf::Generator generator(shaderFile, argv[2]);
  31. int i = 3;
  32. while (i < argc-1)
  33. {
  34. generator.setProperty(argv[i], argv[i+1]);
  35. i += 2;
  36. }
  37. std::cout << generator.generateCode() << std::endl;
  38. return 0;
  39. }
  40. catch(const std::exception& ex)
  41. {
  42. std::cout << "error: " << ex.what() << std::endl;
  43. return 2;
  44. }
  45. }