🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
1.6 KiB

  1. #
  2. # Native file dialog
  3. #
  4. # Build tests
  5. target_arch=str(Platform())
  6. debug = int(ARGUMENTS.get( 'debug', 0 ))
  7. files = {'test_opendialog': ['test_opendialog.c'],
  8. 'test_opendialogmultiple': ['test_opendialogmultiple.c'],
  9. 'test_savedialog': ['test_savedialog.c']}
  10. test_env = Environment()
  11. # Windows runtime library types
  12. win_rtl = {'debug': '/MDd',
  13. 'release': '/MD'}
  14. def set_debug(env):
  15. if target_arch == 'win32':
  16. env.Append( CFLAGS=['/Z7', # obj contains full symbols
  17. win_rtl['debug'] ] )
  18. else:
  19. env.Append( CFLAGS=['-g'] )
  20. def set_release(env):
  21. if target_arch == 'win32':
  22. env.Append( CFLAGS=[win_rtl['release'],
  23. '/O2',
  24. ])
  25. else:
  26. env.Append( CFLAGS=['-O3'] )
  27. def get_lib_name(base, is_debug):
  28. if is_debug:
  29. return base + '_d'
  30. else:
  31. return base
  32. if debug:
  33. set_debug(test_env)
  34. else:
  35. set_release(test_env)
  36. test_env.Append( CPPPATH=['../src/include'], # API header path only, no internals allowed
  37. LIBPATH=['../src'],
  38. LIBS=get_lib_name('nfd', debug) )
  39. # Cocoa OS X builds
  40. if target_arch == 'darwin':
  41. test_env.Append( FRAMEWORKS='AppKit' )
  42. test_env.CC='clang -fcolor-diagnostics'
  43. # Linux GTK+ 3 builds
  44. elif target_arch == 'posix':
  45. test_env.ParseConfig( 'pkg-config --cflags --libs gtk+-3.0' )
  46. elif target_arch == 'win32':
  47. test_env.Append(
  48. LINKFLAGS=['/NODEFAULTLIB:LIBCMT'])
  49. for codebase in files:
  50. output_name = get_lib_name(codebase, debug)
  51. test_env.Program( output_name, files[codebase] )