platforms.nim 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #
  2. #
  3. # Nim's Runtime Library
  4. # (c) Copyright 2015 Andreas Rumpf
  5. #
  6. # See the file "copying.txt", included in this
  7. # distribution, for details about the copyright.
  8. #
  9. ## Platform detection for NimScript. This module is included by the system module!
  10. ## Do not import it directly!
  11. type
  12. CpuPlatform* {.pure.} = enum ## the CPU this program will run on.
  13. none, ## unknown CPU
  14. i386, ## 32 bit x86 compatible CPU
  15. m68k, ## M68k based processor
  16. alpha, ## Alpha processor
  17. powerpc, ## 32 bit PowerPC
  18. powerpc64, ## 64 bit PowerPC
  19. powerpc64el, ## Little Endian 64 bit PowerPC
  20. sparc, ## Sparc based processor
  21. sparc64, ## 64-bit Sparc based processor
  22. ia64, ## Intel Itanium
  23. amd64, ## x86_64 (AMD64); 64 bit x86 compatible CPU
  24. mips, ## Mips based processor
  25. mipsel, ## Little Endian Mips based processor
  26. mips64, ## 64-bit MIPS processor
  27. mips64el, ## Little Endian 64-bit MIPS processor
  28. arm, ## ARM based processor
  29. arm64, ## ARM64 based processor
  30. vm, ## Some Virtual machine: Nim's VM or JavaScript
  31. avr, ## AVR based processor
  32. msp430, ## TI MSP430 microcontroller
  33. riscv64 ## RISC-V 64-bit processor
  34. wasm32 ## WASM, 32-bit
  35. OsPlatform* {.pure.} = enum ## the OS this program will run on.
  36. none, dos, windows, os2, linux, morphos, skyos, solaris,
  37. irix, netbsd, freebsd, openbsd, aix, palmos, qnx, amiga,
  38. atari, netware, macos, macosx, haiku, android, js, nimVM,
  39. standalone, nintendoswitch
  40. const
  41. targetOS* = when defined(windows): OsPlatform.windows
  42. elif defined(dos): OsPlatform.dos
  43. elif defined(os2): OsPlatform.os2
  44. elif defined(linux): OsPlatform.linux
  45. elif defined(morphos): OsPlatform.morphos
  46. elif defined(skyos): OsPlatform.skyos
  47. elif defined(solaris): OsPlatform.solaris
  48. elif defined(irix): OsPlatform.irix
  49. elif defined(netbsd): OsPlatform.netbsd
  50. elif defined(freebsd): OsPlatform.freebsd
  51. elif defined(openbsd): OsPlatform.openbsd
  52. elif defined(aix): OsPlatform.aix
  53. elif defined(palmos): OsPlatform.palmos
  54. elif defined(qnx): OsPlatform.qnx
  55. elif defined(amiga): OsPlatform.amiga
  56. elif defined(atari): OsPlatform.atari
  57. elif defined(netware): OsPlatform.netware
  58. elif defined(macosx): OsPlatform.macosx
  59. elif defined(macos): OsPlatform.macos
  60. elif defined(haiku): OsPlatform.haiku
  61. elif defined(android): OsPlatform.android
  62. elif defined(js): OsPlatform.js
  63. elif defined(nimVM): OsPlatform.nimVM
  64. elif defined(standalone): OsPlatform.standalone
  65. elif defined(nintendoswitch): OsPlatform.nintendoswitch
  66. else: OsPlatform.none
  67. ## the OS this program will run on.
  68. targetCPU* = when defined(i386): CpuPlatform.i386
  69. elif defined(m68k): CpuPlatform.m68k
  70. elif defined(alpha): CpuPlatform.alpha
  71. elif defined(powerpc): CpuPlatform.powerpc
  72. elif defined(powerpc64): CpuPlatform.powerpc64
  73. elif defined(powerpc64el): CpuPlatform.powerpc64el
  74. elif defined(sparc): CpuPlatform.sparc
  75. elif defined(sparc64): CpuPlatform.sparc64
  76. elif defined(ia64): CpuPlatform.ia64
  77. elif defined(amd64): CpuPlatform.amd64
  78. elif defined(mips): CpuPlatform.mips
  79. elif defined(mipsel): CpuPlatform.mipsel
  80. elif defined(mips64): CpuPlatform.mips64
  81. elif defined(mips64el): CpuPlatform.mips64el
  82. elif defined(arm): CpuPlatform.arm
  83. elif defined(arm64): CpuPlatform.arm64
  84. elif defined(vm): CpuPlatform.vm
  85. elif defined(avr): CpuPlatform.avr
  86. elif defined(msp430): CpuPlatform.msp430
  87. elif defined(riscv64): CpuPlatform.riscv64
  88. elif defined(wasm32): CpuPlatform.wasm32
  89. else: CpuPlatform.none
  90. ## the CPU this program will run on.