detect.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. return [
  13. ('debug_symbols', 'Add debug symbols to release version (yes/no/full)', 'yes')
  14. ]
  15. def get_flags():
  16. return [
  17. ]
  18. def configure(env):
  19. ## Build type
  20. if (env["target"] == "release"):
  21. env.Prepend(CCFLAGS=['-O3', '-ffast-math'])
  22. if (env["debug_symbols"] == "yes"):
  23. env.Prepend(CCFLAGS=['-g1'])
  24. if (env["debug_symbols"] == "full"):
  25. env.Prepend(CCFLAGS=['-g2'])
  26. elif (env["target"] == "release_debug"):
  27. env.Prepend(CCFLAGS=['-O2', '-ffast-math', '-DDEBUG_ENABLED'])
  28. if (env["debug_symbols"] == "yes"):
  29. env.Prepend(CCFLAGS=['-g1'])
  30. if (env["debug_symbols"] == "full"):
  31. env.Prepend(CCFLAGS=['-g2'])
  32. elif (env["target"] == "debug"):
  33. env.Prepend(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])
  34. ## Architecture
  35. is64 = sys.maxsize > 2**32
  36. if (env["bits"] == "default"):
  37. env["bits"] = "64" if is64 else "32"
  38. ## Compiler configuration
  39. env["CC"] = "gcc-x86"
  40. env["CXX"] = "g++-x86"
  41. ## Flags
  42. env.Append(CPPPATH=['#platform/haiku'])
  43. env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DOPENGL_ENABLED', '-DGLES2_ENABLED', '-DGLES_OVER_GL'])
  44. env.Append(CPPFLAGS=['-DMEDIA_KIT_ENABLED'])
  45. # env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
  46. env.Append(CPPFLAGS=['-DPTHREAD_NO_RENAME']) # TODO: enable when we have pthread_setname_np
  47. env.Append(LIBS=['be', 'game', 'media', 'network', 'bnetapi', 'z', 'GL'])