clewTest.cpp 842 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // clewTest.cpp : Defines the entry point for the console application.
  2. //
  3. #include "clew.h"
  4. #include <stdio.h>
  5. int main(int argc, char* argv[])
  6. {
  7. int result = -1;
  8. #ifdef _WIN32
  9. const char* cl = "OpenCL.dll";
  10. #elif defined __APPLE__
  11. const char* cl = "/System/Library/Frameworks/OpenCL.framework/Versions/Current/OpenCL";
  12. #else//presumable Linux?
  13. //linux (tested on Ubuntu 12.10 with Catalyst 13.4 beta drivers, not that there is no symbolic link from libOpenCL.so
  14. const char* cl = "libOpenCL.so.1";
  15. result = clewInit(cl);
  16. if (result != CLEW_SUCCESS)
  17. {
  18. cl = "libOpenCL.so";
  19. } else
  20. {
  21. clewExit();
  22. }
  23. #endif
  24. result = clewInit(cl);
  25. if (result!=CLEW_SUCCESS)
  26. printf("clewInit failed with error code %d\n",result);
  27. else
  28. {
  29. printf("clewInit succesfull using %s\n",cl);
  30. //some test and then
  31. clewExit();
  32. }
  33. return 0;
  34. }