platforms.nim 4.3 KB

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