detect.py 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. import os
  2. import sys
  3. def is_active():
  4. return True
  5. def get_name():
  6. return "OSX"
  7. def can_build():
  8. if (sys.platform != "darwin"):
  9. return False
  10. return True # osx enabled
  11. def get_opts():
  12. return [
  13. ('force_64_bits','Force 64 bits binary','no'),
  14. ]
  15. def get_flags():
  16. return [
  17. ('opengl', 'no'),
  18. ('legacygl', 'yes'),
  19. ('builtin_zlib', 'no'),
  20. ('freetype','builtin'), #use builtin freetype
  21. ]
  22. def configure(env):
  23. env.Append(CPPPATH=['#platform/osx'])
  24. if (env["bits"]=="default"):
  25. env["bits"]="32"
  26. if (env["target"]=="release"):
  27. env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer','-ftree-vectorize','-msse2'])
  28. elif (env["target"]=="release_debug"):
  29. env.Append(CCFLAGS=['-O2','-DDEBUG_ENABLED'])
  30. elif (env["target"]=="debug"):
  31. env.Append(CCFLAGS=['-g3', '-Wall','-DDEBUG_ENABLED','-DDEBUG_MEMORY_ENABLED'])
  32. if (env["freetype"]!="no"):
  33. env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
  34. env.Append(CPPPATH=['#tools/freetype'])
  35. env.Append(CPPPATH=['#tools/freetype/freetype/include'])
  36. if (env["bits"]=="64"):
  37. env.Append(CCFLAGS=['-arch', 'x86_64'])
  38. env.Append(LINKFLAGS=['-arch', 'x86_64'])
  39. else:
  40. env.Append(CCFLAGS=['-arch', 'i386'])
  41. env.Append(LINKFLAGS=['-arch', 'i386'])
  42. # env.Append(CPPPATH=['#platform/osx/include/freetype2', '#platform/osx/include'])
  43. # env.Append(LIBPATH=['#platform/osx/lib'])
  44. #if env['opengl'] == 'yes':
  45. # env.Append(CPPFLAGS=['-DOPENGL_ENABLED','-DGLEW_ENABLED'])
  46. env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"])
  47. env.Append(CPPFLAGS=['-DUNIX_ENABLED','-DGLES2_ENABLED','-DGLEW_ENABLED', '-DOSX_ENABLED'])
  48. env.Append(LIBS=['pthread'])
  49. #env.Append(CPPFLAGS=['-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-mmacosx-version-min=10.4'])
  50. #env.Append(LINKFLAGS=['-mmacosx-version-min=10.4', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk'])
  51. env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit','-lz'])
  52. if (env["CXX"]=="clang++"):
  53. env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
  54. env["CC"]="clang"
  55. env["LD"]="clang++"
  56. if (env["colored"]=="yes"):
  57. if sys.stdout.isatty():
  58. env.Append(CPPFLAGS=["-fcolor-diagnostics"])
  59. import methods
  60. env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
  61. env.Append( BUILDERS = { 'GLSL' : env.Builder(action = methods.build_glsl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
  62. env.Append( BUILDERS = { 'GLSL120GLES' : env.Builder(action = methods.build_gles2_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )
  63. #env.Append( BUILDERS = { 'HLSL9' : env.Builder(action = methods.build_hlsl_dx9_headers, suffix = 'hlsl.h',src_suffix = '.hlsl') } )