hplatform.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef HW_PLATFORM_H_
  2. #define HW_PLATFORM_H_
  3. #ifdef _WIN32
  4. #define WIN32_LEAN_AND_MEAN
  5. #define _CRT_SECURE_NO_WARNINGS
  6. #define _CRT_NONSTDC_NO_DEPRECATE
  7. #include <winsock2.h>
  8. #include <windows.h>
  9. #include <process.h> // for getpid,exec
  10. #include <direct.h> // for mkdir,rmdir,chdir,getcwd
  11. #define strcasecmp stricmp
  12. #define strncasecmp strnicmp
  13. #else
  14. #include <unistd.h> // for daemon
  15. #include <dirent.h> // for mkdir,rmdir,chdir,getcwd
  16. #include <sys/time.h> // for gettimeofday
  17. #include <pthread.h>
  18. #include <strings.h>
  19. #define stricmp strcasecmp
  20. #define strnicmp strncasecmp
  21. #endif
  22. #ifdef _MSC_VER
  23. typedef int pid_t;
  24. typedef int gid_t;
  25. typedef int uid_t;
  26. #endif
  27. #ifdef __GNUC__
  28. #define GNUC_ALIGN(n) __attribute__((aligned(n)))
  29. #else
  30. #define GNUC_ALIGN(n)
  31. #endif
  32. #include <sys/types.h>
  33. #include <sys/stat.h>
  34. #include <signal.h>
  35. #ifdef __unix__
  36. #define MKDIR(dir) mkdir(dir, 0777)
  37. #else
  38. #define MKDIR(dir) mkdir(dir)
  39. #endif
  40. #endif // HW_PLATFORM_H_