platforms.nim 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. OsPlatform* {.pure.} = enum ## the OS this program will run on.
  38. none, dos, windows, os2, linux, morphos, skyos, solaris,
  39. irix, netbsd, freebsd, openbsd, aix, palmos, qnx, amiga,
  40. atari, netware, macos, macosx, haiku, android, js, nimVM,
  41. standalone, nintendoswitch
  42. const
  43. targetOS* = when defined(windows): OsPlatform.windows
  44. elif defined(dos): OsPlatform.dos
  45. elif defined(os2): OsPlatform.os2
  46. elif defined(linux): OsPlatform.linux
  47. elif defined(morphos): OsPlatform.morphos
  48. elif defined(skyos): OsPlatform.skyos
  49. elif defined(solaris): OsPlatform.solaris
  50. elif defined(irix): OsPlatform.irix
  51. elif defined(netbsd): OsPlatform.netbsd
  52. elif defined(freebsd): OsPlatform.freebsd
  53. elif defined(openbsd): OsPlatform.openbsd
  54. elif defined(aix): OsPlatform.aix
  55. elif defined(palmos): OsPlatform.palmos
  56. elif defined(qnx): OsPlatform.qnx
  57. elif defined(amiga): OsPlatform.amiga
  58. elif defined(atari): OsPlatform.atari
  59. elif defined(netware): OsPlatform.netware
  60. elif defined(macosx): OsPlatform.macosx
  61. elif defined(macos): OsPlatform.macos
  62. elif defined(haiku): OsPlatform.haiku
  63. elif defined(android): OsPlatform.android
  64. elif defined(js): OsPlatform.js
  65. elif defined(nimVM): OsPlatform.nimVM
  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. else: CpuPlatform.none
  94. ## the CPU this program will run on.