wscript 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #
  2. # This file is the default set of rules to compile a Pebble project.
  3. #
  4. # Feel free to customize this to your needs.
  5. #
  6. import os
  7. import shutil
  8. import waflib
  9. top = '.'
  10. out = 'build'
  11. def distclean(ctx):
  12. if os.path.exists('dist.zip'):
  13. os.remove('dist.zip')
  14. if os.path.exists('dist'):
  15. shutil.rmtree('dist')
  16. waflib.Scripting.distclean(ctx)
  17. def options(ctx):
  18. ctx.load('pebble_sdk_lib')
  19. def configure(ctx):
  20. ctx.load('pebble_sdk_lib')
  21. def build(ctx):
  22. ctx.load('pebble_sdk_lib')
  23. cached_env = ctx.env
  24. for platform in ctx.env.TARGET_PLATFORMS:
  25. ctx.env = ctx.all_envs[platform]
  26. ctx.set_group(ctx.env.PLATFORM_NAME)
  27. lib_name = '{}/{}'.format(ctx.env.BUILD_DIR, ctx.env.PROJECT_INFO['name'])
  28. ctx.pbl_build(source=ctx.path.ant_glob('src/c/**/*.c'), target=lib_name, bin_type='lib')
  29. ctx.env = cached_env
  30. ctx.set_group('bundle')
  31. ctx.pbl_bundle(includes=ctx.path.ant_glob('include/**/*.h'),
  32. js=ctx.path.ant_glob(['src/js/**/*.js', 'src/js/**/*.json']),
  33. bin_type='lib')
  34. if ctx.cmd == 'clean':
  35. for n in ctx.path.ant_glob(['dist/**/*', 'dist.zip'], quiet=True):
  36. n.delete()