detect.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. ('theora','no'), #use builtin openssl
  20. ]
  21. def configure(env):
  22. env.Append(CPPPATH=['#platform/server'])
  23. if (env["use_llvm"]=="yes"):
  24. env["CC"]="clang"
  25. env["CXX"]="clang++"
  26. env["LD"]="clang++"
  27. if (env["colored"]=="yes"):
  28. if sys.stdout.isatty():
  29. env.Append(CXXFLAGS=["-fcolor-diagnostics"])
  30. is64=sys.maxsize > 2**32
  31. if (env["bits"]=="default"):
  32. if (is64):
  33. env["bits"]="64"
  34. else:
  35. env["bits"]="32"
  36. #if (env["tools"]=="no"):
  37. # #no tools suffix
  38. # env['OBJSUFFIX'] = ".nt"+env['OBJSUFFIX']
  39. # env['LIBSUFFIX'] = ".nt"+env['LIBSUFFIX']
  40. if (env["target"]=="release"):
  41. env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer'])
  42. elif (env["target"]=="release_debug"):
  43. env.Append(CCFLAGS=['-O2','-ffast-math','-DDEBUG_ENABLED'])
  44. elif (env["target"]=="debug"):
  45. env.Append(CCFLAGS=['-g2', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
  46. env.Append(CPPFLAGS=['-DSERVER_ENABLED','-DUNIX_ENABLED'])
  47. env.Append(LIBS=['pthread','z']) #TODO detect linux/BSD!
  48. if (env["CXX"]=="clang++"):
  49. env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
  50. env["CC"]="clang"
  51. env["LD"]="clang++"