detect.py 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. import os
  2. import sys
  3. def is_active():
  4. return True
  5. def get_name():
  6. return "Haiku"
  7. def can_build():
  8. if (os.name != "posix" or sys.platform == "darwin"):
  9. return False
  10. return True
  11. def get_opts():
  12. from SCons.Variables import EnumVariable
  13. return [
  14. EnumVariable('debug_symbols', 'Add debugging symbols to release builds', 'yes', ('yes', 'no', 'full')),
  15. ]
  16. def get_flags():
  17. return [
  18. ]
  19. def configure(env):
  20. ## Build type
  21. if (env["target"] == "release"):
  22. env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
  23. if (env["debug_symbols"] == "yes"):
  24. env.Prepend(CCFLAGS=['-g1'])
  25. if (env["debug_symbols"] == "full"):
  26. env.Prepend(CCFLAGS=['-g2'])
  27. elif (env["target"] == "release_debug"):
  28. env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
  29. if (env["debug_symbols"] == "yes"):
  30. env.Prepend(CCFLAGS=['-g1'])
  31. if (env["debug_symbols"] == "full"):
  32. env.Prepend(CCFLAGS=['-g2'])
  33. elif (env["target"] == "debug"):
  34. env.Prepend(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
  35. ## Architecture
  36. is64 = sys.maxsize > 2**32
  37. if (env["bits"] == "default"):
  38. env["bits"] = "64" if is64 else "32"
  39. ## Compiler configuration
  40. env["CC"] = "gcc-x86"
  41. env["CXX"] = "g++-x86"
  42. ## Flags
  43. env.Append(CPPPATH=['#platform/haiku'])
  44. env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES_ENABLED', '-DGLES_OVER_GL'])
  45. env.Append(CPPFLAGS=['-DMEDIA_KIT_ENABLED'])
  46. # env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
  47. env.Append(CPPFLAGS=['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np
  48. env.Append(LIBS=['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL'])