platforms.nim 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. hppa, ## HP PA-RISC
  23. ia64, ## Intel Itanium
  24. amd64, ## x86_64 (AMD64); 64 bit x86 compatible CPU
  25. mips, ## Mips based processor
  26. mipsel, ## Little Endian Mips based processor
  27. mips64, ## 64-bit MIPS processor
  28. mips64el, ## Little Endian 64-bit MIPS processor
  29. arm, ## ARM based processor
  30. arm64, ## ARM64 based processor
  31. vm, ## Some Virtual machine: Nim's VM or JavaScript
  32. avr, ## AVR based processor
  33. msp430, ## TI MSP430 microcontroller
  34. riscv32, ## RISC-V 32-bit processor
  35. riscv64, ## RISC-V 64-bit processor
  36. wasm32, ## WASM, 32-bit
  37. e2k, ## MCST Elbrus 2000
  38. loongarch64 ## LoongArch 64-bit processor
  39. OsPlatform* {.pure.} = enum ## the OS this program will run on.
  40. none, dos, windows, os2, linux, morphos, skyos, solaris,
  41. irix, netbsd, freebsd, openbsd, aix, palmos, qnx, amiga,
  42. atari, netware, macos, macosx, haiku, android, js, standalone, nintendoswitch
  43. const
  44. targetOS* = when defined(windows): OsPlatform.windows
  45. elif defined(dos): OsPlatform.dos
  46. elif defined(os2): OsPlatform.os2
  47. elif defined(linux): OsPlatform.linux
  48. elif defined(morphos): OsPlatform.morphos
  49. elif defined(skyos): OsPlatform.skyos
  50. elif defined(solaris): OsPlatform.solaris
  51. elif defined(irix): OsPlatform.irix
  52. elif defined(netbsd): OsPlatform.netbsd
  53. elif defined(freebsd): OsPlatform.freebsd
  54. elif defined(openbsd): OsPlatform.openbsd
  55. elif defined(aix): OsPlatform.aix
  56. elif defined(palmos): OsPlatform.palmos
  57. elif defined(qnx): OsPlatform.qnx
  58. elif defined(amiga): OsPlatform.amiga
  59. elif defined(atari): OsPlatform.atari
  60. elif defined(netware): OsPlatform.netware
  61. elif defined(macosx): OsPlatform.macosx
  62. elif defined(macos): OsPlatform.macos
  63. elif defined(haiku): OsPlatform.haiku
  64. elif defined(android): OsPlatform.android
  65. elif defined(js): OsPlatform.js
  66. elif defined(standalone): OsPlatform.standalone
  67. elif defined(nintendoswitch): OsPlatform.nintendoswitch
  68. else: OsPlatform.none
  69. ## the OS this program will run on.
  70. targetCPU* = when defined(i386): CpuPlatform.i386
  71. elif defined(m68k): CpuPlatform.m68k
  72. elif defined(alpha): CpuPlatform.alpha
  73. elif defined(powerpc): CpuPlatform.powerpc
  74. elif defined(powerpc64): CpuPlatform.powerpc64
  75. elif defined(powerpc64el): CpuPlatform.powerpc64el
  76. elif defined(sparc): CpuPlatform.sparc
  77. elif defined(sparc64): CpuPlatform.sparc64
  78. elif defined(hppa): CpuPlatform.hppa
  79. elif defined(ia64): CpuPlatform.ia64
  80. elif defined(amd64): CpuPlatform.amd64
  81. elif defined(mips): CpuPlatform.mips
  82. elif defined(mipsel): CpuPlatform.mipsel
  83. elif defined(mips64): CpuPlatform.mips64
  84. elif defined(mips64el): CpuPlatform.mips64el
  85. elif defined(arm): CpuPlatform.arm
  86. elif defined(arm64): CpuPlatform.arm64
  87. elif defined(vm): CpuPlatform.vm
  88. elif defined(avr): CpuPlatform.avr
  89. elif defined(msp430): CpuPlatform.msp430
  90. elif defined(riscv32): CpuPlatform.riscv32
  91. elif defined(riscv64): CpuPlatform.riscv64
  92. elif defined(wasm32): CpuPlatform.wasm32
  93. elif defined(e2k): CpuPlatform.e2k
  94. elif defined(loongarch64): CpuPlatform.loongarch64
  95. else: CpuPlatform.none
  96. ## the CPU this program will run on.