patternMinor
FASTBuild makefile
Viewed 0 times
makefilefastbuildstackoverflow
Problem
I'm replacing my Visual Studio project files with FASTBuild makefiles because it builds in a fraction of the time. Right now FASTBuild isn't well known. The official documentation is sorely lacking, and I can't find anyone else talking about it online.
I've spent quite a bit of time programming-by-error-message to figure out how FASTBuild really works, and I've come up with a functional makefile. It still lacks some features essential to IDE development work, but otherwise it's solid.
The downside is that it's long, verbose, repetitive, ugly, and it's going to be unpleasant to roll this one test project out to the other 95 project files in my solution.
If anyone out there knows FASTBuild, I need suggestions on how to make this less redundant and generally less awful.
```
; FASTBUILD makefile
;_______________
; Variables to customize this library build
;_______________
.LibraryName = 'LibraryName'
.InputFiles = { 'file1.cpp' 'file2.cpp' 'etc.cpp' }
.InputFilesManaged = { 'fileM1.cpp' 'fileM2.cpp' 'etcM.cpp' }
.PathToSolutionBase = '..\..'
;From
.HeaderIncludePaths = '..\Lib1;..\Lib1\Src;..\Lib2;..\Lib3;'
.Includes = ' /I"..\Lib1"'
+ ' /I"..\Lib1\Src"'
+ ' /I"..\Lib2"'
+ ' /I"..\Lib3"'
.PCHFile = 'stdafx.cpp'
.PCHHeader = 'StdAfx.h'
.ObjPath = 'obj'
.OutputPath = '$PathToSolutionBase$\bin'
.ForceUsingCommon = ' /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll"'
+ ' /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll"'
+ ' /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.dll"'
+ ' /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Windows.Forms.dll"'
; Source: grep "<ProjectReference" .vcxproj | sed -e 's/.=.//g' | sed -e 's/..$//g'
.ForceUsing_Debug_x86 = ' /FU"$O
I've spent quite a bit of time programming-by-error-message to figure out how FASTBuild really works, and I've come up with a functional makefile. It still lacks some features essential to IDE development work, but otherwise it's solid.
The downside is that it's long, verbose, repetitive, ugly, and it's going to be unpleasant to roll this one test project out to the other 95 project files in my solution.
If anyone out there knows FASTBuild, I need suggestions on how to make this less redundant and generally less awful.
```
; FASTBUILD makefile
;_______________
; Variables to customize this library build
;_______________
.LibraryName = 'LibraryName'
.InputFiles = { 'file1.cpp' 'file2.cpp' 'etc.cpp' }
.InputFilesManaged = { 'fileM1.cpp' 'fileM2.cpp' 'etcM.cpp' }
.PathToSolutionBase = '..\..'
;From
.HeaderIncludePaths = '..\Lib1;..\Lib1\Src;..\Lib2;..\Lib3;'
.Includes = ' /I"..\Lib1"'
+ ' /I"..\Lib1\Src"'
+ ' /I"..\Lib2"'
+ ' /I"..\Lib3"'
.PCHFile = 'stdafx.cpp'
.PCHHeader = 'StdAfx.h'
.ObjPath = 'obj'
.OutputPath = '$PathToSolutionBase$\bin'
.ForceUsingCommon = ' /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Core.dll"'
+ ' /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll"'
+ ' /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Drawing.dll"'
+ ' /FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Windows.Forms.dll"'
; Source: grep "<ProjectReference" .vcxproj | sed -e 's/.=.//g' | sed -e 's/..$//g'
.ForceUsing_Debug_x86 = ' /FU"$O
Solution
I am the author of FASTBuild.
I presume the config as you have it is ok, but you're worried about copying it 95 times for your other projects and it becoming unmaintainable.
With that in mind, the best advice I can offer is to continue to factorize the common configuration patterns into structures (as you've already started doing). In particular, it looks like your Unity and Project options have lots of settings that don't need to be unique per library. If you can start with a common base, you can always override it for any special cases that come up.
Also, don't be afraid to (ab)use the include system to isolate common configurations. You can #include files at any point and treat them like macros/templates. (A more obvious mechanism for this sort of thing is planned for the future)
Without knowing your overall code base, it's a bit tricky to be more explicit. If you like, private support can be provided here: http://fastbuild.org/docs/contact.html
I hope to extend the language syntax in the future to afford more flexibility and simplify initial setup and maintenance. You are right about the weakness of loops. Right now they can't impact items outside of the scope of the loop. I hope the syntax enhancements will resolve this issue.
PS - I'm sorry about the documentation - it's very much a reference only at the moment, and providing examples and more details is high on the list of priorities!
I presume the config as you have it is ok, but you're worried about copying it 95 times for your other projects and it becoming unmaintainable.
With that in mind, the best advice I can offer is to continue to factorize the common configuration patterns into structures (as you've already started doing). In particular, it looks like your Unity and Project options have lots of settings that don't need to be unique per library. If you can start with a common base, you can always override it for any special cases that come up.
Also, don't be afraid to (ab)use the include system to isolate common configurations. You can #include files at any point and treat them like macros/templates. (A more obvious mechanism for this sort of thing is planned for the future)
Without knowing your overall code base, it's a bit tricky to be more explicit. If you like, private support can be provided here: http://fastbuild.org/docs/contact.html
I hope to extend the language syntax in the future to afford more flexibility and simplify initial setup and maintenance. You are right about the weakness of loops. Right now they can't impact items outside of the scope of the loop. I hope the syntax enhancements will resolve this issue.
PS - I'm sorry about the documentation - it's very much a reference only at the moment, and providing examples and more details is high on the list of priorities!
Context
StackExchange Code Review Q#63199, answer score: 5
Revisions (0)
No revisions yet.