libv8-freebsd 3.3.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (703) hide show
  1. data/.gitignore +9 -0
  2. data/.gitmodules +3 -0
  3. data/Gemfile +4 -0
  4. data/README.md +75 -0
  5. data/Rakefile +115 -0
  6. data/ext/libv8/extconf.rb +27 -0
  7. data/lib/libv8.rb +15 -0
  8. data/lib/libv8/Makefile +39 -0
  9. data/lib/libv8/detect_cpu.rb +27 -0
  10. data/lib/libv8/fpic-on-freebsd-amd64.patch +16 -0
  11. data/lib/libv8/fpic-on-linux-amd64.patch +13 -0
  12. data/lib/libv8/scons/CHANGES.txt +5541 -0
  13. data/lib/libv8/scons/LICENSE.txt +20 -0
  14. data/lib/libv8/scons/MANIFEST +200 -0
  15. data/lib/libv8/scons/PKG-INFO +13 -0
  16. data/lib/libv8/scons/README.txt +243 -0
  17. data/lib/libv8/scons/RELEASE.txt +100 -0
  18. data/lib/libv8/scons/engine/SCons/Action.py +1257 -0
  19. data/lib/libv8/scons/engine/SCons/Builder.py +877 -0
  20. data/lib/libv8/scons/engine/SCons/CacheDir.py +216 -0
  21. data/lib/libv8/scons/engine/SCons/Conftest.py +793 -0
  22. data/lib/libv8/scons/engine/SCons/Debug.py +220 -0
  23. data/lib/libv8/scons/engine/SCons/Defaults.py +494 -0
  24. data/lib/libv8/scons/engine/SCons/Environment.py +2417 -0
  25. data/lib/libv8/scons/engine/SCons/Errors.py +205 -0
  26. data/lib/libv8/scons/engine/SCons/Executor.py +633 -0
  27. data/lib/libv8/scons/engine/SCons/Job.py +435 -0
  28. data/lib/libv8/scons/engine/SCons/Memoize.py +244 -0
  29. data/lib/libv8/scons/engine/SCons/Node/Alias.py +152 -0
  30. data/lib/libv8/scons/engine/SCons/Node/FS.py +3302 -0
  31. data/lib/libv8/scons/engine/SCons/Node/Python.py +128 -0
  32. data/lib/libv8/scons/engine/SCons/Node/__init__.py +1329 -0
  33. data/lib/libv8/scons/engine/SCons/Options/BoolOption.py +50 -0
  34. data/lib/libv8/scons/engine/SCons/Options/EnumOption.py +50 -0
  35. data/lib/libv8/scons/engine/SCons/Options/ListOption.py +50 -0
  36. data/lib/libv8/scons/engine/SCons/Options/PackageOption.py +50 -0
  37. data/lib/libv8/scons/engine/SCons/Options/PathOption.py +76 -0
  38. data/lib/libv8/scons/engine/SCons/Options/__init__.py +67 -0
  39. data/lib/libv8/scons/engine/SCons/PathList.py +231 -0
  40. data/lib/libv8/scons/engine/SCons/Platform/__init__.py +241 -0
  41. data/lib/libv8/scons/engine/SCons/Platform/aix.py +69 -0
  42. data/lib/libv8/scons/engine/SCons/Platform/cygwin.py +55 -0
  43. data/lib/libv8/scons/engine/SCons/Platform/darwin.py +70 -0
  44. data/lib/libv8/scons/engine/SCons/Platform/hpux.py +46 -0
  45. data/lib/libv8/scons/engine/SCons/Platform/irix.py +44 -0
  46. data/lib/libv8/scons/engine/SCons/Platform/os2.py +58 -0
  47. data/lib/libv8/scons/engine/SCons/Platform/posix.py +263 -0
  48. data/lib/libv8/scons/engine/SCons/Platform/sunos.py +50 -0
  49. data/lib/libv8/scons/engine/SCons/Platform/win32.py +385 -0
  50. data/lib/libv8/scons/engine/SCons/SConf.py +1030 -0
  51. data/lib/libv8/scons/engine/SCons/SConsign.py +389 -0
  52. data/lib/libv8/scons/engine/SCons/Scanner/C.py +132 -0
  53. data/lib/libv8/scons/engine/SCons/Scanner/D.py +73 -0
  54. data/lib/libv8/scons/engine/SCons/Scanner/Dir.py +109 -0
  55. data/lib/libv8/scons/engine/SCons/Scanner/Fortran.py +316 -0
  56. data/lib/libv8/scons/engine/SCons/Scanner/IDL.py +48 -0
  57. data/lib/libv8/scons/engine/SCons/Scanner/LaTeX.py +387 -0
  58. data/lib/libv8/scons/engine/SCons/Scanner/Prog.py +101 -0
  59. data/lib/libv8/scons/engine/SCons/Scanner/RC.py +55 -0
  60. data/lib/libv8/scons/engine/SCons/Scanner/__init__.py +413 -0
  61. data/lib/libv8/scons/engine/SCons/Script/Interactive.py +384 -0
  62. data/lib/libv8/scons/engine/SCons/Script/Main.py +1405 -0
  63. data/lib/libv8/scons/engine/SCons/Script/SConsOptions.py +939 -0
  64. data/lib/libv8/scons/engine/SCons/Script/SConscript.py +640 -0
  65. data/lib/libv8/scons/engine/SCons/Script/__init__.py +412 -0
  66. data/lib/libv8/scons/engine/SCons/Sig.py +63 -0
  67. data/lib/libv8/scons/engine/SCons/Subst.py +904 -0
  68. data/lib/libv8/scons/engine/SCons/Taskmaster.py +1025 -0
  69. data/lib/libv8/scons/engine/SCons/Tool/386asm.py +61 -0
  70. data/lib/libv8/scons/engine/SCons/Tool/BitKeeper.py +67 -0
  71. data/lib/libv8/scons/engine/SCons/Tool/CVS.py +73 -0
  72. data/lib/libv8/scons/engine/SCons/Tool/FortranCommon.py +263 -0
  73. data/lib/libv8/scons/engine/SCons/Tool/JavaCommon.py +323 -0
  74. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/__init__.py +56 -0
  75. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/arch.py +61 -0
  76. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/common.py +240 -0
  77. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/netframework.py +82 -0
  78. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/sdk.py +391 -0
  79. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vc.py +459 -0
  80. data/lib/libv8/scons/engine/SCons/Tool/MSCommon/vs.py +526 -0
  81. data/lib/libv8/scons/engine/SCons/Tool/Perforce.py +103 -0
  82. data/lib/libv8/scons/engine/SCons/Tool/PharLapCommon.py +137 -0
  83. data/lib/libv8/scons/engine/SCons/Tool/RCS.py +64 -0
  84. data/lib/libv8/scons/engine/SCons/Tool/SCCS.py +64 -0
  85. data/lib/libv8/scons/engine/SCons/Tool/Subversion.py +71 -0
  86. data/lib/libv8/scons/engine/SCons/Tool/__init__.py +681 -0
  87. data/lib/libv8/scons/engine/SCons/Tool/aixc++.py +82 -0
  88. data/lib/libv8/scons/engine/SCons/Tool/aixcc.py +74 -0
  89. data/lib/libv8/scons/engine/SCons/Tool/aixf77.py +80 -0
  90. data/lib/libv8/scons/engine/SCons/Tool/aixlink.py +76 -0
  91. data/lib/libv8/scons/engine/SCons/Tool/applelink.py +71 -0
  92. data/lib/libv8/scons/engine/SCons/Tool/ar.py +63 -0
  93. data/lib/libv8/scons/engine/SCons/Tool/as.py +78 -0
  94. data/lib/libv8/scons/engine/SCons/Tool/bcc32.py +81 -0
  95. data/lib/libv8/scons/engine/SCons/Tool/c++.py +99 -0
  96. data/lib/libv8/scons/engine/SCons/Tool/cc.py +102 -0
  97. data/lib/libv8/scons/engine/SCons/Tool/cvf.py +58 -0
  98. data/lib/libv8/scons/engine/SCons/Tool/default.py +50 -0
  99. data/lib/libv8/scons/engine/SCons/Tool/dmd.py +240 -0
  100. data/lib/libv8/scons/engine/SCons/Tool/dvi.py +64 -0
  101. data/lib/libv8/scons/engine/SCons/Tool/dvipdf.py +125 -0
  102. data/lib/libv8/scons/engine/SCons/Tool/dvips.py +95 -0
  103. data/lib/libv8/scons/engine/SCons/Tool/f03.py +63 -0
  104. data/lib/libv8/scons/engine/SCons/Tool/f77.py +62 -0
  105. data/lib/libv8/scons/engine/SCons/Tool/f90.py +62 -0
  106. data/lib/libv8/scons/engine/SCons/Tool/f95.py +63 -0
  107. data/lib/libv8/scons/engine/SCons/Tool/filesystem.py +98 -0
  108. data/lib/libv8/scons/engine/SCons/Tool/fortran.py +62 -0
  109. data/lib/libv8/scons/engine/SCons/Tool/g++.py +90 -0
  110. data/lib/libv8/scons/engine/SCons/Tool/g77.py +73 -0
  111. data/lib/libv8/scons/engine/SCons/Tool/gas.py +53 -0
  112. data/lib/libv8/scons/engine/SCons/Tool/gcc.py +80 -0
  113. data/lib/libv8/scons/engine/SCons/Tool/gfortran.py +64 -0
  114. data/lib/libv8/scons/engine/SCons/Tool/gnulink.py +62 -0
  115. data/lib/libv8/scons/engine/SCons/Tool/gs.py +81 -0
  116. data/lib/libv8/scons/engine/SCons/Tool/hpc++.py +84 -0
  117. data/lib/libv8/scons/engine/SCons/Tool/hpcc.py +53 -0
  118. data/lib/libv8/scons/engine/SCons/Tool/hplink.py +77 -0
  119. data/lib/libv8/scons/engine/SCons/Tool/icc.py +59 -0
  120. data/lib/libv8/scons/engine/SCons/Tool/icl.py +52 -0
  121. data/lib/libv8/scons/engine/SCons/Tool/ifl.py +72 -0
  122. data/lib/libv8/scons/engine/SCons/Tool/ifort.py +88 -0
  123. data/lib/libv8/scons/engine/SCons/Tool/ilink.py +59 -0
  124. data/lib/libv8/scons/engine/SCons/Tool/ilink32.py +60 -0
  125. data/lib/libv8/scons/engine/SCons/Tool/install.py +283 -0
  126. data/lib/libv8/scons/engine/SCons/Tool/intelc.py +522 -0
  127. data/lib/libv8/scons/engine/SCons/Tool/ipkg.py +67 -0
  128. data/lib/libv8/scons/engine/SCons/Tool/jar.py +116 -0
  129. data/lib/libv8/scons/engine/SCons/Tool/javac.py +230 -0
  130. data/lib/libv8/scons/engine/SCons/Tool/javah.py +137 -0
  131. data/lib/libv8/scons/engine/SCons/Tool/latex.py +80 -0
  132. data/lib/libv8/scons/engine/SCons/Tool/lex.py +97 -0
  133. data/lib/libv8/scons/engine/SCons/Tool/link.py +122 -0
  134. data/lib/libv8/scons/engine/SCons/Tool/linkloc.py +112 -0
  135. data/lib/libv8/scons/engine/SCons/Tool/m4.py +63 -0
  136. data/lib/libv8/scons/engine/SCons/Tool/masm.py +77 -0
  137. data/lib/libv8/scons/engine/SCons/Tool/midl.py +88 -0
  138. data/lib/libv8/scons/engine/SCons/Tool/mingw.py +179 -0
  139. data/lib/libv8/scons/engine/SCons/Tool/mslib.py +64 -0
  140. data/lib/libv8/scons/engine/SCons/Tool/mslink.py +318 -0
  141. data/lib/libv8/scons/engine/SCons/Tool/mssdk.py +50 -0
  142. data/lib/libv8/scons/engine/SCons/Tool/msvc.py +278 -0
  143. data/lib/libv8/scons/engine/SCons/Tool/msvs.py +1806 -0
  144. data/lib/libv8/scons/engine/SCons/Tool/mwcc.py +207 -0
  145. data/lib/libv8/scons/engine/SCons/Tool/mwld.py +107 -0
  146. data/lib/libv8/scons/engine/SCons/Tool/nasm.py +72 -0
  147. data/lib/libv8/scons/engine/SCons/Tool/packaging/__init__.py +312 -0
  148. data/lib/libv8/scons/engine/SCons/Tool/packaging/ipk.py +185 -0
  149. data/lib/libv8/scons/engine/SCons/Tool/packaging/msi.py +527 -0
  150. data/lib/libv8/scons/engine/SCons/Tool/packaging/rpm.py +365 -0
  151. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_tarbz2.py +43 -0
  152. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_targz.py +43 -0
  153. data/lib/libv8/scons/engine/SCons/Tool/packaging/src_zip.py +43 -0
  154. data/lib/libv8/scons/engine/SCons/Tool/packaging/tarbz2.py +44 -0
  155. data/lib/libv8/scons/engine/SCons/Tool/packaging/targz.py +44 -0
  156. data/lib/libv8/scons/engine/SCons/Tool/packaging/zip.py +44 -0
  157. data/lib/libv8/scons/engine/SCons/Tool/pdf.py +78 -0
  158. data/lib/libv8/scons/engine/SCons/Tool/pdflatex.py +84 -0
  159. data/lib/libv8/scons/engine/SCons/Tool/pdftex.py +109 -0
  160. data/lib/libv8/scons/engine/SCons/Tool/qt.py +336 -0
  161. data/lib/libv8/scons/engine/SCons/Tool/rmic.py +126 -0
  162. data/lib/libv8/scons/engine/SCons/Tool/rpcgen.py +70 -0
  163. data/lib/libv8/scons/engine/SCons/Tool/rpm.py +132 -0
  164. data/lib/libv8/scons/engine/SCons/Tool/sgiar.py +68 -0
  165. data/lib/libv8/scons/engine/SCons/Tool/sgic++.py +58 -0
  166. data/lib/libv8/scons/engine/SCons/Tool/sgicc.py +53 -0
  167. data/lib/libv8/scons/engine/SCons/Tool/sgilink.py +62 -0
  168. data/lib/libv8/scons/engine/SCons/Tool/sunar.py +67 -0
  169. data/lib/libv8/scons/engine/SCons/Tool/sunc++.py +142 -0
  170. data/lib/libv8/scons/engine/SCons/Tool/suncc.py +58 -0
  171. data/lib/libv8/scons/engine/SCons/Tool/sunf77.py +63 -0
  172. data/lib/libv8/scons/engine/SCons/Tool/sunf90.py +64 -0
  173. data/lib/libv8/scons/engine/SCons/Tool/sunf95.py +64 -0
  174. data/lib/libv8/scons/engine/SCons/Tool/sunlink.py +76 -0
  175. data/lib/libv8/scons/engine/SCons/Tool/swig.py +183 -0
  176. data/lib/libv8/scons/engine/SCons/Tool/tar.py +73 -0
  177. data/lib/libv8/scons/engine/SCons/Tool/tex.py +866 -0
  178. data/lib/libv8/scons/engine/SCons/Tool/textfile.py +175 -0
  179. data/lib/libv8/scons/engine/SCons/Tool/tlib.py +53 -0
  180. data/lib/libv8/scons/engine/SCons/Tool/wix.py +99 -0
  181. data/lib/libv8/scons/engine/SCons/Tool/yacc.py +140 -0
  182. data/lib/libv8/scons/engine/SCons/Tool/zip.py +99 -0
  183. data/lib/libv8/scons/engine/SCons/Util.py +1492 -0
  184. data/lib/libv8/scons/engine/SCons/Variables/BoolVariable.py +89 -0
  185. data/lib/libv8/scons/engine/SCons/Variables/EnumVariable.py +103 -0
  186. data/lib/libv8/scons/engine/SCons/Variables/ListVariable.py +135 -0
  187. data/lib/libv8/scons/engine/SCons/Variables/PackageVariable.py +106 -0
  188. data/lib/libv8/scons/engine/SCons/Variables/PathVariable.py +147 -0
  189. data/lib/libv8/scons/engine/SCons/Variables/__init__.py +312 -0
  190. data/lib/libv8/scons/engine/SCons/Warnings.py +246 -0
  191. data/lib/libv8/scons/engine/SCons/__init__.py +49 -0
  192. data/lib/libv8/scons/engine/SCons/compat/__init__.py +237 -0
  193. data/lib/libv8/scons/engine/SCons/compat/_scons_builtins.py +150 -0
  194. data/lib/libv8/scons/engine/SCons/compat/_scons_collections.py +45 -0
  195. data/lib/libv8/scons/engine/SCons/compat/_scons_dbm.py +45 -0
  196. data/lib/libv8/scons/engine/SCons/compat/_scons_hashlib.py +76 -0
  197. data/lib/libv8/scons/engine/SCons/compat/_scons_io.py +45 -0
  198. data/lib/libv8/scons/engine/SCons/compat/_scons_sets.py +563 -0
  199. data/lib/libv8/scons/engine/SCons/compat/_scons_subprocess.py +1281 -0
  200. data/lib/libv8/scons/engine/SCons/cpp.py +589 -0
  201. data/lib/libv8/scons/engine/SCons/dblite.py +254 -0
  202. data/lib/libv8/scons/engine/SCons/exitfuncs.py +77 -0
  203. data/lib/libv8/scons/os_spawnv_fix.diff +83 -0
  204. data/lib/libv8/scons/scons-time.1 +1017 -0
  205. data/lib/libv8/scons/scons.1 +15225 -0
  206. data/lib/libv8/scons/sconsign.1 +208 -0
  207. data/lib/libv8/scons/script/scons +196 -0
  208. data/lib/libv8/scons/script/scons-time +1544 -0
  209. data/lib/libv8/scons/script/scons.bat +34 -0
  210. data/lib/libv8/scons/script/sconsign +514 -0
  211. data/lib/libv8/scons/setup.cfg +5 -0
  212. data/lib/libv8/scons/setup.py +423 -0
  213. data/lib/libv8/v8/.gitignore +35 -0
  214. data/lib/libv8/v8/AUTHORS +44 -0
  215. data/lib/libv8/v8/ChangeLog +2839 -0
  216. data/lib/libv8/v8/LICENSE +52 -0
  217. data/lib/libv8/v8/LICENSE.strongtalk +29 -0
  218. data/lib/libv8/v8/LICENSE.v8 +26 -0
  219. data/lib/libv8/v8/LICENSE.valgrind +45 -0
  220. data/lib/libv8/v8/SConstruct +1478 -0
  221. data/lib/libv8/v8/build/README.txt +49 -0
  222. data/lib/libv8/v8/build/all.gyp +18 -0
  223. data/lib/libv8/v8/build/armu.gypi +32 -0
  224. data/lib/libv8/v8/build/common.gypi +144 -0
  225. data/lib/libv8/v8/build/gyp_v8 +145 -0
  226. data/lib/libv8/v8/include/v8-debug.h +395 -0
  227. data/lib/libv8/v8/include/v8-preparser.h +117 -0
  228. data/lib/libv8/v8/include/v8-profiler.h +505 -0
  229. data/lib/libv8/v8/include/v8-testing.h +104 -0
  230. data/lib/libv8/v8/include/v8.h +4124 -0
  231. data/lib/libv8/v8/include/v8stdint.h +53 -0
  232. data/lib/libv8/v8/preparser/SConscript +38 -0
  233. data/lib/libv8/v8/preparser/preparser-process.cc +379 -0
  234. data/lib/libv8/v8/src/SConscript +368 -0
  235. data/lib/libv8/v8/src/accessors.cc +767 -0
  236. data/lib/libv8/v8/src/accessors.h +123 -0
  237. data/lib/libv8/v8/src/allocation-inl.h +49 -0
  238. data/lib/libv8/v8/src/allocation.cc +122 -0
  239. data/lib/libv8/v8/src/allocation.h +143 -0
  240. data/lib/libv8/v8/src/api.cc +5845 -0
  241. data/lib/libv8/v8/src/api.h +574 -0
  242. data/lib/libv8/v8/src/apinatives.js +110 -0
  243. data/lib/libv8/v8/src/apiutils.h +73 -0
  244. data/lib/libv8/v8/src/arguments.h +118 -0
  245. data/lib/libv8/v8/src/arm/assembler-arm-inl.h +353 -0
  246. data/lib/libv8/v8/src/arm/assembler-arm.cc +2661 -0
  247. data/lib/libv8/v8/src/arm/assembler-arm.h +1375 -0
  248. data/lib/libv8/v8/src/arm/builtins-arm.cc +1658 -0
  249. data/lib/libv8/v8/src/arm/code-stubs-arm.cc +6398 -0
  250. data/lib/libv8/v8/src/arm/code-stubs-arm.h +673 -0
  251. data/lib/libv8/v8/src/arm/codegen-arm.cc +52 -0
  252. data/lib/libv8/v8/src/arm/codegen-arm.h +91 -0
  253. data/lib/libv8/v8/src/arm/constants-arm.cc +152 -0
  254. data/lib/libv8/v8/src/arm/constants-arm.h +775 -0
  255. data/lib/libv8/v8/src/arm/cpu-arm.cc +120 -0
  256. data/lib/libv8/v8/src/arm/debug-arm.cc +317 -0
  257. data/lib/libv8/v8/src/arm/deoptimizer-arm.cc +754 -0
  258. data/lib/libv8/v8/src/arm/disasm-arm.cc +1506 -0
  259. data/lib/libv8/v8/src/arm/frames-arm.cc +45 -0
  260. data/lib/libv8/v8/src/arm/frames-arm.h +168 -0
  261. data/lib/libv8/v8/src/arm/full-codegen-arm.cc +4375 -0
  262. data/lib/libv8/v8/src/arm/ic-arm.cc +1562 -0
  263. data/lib/libv8/v8/src/arm/lithium-arm.cc +2206 -0
  264. data/lib/libv8/v8/src/arm/lithium-arm.h +2348 -0
  265. data/lib/libv8/v8/src/arm/lithium-codegen-arm.cc +4526 -0
  266. data/lib/libv8/v8/src/arm/lithium-codegen-arm.h +403 -0
  267. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.cc +305 -0
  268. data/lib/libv8/v8/src/arm/lithium-gap-resolver-arm.h +84 -0
  269. data/lib/libv8/v8/src/arm/macro-assembler-arm.cc +3163 -0
  270. data/lib/libv8/v8/src/arm/macro-assembler-arm.h +1126 -0
  271. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.cc +1287 -0
  272. data/lib/libv8/v8/src/arm/regexp-macro-assembler-arm.h +253 -0
  273. data/lib/libv8/v8/src/arm/simulator-arm.cc +3424 -0
  274. data/lib/libv8/v8/src/arm/simulator-arm.h +431 -0
  275. data/lib/libv8/v8/src/arm/stub-cache-arm.cc +4243 -0
  276. data/lib/libv8/v8/src/array.js +1366 -0
  277. data/lib/libv8/v8/src/assembler.cc +1207 -0
  278. data/lib/libv8/v8/src/assembler.h +858 -0
  279. data/lib/libv8/v8/src/ast-inl.h +112 -0
  280. data/lib/libv8/v8/src/ast.cc +1146 -0
  281. data/lib/libv8/v8/src/ast.h +2188 -0
  282. data/lib/libv8/v8/src/atomicops.h +167 -0
  283. data/lib/libv8/v8/src/atomicops_internals_arm_gcc.h +145 -0
  284. data/lib/libv8/v8/src/atomicops_internals_mips_gcc.h +169 -0
  285. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.cc +133 -0
  286. data/lib/libv8/v8/src/atomicops_internals_x86_gcc.h +287 -0
  287. data/lib/libv8/v8/src/atomicops_internals_x86_macosx.h +301 -0
  288. data/lib/libv8/v8/src/atomicops_internals_x86_msvc.h +203 -0
  289. data/lib/libv8/v8/src/bignum-dtoa.cc +655 -0
  290. data/lib/libv8/v8/src/bignum-dtoa.h +81 -0
  291. data/lib/libv8/v8/src/bignum.cc +768 -0
  292. data/lib/libv8/v8/src/bignum.h +140 -0
  293. data/lib/libv8/v8/src/bootstrapper.cc +2184 -0
  294. data/lib/libv8/v8/src/bootstrapper.h +188 -0
  295. data/lib/libv8/v8/src/builtins.cc +1707 -0
  296. data/lib/libv8/v8/src/builtins.h +371 -0
  297. data/lib/libv8/v8/src/bytecodes-irregexp.h +105 -0
  298. data/lib/libv8/v8/src/cached-powers.cc +177 -0
  299. data/lib/libv8/v8/src/cached-powers.h +65 -0
  300. data/lib/libv8/v8/src/char-predicates-inl.h +94 -0
  301. data/lib/libv8/v8/src/char-predicates.h +67 -0
  302. data/lib/libv8/v8/src/checks.cc +110 -0
  303. data/lib/libv8/v8/src/checks.h +296 -0
  304. data/lib/libv8/v8/src/circular-queue-inl.h +53 -0
  305. data/lib/libv8/v8/src/circular-queue.cc +122 -0
  306. data/lib/libv8/v8/src/circular-queue.h +103 -0
  307. data/lib/libv8/v8/src/code-stubs.cc +267 -0
  308. data/lib/libv8/v8/src/code-stubs.h +1011 -0
  309. data/lib/libv8/v8/src/code.h +70 -0
  310. data/lib/libv8/v8/src/codegen.cc +231 -0
  311. data/lib/libv8/v8/src/codegen.h +84 -0
  312. data/lib/libv8/v8/src/compilation-cache.cc +540 -0
  313. data/lib/libv8/v8/src/compilation-cache.h +287 -0
  314. data/lib/libv8/v8/src/compiler.cc +786 -0
  315. data/lib/libv8/v8/src/compiler.h +312 -0
  316. data/lib/libv8/v8/src/contexts.cc +347 -0
  317. data/lib/libv8/v8/src/contexts.h +391 -0
  318. data/lib/libv8/v8/src/conversions-inl.h +106 -0
  319. data/lib/libv8/v8/src/conversions.cc +1131 -0
  320. data/lib/libv8/v8/src/conversions.h +135 -0
  321. data/lib/libv8/v8/src/counters.cc +93 -0
  322. data/lib/libv8/v8/src/counters.h +254 -0
  323. data/lib/libv8/v8/src/cpu-profiler-inl.h +101 -0
  324. data/lib/libv8/v8/src/cpu-profiler.cc +609 -0
  325. data/lib/libv8/v8/src/cpu-profiler.h +302 -0
  326. data/lib/libv8/v8/src/cpu.h +69 -0
  327. data/lib/libv8/v8/src/d8-debug.cc +367 -0
  328. data/lib/libv8/v8/src/d8-debug.h +158 -0
  329. data/lib/libv8/v8/src/d8-posix.cc +695 -0
  330. data/lib/libv8/v8/src/d8-readline.cc +130 -0
  331. data/lib/libv8/v8/src/d8-windows.cc +42 -0
  332. data/lib/libv8/v8/src/d8.cc +803 -0
  333. data/lib/libv8/v8/src/d8.gyp +91 -0
  334. data/lib/libv8/v8/src/d8.h +235 -0
  335. data/lib/libv8/v8/src/d8.js +2798 -0
  336. data/lib/libv8/v8/src/data-flow.cc +66 -0
  337. data/lib/libv8/v8/src/data-flow.h +205 -0
  338. data/lib/libv8/v8/src/date.js +1103 -0
  339. data/lib/libv8/v8/src/dateparser-inl.h +127 -0
  340. data/lib/libv8/v8/src/dateparser.cc +178 -0
  341. data/lib/libv8/v8/src/dateparser.h +266 -0
  342. data/lib/libv8/v8/src/debug-agent.cc +447 -0
  343. data/lib/libv8/v8/src/debug-agent.h +129 -0
  344. data/lib/libv8/v8/src/debug-debugger.js +2569 -0
  345. data/lib/libv8/v8/src/debug.cc +3165 -0
  346. data/lib/libv8/v8/src/debug.h +1057 -0
  347. data/lib/libv8/v8/src/deoptimizer.cc +1256 -0
  348. data/lib/libv8/v8/src/deoptimizer.h +602 -0
  349. data/lib/libv8/v8/src/disasm.h +80 -0
  350. data/lib/libv8/v8/src/disassembler.cc +343 -0
  351. data/lib/libv8/v8/src/disassembler.h +58 -0
  352. data/lib/libv8/v8/src/diy-fp.cc +58 -0
  353. data/lib/libv8/v8/src/diy-fp.h +117 -0
  354. data/lib/libv8/v8/src/double.h +238 -0
  355. data/lib/libv8/v8/src/dtoa.cc +103 -0
  356. data/lib/libv8/v8/src/dtoa.h +85 -0
  357. data/lib/libv8/v8/src/execution.cc +849 -0
  358. data/lib/libv8/v8/src/execution.h +297 -0
  359. data/lib/libv8/v8/src/extensions/experimental/break-iterator.cc +250 -0
  360. data/lib/libv8/v8/src/extensions/experimental/break-iterator.h +89 -0
  361. data/lib/libv8/v8/src/extensions/experimental/collator.cc +218 -0
  362. data/lib/libv8/v8/src/extensions/experimental/collator.h +69 -0
  363. data/lib/libv8/v8/src/extensions/experimental/experimental.gyp +94 -0
  364. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.cc +78 -0
  365. data/lib/libv8/v8/src/extensions/experimental/i18n-extension.h +54 -0
  366. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.cc +112 -0
  367. data/lib/libv8/v8/src/extensions/experimental/i18n-locale.h +60 -0
  368. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.cc +43 -0
  369. data/lib/libv8/v8/src/extensions/experimental/i18n-utils.h +49 -0
  370. data/lib/libv8/v8/src/extensions/experimental/i18n.js +180 -0
  371. data/lib/libv8/v8/src/extensions/experimental/language-matcher.cc +251 -0
  372. data/lib/libv8/v8/src/extensions/experimental/language-matcher.h +95 -0
  373. data/lib/libv8/v8/src/extensions/externalize-string-extension.cc +141 -0
  374. data/lib/libv8/v8/src/extensions/externalize-string-extension.h +50 -0
  375. data/lib/libv8/v8/src/extensions/gc-extension.cc +58 -0
  376. data/lib/libv8/v8/src/extensions/gc-extension.h +49 -0
  377. data/lib/libv8/v8/src/factory.cc +1222 -0
  378. data/lib/libv8/v8/src/factory.h +442 -0
  379. data/lib/libv8/v8/src/fast-dtoa.cc +736 -0
  380. data/lib/libv8/v8/src/fast-dtoa.h +83 -0
  381. data/lib/libv8/v8/src/fixed-dtoa.cc +405 -0
  382. data/lib/libv8/v8/src/fixed-dtoa.h +55 -0
  383. data/lib/libv8/v8/src/flag-definitions.h +560 -0
  384. data/lib/libv8/v8/src/flags.cc +551 -0
  385. data/lib/libv8/v8/src/flags.h +79 -0
  386. data/lib/libv8/v8/src/frames-inl.h +247 -0
  387. data/lib/libv8/v8/src/frames.cc +1243 -0
  388. data/lib/libv8/v8/src/frames.h +870 -0
  389. data/lib/libv8/v8/src/full-codegen.cc +1374 -0
  390. data/lib/libv8/v8/src/full-codegen.h +771 -0
  391. data/lib/libv8/v8/src/func-name-inferrer.cc +92 -0
  392. data/lib/libv8/v8/src/func-name-inferrer.h +111 -0
  393. data/lib/libv8/v8/src/gdb-jit.cc +1555 -0
  394. data/lib/libv8/v8/src/gdb-jit.h +143 -0
  395. data/lib/libv8/v8/src/global-handles.cc +665 -0
  396. data/lib/libv8/v8/src/global-handles.h +284 -0
  397. data/lib/libv8/v8/src/globals.h +325 -0
  398. data/lib/libv8/v8/src/handles-inl.h +177 -0
  399. data/lib/libv8/v8/src/handles.cc +987 -0
  400. data/lib/libv8/v8/src/handles.h +382 -0
  401. data/lib/libv8/v8/src/hashmap.cc +230 -0
  402. data/lib/libv8/v8/src/hashmap.h +123 -0
  403. data/lib/libv8/v8/src/heap-inl.h +704 -0
  404. data/lib/libv8/v8/src/heap-profiler.cc +1173 -0
  405. data/lib/libv8/v8/src/heap-profiler.h +397 -0
  406. data/lib/libv8/v8/src/heap.cc +5930 -0
  407. data/lib/libv8/v8/src/heap.h +2268 -0
  408. data/lib/libv8/v8/src/hydrogen-instructions.cc +1769 -0
  409. data/lib/libv8/v8/src/hydrogen-instructions.h +3971 -0
  410. data/lib/libv8/v8/src/hydrogen.cc +6239 -0
  411. data/lib/libv8/v8/src/hydrogen.h +1202 -0
  412. data/lib/libv8/v8/src/ia32/assembler-ia32-inl.h +446 -0
  413. data/lib/libv8/v8/src/ia32/assembler-ia32.cc +2487 -0
  414. data/lib/libv8/v8/src/ia32/assembler-ia32.h +1144 -0
  415. data/lib/libv8/v8/src/ia32/builtins-ia32.cc +1621 -0
  416. data/lib/libv8/v8/src/ia32/code-stubs-ia32.cc +6198 -0
  417. data/lib/libv8/v8/src/ia32/code-stubs-ia32.h +517 -0
  418. data/lib/libv8/v8/src/ia32/codegen-ia32.cc +265 -0
  419. data/lib/libv8/v8/src/ia32/codegen-ia32.h +79 -0
  420. data/lib/libv8/v8/src/ia32/cpu-ia32.cc +88 -0
  421. data/lib/libv8/v8/src/ia32/debug-ia32.cc +312 -0
  422. data/lib/libv8/v8/src/ia32/deoptimizer-ia32.cc +774 -0
  423. data/lib/libv8/v8/src/ia32/disasm-ia32.cc +1628 -0
  424. data/lib/libv8/v8/src/ia32/frames-ia32.cc +45 -0
  425. data/lib/libv8/v8/src/ia32/frames-ia32.h +142 -0
  426. data/lib/libv8/v8/src/ia32/full-codegen-ia32.cc +4338 -0
  427. data/lib/libv8/v8/src/ia32/ic-ia32.cc +1597 -0
  428. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.cc +4461 -0
  429. data/lib/libv8/v8/src/ia32/lithium-codegen-ia32.h +375 -0
  430. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.cc +475 -0
  431. data/lib/libv8/v8/src/ia32/lithium-gap-resolver-ia32.h +110 -0
  432. data/lib/libv8/v8/src/ia32/lithium-ia32.cc +2261 -0
  433. data/lib/libv8/v8/src/ia32/lithium-ia32.h +2396 -0
  434. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.cc +2136 -0
  435. data/lib/libv8/v8/src/ia32/macro-assembler-ia32.h +775 -0
  436. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.cc +1263 -0
  437. data/lib/libv8/v8/src/ia32/regexp-macro-assembler-ia32.h +216 -0
  438. data/lib/libv8/v8/src/ia32/simulator-ia32.cc +30 -0
  439. data/lib/libv8/v8/src/ia32/simulator-ia32.h +74 -0
  440. data/lib/libv8/v8/src/ia32/stub-cache-ia32.cc +3847 -0
  441. data/lib/libv8/v8/src/ic-inl.h +130 -0
  442. data/lib/libv8/v8/src/ic.cc +2577 -0
  443. data/lib/libv8/v8/src/ic.h +736 -0
  444. data/lib/libv8/v8/src/inspector.cc +63 -0
  445. data/lib/libv8/v8/src/inspector.h +62 -0
  446. data/lib/libv8/v8/src/interpreter-irregexp.cc +659 -0
  447. data/lib/libv8/v8/src/interpreter-irregexp.h +49 -0
  448. data/lib/libv8/v8/src/isolate-inl.h +50 -0
  449. data/lib/libv8/v8/src/isolate.cc +1869 -0
  450. data/lib/libv8/v8/src/isolate.h +1382 -0
  451. data/lib/libv8/v8/src/json-parser.cc +504 -0
  452. data/lib/libv8/v8/src/json-parser.h +161 -0
  453. data/lib/libv8/v8/src/json.js +342 -0
  454. data/lib/libv8/v8/src/jsregexp.cc +5385 -0
  455. data/lib/libv8/v8/src/jsregexp.h +1492 -0
  456. data/lib/libv8/v8/src/list-inl.h +212 -0
  457. data/lib/libv8/v8/src/list.h +174 -0
  458. data/lib/libv8/v8/src/lithium-allocator-inl.h +142 -0
  459. data/lib/libv8/v8/src/lithium-allocator.cc +2123 -0
  460. data/lib/libv8/v8/src/lithium-allocator.h +630 -0
  461. data/lib/libv8/v8/src/lithium.cc +190 -0
  462. data/lib/libv8/v8/src/lithium.h +597 -0
  463. data/lib/libv8/v8/src/liveedit-debugger.js +1082 -0
  464. data/lib/libv8/v8/src/liveedit.cc +1691 -0
  465. data/lib/libv8/v8/src/liveedit.h +180 -0
  466. data/lib/libv8/v8/src/liveobjectlist-inl.h +126 -0
  467. data/lib/libv8/v8/src/liveobjectlist.cc +2589 -0
  468. data/lib/libv8/v8/src/liveobjectlist.h +322 -0
  469. data/lib/libv8/v8/src/log-inl.h +59 -0
  470. data/lib/libv8/v8/src/log-utils.cc +428 -0
  471. data/lib/libv8/v8/src/log-utils.h +231 -0
  472. data/lib/libv8/v8/src/log.cc +1993 -0
  473. data/lib/libv8/v8/src/log.h +476 -0
  474. data/lib/libv8/v8/src/macro-assembler.h +120 -0
  475. data/lib/libv8/v8/src/macros.py +178 -0
  476. data/lib/libv8/v8/src/mark-compact.cc +3143 -0
  477. data/lib/libv8/v8/src/mark-compact.h +506 -0
  478. data/lib/libv8/v8/src/math.js +264 -0
  479. data/lib/libv8/v8/src/messages.cc +179 -0
  480. data/lib/libv8/v8/src/messages.h +113 -0
  481. data/lib/libv8/v8/src/messages.js +1096 -0
  482. data/lib/libv8/v8/src/mips/assembler-mips-inl.h +312 -0
  483. data/lib/libv8/v8/src/mips/assembler-mips.cc +1960 -0
  484. data/lib/libv8/v8/src/mips/assembler-mips.h +1138 -0
  485. data/lib/libv8/v8/src/mips/builtins-mips.cc +1628 -0
  486. data/lib/libv8/v8/src/mips/code-stubs-mips.cc +6656 -0
  487. data/lib/libv8/v8/src/mips/code-stubs-mips.h +682 -0
  488. data/lib/libv8/v8/src/mips/codegen-mips.cc +52 -0
  489. data/lib/libv8/v8/src/mips/codegen-mips.h +98 -0
  490. data/lib/libv8/v8/src/mips/constants-mips.cc +352 -0
  491. data/lib/libv8/v8/src/mips/constants-mips.h +739 -0
  492. data/lib/libv8/v8/src/mips/cpu-mips.cc +96 -0
  493. data/lib/libv8/v8/src/mips/debug-mips.cc +308 -0
  494. data/lib/libv8/v8/src/mips/deoptimizer-mips.cc +91 -0
  495. data/lib/libv8/v8/src/mips/disasm-mips.cc +1050 -0
  496. data/lib/libv8/v8/src/mips/frames-mips.cc +47 -0
  497. data/lib/libv8/v8/src/mips/frames-mips.h +219 -0
  498. data/lib/libv8/v8/src/mips/full-codegen-mips.cc +4388 -0
  499. data/lib/libv8/v8/src/mips/ic-mips.cc +1580 -0
  500. data/lib/libv8/v8/src/mips/lithium-codegen-mips.h +65 -0
  501. data/lib/libv8/v8/src/mips/lithium-mips.h +307 -0
  502. data/lib/libv8/v8/src/mips/macro-assembler-mips.cc +4056 -0
  503. data/lib/libv8/v8/src/mips/macro-assembler-mips.h +1214 -0
  504. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.cc +1251 -0
  505. data/lib/libv8/v8/src/mips/regexp-macro-assembler-mips.h +252 -0
  506. data/lib/libv8/v8/src/mips/simulator-mips.cc +2621 -0
  507. data/lib/libv8/v8/src/mips/simulator-mips.h +401 -0
  508. data/lib/libv8/v8/src/mips/stub-cache-mips.cc +4285 -0
  509. data/lib/libv8/v8/src/mirror-debugger.js +2382 -0
  510. data/lib/libv8/v8/src/mksnapshot.cc +328 -0
  511. data/lib/libv8/v8/src/natives.h +64 -0
  512. data/lib/libv8/v8/src/objects-debug.cc +738 -0
  513. data/lib/libv8/v8/src/objects-inl.h +4323 -0
  514. data/lib/libv8/v8/src/objects-printer.cc +829 -0
  515. data/lib/libv8/v8/src/objects-visiting.cc +148 -0
  516. data/lib/libv8/v8/src/objects-visiting.h +424 -0
  517. data/lib/libv8/v8/src/objects.cc +10585 -0
  518. data/lib/libv8/v8/src/objects.h +6838 -0
  519. data/lib/libv8/v8/src/parser.cc +4997 -0
  520. data/lib/libv8/v8/src/parser.h +765 -0
  521. data/lib/libv8/v8/src/platform-cygwin.cc +779 -0
  522. data/lib/libv8/v8/src/platform-freebsd.cc +826 -0
  523. data/lib/libv8/v8/src/platform-linux.cc +1149 -0
  524. data/lib/libv8/v8/src/platform-macos.cc +830 -0
  525. data/lib/libv8/v8/src/platform-nullos.cc +479 -0
  526. data/lib/libv8/v8/src/platform-openbsd.cc +640 -0
  527. data/lib/libv8/v8/src/platform-posix.cc +424 -0
  528. data/lib/libv8/v8/src/platform-solaris.cc +762 -0
  529. data/lib/libv8/v8/src/platform-tls-mac.h +62 -0
  530. data/lib/libv8/v8/src/platform-tls-win32.h +62 -0
  531. data/lib/libv8/v8/src/platform-tls.h +50 -0
  532. data/lib/libv8/v8/src/platform-win32.cc +2021 -0
  533. data/lib/libv8/v8/src/platform.h +667 -0
  534. data/lib/libv8/v8/src/preparse-data-format.h +62 -0
  535. data/lib/libv8/v8/src/preparse-data.cc +183 -0
  536. data/lib/libv8/v8/src/preparse-data.h +225 -0
  537. data/lib/libv8/v8/src/preparser-api.cc +220 -0
  538. data/lib/libv8/v8/src/preparser.cc +1450 -0
  539. data/lib/libv8/v8/src/preparser.h +493 -0
  540. data/lib/libv8/v8/src/prettyprinter.cc +1493 -0
  541. data/lib/libv8/v8/src/prettyprinter.h +223 -0
  542. data/lib/libv8/v8/src/profile-generator-inl.h +128 -0
  543. data/lib/libv8/v8/src/profile-generator.cc +3098 -0
  544. data/lib/libv8/v8/src/profile-generator.h +1126 -0
  545. data/lib/libv8/v8/src/property.cc +105 -0
  546. data/lib/libv8/v8/src/property.h +365 -0
  547. data/lib/libv8/v8/src/proxy.js +83 -0
  548. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp-inl.h +78 -0
  549. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.cc +471 -0
  550. data/lib/libv8/v8/src/regexp-macro-assembler-irregexp.h +142 -0
  551. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.cc +373 -0
  552. data/lib/libv8/v8/src/regexp-macro-assembler-tracer.h +104 -0
  553. data/lib/libv8/v8/src/regexp-macro-assembler.cc +267 -0
  554. data/lib/libv8/v8/src/regexp-macro-assembler.h +243 -0
  555. data/lib/libv8/v8/src/regexp-stack.cc +111 -0
  556. data/lib/libv8/v8/src/regexp-stack.h +147 -0
  557. data/lib/libv8/v8/src/regexp.js +483 -0
  558. data/lib/libv8/v8/src/rewriter.cc +360 -0
  559. data/lib/libv8/v8/src/rewriter.h +50 -0
  560. data/lib/libv8/v8/src/runtime-profiler.cc +489 -0
  561. data/lib/libv8/v8/src/runtime-profiler.h +201 -0
  562. data/lib/libv8/v8/src/runtime.cc +12227 -0
  563. data/lib/libv8/v8/src/runtime.h +652 -0
  564. data/lib/libv8/v8/src/runtime.js +649 -0
  565. data/lib/libv8/v8/src/safepoint-table.cc +256 -0
  566. data/lib/libv8/v8/src/safepoint-table.h +270 -0
  567. data/lib/libv8/v8/src/scanner-base.cc +952 -0
  568. data/lib/libv8/v8/src/scanner-base.h +670 -0
  569. data/lib/libv8/v8/src/scanner.cc +345 -0
  570. data/lib/libv8/v8/src/scanner.h +146 -0
  571. data/lib/libv8/v8/src/scopeinfo.cc +646 -0
  572. data/lib/libv8/v8/src/scopeinfo.h +254 -0
  573. data/lib/libv8/v8/src/scopes.cc +1150 -0
  574. data/lib/libv8/v8/src/scopes.h +507 -0
  575. data/lib/libv8/v8/src/serialize.cc +1574 -0
  576. data/lib/libv8/v8/src/serialize.h +589 -0
  577. data/lib/libv8/v8/src/shell.h +55 -0
  578. data/lib/libv8/v8/src/simulator.h +43 -0
  579. data/lib/libv8/v8/src/small-pointer-list.h +163 -0
  580. data/lib/libv8/v8/src/smart-pointer.h +109 -0
  581. data/lib/libv8/v8/src/snapshot-common.cc +83 -0
  582. data/lib/libv8/v8/src/snapshot-empty.cc +54 -0
  583. data/lib/libv8/v8/src/snapshot.h +91 -0
  584. data/lib/libv8/v8/src/spaces-inl.h +529 -0
  585. data/lib/libv8/v8/src/spaces.cc +3145 -0
  586. data/lib/libv8/v8/src/spaces.h +2369 -0
  587. data/lib/libv8/v8/src/splay-tree-inl.h +310 -0
  588. data/lib/libv8/v8/src/splay-tree.h +205 -0
  589. data/lib/libv8/v8/src/string-search.cc +41 -0
  590. data/lib/libv8/v8/src/string-search.h +568 -0
  591. data/lib/libv8/v8/src/string-stream.cc +592 -0
  592. data/lib/libv8/v8/src/string-stream.h +191 -0
  593. data/lib/libv8/v8/src/string.js +994 -0
  594. data/lib/libv8/v8/src/strtod.cc +440 -0
  595. data/lib/libv8/v8/src/strtod.h +40 -0
  596. data/lib/libv8/v8/src/stub-cache.cc +1965 -0
  597. data/lib/libv8/v8/src/stub-cache.h +924 -0
  598. data/lib/libv8/v8/src/third_party/valgrind/valgrind.h +3925 -0
  599. data/lib/libv8/v8/src/token.cc +63 -0
  600. data/lib/libv8/v8/src/token.h +288 -0
  601. data/lib/libv8/v8/src/type-info.cc +507 -0
  602. data/lib/libv8/v8/src/type-info.h +272 -0
  603. data/lib/libv8/v8/src/unbound-queue-inl.h +95 -0
  604. data/lib/libv8/v8/src/unbound-queue.h +69 -0
  605. data/lib/libv8/v8/src/unicode-inl.h +238 -0
  606. data/lib/libv8/v8/src/unicode.cc +1624 -0
  607. data/lib/libv8/v8/src/unicode.h +280 -0
  608. data/lib/libv8/v8/src/uri.js +408 -0
  609. data/lib/libv8/v8/src/utils-inl.h +48 -0
  610. data/lib/libv8/v8/src/utils.cc +371 -0
  611. data/lib/libv8/v8/src/utils.h +800 -0
  612. data/lib/libv8/v8/src/v8-counters.cc +62 -0
  613. data/lib/libv8/v8/src/v8-counters.h +314 -0
  614. data/lib/libv8/v8/src/v8.cc +213 -0
  615. data/lib/libv8/v8/src/v8.h +131 -0
  616. data/lib/libv8/v8/src/v8checks.h +64 -0
  617. data/lib/libv8/v8/src/v8dll-main.cc +44 -0
  618. data/lib/libv8/v8/src/v8globals.h +512 -0
  619. data/lib/libv8/v8/src/v8memory.h +82 -0
  620. data/lib/libv8/v8/src/v8natives.js +1310 -0
  621. data/lib/libv8/v8/src/v8preparserdll-main.cc +39 -0
  622. data/lib/libv8/v8/src/v8threads.cc +464 -0
  623. data/lib/libv8/v8/src/v8threads.h +165 -0
  624. data/lib/libv8/v8/src/v8utils.h +319 -0
  625. data/lib/libv8/v8/src/variables.cc +114 -0
  626. data/lib/libv8/v8/src/variables.h +167 -0
  627. data/lib/libv8/v8/src/version.cc +116 -0
  628. data/lib/libv8/v8/src/version.h +68 -0
  629. data/lib/libv8/v8/src/vm-state-inl.h +138 -0
  630. data/lib/libv8/v8/src/vm-state.h +71 -0
  631. data/lib/libv8/v8/src/win32-headers.h +96 -0
  632. data/lib/libv8/v8/src/x64/assembler-x64-inl.h +462 -0
  633. data/lib/libv8/v8/src/x64/assembler-x64.cc +3027 -0
  634. data/lib/libv8/v8/src/x64/assembler-x64.h +1633 -0
  635. data/lib/libv8/v8/src/x64/builtins-x64.cc +1520 -0
  636. data/lib/libv8/v8/src/x64/code-stubs-x64.cc +5132 -0
  637. data/lib/libv8/v8/src/x64/code-stubs-x64.h +514 -0
  638. data/lib/libv8/v8/src/x64/codegen-x64.cc +146 -0
  639. data/lib/libv8/v8/src/x64/codegen-x64.h +76 -0
  640. data/lib/libv8/v8/src/x64/cpu-x64.cc +88 -0
  641. data/lib/libv8/v8/src/x64/debug-x64.cc +319 -0
  642. data/lib/libv8/v8/src/x64/deoptimizer-x64.cc +815 -0
  643. data/lib/libv8/v8/src/x64/disasm-x64.cc +1832 -0
  644. data/lib/libv8/v8/src/x64/frames-x64.cc +45 -0
  645. data/lib/libv8/v8/src/x64/frames-x64.h +130 -0
  646. data/lib/libv8/v8/src/x64/full-codegen-x64.cc +4318 -0
  647. data/lib/libv8/v8/src/x64/ic-x64.cc +1608 -0
  648. data/lib/libv8/v8/src/x64/lithium-codegen-x64.cc +4267 -0
  649. data/lib/libv8/v8/src/x64/lithium-codegen-x64.h +367 -0
  650. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.cc +320 -0
  651. data/lib/libv8/v8/src/x64/lithium-gap-resolver-x64.h +74 -0
  652. data/lib/libv8/v8/src/x64/lithium-x64.cc +2202 -0
  653. data/lib/libv8/v8/src/x64/lithium-x64.h +2333 -0
  654. data/lib/libv8/v8/src/x64/macro-assembler-x64.cc +3745 -0
  655. data/lib/libv8/v8/src/x64/macro-assembler-x64.h +1290 -0
  656. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.cc +1398 -0
  657. data/lib/libv8/v8/src/x64/regexp-macro-assembler-x64.h +282 -0
  658. data/lib/libv8/v8/src/x64/simulator-x64.cc +27 -0
  659. data/lib/libv8/v8/src/x64/simulator-x64.h +72 -0
  660. data/lib/libv8/v8/src/x64/stub-cache-x64.cc +3610 -0
  661. data/lib/libv8/v8/src/zone-inl.h +140 -0
  662. data/lib/libv8/v8/src/zone.cc +196 -0
  663. data/lib/libv8/v8/src/zone.h +240 -0
  664. data/lib/libv8/v8/tools/codemap.js +265 -0
  665. data/lib/libv8/v8/tools/consarray.js +93 -0
  666. data/lib/libv8/v8/tools/csvparser.js +78 -0
  667. data/lib/libv8/v8/tools/disasm.py +92 -0
  668. data/lib/libv8/v8/tools/freebsd-tick-processor +10 -0
  669. data/lib/libv8/v8/tools/gc-nvp-trace-processor.py +342 -0
  670. data/lib/libv8/v8/tools/gcmole/README +62 -0
  671. data/lib/libv8/v8/tools/gcmole/gccause.lua +60 -0
  672. data/lib/libv8/v8/tools/gcmole/gcmole.cc +1261 -0
  673. data/lib/libv8/v8/tools/gcmole/gcmole.lua +378 -0
  674. data/lib/libv8/v8/tools/generate-ten-powers.scm +286 -0
  675. data/lib/libv8/v8/tools/grokdump.py +841 -0
  676. data/lib/libv8/v8/tools/gyp/v8.gyp +995 -0
  677. data/lib/libv8/v8/tools/js2c.py +364 -0
  678. data/lib/libv8/v8/tools/jsmin.py +280 -0
  679. data/lib/libv8/v8/tools/linux-tick-processor +35 -0
  680. data/lib/libv8/v8/tools/ll_prof.py +942 -0
  681. data/lib/libv8/v8/tools/logreader.js +185 -0
  682. data/lib/libv8/v8/tools/mac-nm +18 -0
  683. data/lib/libv8/v8/tools/mac-tick-processor +6 -0
  684. data/lib/libv8/v8/tools/oom_dump/README +31 -0
  685. data/lib/libv8/v8/tools/oom_dump/SConstruct +42 -0
  686. data/lib/libv8/v8/tools/oom_dump/oom_dump.cc +288 -0
  687. data/lib/libv8/v8/tools/presubmit.py +305 -0
  688. data/lib/libv8/v8/tools/process-heap-prof.py +120 -0
  689. data/lib/libv8/v8/tools/profile.js +751 -0
  690. data/lib/libv8/v8/tools/profile_view.js +219 -0
  691. data/lib/libv8/v8/tools/run-valgrind.py +77 -0
  692. data/lib/libv8/v8/tools/splaytree.js +316 -0
  693. data/lib/libv8/v8/tools/stats-viewer.py +468 -0
  694. data/lib/libv8/v8/tools/test.py +1510 -0
  695. data/lib/libv8/v8/tools/tickprocessor-driver.js +59 -0
  696. data/lib/libv8/v8/tools/tickprocessor.js +877 -0
  697. data/lib/libv8/v8/tools/utils.py +96 -0
  698. data/lib/libv8/v8/tools/visual_studio/README.txt +12 -0
  699. data/lib/libv8/v8/tools/windows-tick-processor.bat +30 -0
  700. data/lib/libv8/version.rb +6 -0
  701. data/libv8.gemspec +36 -0
  702. data/thefrontside.png +0 -0
  703. metadata +776 -0
