log-architecture.jam 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. # log-architecture.jam
  2. #
  3. # Copyright 2012 Steven Watanabe
  4. # Copyright 2013 Andrey Semashev
  5. #
  6. # Distributed under the Boost Software License Version 1.0. (See
  7. # accompanying file LICENSE_1_0.txt or copy at
  8. # http://www.boost.org/LICENSE_1_0.txt)
  9. import configure ;
  10. import project ;
  11. import path ;
  12. import property ;
  13. import feature ;
  14. local here = [ modules.binding $(__name__) ] ;
  15. feature.feature log-architecture : : free ;
  16. feature.feature log-address-model : : free ;
  17. feature.feature log-instruction-set : : free ;
  18. project.push-current [ project.current ] ;
  19. project.load [ path.join [ path.make $(here:D) ] ../../config/checks/architecture ] ;
  20. project.pop-current ;
  21. rule deduce-address-model ( properties * )
  22. {
  23. local address_model = [ feature.get-values "address-model" : $(properties) ] ;
  24. if $(address_model)
  25. {
  26. return <log-address-model>$(address_model) ;
  27. }
  28. else
  29. {
  30. if [ configure.builds /boost/architecture//32 : $(properties) : 32-bit ]
  31. {
  32. return <log-address-model>32 ;
  33. }
  34. else if [ configure.builds /boost/architecture//64 : $(properties) : 64-bit ]
  35. {
  36. return <log-address-model>64 ;
  37. }
  38. }
  39. }
  40. rule address-model ( )
  41. {
  42. return <conditional>@log-architecture.deduce-address-model ;
  43. }
  44. rule deduce-architecture ( properties * )
  45. {
  46. local architecture = [ feature.get-values "architecture" : $(properties) ] ;
  47. if $(architecture)
  48. {
  49. return <log-architecture>$(architecture) ;
  50. }
  51. else
  52. {
  53. if [ configure.builds /boost/architecture//x86 : $(properties) : x86 ]
  54. {
  55. return <log-architecture>x86 ;
  56. }
  57. else if [ configure.builds /boost/architecture//arm : $(properties) : arm ]
  58. {
  59. return <log-architecture>arm ;
  60. }
  61. else if [ configure.builds /boost/architecture//mips1 : $(properties) : mips1 ]
  62. {
  63. return <log-architecture>mips1 ;
  64. }
  65. else if [ configure.builds /boost/architecture//power : $(properties) : power ]
  66. {
  67. return <log-architecture>power ;
  68. }
  69. else if [ configure.builds /boost/architecture//sparc : $(properties) : sparc ]
  70. {
  71. return <log-architecture>sparc ;
  72. }
  73. }
  74. }
  75. rule architecture ( )
  76. {
  77. return <conditional>@log-architecture.deduce-architecture ;
  78. }
  79. rule deduce-instruction-set ( properties * )
  80. {
  81. local result ;
  82. local instruction_set = [ feature.get-values "instruction-set" : $(properties) ] ;
  83. if $(instruction_set)
  84. {
  85. result = <log-instruction-set>$(instruction_set) ;
  86. }
  87. else
  88. {
  89. if <log-architecture>x86 in $(properties) && <log-address-model>32 in $(properties)
  90. {
  91. # We build for Pentium Pro and later CPUs by default. This is used as the target in many Linux distributions, and Windows and OS X also seem to not support older CPUs.
  92. result = <log-instruction-set>i686 ;
  93. }
  94. }
  95. return $(result) ;
  96. }
  97. rule instruction-set ( )
  98. {
  99. return <conditional>@log-architecture.deduce-instruction-set ;
  100. }