detect.py 1.5 KB

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