build_config.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // This file is part of Desktop App Toolkit,
  2. // a set of libraries for developing nice desktop applications.
  3. //
  4. // For license and copyright information please follow this link:
  5. // https://github.com/desktop-app/legal/blob/master/LEGAL
  6. //
  7. #pragma once
  8. #include <stdint.h>
  9. // thanks Chromium
  10. // Compiler detection.
  11. #if defined(__clang__)
  12. #define COMPILER_CLANG 1
  13. #elif defined(__GNUC__) // __clang__
  14. #define COMPILER_GCC 1
  15. #elif defined(_MSC_VER) // __clang__ || __GNUC__
  16. #define COMPILER_MSVC 1
  17. #endif // _MSC_VER || __clang__ || __GNUC__
  18. // Processor architecture detection.
  19. #if defined(_M_X64) || defined(__x86_64__)
  20. #define ARCH_CPU_X86_FAMILY 1
  21. #define ARCH_CPU_X86_64 1
  22. #elif defined(_M_IX86) || defined(__i386__)
  23. #define ARCH_CPU_X86_FAMILY 1
  24. #define ARCH_CPU_X86 1
  25. #endif
  26. // _LP64 is defined by GCC, others by MSVC
  27. #if defined _LP64 || defined _M_X64 || defined _M_ARM64 || defined _M_ALPHA
  28. #define ARCH_CPU_64_BITS 1
  29. #else
  30. #define ARCH_CPU_32_BITS 1
  31. #endif
  32. #if defined(__GNUC__)
  33. #define TG_FORCE_INLINE inline __attribute__((always_inline))
  34. #elif defined(_MSC_VER)
  35. #define TG_FORCE_INLINE __forceinline
  36. #else
  37. #define TG_FORCE_INLINE inline
  38. #endif
  39. #include <climits>
  40. static_assert(CHAR_BIT == 8, "Not supported char size.");