config.nims 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. when defined(emscripten):
  2. import std/compilesettings
  3. import strformat
  4. # This path will only run if -d:emscripten is passed to nim.
  5. --nimcache:tmp # Store intermediate files close by in the ./tmp dir.
  6. --os:linux # Emscripten pretends to be linux.
  7. --cpu:wasm32 # Emscripten is 32bits.
  8. --cc:clang # Emscripten is very close to clang, so we ill replace it.
  9. when defined(windows):
  10. --clang.exe:emcc.bat # Replace C
  11. --clang.linkerexe:emcc.bat # Replace C linker
  12. --clang.cpp.exe:emcc.bat # Replace C++
  13. --clang.cpp.linkerexe:emcc.bat # Replace C++ linker.
  14. else:
  15. --clang.exe:emcc # Replace C
  16. --clang.linkerexe:emcc # Replace C linker
  17. --clang.cpp.exe:emcc # Replace C++
  18. --clang.cpp.linkerexe:emcc # Replace C++ linker.
  19. --listCmd # List what commands we are running so that we can debug them.
  20. --gc:orc # GC:arc is friendlier with crazy platforms.
  21. --exceptions:goto # Goto exceptions are friendlier with crazy platforms.
  22. --define:noSignalHandler # Emscripten doesn't support signal handlers.
  23. --dynlibOverride:SDL2
  24. when defined(opengl):
  25. --dynlibOverride:opengl
  26. --define:emscripten
  27. # Pass this to Emscripten linker to generate html file scaffold for us.
  28. const projName = projectName()
  29. const userSetOutFile = querySetting(SingleValueSetting.outFile)
  30. const outFile = if userSetOutFile == "": &"{projName}.html" else: userSetOutFile
  31. when defined(debug):
  32. switch("passL", &"-o {outFile} --shell-file nico_minimal.html -lidbfs.js -s ASSERTIONS=1 -s USE_SDL=2 -s FORCE_FILESYSTEM=1 -s ALLOW_MEMORY_GROWTH -s EXPORTED_FUNCTIONS=[\"_main\",\"_initConfigDone\"] -s EXPORTED_RUNTIME_METHODS=[\"ccall\",\"cwrap\",\"print\"] -O0 --preload-file assets")
  33. else:
  34. switch("passL", &"-o {outFile} --shell-file nico_minimal.html -lidbfs.js -s ASSERTIONS=1 -s USE_SDL=2 -s FORCE_FILESYSTEM=1 -s ALLOW_MEMORY_GROWTH -s EXPORTED_FUNCTIONS=[\"_main\",\"_initConfigDone\"] -s EXPORTED_RUNTIME_METHODS=[\"ccall\",\"cwrap\",\"print\"] -O3 --preload-file assets")
  35. # begin Nimble config (version 2)
  36. when withDir(thisDir(), system.fileExists("nimble.paths")):
  37. include "nimble.paths"
  38. # end Nimble config