@@ -0,0 +1,50 @@
1
+ #
2
+ # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included
13
+ # in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
16
+ # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
17
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #
23
+
24
+ __revision__ = "src/engine/SCons/Tool/mssdk.py 5357 2011/09/09 21:31:03 bdeegan"
25
+
26
+ """engine.SCons.Tool.mssdk
27
+
28
+ Tool-specific initialization for Microsoft SDKs, both Platform
29
+ SDKs and Windows SDKs.
30
+
31
+ There normally shouldn't be any need to import this module directly.
32
+ It will usually be imported through the generic SCons.Tool.Tool()
33
+ selection method.
34
+ """
35
+
36
+ from MSCommon import mssdk_exists, \
37
+ mssdk_setup_env
38
+
39
+ def generate(env):
40
+ """Add construction variables for an MS SDK to an Environment."""
41
+ mssdk_setup_env(env)
42
+
43
+ def exists(env):
44
+ return mssdk_exists()
45
+
46
+ # Local Variables:
47
+ # tab-width:4
48
+ # indent-tabs-mode:nil
49
+ # End:
50
+ # vim: set expandtab tabstop=4 shiftwidth=4:
@@ -0,0 +1,278 @@
1
+ """engine.SCons.Tool.msvc
2
+
3
+ Tool-specific initialization for Microsoft Visual C/C++.
4
+
5
+ There normally shouldn't be any need to import this module directly.
6
+ It will usually be imported through the generic SCons.Tool.Tool()
7
+ selection method.
8
+
9
+ """
10
+
11
+ #
12
+ # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
13
+ #
14
+ # Permission is hereby granted, free of charge, to any person obtaining
15
+ # a copy of this software and associated documentation files (the
16
+ # "Software"), to deal in the Software without restriction, including
17
+ # without limitation the rights to use, copy, modify, merge, publish,
18
+ # distribute, sublicense, and/or sell copies of the Software, and to
19
+ # permit persons to whom the Software is furnished to do so, subject to
20
+ # the following conditions:
21
+ #
22
+ # The above copyright notice and this permission notice shall be included
23
+ # in all copies or substantial portions of the Software.
24
+ #
25
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
26
+ # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
27
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+ #
33
+
34
+ __revision__ = "src/engine/SCons/Tool/msvc.py 5357 2011/09/09 21:31:03 bdeegan"
35
+
36
+ import os.path
37
+ import re
38
+ import sys
39
+
40
+ import SCons.Action
41
+ import SCons.Builder
42
+ import SCons.Errors
43
+ import SCons.Platform.win32
44
+ import SCons.Tool
45
+ import SCons.Tool.msvs
46
+ import SCons.Util
47
+ import SCons.Warnings
48
+ import SCons.Scanner.RC
49
+
50
+ from MSCommon import msvc_exists, msvc_setup_env_once
51
+
52
+ CSuffixes = ['.c', '.C']
53
+ CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++']
54
+
55
+ def validate_vars(env):
56
+ """Validate the PCH and PCHSTOP construction variables."""
57
+ if 'PCH' in env and env['PCH']:
58
+ if 'PCHSTOP' not in env:
59
+ raise SCons.Errors.UserError("The PCHSTOP construction must be defined if PCH is defined.")
60
+ if not SCons.Util.is_String(env['PCHSTOP']):
61
+ raise SCons.Errors.UserError("The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP'])
62
+
63
+ def pch_emitter(target, source, env):
64
+ """Adds the object file target."""
65
+
66
+ validate_vars(env)
67
+
68
+ pch = None
69
+ obj = None
70
+
71
+ for t in target:
72
+ if SCons.Util.splitext(str(t))[1] == '.pch':
73
+ pch = t
74
+ if SCons.Util.splitext(str(t))[1] == '.obj':
75
+ obj = t
76
+
77
+ if not obj:
78
+ obj = SCons.Util.splitext(str(pch))[0]+'.obj'
79
+
80
+ target = [pch, obj] # pch must be first, and obj second for the PCHCOM to work
81
+
82
+ return (target, source)
83
+
84
+ def object_emitter(target, source, env, parent_emitter):
85
+ """Sets up the PCH dependencies for an object file."""
86
+
87
+ validate_vars(env)
88
+
89
+ parent_emitter(target, source, env)
90
+
91
+ # Add a dependency, but only if the target (e.g. 'Source1.obj')
92
+ # doesn't correspond to the pre-compiled header ('Source1.pch').
93
+ # If the basenames match, then this was most likely caused by
94
+ # someone adding the source file to both the env.PCH() and the
95
+ # env.Program() calls, and adding the explicit dependency would
96
+ # cause a cycle on the .pch file itself.
97
+ #
98
+ # See issue #2505 for a discussion of what to do if it turns
99
+ # out this assumption causes trouble in the wild:
100
+ # http://scons.tigris.org/issues/show_bug.cgi?id=2505
101
+ if 'PCH' in env:
102
+ pch = env['PCH']
103
+ if str(target[0]) != SCons.Util.splitext(str(pch))[0] + '.obj':
104
+ env.Depends(target, pch)
105
+
106
+ return (target, source)
107
+
108
+ def static_object_emitter(target, source, env):
109
+ return object_emitter(target, source, env,
110
+ SCons.Defaults.StaticObjectEmitter)
111
+
112
+ def shared_object_emitter(target, source, env):
113
+ return object_emitter(target, source, env,
114
+ SCons.Defaults.SharedObjectEmitter)
115
+
116
+ pch_action = SCons.Action.Action('$PCHCOM', '$PCHCOMSTR')
117
+ pch_builder = SCons.Builder.Builder(action=pch_action, suffix='.pch',
118
+ emitter=pch_emitter,
119
+ source_scanner=SCons.Tool.SourceFileScanner)
120
+
121
+
122
+ # Logic to build .rc files into .res files (resource files)
123
+ res_scanner = SCons.Scanner.RC.RCScan()
124
+ res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR')
125
+ res_builder = SCons.Builder.Builder(action=res_action,
126
+ src_suffix='.rc',
127
+ suffix='.res',
128
+ src_builder=[],
129
+ source_scanner=res_scanner)
130
+
131
+ def msvc_batch_key(action, env, target, source):
132
+ """
133
+ Returns a key to identify unique batches of sources for compilation.
134
+
135
+ If batching is enabled (via the $MSVC_BATCH setting), then all
136
+ target+source pairs that use the same action, defined by the same
137
+ environment, and have the same target and source directories, will
138
+ be batched.
139
+
140
+ Returning None specifies that the specified target+source should not
141
+ be batched with other compilations.
142
+ """
143
+
144
+ # Fixing MSVC_BATCH mode. Previous if did not work when MSVC_BATCH
145
+ # was set to False. This new version should work better.
146
+ # Note we need to do the env.subst so $MSVC_BATCH can be a reference to
147
+ # another construction variable, which is why we test for False and 0
148
+ # as strings.
149
+ if not 'MSVC_BATCH' in env or env.subst('$MSVC_BATCH') in ('0', 'False', '', None):
150
+ # We're not using batching; return no key.
151
+ return None
152
+ t = target[0]
153
+ s = source[0]
154
+ if os.path.splitext(t.name)[0] != os.path.splitext(s.name)[0]:
155
+ # The base names are different, so this *must* be compiled
156
+ # separately; return no key.
157
+ return None
158
+ return (id(action), id(env), t.dir, s.dir)
159
+
160
+ def msvc_output_flag(target, source, env, for_signature):
161
+ """
162
+ Returns the correct /Fo flag for batching.
163
+
164
+ If batching is disabled or there's only one source file, then we
165
+ return an /Fo string that specifies the target explicitly. Otherwise,
166
+ we return an /Fo string that just specifies the first target's
167
+ directory (where the Visual C/C++ compiler will put the .obj files).
168
+ """
169
+
170
+ # Fixing MSVC_BATCH mode. Previous if did not work when MSVC_BATCH
171
+ # was set to False. This new version should work better. Removed
172
+ # len(source)==1 as batch mode can compile only one file
173
+ # (and it also fixed problem with compiling only one changed file
174
+ # with batch mode enabled)
175
+ if not 'MSVC_BATCH' in env or env.subst('$MSVC_BATCH') in ('0', 'False', '', None):
176
+ return '/Fo$TARGET'
177
+ else:
178
+ # The Visual C/C++ compiler requires a \ at the end of the /Fo
179
+ # option to indicate an output directory. We use os.sep here so
180
+ # that the test(s) for this can be run on non-Windows systems
181
+ # without having a hard-coded backslash mess up command-line
182
+ # argument parsing.
183
+ return '/Fo${TARGET.dir}' + os.sep
184
+
185
+ CAction = SCons.Action.Action("$CCCOM", "$CCCOMSTR",
186
+ batch_key=msvc_batch_key,
187
+ targets='$CHANGED_TARGETS')
188
+ ShCAction = SCons.Action.Action("$SHCCCOM", "$SHCCCOMSTR",
189
+ batch_key=msvc_batch_key,
190
+ targets='$CHANGED_TARGETS')
191
+ CXXAction = SCons.Action.Action("$CXXCOM", "$CXXCOMSTR",
192
+ batch_key=msvc_batch_key,
193
+ targets='$CHANGED_TARGETS')
194
+ ShCXXAction = SCons.Action.Action("$SHCXXCOM", "$SHCXXCOMSTR",
195
+ batch_key=msvc_batch_key,
196
+ targets='$CHANGED_TARGETS')
197
+
198
+ def generate(env):
199
+ """Add Builders and construction variables for MSVC++ to an Environment."""
200
+ static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
201
+
202
+ # TODO(batch): shouldn't reach in to cmdgen this way; necessary
203
+ # for now to bypass the checks in Builder.DictCmdGenerator.__call__()
204
+ # and allow .cc and .cpp to be compiled in the same command line.
205
+ static_obj.cmdgen.source_ext_match = False
206
+ shared_obj.cmdgen.source_ext_match = False
207
+
208
+ for suffix in CSuffixes:
209
+ static_obj.add_action(suffix, CAction)
210
+ shared_obj.add_action(suffix, ShCAction)
211
+ static_obj.add_emitter(suffix, static_object_emitter)
212
+ shared_obj.add_emitter(suffix, shared_object_emitter)
213
+
214
+ for suffix in CXXSuffixes:
215
+ static_obj.add_action(suffix, CXXAction)
216
+ shared_obj.add_action(suffix, ShCXXAction)
217
+ static_obj.add_emitter(suffix, static_object_emitter)
218
+ shared_obj.add_emitter(suffix, shared_object_emitter)
219
+
220
+ env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Z7") or ""}'])
221
+ env['CCPCHFLAGS'] = SCons.Util.CLVar(['${(PCH and "/Yu%s \\\"/Fp%s\\\""%(PCHSTOP or "",File(PCH))) or ""}'])
222
+ env['_MSVC_OUTPUT_FLAG'] = msvc_output_flag
223
+ env['_CCCOMCOM'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS $CCPCHFLAGS $CCPDBFLAGS'
224
+ env['CC'] = 'cl'
225
+ env['CCFLAGS'] = SCons.Util.CLVar('/nologo')
226
+ env['CFLAGS'] = SCons.Util.CLVar('')
227
+ env['CCCOM'] = '${TEMPFILE("$CC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $CFLAGS $CCFLAGS $_CCCOMCOM")}'
228
+ env['SHCC'] = '$CC'
229
+ env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')
230
+ env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS')
231
+ env['SHCCCOM'] = '${TEMPFILE("$SHCC $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $SHCFLAGS $SHCCFLAGS $_CCCOMCOM")}'
232
+ env['CXX'] = '$CC'
233
+ env['CXXFLAGS'] = SCons.Util.CLVar('$( /TP $)')
234
+ env['CXXCOM'] = '${TEMPFILE("$CXX $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $CXXFLAGS $CCFLAGS $_CCCOMCOM")}'
235
+ env['SHCXX'] = '$CXX'
236
+ env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS')
237
+ env['SHCXXCOM'] = '${TEMPFILE("$SHCXX $_MSVC_OUTPUT_FLAG /c $CHANGED_SOURCES $SHCXXFLAGS $SHCCFLAGS $_CCCOMCOM")}'
238
+ env['CPPDEFPREFIX'] = '/D'
239
+ env['CPPDEFSUFFIX'] = ''
240
+ env['INCPREFIX'] = '/I'
241
+ env['INCSUFFIX'] = ''
242
+ # env.Append(OBJEMITTER = [static_object_emitter])
243
+ # env.Append(SHOBJEMITTER = [shared_object_emitter])
244
+ env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1
245
+
246
+ env['RC'] = 'rc'
247
+ env['RCFLAGS'] = SCons.Util.CLVar('')
248
+ env['RCSUFFIXES']=['.rc','.rc2']
249
+ env['RCCOM'] = '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES'
250
+ env['BUILDERS']['RES'] = res_builder
251
+ env['OBJPREFIX'] = ''
252
+ env['OBJSUFFIX'] = '.obj'
253
+ env['SHOBJPREFIX'] = '$OBJPREFIX'
254
+ env['SHOBJSUFFIX'] = '$OBJSUFFIX'
255
+
256
+ # Set-up ms tools paths
257
+ msvc_setup_env_once(env)
258
+
259
+ env['CFILESUFFIX'] = '.c'
260
+ env['CXXFILESUFFIX'] = '.cc'
261
+
262
+ env['PCHPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Yd") or ""}'])
263
+ env['PCHCOM'] = '$CXX /Fo${TARGETS[1]} $CXXFLAGS $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS $PCHPDBFLAGS'
264
+ env['BUILDERS']['PCH'] = pch_builder
265
+
266
+ if 'ENV' not in env:
267
+ env['ENV'] = {}
268
+ if 'SystemRoot' not in env['ENV']: # required for dlls in the winsxs folders
269
+ env['ENV']['SystemRoot'] = SCons.Platform.win32.get_system_root()
270
+
271
+ def exists(env):
272
+ return msvc_exists()
273
+
274
+ # Local Variables:
275
+ # tab-width:4
276
+ # indent-tabs-mode:nil
277
+ # End:
278
+ # vim: set expandtab tabstop=4 shiftwidth=4:
@@ -0,0 +1,1806 @@
1
+ """SCons.Tool.msvs
2
+
3
+ Tool-specific initialization for Microsoft Visual Studio project files.
4
+
5
+ There normally shouldn't be any need to import this module directly.
6
+ It will usually be imported through the generic SCons.Tool.Tool()
7
+ selection method.
8
+
9
+ """
10
+
11
+ #
12
+ # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
13
+ #
14
+ # Permission is hereby granted, free of charge, to any person obtaining
15
+ # a copy of this software and associated documentation files (the
16
+ # "Software"), to deal in the Software without restriction, including
17
+ # without limitation the rights to use, copy, modify, merge, publish,
18
+ # distribute, sublicense, and/or sell copies of the Software, and to
19
+ # permit persons to whom the Software is furnished to do so, subject to
20
+ # the following conditions:
21
+ #
22
+ # The above copyright notice and this permission notice shall be included
23
+ # in all copies or substantial portions of the Software.
24
+ #
25
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
26
+ # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
27
+ # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+
33
+ __revision__ = "src/engine/SCons/Tool/msvs.py 5357 2011/09/09 21:31:03 bdeegan"
34
+
35
+ import SCons.compat
36
+
37
+ import base64
38
+ import hashlib
39
+ import ntpath
40
+ import os
41
+ # compat layer imports "cPickle" for us if it's available.
42
+ import pickle
43
+ import re
44
+ import sys
45
+
46
+ import SCons.Builder
47
+ import SCons.Node.FS
48
+ import SCons.Platform.win32
49
+ import SCons.Script.SConscript
50
+ import SCons.PathList
51
+ import SCons.Util
52
+ import SCons.Warnings
53
+
54
+ from MSCommon import msvc_exists, msvc_setup_env_once
55
+ from SCons.Defaults import processDefines
56
+
57
+ ##############################################################################
58
+ # Below here are the classes and functions for generation of
59
+ # DSP/DSW/SLN/VCPROJ files.
60
+ ##############################################################################
61
+
62
+ def xmlify(s):
63
+ s = s.replace("&", "&") # do this first
64
+ s = s.replace("'", "'")
65
+ s = s.replace('"', """)
66
+ return s
67
+
68
+ # Process a CPPPATH list in includes, given the env, target and source.
69
+ # Returns a tuple of nodes.
70
+ def processIncludes(includes, env, target, source):
71
+ return SCons.PathList.PathList(includes).subst_path(env, target, source)
72
+
73
+
74
+ external_makefile_guid = '{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}'
75
+
76
+ def _generateGUID(slnfile, name):
77
+ """This generates a dummy GUID for the sln file to use. It is
78
+ based on the MD5 signatures of the sln filename plus the name of
79
+ the project. It basically just needs to be unique, and not
80
+ change with each invocation."""
81
+ m = hashlib.md5()
82
+ # Normalize the slnfile path to a Windows path (\ separators) so
83
+ # the generated file has a consistent GUID even if we generate
84
+ # it on a non-Windows platform.
85
+ m.update(ntpath.normpath(str(slnfile)) + str(name))
86
+ solution = m.hexdigest().upper()
87
+ # convert most of the signature to GUID form (discard the rest)
88
+ solution = "{" + solution[:8] + "-" + solution[8:12] + "-" + solution[12:16] + "-" + solution[16:20] + "-" + solution[20:32] + "}"
89
+ return solution
90
+
91
+ version_re = re.compile(r'(\d+\.\d+)(.*)')
92
+
93
+ def msvs_parse_version(s):
94
+ """
95
+ Split a Visual Studio version, which may in fact be something like
96
+ '7.0Exp', into is version number (returned as a float) and trailing
97
+ "suite" portion.
98
+ """
99
+ num, suite = version_re.match(s).groups()
100
+ return float(num), suite
101
+
102
+ # os.path.relpath has been introduced in Python 2.6
103
+ # We define it locally for earlier versions of Python
104
+ def relpath(path, start=os.path.curdir):
105
+ """Return a relative version of a path"""
106
+ import sys
107
+ if not path:
108
+ raise ValueError("no path specified")
109
+ start_list = os.path.abspath(start).split(os.sep)
110
+ path_list = os.path.abspath(path).split(os.sep)
111
+ if 'posix' in sys.builtin_module_names:
112
+ # Work out how much of the filepath is shared by start and path.
113
+ i = len(os.path.commonprefix([start_list, path_list]))
114
+ else:
115
+ if start_list[0].lower() != path_list[0].lower():
116
+ unc_path, rest = os.path.splitunc(path)
117
+ unc_start, rest = os.path.splitunc(start)
118
+ if bool(unc_path) ^ bool(unc_start):
119
+ raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)"
120
+ % (path, start))
121
+ else:
122
+ raise ValueError("path is on drive %s, start on drive %s"
123
+ % (path_list[0], start_list[0]))
124
+ # Work out how much of the filepath is shared by start and path.
125
+ for i in range(min(len(start_list), len(path_list))):
126
+ if start_list[i].lower() != path_list[i].lower():
127
+ break
128
+ else:
129
+ i += 1
130
+ rel_list = [os.pardir] * (len(start_list)-i) + path_list[i:]
131
+ if not rel_list:
132
+ return os.path.curdir
133
+ return os.path.join(*rel_list)
134
+
135
+ if not "relpath" in os.path.__all__:
136
+ os.path.relpath = relpath
137
+
138
+ # This is how we re-invoke SCons from inside MSVS Project files.
139
+ # The problem is that we might have been invoked as either scons.bat
140
+ # or scons.py. If we were invoked directly as scons.py, then we could
141
+ # use sys.argv[0] to find the SCons "executable," but that doesn't work
142
+ # if we were invoked as scons.bat, which uses "python -c" to execute
143
+ # things and ends up with "-c" as sys.argv[0]. Consequently, we have
144
+ # the MSVS Project file invoke SCons the same way that scons.bat does,
145
+ # which works regardless of how we were invoked.
146
+ def getExecScriptMain(env, xml=None):
147
+ scons_home = env.get('SCONS_HOME')
148
+ if not scons_home and 'SCONS_LIB_DIR' in os.environ:
149
+ scons_home = os.environ['SCONS_LIB_DIR']
150
+ if scons_home:
151
+ exec_script_main = "from os.path import join; import sys; sys.path = [ r'%s' ] + sys.path; import SCons.Script; SCons.Script.main()" % scons_home
152
+ else:
153
+ version = SCons.__version__
154
+ exec_script_main = "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-%(version)s'), join(sys.prefix, 'scons-%(version)s'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons') ] + sys.path; import SCons.Script; SCons.Script.main()" % locals()
155
+ if xml:
156
+ exec_script_main = xmlify(exec_script_main)
157
+ return exec_script_main
158
+
159
+ # The string for the Python executable we tell the Project file to use
160
+ # is either sys.executable or, if an external PYTHON_ROOT environment
161
+ # variable exists, $(PYTHON)ROOT\\python.exe (generalized a little to
162
+ # pluck the actual executable name from sys.executable).
163
+ try:
164
+ python_root = os.environ['PYTHON_ROOT']
165
+ except KeyError:
166
+ python_executable = sys.executable
167
+ else:
168
+ python_executable = os.path.join('$$(PYTHON_ROOT)',
169
+ os.path.split(sys.executable)[1])
170
+
171
+ class Config(object):
172
+ pass
173
+
174
+ def splitFully(path):
175
+ dir, base = os.path.split(path)
176
+ if dir and dir != '' and dir != path:
177
+ return splitFully(dir)+[base]
178
+ if base == '':
179
+ return []
180
+ return [base]
181
+
182
+ def makeHierarchy(sources):
183
+ '''Break a list of files into a hierarchy; for each value, if it is a string,
184
+ then it is a file. If it is a dictionary, it is a folder. The string is
185
+ the original path of the file.'''
186
+
187
+ hierarchy = {}
188
+ for file in sources:
189
+ path = splitFully(file)
190
+ if len(path):
191
+ dict = hierarchy
192
+ for part in path[:-1]:
193
+ if part not in dict:
194
+ dict[part] = {}
195
+ dict = dict[part]
196
+ dict[path[-1]] = file
197
+ #else:
198
+ # print 'Warning: failed to decompose path for '+str(file)
199
+ return hierarchy
200
+
201
+ class _DSPGenerator(object):
202
+ """ Base class for DSP generators """
203
+
204
+ srcargs = [
205
+ 'srcs',
206
+ 'incs',
207
+ 'localincs',
208
+ 'resources',
209
+ 'misc']
210
+
211
+ def __init__(self, dspfile, source, env):
212
+ self.dspfile = str(dspfile)
213
+ try:
214
+ get_abspath = dspfile.get_abspath
215
+ except AttributeError:
216
+ self.dspabs = os.path.abspath(dspfile)
217
+ else:
218
+ self.dspabs = get_abspath()
219
+
220
+ if 'variant' not in env:
221
+ raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\
222
+ "'Release') to create an MSVSProject.")
223
+ elif SCons.Util.is_String(env['variant']):
224
+ variants = [env['variant']]
225
+ elif SCons.Util.is_List(env['variant']):
226
+ variants = env['variant']
227
+
228
+ if 'buildtarget' not in env or env['buildtarget'] == None:
229
+ buildtarget = ['']
230
+ elif SCons.Util.is_String(env['buildtarget']):
231
+ buildtarget = [env['buildtarget']]
232
+ elif SCons.Util.is_List(env['buildtarget']):
233
+ if len(env['buildtarget']) != len(variants):
234
+ raise SCons.Errors.InternalError("Sizes of 'buildtarget' and 'variant' lists must be the same.")
235
+ buildtarget = []
236
+ for bt in env['buildtarget']:
237
+ if SCons.Util.is_String(bt):
238
+ buildtarget.append(bt)
239
+ else:
240
+ buildtarget.append(bt.get_abspath())
241
+ else:
242
+ buildtarget = [env['buildtarget'].get_abspath()]
243
+ if len(buildtarget) == 1:
244
+ bt = buildtarget[0]
245
+ buildtarget = []
246
+ for _ in variants:
247
+ buildtarget.append(bt)
248
+
249
+ if 'outdir' not in env or env['outdir'] == None:
250
+ outdir = ['']
251
+ elif SCons.Util.is_String(env['outdir']):
252
+ outdir = [env['outdir']]
253
+ elif SCons.Util.is_List(env['outdir']):
254
+ if len(env['outdir']) != len(variants):
255
+ raise SCons.Errors.InternalError("Sizes of 'outdir' and 'variant' lists must be the same.")
256
+ outdir = []
257
+ for s in env['outdir']:
258
+ if SCons.Util.is_String(s):
259
+ outdir.append(s)
260
+ else:
261
+ outdir.append(s.get_abspath())
262
+ else:
263
+ outdir = [env['outdir'].get_abspath()]
264
+ if len(outdir) == 1:
265
+ s = outdir[0]
266
+ outdir = []
267
+ for v in variants:
268
+ outdir.append(s)
269
+
270
+ if 'runfile' not in env or env['runfile'] == None:
271
+ runfile = buildtarget[-1:]
272
+ elif SCons.Util.is_String(env['runfile']):
273
+ runfile = [env['runfile']]
274
+ elif SCons.Util.is_List(env['runfile']):
275
+ if len(env['runfile']) != len(variants):
276
+ raise SCons.Errors.InternalError("Sizes of 'runfile' and 'variant' lists must be the same.")
277
+ runfile = []
278
+ for s in env['runfile']:
279
+ if SCons.Util.is_String(s):
280
+ runfile.append(s)
281
+ else:
282
+ runfile.append(s.get_abspath())
283
+ else:
284
+ runfile = [env['runfile'].get_abspath()]
285
+ if len(runfile) == 1:
286
+ s = runfile[0]
287
+ runfile = []
288
+ for v in variants:
289
+ runfile.append(s)
290
+
291
+ self.sconscript = env['MSVSSCONSCRIPT']
292
+
293
+ cmdargs = env.get('cmdargs', '')
294
+
295
+ self.env = env
296
+
297
+ if 'name' in self.env:
298
+ self.name = self.env['name']
299
+ else:
300
+ self.name = os.path.basename(SCons.Util.splitext(self.dspfile)[0])
301
+ self.name = self.env.subst(self.name)
302
+
303
+ sourcenames = [
304
+ 'Source Files',
305
+ 'Header Files',
306
+ 'Local Headers',
307
+ 'Resource Files',
308
+ 'Other Files']
309
+
310
+ self.sources = {}
311
+ for n in sourcenames:
312
+ self.sources[n] = []
313
+
314
+ self.configs = {}
315
+
316
+ self.nokeep = 0
317
+ if 'nokeep' in env and env['variant'] != 0:
318
+ self.nokeep = 1
319
+
320
+ if self.nokeep == 0 and os.path.exists(self.dspabs):
321
+ self.Parse()
322
+
323
+ for t in zip(sourcenames,self.srcargs):
324
+ if t[1] in self.env:
325
+ if SCons.Util.is_List(self.env[t[1]]):
326
+ for i in self.env[t[1]]:
327
+ if not i in self.sources[t[0]]:
328
+ self.sources[t[0]].append(i)
329
+ else:
330
+ if not self.env[t[1]] in self.sources[t[0]]:
331
+ self.sources[t[0]].append(self.env[t[1]])
332
+
333
+ for n in sourcenames:
334
+ #TODO 2.4: compat layer supports sorted(key=) but not sort(key=)
335
+ #TODO 2.4: self.sources[n].sort(key=lambda a: a.lower())
336
+ self.sources[n] = sorted(self.sources[n], key=lambda a: a.lower())
337
+
338
+ def AddConfig(self, variant, buildtarget, outdir, runfile, cmdargs, dspfile=dspfile):
339
+ config = Config()
340
+ config.buildtarget = buildtarget
341
+ config.outdir = outdir
342
+ config.cmdargs = cmdargs
343
+ config.runfile = runfile
344
+
345
+ match = re.match('(.*)\|(.*)', variant)
346
+ if match:
347
+ config.variant = match.group(1)
348
+ config.platform = match.group(2)
349
+ else:
350
+ config.variant = variant
351
+ config.platform = 'Win32'
352
+
353
+ self.configs[variant] = config
354
+ print "Adding '" + self.name + ' - ' + config.variant + '|' + config.platform + "' to '" + str(dspfile) + "'"
355
+
356
+ for i in range(len(variants)):
357
+ AddConfig(self, variants[i], buildtarget[i], outdir[i], runfile[i], cmdargs)
358
+
359
+ self.platforms = []
360
+ for key in self.configs.keys():
361
+ platform = self.configs[key].platform
362
+ if not platform in self.platforms:
363
+ self.platforms.append(platform)
364
+
365
+ def Build(self):
366
+ pass
367
+
368
+ V6DSPHeader = """\
369
+ # Microsoft Developer Studio Project File - Name="%(name)s" - Package Owner=<4>
370
+ # Microsoft Developer Studio Generated Build File, Format Version 6.00
371
+ # ** DO NOT EDIT **
372
+
373
+ # TARGTYPE "Win32 (x86) External Target" 0x0106
374
+
375
+ CFG=%(name)s - Win32 %(confkey)s
376
+ !MESSAGE This is not a valid makefile. To build this project using NMAKE,
377
+ !MESSAGE use the Export Makefile command and run
378
+ !MESSAGE
379
+ !MESSAGE NMAKE /f "%(name)s.mak".
380
+ !MESSAGE
381
+ !MESSAGE You can specify a configuration when running NMAKE
382
+ !MESSAGE by defining the macro CFG on the command line. For example:
383
+ !MESSAGE
384
+ !MESSAGE NMAKE /f "%(name)s.mak" CFG="%(name)s - Win32 %(confkey)s"
385
+ !MESSAGE
386
+ !MESSAGE Possible choices for configuration are:
387
+ !MESSAGE
388
+ """
389
+
390
+ class _GenerateV6DSP(_DSPGenerator):
391
+ """Generates a Project file for MSVS 6.0"""
392
+
393
+ def PrintHeader(self):
394
+ # pick a default config
395
+ confkeys = sorted(self.configs.keys())
396
+
397
+ name = self.name
398
+ confkey = confkeys[0]
399
+
400
+ self.file.write(V6DSPHeader % locals())
401
+
402
+ for kind in confkeys:
403
+ self.file.write('!MESSAGE "%s - Win32 %s" (based on "Win32 (x86) External Target")\n' % (name, kind))
404
+
405
+ self.file.write('!MESSAGE \n\n')
406
+
407
+ def PrintProject(self):
408
+ name = self.name
409
+ self.file.write('# Begin Project\n'
410
+ '# PROP AllowPerConfigDependencies 0\n'
411
+ '# PROP Scc_ProjName ""\n'
412
+ '# PROP Scc_LocalPath ""\n\n')
413
+
414
+ first = 1
415
+ confkeys = sorted(self.configs.keys())
416
+ for kind in confkeys:
417
+ outdir = self.configs[kind].outdir
418
+ buildtarget = self.configs[kind].buildtarget
419
+ if first == 1:
420
+ self.file.write('!IF "$(CFG)" == "%s - Win32 %s"\n\n' % (name, kind))
421
+ first = 0
422
+ else:
423
+ self.file.write('\n!ELSEIF "$(CFG)" == "%s - Win32 %s"\n\n' % (name, kind))
424
+
425
+ env_has_buildtarget = 'MSVSBUILDTARGET' in self.env
426
+ if not env_has_buildtarget:
427
+ self.env['MSVSBUILDTARGET'] = buildtarget
428
+
429
+ # have to write this twice, once with the BASE settings, and once without
430
+ for base in ("BASE ",""):
431
+ self.file.write('# PROP %sUse_MFC 0\n'
432
+ '# PROP %sUse_Debug_Libraries ' % (base, base))
433
+ if kind.lower().find('debug') < 0:
434
+ self.file.write('0\n')
435
+ else:
436
+ self.file.write('1\n')
437
+ self.file.write('# PROP %sOutput_Dir "%s"\n'
438
+ '# PROP %sIntermediate_Dir "%s"\n' % (base,outdir,base,outdir))
439
+ cmd = 'echo Starting SCons && ' + self.env.subst('$MSVSBUILDCOM', 1)
440
+ self.file.write('# PROP %sCmd_Line "%s"\n'
441
+ '# PROP %sRebuild_Opt "-c && %s"\n'
442
+ '# PROP %sTarget_File "%s"\n'
443
+ '# PROP %sBsc_Name ""\n'
444
+ '# PROP %sTarget_Dir ""\n'\
445
+ %(base,cmd,base,cmd,base,buildtarget,base,base))
446
+
447
+ if not env_has_buildtarget:
448
+ del self.env['MSVSBUILDTARGET']
449
+
450
+ self.file.write('\n!ENDIF\n\n'
451
+ '# Begin Target\n\n')
452
+ for kind in confkeys:
453
+ self.file.write('# Name "%s - Win32 %s"\n' % (name,kind))
454
+ self.file.write('\n')
455
+ first = 0
456
+ for kind in confkeys:
457
+ if first == 0:
458
+ self.file.write('!IF "$(CFG)" == "%s - Win32 %s"\n\n' % (name,kind))
459
+ first = 1
460
+ else:
461
+ self.file.write('!ELSEIF "$(CFG)" == "%s - Win32 %s"\n\n' % (name,kind))
462
+ self.file.write('!ENDIF \n\n')
463
+ self.PrintSourceFiles()
464
+ self.file.write('# End Target\n'
465
+ '# End Project\n')
466
+
467
+ if self.nokeep == 0:
468
+ # now we pickle some data and add it to the file -- MSDEV will ignore it.
469
+ pdata = pickle.dumps(self.configs,1)
470
+ pdata = base64.encodestring(pdata)
471
+ self.file.write(pdata + '\n')
472
+ pdata = pickle.dumps(self.sources,1)
473
+ pdata = base64.encodestring(pdata)
474
+ self.file.write(pdata + '\n')
475
+
476
+ def PrintSourceFiles(self):
477
+ categories = {'Source Files': 'cpp|c|cxx|l|y|def|odl|idl|hpj|bat',
478
+ 'Header Files': 'h|hpp|hxx|hm|inl',
479
+ 'Local Headers': 'h|hpp|hxx|hm|inl',
480
+ 'Resource Files': 'r|rc|ico|cur|bmp|dlg|rc2|rct|bin|cnt|rtf|gif|jpg|jpeg|jpe',
481
+ 'Other Files': ''}
482
+
483
+ for kind in sorted(categories.keys(), key=lambda a: a.lower()):
484
+ if not self.sources[kind]:
485
+ continue # skip empty groups
486
+
487
+ self.file.write('# Begin Group "' + kind + '"\n\n')
488
+ typelist = categories[kind].replace('|', ';')
489
+ self.file.write('# PROP Default_Filter "' + typelist + '"\n')
490
+
491
+ for file in self.sources[kind]:
492
+ file = os.path.normpath(file)
493
+ self.file.write('# Begin Source File\n\n'
494
+ 'SOURCE="' + file + '"\n'
495
+ '# End Source File\n')
496
+ self.file.write('# End Group\n')
497
+
498
+ # add the SConscript file outside of the groups
499
+ self.file.write('# Begin Source File\n\n'
500
+ 'SOURCE="' + str(self.sconscript) + '"\n'
501
+ '# End Source File\n')
502
+
503
+ def Parse(self):
504
+ try:
505
+ dspfile = open(self.dspabs,'r')
506
+ except IOError:
507
+ return # doesn't exist yet, so can't add anything to configs.
508
+
509
+ line = dspfile.readline()
510
+ while line:
511
+ if line.find("# End Project") > -1:
512
+ break
513
+ line = dspfile.readline()
514
+
515
+ line = dspfile.readline()
516
+ datas = line
517
+ while line and line != '\n':
518
+ line = dspfile.readline()
519
+ datas = datas + line
520
+
521
+ # OK, we've found our little pickled cache of data.
522
+ try:
523
+ datas = base64.decodestring(datas)
524
+ data = pickle.loads(datas)
525
+ except KeyboardInterrupt:
526
+ raise
527
+ except:
528
+ return # unable to unpickle any data for some reason
529
+
530
+ self.configs.update(data)
531
+
532
+ data = None
533
+ line = dspfile.readline()
534
+ datas = line
535
+ while line and line != '\n':
536
+ line = dspfile.readline()
537
+ datas = datas + line
538
+
539
+ # OK, we've found our little pickled cache of data.
540
+ # it has a "# " in front of it, so we strip that.
541
+ try:
542
+ datas = base64.decodestring(datas)
543
+ data = pickle.loads(datas)
544
+ except KeyboardInterrupt:
545
+ raise
546
+ except:
547
+ return # unable to unpickle any data for some reason
548
+
549
+ self.sources.update(data)
550
+
551
+ def Build(self):
552
+ try:
553
+ self.file = open(self.dspabs,'w')
554
+ except IOError, detail:
555
+ raise SCons.Errors.InternalError('Unable to open "' + self.dspabs + '" for writing:' + str(detail))
556
+ else:
557
+ self.PrintHeader()
558
+ self.PrintProject()
559
+ self.file.close()
560
+
561
+ V7DSPHeader = """\
562
+ <?xml version="1.0" encoding="%(encoding)s"?>
563
+ <VisualStudioProject
564
+ \tProjectType="Visual C++"
565
+ \tVersion="%(versionstr)s"
566
+ \tName="%(name)s"
567
+ \tProjectGUID="%(project_guid)s"
568
+ %(scc_attrs)s
569
+ \tKeyword="MakeFileProj">
570
+ """
571
+
572
+ V7DSPConfiguration = """\
573
+ \t\t<Configuration
574
+ \t\t\tName="%(variant)s|%(platform)s"
575
+ \t\t\tOutputDirectory="%(outdir)s"
576
+ \t\t\tIntermediateDirectory="%(outdir)s"
577
+ \t\t\tConfigurationType="0"
578
+ \t\t\tUseOfMFC="0"
579
+ \t\t\tATLMinimizesCRunTimeLibraryUsage="FALSE">
580
+ \t\t\t<Tool
581
+ \t\t\t\tName="VCNMakeTool"
582
+ \t\t\t\tBuildCommandLine="%(buildcmd)s"
583
+ \t\t\t\tReBuildCommandLine="%(rebuildcmd)s"
584
+ \t\t\t\tCleanCommandLine="%(cleancmd)s"
585
+ \t\t\t\tOutput="%(runfile)s"/>
586
+ \t\t</Configuration>
587
+ """
588
+
589
+ V8DSPHeader = """\
590
+ <?xml version="1.0" encoding="%(encoding)s"?>
591
+ <VisualStudioProject
592
+ \tProjectType="Visual C++"
593
+ \tVersion="%(versionstr)s"
594
+ \tName="%(name)s"
595
+ \tProjectGUID="%(project_guid)s"
596
+ \tRootNamespace="%(name)s"
597
+ %(scc_attrs)s
598
+ \tKeyword="MakeFileProj">
599
+ """
600
+
601
+ V8DSPConfiguration = """\
602
+ \t\t<Configuration
603
+ \t\t\tName="%(variant)s|%(platform)s"
604
+ \t\t\tConfigurationType="0"
605
+ \t\t\tUseOfMFC="0"
606
+ \t\t\tATLMinimizesCRunTimeLibraryUsage="false"
607
+ \t\t\t>
608
+ \t\t\t<Tool
609
+ \t\t\t\tName="VCNMakeTool"
610
+ \t\t\t\tBuildCommandLine="%(buildcmd)s"
611
+ \t\t\t\tReBuildCommandLine="%(rebuildcmd)s"
612
+ \t\t\t\tCleanCommandLine="%(cleancmd)s"
613
+ \t\t\t\tOutput="%(runfile)s"
614
+ \t\t\t\tPreprocessorDefinitions="%(preprocdefs)s"
615
+ \t\t\t\tIncludeSearchPath="%(includepath)s"
616
+ \t\t\t\tForcedIncludes=""
617
+ \t\t\t\tAssemblySearchPath=""
618
+ \t\t\t\tForcedUsingAssemblies=""
619
+ \t\t\t\tCompileAsManaged=""
620
+ \t\t\t/>
621
+ \t\t</Configuration>
622
+ """
623
+ class _GenerateV7DSP(_DSPGenerator):
624
+ """Generates a Project file for MSVS .NET"""
625
+
626
+ def __init__(self, dspfile, source, env):
627
+ _DSPGenerator.__init__(self, dspfile, source, env)
628
+ self.version = env['MSVS_VERSION']
629
+ self.version_num, self.suite = msvs_parse_version(self.version)
630
+ if self.version_num >= 9.0:
631
+ self.versionstr = '9.00'
632
+ self.dspheader = V8DSPHeader
633
+ self.dspconfiguration = V8DSPConfiguration
634
+ elif self.version_num >= 8.0:
635
+ self.versionstr = '8.00'
636
+ self.dspheader = V8DSPHeader
637
+ self.dspconfiguration = V8DSPConfiguration
638
+ else:
639
+ if self.version_num >= 7.1:
640
+ self.versionstr = '7.10'
641
+ else:
642
+ self.versionstr = '7.00'
643
+ self.dspheader = V7DSPHeader
644
+ self.dspconfiguration = V7DSPConfiguration
645
+ self.file = None
646
+
647
+ def PrintHeader(self):
648
+ env = self.env
649
+ versionstr = self.versionstr
650
+ name = self.name
651
+ encoding = self.env.subst('$MSVSENCODING')
652
+ scc_provider = env.get('MSVS_SCC_PROVIDER', '')
653
+ scc_project_name = env.get('MSVS_SCC_PROJECT_NAME', '')
654
+ scc_aux_path = env.get('MSVS_SCC_AUX_PATH', '')
655
+ # MSVS_SCC_LOCAL_PATH is kept for backwards compatibility purpose and should
656
+ # be deprecated as soon as possible.
657
+ scc_local_path_legacy = env.get('MSVS_SCC_LOCAL_PATH', '')
658
+ scc_connection_root = env.get('MSVS_SCC_CONNECTION_ROOT', os.curdir)
659
+ scc_local_path = os.path.relpath(scc_connection_root, os.path.dirname(self.dspabs))
660
+ project_guid = env.get('MSVS_PROJECT_GUID', '')
661
+ if not project_guid:
662
+ project_guid = _generateGUID(self.dspfile, '')
663
+ if scc_provider != '':
664
+ scc_attrs = '\tSccProjectName="%s"\n' % scc_project_name
665
+ if scc_aux_path != '':
666
+ scc_attrs += '\tSccAuxPath="%s"\n' % scc_aux_path
667
+ scc_attrs += ('\tSccLocalPath="%s"\n'
668
+ '\tSccProvider="%s"' % (scc_local_path, scc_provider))
669
+ elif scc_local_path_legacy != '':
670
+ # This case is kept for backwards compatibility purpose and should
671
+ # be deprecated as soon as possible.
672
+ scc_attrs = ('\tSccProjectName="%s"\n'
673
+ '\tSccLocalPath="%s"' % (scc_project_name, scc_local_path_legacy))
674
+ else:
675
+ self.dspheader = self.dspheader.replace('%(scc_attrs)s\n', '')
676
+
677
+ self.file.write(self.dspheader % locals())
678
+
679
+ self.file.write('\t<Platforms>\n')
680
+ for platform in self.platforms:
681
+ self.file.write(
682
+ '\t\t<Platform\n'
683
+ '\t\t\tName="%s"/>\n' % platform)
684
+ self.file.write('\t</Platforms>\n')
685
+
686
+ if self.version_num >= 8.0:
687
+ self.file.write('\t<ToolFiles>\n'
688
+ '\t</ToolFiles>\n')
689
+
690
+ def PrintProject(self):
691
+ self.file.write('\t<Configurations>\n')
692
+
693
+ confkeys = sorted(self.configs.keys())
694
+ for kind in confkeys:
695
+ variant = self.configs[kind].variant
696
+ platform = self.configs[kind].platform
697
+ outdir = self.configs[kind].outdir
698
+ buildtarget = self.configs[kind].buildtarget
699
+ runfile = self.configs[kind].runfile
700
+ cmdargs = self.configs[kind].cmdargs
701
+
702
+ env_has_buildtarget = 'MSVSBUILDTARGET' in self.env
703
+ if not env_has_buildtarget:
704
+ self.env['MSVSBUILDTARGET'] = buildtarget
705
+
706
+ starting = 'echo Starting SCons && '
707
+ if cmdargs:
708
+ cmdargs = ' ' + cmdargs
709
+ else:
710
+ cmdargs = ''
711
+ buildcmd = xmlify(starting + self.env.subst('$MSVSBUILDCOM', 1) + cmdargs)
712
+ rebuildcmd = xmlify(starting + self.env.subst('$MSVSREBUILDCOM', 1) + cmdargs)
713
+ cleancmd = xmlify(starting + self.env.subst('$MSVSCLEANCOM', 1) + cmdargs)
714
+
715
+ # This isn't perfect; CPPDEFINES and CPPPATH can contain $TARGET and $SOURCE,
716
+ # so they could vary depending on the command being generated. This code
717
+ # assumes they don't.
718
+ preprocdefs = xmlify(';'.join(processDefines(self.env.get('CPPDEFINES', []))))
719
+ includepath_Dirs = processIncludes(self.env.get('CPPPATH', []), self.env, None, None)
720
+ includepath = xmlify(';'.join([str(x) for x in includepath_Dirs]))
721
+
722
+ if not env_has_buildtarget:
723
+ del self.env['MSVSBUILDTARGET']
724
+
725
+ self.file.write(self.dspconfiguration % locals())
726
+
727
+ self.file.write('\t</Configurations>\n')
728
+
729
+ if self.version_num >= 7.1:
730
+ self.file.write('\t<References>\n'
731
+ '\t</References>\n')
732
+
733
+ self.PrintSourceFiles()
734
+
735
+ self.file.write('</VisualStudioProject>\n')
736
+
737
+ if self.nokeep == 0:
738
+ # now we pickle some data and add it to the file -- MSDEV will ignore it.
739
+ pdata = pickle.dumps(self.configs,1)
740
+ pdata = base64.encodestring(pdata)
741
+ self.file.write('<!-- SCons Data:\n' + pdata + '\n')
742
+ pdata = pickle.dumps(self.sources,1)
743
+ pdata = base64.encodestring(pdata)
744
+ self.file.write(pdata + '-->\n')
745
+
746
+ def printSources(self, hierarchy, commonprefix):
747
+ sorteditems = sorted(hierarchy.items(), key=lambda a: a[0].lower())
748
+
749
+ # First folders, then files
750
+ for key, value in sorteditems:
751
+ if SCons.Util.is_Dict(value):
752
+ self.file.write('\t\t\t<Filter\n'
753
+ '\t\t\t\tName="%s"\n'
754
+ '\t\t\t\tFilter="">\n' % (key))
755
+ self.printSources(value, commonprefix)
756
+ self.file.write('\t\t\t</Filter>\n')
757
+
758
+ for key, value in sorteditems:
759
+ if SCons.Util.is_String(value):
760
+ file = value
761
+ if commonprefix:
762
+ file = os.path.join(commonprefix, value)
763
+ file = os.path.normpath(file)
764
+ self.file.write('\t\t\t<File\n'
765
+ '\t\t\t\tRelativePath="%s">\n'
766
+ '\t\t\t</File>\n' % (file))
767
+
768
+ def PrintSourceFiles(self):
769
+ categories = {'Source Files': 'cpp;c;cxx;l;y;def;odl;idl;hpj;bat',
770
+ 'Header Files': 'h;hpp;hxx;hm;inl',
771
+ 'Local Headers': 'h;hpp;hxx;hm;inl',
772
+ 'Resource Files': 'r;rc;ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe',
773
+ 'Other Files': ''}
774
+
775
+ self.file.write('\t<Files>\n')
776
+
777
+ cats = sorted([k for k in categories.keys() if self.sources[k]],
778
+ key=lambda a: a.lower())
779
+ for kind in cats:
780
+ if len(cats) > 1:
781
+ self.file.write('\t\t<Filter\n'
782
+ '\t\t\tName="%s"\n'
783
+ '\t\t\tFilter="%s">\n' % (kind, categories[kind]))
784
+
785
+ sources = self.sources[kind]
786
+
787
+ # First remove any common prefix
788
+ commonprefix = None
789
+ if len(sources) > 1:
790
+ s = list(map(os.path.normpath, sources))
791
+ # take the dirname because the prefix may include parts
792
+ # of the filenames (e.g. if you have 'dir\abcd' and
793
+ # 'dir\acde' then the cp will be 'dir\a' )
794
+ cp = os.path.dirname( os.path.commonprefix(s) )
795
+ if cp and s[0][len(cp)] == os.sep:
796
+ # +1 because the filename starts after the separator
797
+ sources = [s[len(cp)+1:] for s in sources]
798
+ commonprefix = cp
799
+ elif len(sources) == 1:
800
+ commonprefix = os.path.dirname( sources[0] )
801
+ sources[0] = os.path.basename( sources[0] )
802
+
803
+ hierarchy = makeHierarchy(sources)
804
+ self.printSources(hierarchy, commonprefix=commonprefix)
805
+
806
+ if len(cats)>1:
807
+ self.file.write('\t\t</Filter>\n')
808
+
809
+ # add the SConscript file outside of the groups
810
+ self.file.write('\t\t<File\n'
811
+ '\t\t\tRelativePath="%s">\n'
812
+ '\t\t</File>\n' % str(self.sconscript))
813
+
814
+ self.file.write('\t</Files>\n'
815
+ '\t<Globals>\n'
816
+ '\t</Globals>\n')
817
+
818
+ def Parse(self):
819
+ try:
820
+ dspfile = open(self.dspabs,'r')
821
+ except IOError:
822
+ return # doesn't exist yet, so can't add anything to configs.
823
+
824
+ line = dspfile.readline()
825
+ while line:
826
+ if line.find('<!-- SCons Data:') > -1:
827
+ break
828
+ line = dspfile.readline()
829
+
830
+ line = dspfile.readline()
831
+ datas = line
832
+ while line and line != '\n':
833
+ line = dspfile.readline()
834
+ datas = datas + line
835
+
836
+ # OK, we've found our little pickled cache of data.
837
+ try:
838
+ datas = base64.decodestring(datas)
839
+ data = pickle.loads(datas)
840
+ except KeyboardInterrupt:
841
+ raise
842
+ except:
843
+ return # unable to unpickle any data for some reason
844
+
845
+ self.configs.update(data)
846
+
847
+ data = None
848
+ line = dspfile.readline()
849
+ datas = line
850
+ while line and line != '\n':
851
+ line = dspfile.readline()
852
+ datas = datas + line
853
+
854
+ # OK, we've found our little pickled cache of data.
855
+ try:
856
+ datas = base64.decodestring(datas)
857
+ data = pickle.loads(datas)
858
+ except KeyboardInterrupt:
859
+ raise
860
+ except:
861
+ return # unable to unpickle any data for some reason
862
+
863
+ self.sources.update(data)
864
+
865
+ def Build(self):
866
+ try:
867
+ self.file = open(self.dspabs,'w')
868
+ except IOError, detail:
869
+ raise SCons.Errors.InternalError('Unable to open "' + self.dspabs + '" for writing:' + str(detail))
870
+ else:
871
+ self.PrintHeader()
872
+ self.PrintProject()
873
+ self.file.close()
874
+
875
+ V10DSPHeader = """\
876
+ <?xml version="1.0" encoding="%(encoding)s"?>
877
+ <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
878
+ """
879
+
880
+ V10DSPProjectConfiguration = """\
881
+ \t\t<ProjectConfiguration Include="%(variant)s|%(platform)s">
882
+ \t\t\t<Configuration>%(variant)s</Configuration>
883
+ \t\t\t<Platform>%(platform)s</Platform>
884
+ \t\t</ProjectConfiguration>
885
+ """
886
+
887
+ V10DSPGlobals = """\
888
+ \t<PropertyGroup Label="Globals">
889
+ \t\t<ProjectGuid>%(project_guid)s</ProjectGuid>
890
+ %(scc_attrs)s\t\t<RootNamespace>%(name)s</RootNamespace>
891
+ \t\t<Keyword>MakeFileProj</Keyword>
892
+ \t</PropertyGroup>
893
+ """
894
+
895
+ V10DSPPropertyGroupCondition = """\
896
+ \t<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='%(variant)s|%(platform)s'" Label="Configuration">
897
+ \t\t<ConfigurationType>Makefile</ConfigurationType>
898
+ \t\t<UseOfMfc>false</UseOfMfc>
899
+ \t</PropertyGroup>
900
+ """
901
+
902
+ V10DSPImportGroupCondition = """\
903
+ \t<ImportGroup Condition="'$(Configuration)|$(Platform)'=='%(variant)s|%(platform)s'" Label="PropertySheets">
904
+ \t\t<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
905
+ \t</ImportGroup>
906
+ """
907
+
908
+ V10DSPCommandLine = """\
909
+ \t\t<NMakeBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='%(variant)s|%(platform)s'">%(buildcmd)s</NMakeBuildCommandLine>
910
+ \t\t<NMakeReBuildCommandLine Condition="'$(Configuration)|$(Platform)'=='%(variant)s|%(platform)s'">%(rebuildcmd)s</NMakeReBuildCommandLine>
911
+ \t\t<NMakeCleanCommandLine Condition="'$(Configuration)|$(Platform)'=='%(variant)s|%(platform)s'">%(cleancmd)s</NMakeCleanCommandLine>
912
+ \t\t<NMakeOutput Condition="'$(Configuration)|$(Platform)'=='%(variant)s|%(platform)s'">%(runfile)s</NMakeOutput>
913
+ \t\t<NMakePreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='%(variant)s|%(platform)s'">%(preprocdefs)s</NMakePreprocessorDefinitions>
914
+ \t\t<NMakeIncludeSearchPath Condition="'$(Configuration)|$(Platform)'=='%(variant)s|%(platform)s'">%(includepath)s</NMakeIncludeSearchPath>
915
+ \t\t<NMakeForcedIncludes Condition="'$(Configuration)|$(Platform)'=='%(variant)s|%(platform)s'">$(NMakeForcedIncludes)</NMakeForcedIncludes>
916
+ \t\t<NMakeAssemblySearchPath Condition="'$(Configuration)|$(Platform)'=='%(variant)s|%(platform)s'">$(NMakeAssemblySearchPath)</NMakeAssemblySearchPath>
917
+ \t\t<NMakeForcedUsingAssemblies Condition="'$(Configuration)|$(Platform)'=='%(variant)s|%(platform)s'">$(NMakeForcedUsingAssemblies)</NMakeForcedUsingAssemblies>
918
+ """
919
+
920
+ class _GenerateV10DSP(_DSPGenerator):
921
+ """Generates a Project file for MSVS 2010"""
922
+
923
+ def __init__(self, dspfile, source, env):
924
+ _DSPGenerator.__init__(self, dspfile, source, env)
925
+
926
+ self.dspheader = V10DSPHeader
927
+ self.dspconfiguration = V10DSPProjectConfiguration
928
+ self.dspglobals = V10DSPGlobals
929
+
930
+ def PrintHeader(self):
931
+ env = self.env
932
+ name = self.name
933
+ encoding = env.subst('$MSVSENCODING')
934
+ project_guid = env.get('MSVS_PROJECT_GUID', '')
935
+ scc_provider = env.get('MSVS_SCC_PROVIDER', '')
936
+ scc_project_name = env.get('MSVS_SCC_PROJECT_NAME', '')
937
+ scc_aux_path = env.get('MSVS_SCC_AUX_PATH', '')
938
+ # MSVS_SCC_LOCAL_PATH is kept for backwards compatibility purpose and should
939
+ # be deprecated as soon as possible.
940
+ scc_local_path_legacy = env.get('MSVS_SCC_LOCAL_PATH', '')
941
+ scc_connection_root = env.get('MSVS_SCC_CONNECTION_ROOT', os.curdir)
942
+ scc_local_path = os.path.relpath(scc_connection_root, os.path.dirname(self.dspabs))
943
+ if not project_guid:
944
+ project_guid = _generateGUID(self.dspfile, '')
945
+ if scc_provider != '':
946
+ scc_attrs = '\t\t<SccProjectName>%s</SccProjectName>\n' % scc_project_name
947
+ if scc_aux_path != '':
948
+ scc_attrs += '\t\t<SccAuxPath>%s</SccAuxPath>\n' % scc_aux_path
949
+ scc_attrs += ('\t\t<SccLocalPath>%s</SccLocalPath>\n'
950
+ '\t\t<SccProvider>%s</SccProvider>\n' % (scc_local_path, scc_provider))
951
+ elif scc_local_path_legacy != '':
952
+ # This case is kept for backwards compatibility purpose and should
953
+ # be deprecated as soon as possible.
954
+ scc_attrs = ('\t\t<SccProjectName>%s</SccProjectName>\n'
955
+ '\t\t<SccLocalPath>%s</SccLocalPath>\n' % (scc_project_name, scc_local_path_legacy))
956
+ else:
957
+ self.dspglobals = self.dspglobals.replace('%(scc_attrs)s', '')
958
+
959
+ self.file.write(self.dspheader % locals())
960
+
961
+ self.file.write('\t<ItemGroup Label="ProjectConfigurations">\n')
962
+
963
+ confkeys = sorted(self.configs.keys())
964
+ for kind in confkeys:
965
+ variant = self.configs[kind].variant
966
+ platform = self.configs[kind].platform
967
+ self.file.write(self.dspconfiguration % locals())
968
+
969
+ self.file.write('\t</ItemGroup>\n')
970
+
971
+ self.file.write(self.dspglobals % locals())
972
+
973
+ def PrintProject(self):
974
+ name = self.name
975
+ confkeys = sorted(self.configs.keys())
976
+
977
+ self.file.write('\t<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\n')
978
+
979
+ for kind in confkeys:
980
+ variant = self.configs[kind].variant
981
+ platform = self.configs[kind].platform
982
+ self.file.write(V10DSPPropertyGroupCondition % locals())
983
+
984
+ self.file.write('\t<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\n')
985
+ self.file.write('\t<ImportGroup Label="ExtensionSettings">\n')
986
+ self.file.write('\t</ImportGroup>\n')
987
+
988
+ for kind in confkeys:
989
+ variant = self.configs[kind].variant
990
+ platform = self.configs[kind].platform
991
+ self.file.write(V10DSPImportGroupCondition % locals())
992
+
993
+ self.file.write('\t<PropertyGroup Label="UserMacros" />\n')
994
+ self.file.write('\t<PropertyGroup>\n')
995
+ self.file.write('\t<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>\n')
996
+
997
+ for kind in confkeys:
998
+ variant = self.configs[kind].variant
999
+ platform = self.configs[kind].platform
1000
+ outdir = self.configs[kind].outdir
1001
+ buildtarget = self.configs[kind].buildtarget
1002
+ runfile = self.configs[kind].runfile
1003
+ cmdargs = self.configs[kind].cmdargs
1004
+
1005
+ env_has_buildtarget = 'MSVSBUILDTARGET' in self.env
1006
+ if not env_has_buildtarget:
1007
+ self.env['MSVSBUILDTARGET'] = buildtarget
1008
+
1009
+ starting = 'echo Starting SCons && '
1010
+ if cmdargs:
1011
+ cmdargs = ' ' + cmdargs
1012
+ else:
1013
+ cmdargs = ''
1014
+ buildcmd = xmlify(starting + self.env.subst('$MSVSBUILDCOM', 1) + cmdargs)
1015
+ rebuildcmd = xmlify(starting + self.env.subst('$MSVSREBUILDCOM', 1) + cmdargs)
1016
+ cleancmd = xmlify(starting + self.env.subst('$MSVSCLEANCOM', 1) + cmdargs)
1017
+
1018
+ # This isn't perfect; CPPDEFINES and CPPPATH can contain $TARGET and $SOURCE,
1019
+ # so they could vary depending on the command being generated. This code
1020
+ # assumes they don't.
1021
+ preprocdefs = xmlify(';'.join(processDefines(self.env.get('CPPDEFINES', []))))
1022
+ includepath_Dirs = processIncludes(self.env.get('CPPPATH', []), self.env, None, None)
1023
+ includepath = xmlify(';'.join([str(x) for x in includepath_Dirs]))
1024
+
1025
+ if not env_has_buildtarget:
1026
+ del self.env['MSVSBUILDTARGET']
1027
+
1028
+ self.file.write(V10DSPCommandLine % locals())
1029
+
1030
+ self.file.write('\t</PropertyGroup>\n')
1031
+
1032
+ #filter settings in MSVS 2010 are stored in separate file
1033
+ self.filtersabs = self.dspabs + '.filters'
1034
+ try:
1035
+ self.filters_file = open(self.filtersabs, 'w')
1036
+ except IOError, detail:
1037
+ raise SCons.Errors.InternalError('Unable to open "' + self.filtersabs + '" for writing:' + str(detail))
1038
+
1039
+ self.filters_file.write('<?xml version="1.0" encoding="utf-8"?>\n'
1040
+ '<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\n')
1041
+
1042
+ self.PrintSourceFiles()
1043
+
1044
+ self.filters_file.write('</Project>')
1045
+ self.filters_file.close()
1046
+
1047
+ self.file.write('\t<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\n'
1048
+ '\t<ImportGroup Label="ExtensionTargets">\n'
1049
+ '\t</ImportGroup>\n'
1050
+ '</Project>\n')
1051
+
1052
+ if self.nokeep == 0:
1053
+ # now we pickle some data and add it to the file -- MSDEV will ignore it.
1054
+ pdata = pickle.dumps(self.configs,1)
1055
+ pdata = base64.encodestring(pdata)
1056
+ self.file.write('<!-- SCons Data:\n' + pdata + '\n')
1057
+ pdata = pickle.dumps(self.sources,1)
1058
+ pdata = base64.encodestring(pdata)
1059
+ self.file.write(pdata + '-->\n')
1060
+
1061
+ def printFilters(self, hierarchy, name):
1062
+ sorteditems = sorted(hierarchy.items(), key = lambda a: a[0].lower())
1063
+
1064
+ for key, value in sorteditems:
1065
+ if SCons.Util.is_Dict(value):
1066
+ filter_name = name + '\\' + key
1067
+ self.filters_file.write('\t\t<Filter Include="%s">\n'
1068
+ '\t\t\t<UniqueIdentifier>%s</UniqueIdentifier>\n'
1069
+ '\t\t</Filter>\n' % (filter_name, _generateGUID(self.dspabs, filter_name)))
1070
+ self.printFilters(value, filter_name)
1071
+
1072
+ def printSources(self, hierarchy, kind, commonprefix, filter_name):
1073
+ keywords = {'Source Files': 'ClCompile',
1074
+ 'Header Files': 'ClInclude',
1075
+ 'Local Headers': 'ClInclude',
1076
+ 'Resource Files': 'None',
1077
+ 'Other Files': 'None'}
1078
+
1079
+ sorteditems = sorted(hierarchy.items(), key = lambda a: a[0].lower())
1080
+
1081
+ # First folders, then files
1082
+ for key, value in sorteditems:
1083
+ if SCons.Util.is_Dict(value):
1084
+ self.printSources(value, kind, commonprefix, filter_name + '\\' + key)
1085
+
1086
+ for key, value in sorteditems:
1087
+ if SCons.Util.is_String(value):
1088
+ file = value
1089
+ if commonprefix:
1090
+ file = os.path.join(commonprefix, value)
1091
+ file = os.path.normpath(file)
1092
+
1093
+ self.file.write('\t\t<%s Include="%s" />\n' % (keywords[kind], file))
1094
+ self.filters_file.write('\t\t<%s Include="%s">\n'
1095
+ '\t\t\t<Filter>%s</Filter>\n'
1096
+ '\t\t</%s>\n' % (keywords[kind], file, filter_name, keywords[kind]))
1097
+
1098
+ def PrintSourceFiles(self):
1099
+ categories = {'Source Files': 'cpp;c;cxx;l;y;def;odl;idl;hpj;bat',
1100
+ 'Header Files': 'h;hpp;hxx;hm;inl',
1101
+ 'Local Headers': 'h;hpp;hxx;hm;inl',
1102
+ 'Resource Files': 'r;rc;ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe',
1103
+ 'Other Files': ''}
1104
+
1105
+ cats = sorted([k for k in categories.keys() if self.sources[k]],
1106
+ key = lambda a: a.lower())
1107
+
1108
+ # print vcxproj.filters file first
1109
+ self.filters_file.write('\t<ItemGroup>\n')
1110
+ for kind in cats:
1111
+ self.filters_file.write('\t\t<Filter Include="%s">\n'
1112
+ '\t\t\t<UniqueIdentifier>{7b42d31d-d53c-4868-8b92-ca2bc9fc052f}</UniqueIdentifier>\n'
1113
+ '\t\t\t<Extensions>%s</Extensions>\n'
1114
+ '\t\t</Filter>\n' % (kind, categories[kind]))
1115
+
1116
+ # First remove any common prefix
1117
+ sources = self.sources[kind]
1118
+ commonprefix = None
1119
+ if len(sources) > 1:
1120
+ s = list(map(os.path.normpath, sources))
1121
+ # take the dirname because the prefix may include parts
1122
+ # of the filenames (e.g. if you have 'dir\abcd' and
1123
+ # 'dir\acde' then the cp will be 'dir\a' )
1124
+ cp = os.path.dirname( os.path.commonprefix(s) )
1125
+ if cp and s[0][len(cp)] == os.sep:
1126
+ # +1 because the filename starts after the separator
1127
+ sources = [s[len(cp)+1:] for s in sources]
1128
+ commonprefix = cp
1129
+ elif len(sources) == 1:
1130
+ commonprefix = os.path.dirname( sources[0] )
1131
+ sources[0] = os.path.basename( sources[0] )
1132
+
1133
+ hierarchy = makeHierarchy(sources)
1134
+ self.printFilters(hierarchy, kind)
1135
+
1136
+ self.filters_file.write('\t</ItemGroup>\n')
1137
+
1138
+ # then print files and filters
1139
+ for kind in cats:
1140
+ self.file.write('\t<ItemGroup>\n')
1141
+ self.filters_file.write('\t<ItemGroup>\n')
1142
+
1143
+ # First remove any common prefix
1144
+ sources = self.sources[kind]
1145
+ commonprefix = None
1146
+ if len(sources) > 1:
1147
+ s = list(map(os.path.normpath, sources))
1148
+ # take the dirname because the prefix may include parts
1149
+ # of the filenames (e.g. if you have 'dir\abcd' and
1150
+ # 'dir\acde' then the cp will be 'dir\a' )
1151
+ cp = os.path.dirname( os.path.commonprefix(s) )
1152
+ if cp and s[0][len(cp)] == os.sep:
1153
+ # +1 because the filename starts after the separator
1154
+ sources = [s[len(cp)+1:] for s in sources]
1155
+ commonprefix = cp
1156
+ elif len(sources) == 1:
1157
+ commonprefix = os.path.dirname( sources[0] )
1158
+ sources[0] = os.path.basename( sources[0] )
1159
+
1160
+ hierarchy = makeHierarchy(sources)
1161
+ self.printSources(hierarchy, kind, commonprefix, kind)
1162
+
1163
+ self.file.write('\t</ItemGroup>\n')
1164
+ self.filters_file.write('\t</ItemGroup>\n')
1165
+
1166
+ # add the SConscript file outside of the groups
1167
+ self.file.write('\t<ItemGroup>\n'
1168
+ '\t\t<None Include="%s" />\n'
1169
+ #'\t\t<None Include="SConstruct" />\n'
1170
+ '\t</ItemGroup>\n' % str(self.sconscript))
1171
+
1172
+ def Parse(self):
1173
+ print "_GenerateV10DSP.Parse()"
1174
+
1175
+ def Build(self):
1176
+ try:
1177
+ self.file = open(self.dspabs, 'w')
1178
+ except IOError, detail:
1179
+ raise SCons.Errors.InternalError('Unable to open "' + self.dspabs + '" for writing:' + str(detail))
1180
+ else:
1181
+ self.PrintHeader()
1182
+ self.PrintProject()
1183
+ self.file.close()
1184
+
1185
+ class _DSWGenerator(object):
1186
+ """ Base class for DSW generators """
1187
+ def __init__(self, dswfile, source, env):
1188
+ self.dswfile = os.path.normpath(str(dswfile))
1189
+ self.dsw_folder_path = os.path.dirname(os.path.abspath(self.dswfile))
1190
+ self.env = env
1191
+
1192
+ if 'projects' not in env:
1193
+ raise SCons.Errors.UserError("You must specify a 'projects' argument to create an MSVSSolution.")
1194
+ projects = env['projects']
1195
+ if not SCons.Util.is_List(projects):
1196
+ raise SCons.Errors.InternalError("The 'projects' argument must be a list of nodes.")
1197
+ projects = SCons.Util.flatten(projects)
1198
+ if len(projects) < 1:
1199
+ raise SCons.Errors.UserError("You must specify at least one project to create an MSVSSolution.")
1200
+ self.dspfiles = list(map(str, projects))
1201
+
1202
+ if 'name' in self.env:
1203
+ self.name = self.env['name']
1204
+ else:
1205
+ self.name = os.path.basename(SCons.Util.splitext(self.dswfile)[0])
1206
+ self.name = self.env.subst(self.name)
1207
+
1208
+ def Build(self):
1209
+ pass
1210
+
1211
+ class _GenerateV7DSW(_DSWGenerator):
1212
+ """Generates a Solution file for MSVS .NET"""
1213
+ def __init__(self, dswfile, source, env):
1214
+ _DSWGenerator.__init__(self, dswfile, source, env)
1215
+
1216
+ self.file = None
1217
+ self.version = self.env['MSVS_VERSION']
1218
+ self.version_num, self.suite = msvs_parse_version(self.version)
1219
+ self.versionstr = '7.00'
1220
+ if self.version_num >= 10.0:
1221
+ self.versionstr = '11.00'
1222
+ elif self.version_num >= 9.0:
1223
+ self.versionstr = '10.00'
1224
+ elif self.version_num >= 8.0:
1225
+ self.versionstr = '9.00'
1226
+ elif self.version_num >= 7.1:
1227
+ self.versionstr = '8.00'
1228
+
1229
+ if 'slnguid' in env and env['slnguid']:
1230
+ self.slnguid = env['slnguid']
1231
+ else:
1232
+ self.slnguid = _generateGUID(dswfile, self.name)
1233
+
1234
+ self.configs = {}
1235
+
1236
+ self.nokeep = 0
1237
+ if 'nokeep' in env and env['variant'] != 0:
1238
+ self.nokeep = 1
1239
+
1240
+ if self.nokeep == 0 and os.path.exists(self.dswfile):
1241
+ self.Parse()
1242
+
1243
+ def AddConfig(self, variant, dswfile=dswfile):
1244
+ config = Config()
1245
+
1246
+ match = re.match('(.*)\|(.*)', variant)
1247
+ if match:
1248
+ config.variant = match.group(1)
1249
+ config.platform = match.group(2)
1250
+ else:
1251
+ config.variant = variant
1252
+ config.platform = 'Win32'
1253
+
1254
+ self.configs[variant] = config
1255
+ print "Adding '" + self.name + ' - ' + config.variant + '|' + config.platform + "' to '" + str(dswfile) + "'"
1256
+
1257
+ if 'variant' not in env:
1258
+ raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\
1259
+ "'Release') to create an MSVS Solution File.")
1260
+ elif SCons.Util.is_String(env['variant']):
1261
+ AddConfig(self, env['variant'])
1262
+ elif SCons.Util.is_List(env['variant']):
1263
+ for variant in env['variant']:
1264
+ AddConfig(self, variant)
1265
+
1266
+ self.platforms = []
1267
+ for key in self.configs.keys():
1268
+ platform = self.configs[key].platform
1269
+ if not platform in self.platforms:
1270
+ self.platforms.append(platform)
1271
+
1272
+ def GenerateProjectFilesInfo(self):
1273
+ for dspfile in self.dspfiles:
1274
+ dsp_folder_path, name = os.path.split(dspfile)
1275
+ dsp_folder_path = os.path.abspath(dsp_folder_path)
1276
+ dsp_relative_folder_path = os.path.relpath(dsp_folder_path, self.dsw_folder_path)
1277
+ if dsp_relative_folder_path == os.curdir:
1278
+ dsp_relative_file_path = name
1279
+ else:
1280
+ dsp_relative_file_path = os.path.join(dsp_relative_folder_path, name)
1281
+ dspfile_info = {'NAME': name,
1282
+ 'GUID': _generateGUID(dspfile, ''),
1283
+ 'FOLDER_PATH': dsp_folder_path,
1284
+ 'FILE_PATH': dspfile,
1285
+ 'SLN_RELATIVE_FOLDER_PATH': dsp_relative_folder_path,
1286
+ 'SLN_RELATIVE_FILE_PATH': dsp_relative_file_path}
1287
+ self.dspfiles_info.append(dspfile_info)
1288
+
1289
+ self.dspfiles_info = []
1290
+ GenerateProjectFilesInfo(self)
1291
+
1292
+ def Parse(self):
1293
+ try:
1294
+ dswfile = open(self.dswfile,'r')
1295
+ except IOError:
1296
+ return # doesn't exist yet, so can't add anything to configs.
1297
+
1298
+ line = dswfile.readline()
1299
+ while line:
1300
+ if line[:9] == "EndGlobal":
1301
+ break
1302
+ line = dswfile.readline()
1303
+
1304
+ line = dswfile.readline()
1305
+ datas = line
1306
+ while line:
1307
+ line = dswfile.readline()
1308
+ datas = datas + line
1309
+
1310
+ # OK, we've found our little pickled cache of data.
1311
+ try:
1312
+ datas = base64.decodestring(datas)
1313
+ data = pickle.loads(datas)
1314
+ except KeyboardInterrupt:
1315
+ raise
1316
+ except:
1317
+ return # unable to unpickle any data for some reason
1318
+
1319
+ self.configs.update(data)
1320
+
1321
+ def PrintSolution(self):
1322
+ """Writes a solution file"""
1323
+ self.file.write('Microsoft Visual Studio Solution File, Format Version %s\n' % self.versionstr )
1324
+ if self.version_num >= 10.0:
1325
+ self.file.write('# Visual Studio 2010\n')
1326
+ elif self.version_num >= 9.0:
1327
+ self.file.write('# Visual Studio 2008\n')
1328
+ elif self.version_num >= 8.0:
1329
+ self.file.write('# Visual Studio 2005\n')
1330
+ for dspinfo in self.dspfiles_info:
1331
+ name = dspinfo['NAME']
1332
+ base, suffix = SCons.Util.splitext(name)
1333
+ if suffix == '.vcproj':
1334
+ name = base
1335
+ self.file.write('Project("%s") = "%s", "%s", "%s"\n'
1336
+ % (external_makefile_guid, name, dspinfo['SLN_RELATIVE_FILE_PATH'], dspinfo['GUID']))
1337
+ if self.version_num >= 7.1 and self.version_num < 8.0:
1338
+ self.file.write('\tProjectSection(ProjectDependencies) = postProject\n'
1339
+ '\tEndProjectSection\n')
1340
+ self.file.write('EndProject\n')
1341
+
1342
+ self.file.write('Global\n')
1343
+
1344
+ env = self.env
1345
+ if 'MSVS_SCC_PROVIDER' in env:
1346
+ scc_number_of_projects = len(self.dspfiles) + 1
1347
+ slnguid = self.slnguid
1348
+ scc_provider = env.get('MSVS_SCC_PROVIDER', '').replace(' ', r'\u0020')
1349
+ scc_project_name = env.get('MSVS_SCC_PROJECT_NAME', '').replace(' ', r'\u0020')
1350
+ scc_connection_root = env.get('MSVS_SCC_CONNECTION_ROOT', os.curdir)
1351
+ scc_local_path = os.path.relpath(scc_connection_root, self.dsw_folder_path).replace('\\', '\\\\')
1352
+ self.file.write('\tGlobalSection(SourceCodeControl) = preSolution\n'
1353
+ '\t\tSccNumberOfProjects = %(scc_number_of_projects)d\n'
1354
+ '\t\tSccProjectName0 = %(scc_project_name)s\n'
1355
+ '\t\tSccLocalPath0 = %(scc_local_path)s\n'
1356
+ '\t\tSccProvider0 = %(scc_provider)s\n'
1357
+ '\t\tCanCheckoutShared = true\n' % locals())
1358
+ sln_relative_path_from_scc = os.path.relpath(self.dsw_folder_path, scc_connection_root)
1359
+ if sln_relative_path_from_scc != os.curdir:
1360
+ self.file.write('\t\tSccProjectFilePathRelativizedFromConnection0 = %s\\\\\n'
1361
+ % sln_relative_path_from_scc.replace('\\', '\\\\'))
1362
+ if self.version_num < 8.0:
1363
+ # When present, SolutionUniqueID is automatically removed by VS 2005
1364
+ # TODO: check for Visual Studio versions newer than 2005
1365
+ self.file.write('\t\tSolutionUniqueID = %s\n' % slnguid)
1366
+ for dspinfo in self.dspfiles_info:
1367
+ i = self.dspfiles_info.index(dspinfo) + 1
1368
+ dsp_relative_file_path = dspinfo['SLN_RELATIVE_FILE_PATH'].replace('\\', '\\\\')
1369
+ dsp_scc_relative_folder_path = os.path.relpath(dspinfo['FOLDER_PATH'], scc_connection_root).replace('\\', '\\\\')
1370
+ self.file.write('\t\tSccProjectUniqueName%(i)s = %(dsp_relative_file_path)s\n'
1371
+ '\t\tSccLocalPath%(i)d = %(scc_local_path)s\n'
1372
+ '\t\tCanCheckoutShared = true\n'
1373
+ '\t\tSccProjectFilePathRelativizedFromConnection%(i)s = %(dsp_scc_relative_folder_path)s\\\\\n'
1374
+ % locals())
1375
+ self.file.write('\tEndGlobalSection\n')
1376
+ if self.version_num >= 8.0:
1377
+ self.file.write('\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n')
1378
+ else:
1379
+ self.file.write('\tGlobalSection(SolutionConfiguration) = preSolution\n')
1380
+
1381
+ confkeys = sorted(self.configs.keys())
1382
+ cnt = 0
1383
+ for name in confkeys:
1384
+ variant = self.configs[name].variant
1385
+ platform = self.configs[name].platform
1386
+ if self.version_num >= 8.0:
1387
+ self.file.write('\t\t%s|%s = %s|%s\n' % (variant, platform, variant, platform))
1388
+ else:
1389
+ self.file.write('\t\tConfigName.%d = %s\n' % (cnt, variant))
1390
+ cnt = cnt + 1
1391
+ self.file.write('\tEndGlobalSection\n')
1392
+ if self.version_num <= 7.1:
1393
+ self.file.write('\tGlobalSection(ProjectDependencies) = postSolution\n'
1394
+ '\tEndGlobalSection\n')
1395
+ if self.version_num >= 8.0:
1396
+ self.file.write('\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n')
1397
+ else:
1398
+ self.file.write('\tGlobalSection(ProjectConfiguration) = postSolution\n')
1399
+
1400
+ for name in confkeys:
1401
+ variant = self.configs[name].variant
1402
+ platform = self.configs[name].platform
1403
+ if self.version_num >= 8.0:
1404
+ for dspinfo in self.dspfiles_info:
1405
+ guid = dspinfo['GUID']
1406
+ self.file.write('\t\t%s.%s|%s.ActiveCfg = %s|%s\n'
1407
+ '\t\t%s.%s|%s.Build.0 = %s|%s\n' % (guid,variant,platform,variant,platform,guid,variant,platform,variant,platform))
1408
+ else:
1409
+ for dspinfo in self.dspfiles_info:
1410
+ guid = dspinfo['GUID']
1411
+ self.file.write('\t\t%s.%s.ActiveCfg = %s|%s\n'
1412
+ '\t\t%s.%s.Build.0 = %s|%s\n' %(guid,variant,variant,platform,guid,variant,variant,platform))
1413
+
1414
+ self.file.write('\tEndGlobalSection\n')
1415
+
1416
+ if self.version_num >= 8.0:
1417
+ self.file.write('\tGlobalSection(SolutionProperties) = preSolution\n'
1418
+ '\t\tHideSolutionNode = FALSE\n'
1419
+ '\tEndGlobalSection\n')
1420
+ else:
1421
+ self.file.write('\tGlobalSection(ExtensibilityGlobals) = postSolution\n'
1422
+ '\tEndGlobalSection\n'
1423
+ '\tGlobalSection(ExtensibilityAddIns) = postSolution\n'
1424
+ '\tEndGlobalSection\n')
1425
+ self.file.write('EndGlobal\n')
1426
+ if self.nokeep == 0:
1427
+ pdata = pickle.dumps(self.configs,1)
1428
+ pdata = base64.encodestring(pdata)
1429
+ self.file.write(pdata + '\n')
1430
+
1431
+ def Build(self):
1432
+ try:
1433
+ self.file = open(self.dswfile,'w')
1434
+ except IOError, detail:
1435
+ raise SCons.Errors.InternalError('Unable to open "' + self.dswfile + '" for writing:' + str(detail))
1436
+ else:
1437
+ self.PrintSolution()
1438
+ self.file.close()
1439
+
1440
+ V6DSWHeader = """\
1441
+ Microsoft Developer Studio Workspace File, Format Version 6.00
1442
+ # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
1443
+
1444
+ ###############################################################################
1445
+
1446
+ Project: "%(name)s"="%(dspfile)s" - Package Owner=<4>
1447
+
1448
+ Package=<5>
1449
+ {{{
1450
+ }}}
1451
+
1452
+ Package=<4>
1453
+ {{{
1454
+ }}}
1455
+
1456
+ ###############################################################################
1457
+
1458
+ Global:
1459
+
1460
+ Package=<5>
1461
+ {{{
1462
+ }}}
1463
+
1464
+ Package=<3>
1465
+ {{{
1466
+ }}}
1467
+
1468
+ ###############################################################################
1469
+ """
1470
+
1471
+ class _GenerateV6DSW(_DSWGenerator):
1472
+ """Generates a Workspace file for MSVS 6.0"""
1473
+
1474
+ def PrintWorkspace(self):
1475
+ """ writes a DSW file """
1476
+ name = self.name
1477
+ dspfile = os.path.relpath(self.dspfiles[0], self.dsw_folder_path)
1478
+ self.file.write(V6DSWHeader % locals())
1479
+
1480
+ def Build(self):
1481
+ try:
1482
+ self.file = open(self.dswfile,'w')
1483
+ except IOError, detail:
1484
+ raise SCons.Errors.InternalError('Unable to open "' + self.dswfile + '" for writing:' + str(detail))
1485
+ else:
1486
+ self.PrintWorkspace()
1487
+ self.file.close()
1488
+
1489
+
1490
+ def GenerateDSP(dspfile, source, env):
1491
+ """Generates a Project file based on the version of MSVS that is being used"""
1492
+
1493
+ version_num = 6.0
1494
+ if 'MSVS_VERSION' in env:
1495
+ version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
1496
+ if version_num >= 10.0:
1497
+ g = _GenerateV10DSP(dspfile, source, env)
1498
+ g.Build()
1499
+ elif version_num >= 7.0:
1500
+ g = _GenerateV7DSP(dspfile, source, env)
1501
+ g.Build()
1502
+ else:
1503
+ g = _GenerateV6DSP(dspfile, source, env)
1504
+ g.Build()
1505
+
1506
+ def GenerateDSW(dswfile, source, env):
1507
+ """Generates a Solution/Workspace file based on the version of MSVS that is being used"""
1508
+
1509
+ version_num = 6.0
1510
+ if 'MSVS_VERSION' in env:
1511
+ version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
1512
+ if version_num >= 7.0:
1513
+ g = _GenerateV7DSW(dswfile, source, env)
1514
+ g.Build()
1515
+ else:
1516
+ g = _GenerateV6DSW(dswfile, source, env)
1517
+ g.Build()
1518
+
1519
+
1520
+ ##############################################################################
1521
+ # Above here are the classes and functions for generation of
1522
+ # DSP/DSW/SLN/VCPROJ files.
1523
+ ##############################################################################
1524
+
1525
+ def GetMSVSProjectSuffix(target, source, env, for_signature):
1526
+ return env['MSVS']['PROJECTSUFFIX']
1527
+
1528
+ def GetMSVSSolutionSuffix(target, source, env, for_signature):
1529
+ return env['MSVS']['SOLUTIONSUFFIX']
1530
+
1531
+ def GenerateProject(target, source, env):
1532
+ # generate the dsp file, according to the version of MSVS.
1533
+ builddspfile = target[0]
1534
+ dspfile = builddspfile.srcnode()
1535
+
1536
+ # this detects whether or not we're using a VariantDir
1537
+ if not dspfile is builddspfile:
1538
+ try:
1539
+ bdsp = open(str(builddspfile), "w+")
1540
+ except IOError, detail:
1541
+ print 'Unable to open "' + str(dspfile) + '" for writing:',detail,'\n'
1542
+ raise
1543
+
1544
+ bdsp.write("This is just a placeholder file.\nThe real project file is here:\n%s\n" % dspfile.get_abspath())
1545
+
1546
+ GenerateDSP(dspfile, source, env)
1547
+
1548
+ if env.get('auto_build_solution', 1):
1549
+ builddswfile = target[1]
1550
+ dswfile = builddswfile.srcnode()
1551
+
1552
+ if not dswfile is builddswfile:
1553
+
1554
+ try:
1555
+ bdsw = open(str(builddswfile), "w+")
1556
+ except IOError, detail:
1557
+ print 'Unable to open "' + str(dspfile) + '" for writing:',detail,'\n'
1558
+ raise
1559
+
1560
+ bdsw.write("This is just a placeholder file.\nThe real workspace file is here:\n%s\n" % dswfile.get_abspath())
1561
+
1562
+ GenerateDSW(dswfile, source, env)
1563
+
1564
+ def GenerateSolution(target, source, env):
1565
+ GenerateDSW(target[0], source, env)
1566
+
1567
+ def projectEmitter(target, source, env):
1568
+ """Sets up the DSP dependencies."""
1569
+
1570
+ # todo: Not sure what sets source to what user has passed as target,
1571
+ # but this is what happens. When that is fixed, we also won't have
1572
+ # to make the user always append env['MSVSPROJECTSUFFIX'] to target.
1573
+ if source[0] == target[0]:
1574
+ source = []
1575
+
1576
+ # make sure the suffix is correct for the version of MSVS we're running.
1577
+ (base, suff) = SCons.Util.splitext(str(target[0]))
1578
+ suff = env.subst('$MSVSPROJECTSUFFIX')
1579
+ target[0] = base + suff
1580
+
1581
+ if not source:
1582
+ source = 'prj_inputs:'
1583
+ source = source + env.subst('$MSVSSCONSCOM', 1)
1584
+ source = source + env.subst('$MSVSENCODING', 1)
1585
+
1586
+ # Project file depends on CPPDEFINES and CPPPATH
1587
+ preprocdefs = xmlify(';'.join(processDefines(env.get('CPPDEFINES', []))))
1588
+ includepath_Dirs = processIncludes(env.get('CPPPATH', []), env, None, None)
1589
+ includepath = xmlify(';'.join([str(x) for x in includepath_Dirs]))
1590
+ source = source + "; ppdefs:%s incpath:%s"%(preprocdefs, includepath)
1591
+
1592
+ if 'buildtarget' in env and env['buildtarget'] != None:
1593
+ if SCons.Util.is_String(env['buildtarget']):
1594
+ source = source + ' "%s"' % env['buildtarget']
1595
+ elif SCons.Util.is_List(env['buildtarget']):
1596
+ for bt in env['buildtarget']:
1597
+ if SCons.Util.is_String(bt):
1598
+ source = source + ' "%s"' % bt
1599
+ else:
1600
+ try: source = source + ' "%s"' % bt.get_abspath()
1601
+ except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None")
1602
+ else:
1603
+ try: source = source + ' "%s"' % env['buildtarget'].get_abspath()
1604
+ except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None")
1605
+
1606
+ if 'outdir' in env and env['outdir'] != None:
1607
+ if SCons.Util.is_String(env['outdir']):
1608
+ source = source + ' "%s"' % env['outdir']
1609
+ elif SCons.Util.is_List(env['outdir']):
1610
+ for s in env['outdir']:
1611
+ if SCons.Util.is_String(s):
1612
+ source = source + ' "%s"' % s
1613
+ else:
1614
+ try: source = source + ' "%s"' % s.get_abspath()
1615
+ except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None")
1616
+ else:
1617
+ try: source = source + ' "%s"' % env['outdir'].get_abspath()
1618
+ except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None")
1619
+
1620
+ if 'name' in env:
1621
+ if SCons.Util.is_String(env['name']):
1622
+ source = source + ' "%s"' % env['name']
1623
+ else:
1624
+ raise SCons.Errors.InternalError("name must be a string")
1625
+
1626
+ if 'variant' in env:
1627
+ if SCons.Util.is_String(env['variant']):
1628
+ source = source + ' "%s"' % env['variant']
1629
+ elif SCons.Util.is_List(env['variant']):
1630
+ for variant in env['variant']:
1631
+ if SCons.Util.is_String(variant):
1632
+ source = source + ' "%s"' % variant
1633
+ else:
1634
+ raise SCons.Errors.InternalError("name must be a string or a list of strings")
1635
+ else:
1636
+ raise SCons.Errors.InternalError("variant must be a string or a list of strings")
1637
+ else:
1638
+ raise SCons.Errors.InternalError("variant must be specified")
1639
+
1640
+ for s in _DSPGenerator.srcargs:
1641
+ if s in env:
1642
+ if SCons.Util.is_String(env[s]):
1643
+ source = source + ' "%s' % env[s]
1644
+ elif SCons.Util.is_List(env[s]):
1645
+ for t in env[s]:
1646
+ if SCons.Util.is_String(t):
1647
+ source = source + ' "%s"' % t
1648
+ else:
1649
+ raise SCons.Errors.InternalError(s + " must be a string or a list of strings")
1650
+ else:
1651
+ raise SCons.Errors.InternalError(s + " must be a string or a list of strings")
1652
+
1653
+ source = source + ' "%s"' % str(target[0])
1654
+ source = [SCons.Node.Python.Value(source)]
1655
+
1656
+ targetlist = [target[0]]
1657
+ sourcelist = source
1658
+
1659
+ if env.get('auto_build_solution', 1):
1660
+ env['projects'] = [env.File(t).srcnode() for t in targetlist]
1661
+ t, s = solutionEmitter(target, target, env)
1662
+ targetlist = targetlist + t
1663
+
1664
+ return (targetlist, sourcelist)
1665
+
1666
+ def solutionEmitter(target, source, env):
1667
+ """Sets up the DSW dependencies."""
1668
+
1669
+ # todo: Not sure what sets source to what user has passed as target,
1670
+ # but this is what happens. When that is fixed, we also won't have
1671
+ # to make the user always append env['MSVSSOLUTIONSUFFIX'] to target.
1672
+ if source[0] == target[0]:
1673
+ source = []
1674
+
1675
+ # make sure the suffix is correct for the version of MSVS we're running.
1676
+ (base, suff) = SCons.Util.splitext(str(target[0]))
1677
+ suff = env.subst('$MSVSSOLUTIONSUFFIX')
1678
+ target[0] = base + suff
1679
+
1680
+ if not source:
1681
+ source = 'sln_inputs:'
1682
+
1683
+ if 'name' in env:
1684
+ if SCons.Util.is_String(env['name']):
1685
+ source = source + ' "%s"' % env['name']
1686
+ else:
1687
+ raise SCons.Errors.InternalError("name must be a string")
1688
+
1689
+ if 'variant' in env:
1690
+ if SCons.Util.is_String(env['variant']):
1691
+ source = source + ' "%s"' % env['variant']
1692
+ elif SCons.Util.is_List(env['variant']):
1693
+ for variant in env['variant']:
1694
+ if SCons.Util.is_String(variant):
1695
+ source = source + ' "%s"' % variant
1696
+ else:
1697
+ raise SCons.Errors.InternalError("name must be a string or a list of strings")
1698
+ else:
1699
+ raise SCons.Errors.InternalError("variant must be a string or a list of strings")
1700
+ else:
1701
+ raise SCons.Errors.InternalError("variant must be specified")
1702
+
1703
+ if 'slnguid' in env:
1704
+ if SCons.Util.is_String(env['slnguid']):
1705
+ source = source + ' "%s"' % env['slnguid']
1706
+ else:
1707
+ raise SCons.Errors.InternalError("slnguid must be a string")
1708
+
1709
+ if 'projects' in env:
1710
+ if SCons.Util.is_String(env['projects']):
1711
+ source = source + ' "%s"' % env['projects']
1712
+ elif SCons.Util.is_List(env['projects']):
1713
+ for t in env['projects']:
1714
+ if SCons.Util.is_String(t):
1715
+ source = source + ' "%s"' % t
1716
+
1717
+ source = source + ' "%s"' % str(target[0])
1718
+ source = [SCons.Node.Python.Value(source)]
1719
+
1720
+ return ([target[0]], source)
1721
+
1722
+ projectAction = SCons.Action.Action(GenerateProject, None)
1723
+
1724
+ solutionAction = SCons.Action.Action(GenerateSolution, None)
1725
+
1726
+ projectBuilder = SCons.Builder.Builder(action = '$MSVSPROJECTCOM',
1727
+ suffix = '$MSVSPROJECTSUFFIX',
1728
+ emitter = projectEmitter)
1729
+
1730
+ solutionBuilder = SCons.Builder.Builder(action = '$MSVSSOLUTIONCOM',
1731
+ suffix = '$MSVSSOLUTIONSUFFIX',
1732
+ emitter = solutionEmitter)
1733
+
1734
+ default_MSVS_SConscript = None
1735
+
1736
+ def generate(env):
1737
+ """Add Builders and construction variables for Microsoft Visual
1738
+ Studio project files to an Environment."""
1739
+ try:
1740
+ env['BUILDERS']['MSVSProject']
1741
+ except KeyError:
1742
+ env['BUILDERS']['MSVSProject'] = projectBuilder
1743
+
1744
+ try:
1745
+ env['BUILDERS']['MSVSSolution']
1746
+ except KeyError:
1747
+ env['BUILDERS']['MSVSSolution'] = solutionBuilder
1748
+
1749
+ env['MSVSPROJECTCOM'] = projectAction
1750
+ env['MSVSSOLUTIONCOM'] = solutionAction
1751
+
1752
+ if SCons.Script.call_stack:
1753
+ # XXX Need to find a way to abstract this; the build engine
1754
+ # shouldn't depend on anything in SCons.Script.
1755
+ env['MSVSSCONSCRIPT'] = SCons.Script.call_stack[0].sconscript
1756
+ else:
1757
+ global default_MSVS_SConscript
1758
+ if default_MSVS_SConscript is None:
1759
+ default_MSVS_SConscript = env.File('SConstruct')
1760
+ env['MSVSSCONSCRIPT'] = default_MSVS_SConscript
1761
+
1762
+ env['MSVSSCONS'] = '"%s" -c "%s"' % (python_executable, getExecScriptMain(env))
1763
+ env['MSVSSCONSFLAGS'] = '-C "${MSVSSCONSCRIPT.dir.abspath}" -f ${MSVSSCONSCRIPT.name}'
1764
+ env['MSVSSCONSCOM'] = '$MSVSSCONS $MSVSSCONSFLAGS'
1765
+ env['MSVSBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"'
1766
+ env['MSVSREBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"'
1767
+ env['MSVSCLEANCOM'] = '$MSVSSCONSCOM -c "$MSVSBUILDTARGET"'
1768
+
1769
+ # Set-up ms tools paths for default version
1770
+ msvc_setup_env_once(env)
1771
+
1772
+ if 'MSVS_VERSION' in env:
1773
+ version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
1774
+ else:
1775
+ (version_num, suite) = (7.0, None) # guess at a default
1776
+ if 'MSVS' not in env:
1777
+ env['MSVS'] = {}
1778
+ if (version_num < 7.0):
1779
+ env['MSVS']['PROJECTSUFFIX'] = '.dsp'
1780
+ env['MSVS']['SOLUTIONSUFFIX'] = '.dsw'
1781
+ elif (version_num < 10.0):
1782
+ env['MSVS']['PROJECTSUFFIX'] = '.vcproj'
1783
+ env['MSVS']['SOLUTIONSUFFIX'] = '.sln'
1784
+ else:
1785
+ env['MSVS']['PROJECTSUFFIX'] = '.vcxproj'
1786
+ env['MSVS']['SOLUTIONSUFFIX'] = '.sln'
1787
+
1788
+ if (version_num >= 10.0):
1789
+ env['MSVSENCODING'] = 'utf-8'
1790
+ else:
1791
+ env['MSVSENCODING'] = 'Windows-1252'
1792
+
1793
+ env['GET_MSVSPROJECTSUFFIX'] = GetMSVSProjectSuffix
1794
+ env['GET_MSVSSOLUTIONSUFFIX'] = GetMSVSSolutionSuffix
1795
+ env['MSVSPROJECTSUFFIX'] = '${GET_MSVSPROJECTSUFFIX}'
1796
+ env['MSVSSOLUTIONSUFFIX'] = '${GET_MSVSSOLUTIONSUFFIX}'
1797
+ env['SCONS_HOME'] = os.environ.get('SCONS_HOME')
1798
+
1799
+ def exists(env):
1800
+ return msvc_exists()
1801
+
1802
+ # Local Variables:
1803
+ # tab-width:4
1804
+ # indent-tabs-mode:nil
1805
+ # End:
1806
+ # vim: set expandtab tabstop=4 shiftwidth=4: