AMBuilder 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
  2. import os, sys
  3. projectName = 'tf2econdynamic'
  4. sourceFiles = [
  5. 'mmsplugin.cpp',
  6. 'econmanager.cpp',
  7. 'natives.cpp',
  8. ]
  9. pluginFiles = [
  10. 'tf_econ_dynamic_compat.sp'
  11. ]
  12. spcomp_argv = [
  13. Extension.spcomp_bin,
  14. '-i' + os.path.relpath(os.path.join(builder.sourcePath, 'scripting', 'include'),
  15. os.path.join(builder.buildPath, builder.buildFolder)),
  16. '-h',
  17. '-E',
  18. ]
  19. ###############
  20. # Make sure to edit PackageScript, which copies your files to their appropriate locations
  21. # Simple extensions do not need to modify past this point.
  22. project = Extension.HL2Project(builder, projectName + '.ext')
  23. if os.path.isfile(os.path.join(builder.currentSourcePath, 'sdk', 'smsdk_ext.cpp')):
  24. # Use the copy included in the project
  25. project.sources += [os.path.join('sdk', 'smsdk_ext.cpp')]
  26. else:
  27. # Use the copy included with SM 1.6 and newer
  28. project.sources += [os.path.join(Extension.sm_root, 'public', 'smsdk_ext.cpp')]
  29. project.sources += sourceFiles
  30. for sdk_name in Extension.sdks:
  31. sdk = Extension.sdks[sdk_name]
  32. binary = Extension.HL2Config(project, projectName + '.ext.' + sdk.ext, sdk)
  33. def build_plugin(script_path, smx_file):
  34. inputs = [
  35. Extension.spcomp_bin,
  36. script_path,
  37. ]
  38. outputs = [
  39. smx_file
  40. ]
  41. argv = spcomp_argv + [script_path]
  42. result = builder.AddCommand(
  43. inputs = inputs,
  44. argv = argv,
  45. outputs = outputs,
  46. dep_type = 'msvc',
  47. )
  48. # ???
  49. (smx_command, smx_outputs) = result
  50. out, *_ = smx_outputs
  51. Extension.plugins[smx_file] = out
  52. for script_file in pluginFiles:
  53. script_path = os.path.join(builder.currentSourcePath, 'scripting', script_file)
  54. smx_file = os.path.splitext(script_file)[0] + '.smx'
  55. build_plugin(script_path, smx_file)
  56. Extension.extensions = builder.Add(project)