genconfig.py 936 B

1234567891011121314151617181920212223242526272829303132333435
  1. # Generates configuration headers for VC++ builds
  2. import sys
  3. import os.path
  4. import outpututils
  5. import win_resource
  6. import version2code
  7. #
  8. # platform: one of { Win32, x64 }
  9. # configuration: one of { Debug, Developer, Release }
  10. # outputPath: the location in which to generate config files
  11. #
  12. def genConfig(platform, configuration, outputPath):
  13. #
  14. # resource-info.hh
  15. #
  16. resourceInfoHeader = os.path.join(outputPath, 'resource-info.h')
  17. generator = win_resource.iterResourceHeader()
  18. outpututils.rewriteIfChanged(resourceInfoHeader, generator)
  19. #
  20. # version.ii
  21. #
  22. versionHeader = os.path.join(outputPath, 'version.ii')
  23. generator = version2code.iterVersionInclude()
  24. outpututils.rewriteIfChanged(versionHeader, generator)
  25. if len(sys.argv) == 4:
  26. genConfig(sys.argv[1], sys.argv[2], sys.argv[3])
  27. else:
  28. print >> sys.stderr, 'Usage: python genconfig.py platform configuration outputPath'
  29. sys.exit(2)