platforms.nim 5.0 KB

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