remove_requirement.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/usr/bin/python
  2. # Copyright (C) Vladimir Prus 2006.
  3. # Distributed under the Boost Software License, Version 1.0. (See
  4. # accompanying file LICENSE.txt or copy at
  5. # https://www.bfgroup.xyz/b2/LICENSE.txt)
  6. import BoostBuild
  7. t = BoostBuild.Tester(use_test_config=False)
  8. t.write("jamroot.jam", """
  9. project : requirements <threading>multi <variant>debug:<link>static ;
  10. # Force link to be relevant
  11. project : requirements <link>shared:<define>TEST_DLL ;
  12. build-project sub ;
  13. build-project sub2 ;
  14. build-project sub3 ;
  15. build-project sub4 ;
  16. """)
  17. t.write("sub/jamfile.jam", """
  18. exe hello : hello.cpp : -<threading>multi ;
  19. """)
  20. t.write("sub/hello.cpp", """
  21. int main() {}
  22. """)
  23. t.write("sub2/jamfile.jam", """
  24. project : requirements -<threading>multi ;
  25. exe hello : hello.cpp ;
  26. """)
  27. t.write("sub2/hello.cpp", """
  28. int main() {}
  29. """)
  30. t.write("sub3/hello.cpp", """
  31. int main() {}
  32. """)
  33. t.write("sub3/jamfile.jam", """
  34. exe hello : hello.cpp : "-<variant>debug:<link>static" ;
  35. """)
  36. t.write("sub4/hello.cpp", """
  37. int main() {}
  38. """)
  39. t.write("sub4/jamfile.jam", """
  40. project : requirements "-<variant>debug:<link>static" ;
  41. exe hello : hello.cpp ;
  42. """)
  43. t.run_build_system()
  44. t.expect_addition("sub/bin/$toolset/debug*/link-static*/hello.exe")
  45. t.expect_addition("sub2/bin/$toolset/debug*/link-static*/hello.exe")
  46. t.expect_addition("sub3/bin/$toolset/debug*/threading-multi*/hello.exe")
  47. t.expect_addition("sub4/bin/$toolset/debug*/threading-multi*/hello.exe")
  48. t.rm(".")
  49. # Now test that path requirements can be removed as well.
  50. t.write("jamroot.jam", """
  51. build-project sub ;
  52. """)
  53. t.write("sub/jamfile.jam", """
  54. project : requirements <include>broken ;
  55. exe hello : hello.cpp : -<include>broken ;
  56. """)
  57. t.write("sub/hello.cpp", """
  58. #include "math.h"
  59. int main() {}
  60. """)
  61. t.write("sub/broken/math.h", """
  62. Broken
  63. """)
  64. t.run_build_system()
  65. t.expect_addition("sub/bin/$toolset/debug*/hello.exe")
  66. t.cleanup()