chain.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/usr/bin/python
  2. # Copyright 2003 Dave Abrahams
  3. # Copyright 2002, 2003 Vladimir Prus
  4. # Distributed under the Boost Software License, Version 1.0.
  5. # (See accompanying file LICENSE.txt or https://www.bfgroup.xyz/b2/LICENSE.txt)
  6. # This tests that :
  7. # 1) the 'make' correctly assigns types to produced targets
  8. # 2) if 'make' creates targets of type CPP, they are correctly used.
  9. import BoostBuild
  10. t = BoostBuild.Tester(use_test_config=False)
  11. # In order to correctly link this app, 'b.cpp', created by a 'make' rule, should
  12. # be compiled.
  13. t.write("jamroot.jam", "import gcc ;")
  14. t.write("jamfile.jam", r'''
  15. import os ;
  16. if [ os.name ] = NT
  17. {
  18. actions create
  19. {
  20. echo int main() {} > $(<)
  21. }
  22. }
  23. else
  24. {
  25. actions create
  26. {
  27. echo "int main() {}" > $(<)
  28. }
  29. }
  30. IMPORT $(__name__) : create : : create ;
  31. exe a : l dummy.cpp ;
  32. # Needs to be a static lib for Windows - main() cannot appear in DLL.
  33. static-lib l : a.cpp b.cpp ;
  34. make b.cpp : : create ;
  35. ''')
  36. t.write("a.cpp", "")
  37. t.write("dummy.cpp", "// msvc needs at least one object file\n")
  38. t.run_build_system()
  39. t.expect_addition("bin/$toolset/debug*/a.exe")
  40. t.cleanup()