vs2005_fsproj.lua 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. --
  2. -- vs2005_fsproj.lua
  3. -- Generate a Visual Studio 2005+ F# project.
  4. -- Copyright (c) Jason Perkins and the Premake project
  5. --
  6. local p = premake
  7. p.vstudio.fs2005 = {}
  8. local vstudio = p.vstudio
  9. local fs2005 = p.vstudio.fs2005
  10. local dotnetbase = p.vstudio.dotnetbase
  11. local project = p.project
  12. local config = p.config
  13. local fileconfig = p.fileconfig
  14. local dotnet = p.tools.dotnet
  15. fs2005.elements = {}
  16. fs2005.elements.project = function ()
  17. return {
  18. dotnetbase.xmlDeclaration,
  19. dotnetbase.projectElement,
  20. dotnetbase.commonProperties,
  21. dotnetbase.projectProperties,
  22. dotnetbase.configurations,
  23. dotnetbase.applicationIcon,
  24. dotnetbase.references
  25. }
  26. end
  27. fs2005.elements.projectProperties = function ()
  28. return {
  29. dotnetbase.configurationCondition,
  30. dotnetbase.platformCondition,
  31. dotnetbase.schemaVersion,
  32. dotnetbase.productVersion,
  33. dotnetbase.projectGuid,
  34. dotnetbase.outputType,
  35. dotnetbase.appDesignerFolder,
  36. dotnetbase.rootNamespace,
  37. dotnetbase.assemblyName,
  38. dotnetbase.targetFrameworkVersion,
  39. dotnetbase.targetFrameworkProfile,
  40. dotnetbase.projectTypeGuids
  41. }
  42. end
  43. fs2005.elements.configuration = function ()
  44. return {
  45. dotnetbase.propertyGroup,
  46. dotnetbase.debugProps,
  47. dotnetbase.outputProps,
  48. dotnetbase.compilerProps,
  49. dotnetbase.NoWarn,
  50. fs2005.tailCalls
  51. }
  52. end
  53. function fs2005.generate(prj)
  54. dotnetbase.prepare(fs2005)
  55. dotnetbase.generate(prj)
  56. end
  57. function fs2005.tailCalls(cfg)
  58. local tc
  59. if cfg.tailcalls == nil then
  60. tc = config.isDebugBuild(cfg)
  61. else
  62. tc = cfg.tailcalls
  63. end
  64. _p(2, '<Tailcalls>%s</Tailcalls>', iif(tc, "true", "false"))
  65. end
  66. function fs2005.targets(prj)
  67. _p(1, '<Choose>')
  68. _p(2, '<When Condition="\'$(VisualStudioVersion)\' == \'11.0\'">')
  69. _p(3, '<PropertyGroup Condition="Exists(\'$(MSBuildExtensionsPath32)\\..\\Microsoft SDKs\\F#\\3.0\\Framework\\v4.0\\Microsoft.FSharp.Targets\')">')
  70. _p(4, '<FSharpTargetsPath>$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\FSharp\\Microsoft.FSharp.Targets</FSharpTargetsPath>')
  71. _p(3, '</PropertyGroup>')
  72. _p(2, '</When>')
  73. _p(2, '<Otherwise>')
  74. _p(2, '<PropertyGroup Condition="Exists(\'$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\FSharp\\Microsoft.FSharp.Targets\')">')
  75. _p(3, '<FSharpTargetsPath>$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\FSharp\\Microsoft.FSharp.Targets</FSharpTargetsPath>')
  76. _p(2, '</PropertyGroup>')
  77. _p(2, '</Otherwise>')
  78. _p(1, '</Choose>')
  79. _p(1, '<Import Project="$(FSharpTargetsPath)" />')
  80. end