SCsub 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python
  2. from compat import open_utf8
  3. Import("env")
  4. env.platform_sources = []
  5. # Register platform-exclusive APIs
  6. reg_apis_inc = '#include "register_platform_apis.h"\n'
  7. reg_apis = "void register_platform_apis() {\n"
  8. unreg_apis = "void unregister_platform_apis() {\n"
  9. for platform in env.platform_apis:
  10. platform_dir = env.Dir(platform)
  11. env.add_source_files(env.platform_sources, platform + "/api/api.cpp")
  12. reg_apis += "\tregister_" + platform + "_api();\n"
  13. unreg_apis += "\tunregister_" + platform + "_api();\n"
  14. reg_apis_inc += '#include "' + platform + '/api/api.h"\n'
  15. reg_apis_inc += "\n"
  16. reg_apis += "}\n\n"
  17. unreg_apis += "}\n"
  18. # NOTE: It is safe to generate this file here, since this is still execute serially
  19. with open_utf8("register_platform_apis.gen.cpp", "w") as f:
  20. f.write(reg_apis_inc)
  21. f.write(reg_apis)
  22. f.write(unreg_apis)
  23. env.add_source_files(env.platform_sources, "register_platform_apis.gen.cpp")
  24. lib = env.add_library("platform", env.platform_sources)
  25. env.Prepend(LIBS=[lib])