inline.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/usr/bin/python
  2. # Copyright 2003, 2006 Vladimir Prus
  3. # Distributed under the Boost Software License, Version 1.0.
  4. # (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
  5. import BoostBuild
  6. t = BoostBuild.Tester(use_test_config=False)
  7. t.write("jamroot.jam", """\
  8. project : requirements <link>static ;
  9. exe a : a.cpp [ lib helper : helper.cpp ] ;
  10. """)
  11. t.write("a.cpp", """\
  12. extern void helper();
  13. int main() {}
  14. """)
  15. t.write("helper.cpp", "void helper() {}\n")
  16. t.run_build_system()
  17. t.expect_addition("bin/$toolset/debug*/a__helper.lib")
  18. t.rm("bin/$toolset/debug*/a__helper.lib")
  19. t.run_build_system(["a__helper"])
  20. t.expect_addition("bin/$toolset/debug*/a__helper.lib")
  21. t.rm("bin")
  22. # Now check that inline targets with the same name but present in different
  23. # places are not confused between each other, and with top-level targets.
  24. t.write("jamroot.jam", """\
  25. project : requirements <link>static ;
  26. exe a : a.cpp [ lib helper : helper.cpp ] ;
  27. exe a2 : a.cpp [ lib helper : helper.cpp ] ;
  28. """)
  29. t.run_build_system()
  30. t.expect_addition("bin/$toolset/debug/link-static*/a.exe")
  31. t.expect_addition("bin/$toolset/debug*/a__helper.lib")
  32. t.expect_addition("bin/$toolset/debug*/a2__helper.lib")
  33. # Check that the 'alias' target does not change the name of inline targets, and
  34. # that inline targets are explicit.
  35. t.write("jamroot.jam", """\
  36. project : requirements <link>static ;
  37. alias a : [ lib helper : helper.cpp ] ;
  38. explicit a ;
  39. """)
  40. t.rm("bin")
  41. t.run_build_system()
  42. t.expect_nothing_more()
  43. t.run_build_system(["a"])
  44. t.expect_addition("bin/$toolset/debug*/helper.lib")
  45. t.cleanup()