detect.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import os
  2. import sys
  3. def is_active():
  4. return True
  5. def get_name():
  6. return "Server"
  7. def can_build():
  8. if (os.name!="posix"):
  9. return False
  10. return True # enabled
  11. def get_opts():
  12. return [
  13. ('use_llvm','Use llvm compiler','no'),
  14. ('force_32_bits','Force 32 bits binary','no')
  15. ]
  16. def get_flags():
  17. return [
  18. ('builtin_zlib', 'no'),
  19. ]
  20. def configure(env):
  21. env.Append(CPPPATH=['#platform/server'])
  22. if (env["use_llvm"]=="yes"):
  23. env["CC"]="clang"
  24. env["CXX"]="clang++"
  25. env["LD"]="clang++"
  26. if (env["colored"]=="yes"):
  27. if sys.stdout.isatty():
  28. env.Append(CXXFLAGS=["-fcolor-diagnostics"])
  29. is64=sys.maxsize > 2**32
  30. if (env["bits"]=="default"):
  31. if (is64):
  32. env["bits"]="64"
  33. else:
  34. env["bits"]="32"
  35. #if (env["tools"]=="no"):
  36. # #no tools suffix
  37. # env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
  38. # env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
  39. if (env["target"]=="release"):
  40. env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer'])
  41. elif (env["target"]=="release_debug"):
  42. env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
  43. elif (env["target"]=="debug"):
  44. env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
  45. env.Append(CPPFLAGS=['-DSERVER_ENABLED','-DUNIX_ENABLED'])
  46. env.Append(LIBS=['pthread','z']) #TODO detect linux/BSD!
  47. if (env["CXX"]=="clang++"):
  48. env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
  49. env["CC"]="clang"
  50. env["LD"]="clang++"