building software - simon fraser universitywsumner/teaching/373/02-building.pdf– a script in every...
TRANSCRIPT
![Page 2: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/2.jpg)
What does it mean to build software?
● How many of you know how to build software?– Really.
![Page 3: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/3.jpg)
What does it mean to build software?
● How many of you know how to build software?– Really.
● What does the process include?
![Page 4: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/4.jpg)
What does it mean to build software?
● How many of you know how to build software?– Really.
● What does the process include?
● How many of you have heard terms like– Build Engineering?
– Build Configuration?
– Build Automation?
– Dependency Management?
– Continuous Integration?
![Page 5: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/5.jpg)
What does it mean to build software?
● How many of you know how to build software?– Really.
● What does the process include?
● How many of you have heard terms like– Build Engineering?
– Build Configuration?
– Build Automation?
– Dependency Management?
– Continuous Integration?
Just getting something to compile reproducibly can be nontrivial
![Page 6: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/6.jpg)
What does it mean to build software?
● Building software includes (at least):– version control integration
![Page 7: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/7.jpg)
What does it mean to build software?
● Building software includes (at least):– version control integration
– identifying dependencies & their versions
![Page 8: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/8.jpg)
What does it mean to build software?
● Building software includes (at least):– version control integration
– identifying dependencies & their versions
– configuring build commands for different build modes & environments
![Page 9: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/9.jpg)
What does it mean to build software?
● Building software includes (at least):– version control integration
– identifying dependencies & their versions
– configuring build commands for different build modes & environments
– writing instructions for how to configure & build
![Page 10: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/10.jpg)
What does it mean to build software?
● Building software includes (at least):– version control integration
– identifying dependencies & their versions
– configuring build commands for different build modes & environments
– writing instructions for how to configure & build
– test configuration & execution (performance & correctness)
![Page 11: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/11.jpg)
What does it mean to build software?
● Building software includes (at least):– version control integration
– identifying dependencies & their versions
– configuring build commands for different build modes & environments
– writing instructions for how to configure & build
– test configuration & execution (performance & correctness)
– automated code quality checking
![Page 12: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/12.jpg)
What does it mean to build software?
● Building software includes (at least):– version control integration
– identifying dependencies & their versions
– configuring build commands for different build modes & environments
– writing instructions for how to configure & build
– test configuration & execution (performance & correctness)
– automated code quality checking
– scalable compilation & linking
![Page 13: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/13.jpg)
What does it mean to build software?
● Building software includes (at least):– version control integration
– identifying dependencies & their versions
– configuring build commands for different build modes & environments
– writing instructions for how to configure & build
– test configuration & execution (performance & correctness)
– automated code quality checking
– scalable compilation & linking
– possibly even deployment
![Page 14: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/14.jpg)
What does it mean to build software?
● Building software includes (at least):– version control integration
– identifying dependencies & their versions
– configuring build commands for different build modes & environments
– writing instructions for how to configure & build
– test configuration & execution (performance & correctness)
– automated code quality checking
– scalable the compilation & linking
– possibly even deployment
● It is the foundation of getting anything done.
![Page 15: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/15.jpg)
What does it mean to build software?
● How many of you know how to build software?– Really.
![Page 16: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/16.jpg)
What does it mean to build software?
● How many of you know how to build software?– Really.
● You should at least ask yourself:– What tools do you use?
– What workflow?
– What benefits do you get?
– What are the painful points?
– Why haven't you made them less painful?
![Page 17: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/17.jpg)
Modeling a Build
● To build software, we must consider:
![Page 18: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/18.jpg)
Modeling a Build
● To build software, we must consider:– Components & Objectives
Client ServerProgram Program
![Page 19: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/19.jpg)
Modeling a Build
● To build software, we must consider:– Components & Objectives
Client Server
JSON Networking
Program Program
LibraryLibrary
![Page 20: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/20.jpg)
Modeling a Build
● To build software, we must consider:– Components & Objectives
Client Server
JSON Networking
Formatting
Program Program
LibraryLibrary
Library
![Page 21: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/21.jpg)
Modeling a Build
● To build software, we must consider:– Components & Objectives
Client Server
JSON Networking
Formatting
All
Program Program
LibraryLibrary
Library
Project
![Page 22: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/22.jpg)
Modeling a Build
● To build software, we must consider:– Components & Objectives
– Dependencies between them
Client Server
JSON Networking
Formatting
All
Program Program
LibraryLibrary
Library
Project
![Page 23: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/23.jpg)
Modeling a Build
● To build software, we must consider:– Components & Objectives
– Dependencies between them
Client Server
JSON Networking
Formatting
All
Program Program
LibraryLibrary
Library
Project
![Page 24: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/24.jpg)
Modeling a Build
● To build software, we must consider:– Components & Objectives
– Dependencies between them
Client Server
JSON Networking
Formatting
All
Program Program
LibraryLibrary
Library
Project
![Page 25: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/25.jpg)
Modeling a Build
● To build software, we must consider:– Components & Objectives
– Dependencies between them
Client Server
JSON Networking
Formatting
All
Program Program
LibraryLibrary
Library
Project
![Page 26: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/26.jpg)
Modeling a Build
● To build software, we must consider:– Components & Objectives
– Dependencies between them
Client Server
JSON Networking
Formatting
All
Program Program
LibraryLibrary
Library
Project
This defines the dependency graph of a project.
![Page 27: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/27.jpg)
Modeling a Build
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!
Client Server
JSON Networking
Formatting
All
Program Program
LibraryLibrary
Library
Project
![Page 28: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/28.jpg)
Modeling a Build
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!
Client Server
JSON Networking
Formatting
All
Program Program
LibraryLibrary
Library
Project
![Page 29: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/29.jpg)
Modeling a Build
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
Client Server
JSON Networking
Formatting
All
Program Program
LibraryLibrary
Library
Project
![Page 30: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/30.jpg)
Modeling a Build
Client Server
JSON Networking
Formatting
All
Program Program
LibraryLibrary
Library
Project● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
![Page 31: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/31.jpg)
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formatting
Program
LibraryLibrary
Library
![Page 32: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/32.jpg)
Library
Library Library
Program
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formattingformat.cpp
libformat.a
![Page 33: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/33.jpg)
Library
Library Library
Program
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formattingformat.cpp
libformat.a
libjson.a
![Page 34: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/34.jpg)
Library
Library Library
Program
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formattingformat.cpp
libformat.a
libjson.a
json.cpp
![Page 35: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/35.jpg)
Library
Library Library
Program
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formattingformat.cpp
libformat.a
libjson.a
json.cpp <...>/format.h
![Page 36: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/36.jpg)
Library
Library Library
Program
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formattingformat.cpp
libformat.a
<...>/libformat.a
libjson.a
json.cpp <...>/format.h
![Page 37: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/37.jpg)
Library
Library Library
Program
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formattingformat.cpp
libformat.a
<...>/libformat.a
libjson.a
json.cpp <...>/format.h ?
![Page 38: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/38.jpg)
Library
Library Library
Program
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formattingformat.cpp
libformat.a
libjson.a
json.cpp <...>/format.h
![Page 39: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/39.jpg)
Library
Library Library
Program
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formattingformat.cpp
libformat.a
libjson.a
json.cpp <...>/format.hlibnetworking.a
net.cpp <...>/format.h
![Page 40: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/40.jpg)
Library
Library Library
Program
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formattingformat.cpp
libformat.a
libjson.a
json.cpp <...>/format.hlibnetworking.a
net.cpp <...>/format.h
<...>/libformat.a
bin/client
client.cpp <...>/net.h
<...>/json.h <...>/libnetworking.a
<...>/libjson.a
![Page 41: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/41.jpg)
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formatting
Program
LibraryLibrary
LibraryCan you think of problems that may arise?
![Page 42: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/42.jpg)
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formatting
Program
LibraryLibrary
LibraryCan you think of problems that may arise?
![Page 43: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/43.jpg)
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formatting
Program
LibraryLibrary
LibraryCan you think of problems that may arise?
bin/client
client.cpp <...>/net.h
<...>/json.h <...>/libnetworking.a
<...>/libjson.a
<...>/libformat.a <...>/libformat.a
![Page 44: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/44.jpg)
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formatting
Program
LibraryLibrary
LibraryCan you think of problems that may arise?
foo/<...>/format.h
bar/<...>/format.h
![Page 45: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/45.jpg)
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formatting
Program
LibraryLibrary
LibraryCan you think of problems that may arise?
foo/<...>/format.h
bar/<...>/format.h
libjson.a
json.cpp ?/format.h
![Page 46: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/46.jpg)
Modeling a Build
Server
All
Program
Project
What must the build system perform?
● To build software, we must consider:– Components & Objectives
– Dependencies between them
● The dependency graph can alreadyhelp to analyze our project!– A good dependency graph is a DAG
● Modern build management uses thedependency DAG to drive build process
Client
JSON Networking
Formatting
Program
LibraryLibrary
LibraryCan you think of problems that may arise?
![Page 47: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/47.jpg)
Modeling a Build
● For each component, build management requires– Direct build requirements
![Page 48: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/48.jpg)
Modeling a Build
● For each component, build management requires– Direct build requirements– Transitive usage requirements
![Page 49: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/49.jpg)
Modeling a Build
● For each component, build management requires– Direct build requirements– Transitive usage requirements
– Note, these just separate interfaces from implementation
![Page 50: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/50.jpg)
Modeling a Build
● For each component, build management requires– Direct build requirements– Transitive usage requirements
– Note, these just separate interfaces from implementation
● The dependency graph allows us to use these to infer how to build a component correctly based on its dependencies– NOTE:
Even if a dependency uses a new library, the build system should detect it.
![Page 51: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/51.jpg)
Modeling a Build
● For each component, build management requires– Direct build requirements– Transitive usage requirements
– Note, these just separate interfaces from implementation
● The dependency graph allows us to use these to infer how to build a component correctly based on its dependencies– NOTE:
Even if a dependency uses a new library, the build system should detect it.Client
JSON Networking
Formatting
![Page 52: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/52.jpg)
Modeling a Build
● For each component, build management requires– Direct build requirements– Transitive usage requirements
– Note, these just separate interfaces from implementation
● The dependency graph allows us to use these to infer how to build a component correctly based on its dependencies– NOTE:
Even if a dependency uses a new library, the build system should detect it.Client
JSON Networking
Formatting FancyIO
![Page 53: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/53.jpg)
Modeling a Build
● For each component, build management requires– Direct build requirements– Transitive usage requirements
– Note, these just separate interfaces from implementation
● The dependency graph allows us to use these to infer how to build a component correctly based on its dependencies– NOTE:
Even if a dependency uses a new library, the build system should detect it.Client
JSON Networking
Formatting FancyIO
Include directories for Networking should change
![Page 54: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/54.jpg)
Modeling a Build
● For each component, build management requires– Direct build requirements– Transitive usage requirements
– Note, these just separate interfaces from implementation
● The dependency graph allows us to use these to infer how to build a component correctly based on its dependencies– NOTE:
Even if a dependency uses a new library, the build system should detect it.Client
JSON Networking
Formatting FancyIO
Include directories for Networking should changeLinked libraries for Client should change
![Page 55: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/55.jpg)
Modeling a Build
● For each component, build management requires– Direct build requirements– Transitive usage requirements
– Note, these just separate interfaces from implementation
● The dependency graph allows us to use these to infer how to build a component correctly based on its dependencies– NOTE:
Even if a dependency uses a new library, the build system should detect it.
● Let’s dive into one specific system to see....
![Page 56: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/56.jpg)
What will be be using?
● CMake– Cross-platform build management tool
– Used by large projects like KDE, Wireshark, LLVM, ...
![Page 57: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/57.jpg)
What will be be using?
● CMake– Cross-platform build management tool
– Used by large projects like KDE, Wireshark, LLVM, ...
● What does it do?– Given a specification & configuration of your project, CMake creates the
build commands for you
– Analogous to autoconf (but easier to use)
![Page 58: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/58.jpg)
What will be be using?
● CMake– Cross-platform build management tool
– Used by large projects like KDE, Wireshark, LLVM, ...
● What does it do?– Given a specification & configuration of your project, CMake creates the
build commands for you
– Analogous to autoconf (but easier to use)
[DEMO]
![Page 59: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/59.jpg)
What does this add?
● Why not just write makefiles manually?
![Page 60: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/60.jpg)
What does this add?
● Why not just write makefiles manually?– May need different makefiles for different...
![Page 61: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/61.jpg)
What does this add?
● Why not just write makefiles manually?– May need different makefiles for different
● Operating Systems● Compilers● Libraries● Build Modes● ...
![Page 62: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/62.jpg)
What does this add?
● Why not just write makefiles manually?– May need different makefiles for different
● Operating Systems● Compilers● Libraries● Build Modes● ...
– May need different source files for different “”
![Page 63: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/63.jpg)
What does this add?
● Why not just write makefiles manually?– May need different makefiles for different
● Operating Systems● Compilers● Libraries● Build Modes● ...
– May need different source files for different “”
– Specification can clearly capture● Libraries, versions, & even how to download them automatically● Semantics of compilation & how to use in analysis tools
![Page 64: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/64.jpg)
What does this add?
● Scalability– Replace “make” with analogous scalable tools (“ninja”)
![Page 65: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/65.jpg)
What does this add?
● Scalability– Replace “make” with analogous scalable tools (“ninja”)
● Easier tool integration– CMake can export compilation rules for other tools
![Page 66: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/66.jpg)
What does this add?
● Scalability– Replace “make” with analogous scalable tools (“ninja”)
● Easier tool integration– CMake can export compilation rules for other tools
[DEMO]
![Page 67: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/67.jpg)
Preliminary: Out of source builds
● A common bad habit is “in source” building
![Page 68: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/68.jpg)
Preliminary: Out of source builds
● A common bad habit is “in source” building– Why is this bad?
![Page 69: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/69.jpg)
Preliminary: Out of source builds
● A common bad habit is “in source” building– Why is this bad?
– May need multiple builds at once: debug, release, ...
– Pollutes version control
– Makes clean builds complicated
![Page 70: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/70.jpg)
Preliminary: Out of source builds
● A common bad habit is “in source” building– Why is this bad?
– May need multiple builds at once: debug, release, ...
– Pollutes version control
– Makes clean builds complicated
● Use “out of source” builds instead
![Page 71: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/71.jpg)
Using CMake
● CMakeLists.txt– A script in every directory of your project that controls how to build
“things” in that directory
![Page 72: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/72.jpg)
Using CMake
● CMakeLists.txt– A script in every directory of your project that controls how to build
“things” in that directory
● Simple syntax– Case insensitive commands
– Let's revisit demo 1!
command( argument1 argument2 argument3 ...)
![Page 73: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/73.jpg)
add_executable(helloworld)add_library(hellohelper STATIC)
Targets & Commands
● CMake allows you to specify targets– Executables, libraries, “objects”
![Page 74: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/74.jpg)
Targets & Commands
● CMake allows you to specify targets– Executables, libraries, “objects”
● And commands that can describe how to build those targets– Automatic for executable & library
– add_custom_command can build others● Documentation● Media
add_executable(helloworld)add_library(hellohelper STATIC)
![Page 75: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/75.jpg)
Specifying Requirements
● Recall build requirements & usage requirements.
![Page 76: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/76.jpg)
Specifying Requirements
● Recall build requirements & usage requirements.
● target_* commands allow you to specify the requirements of a target
![Page 77: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/77.jpg)
Specifying Requirements
● Recall build requirements & usage requirements.
● target_* commands allow you to specify the requirements of a target
target_sources(hellohelper PRIVATE helloworld.cpp)
![Page 78: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/78.jpg)
Specifying Requirements
● Recall build requirements & usage requirements.
● target_* commands allow you to specify the requirements of a target
target_sources(hellohelper PRIVATE helloworld.cpp)target_include_directories(hellohelper INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include/)
![Page 79: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/79.jpg)
Specifying Requirements
● Recall build requirements & usage requirements.
● target_* commands allow you to specify the requirements of a target
target_sources(hellohelper PRIVATE helloworld.cpp)target_include_directories(hellohelper INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include/)target_link_libraries(helloworld PRIVATE hellohelper)
![Page 80: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/80.jpg)
Specifying Requirements
● Recall build requirements & usage requirements.
● target_* commands allow you to specify the requirements of a target
target_sources(hellohelper PRIVATE helloworld.cpp)target_include_directories(hellohelper INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include/)target_link_libraries(helloworld PRIVATE hellohelper)
![Page 81: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/81.jpg)
Using Libraries
● You can simply specify the libraries that a target directly uses
target_link_libraries(helloworld PRIVATE hellohelper aaa bbb)target_link_libraries(hellohelper INTERFACE fancyformatting ccc)
![Page 82: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/82.jpg)
Using Libraries
● You can simply specify the libraries that a target directly uses
● Transitive interface dependences of libraries will be linked in as required
target_link_libraries(helloworld PRIVATE hellohelper aaa bbb)target_link_libraries(hellohelper INTERFACE fancyformatting ccc)
![Page 83: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/83.jpg)
Using Libraries
● You can simply specify the libraries that a target directly uses
● Transitive interface dependences of libraries will be linked in as required
● Include directories, etc. From libraries will also be inferred
target_link_libraries(helloworld PRIVATE hellohelper aaa bbb)target_link_libraries(hellohelper INTERFACE fancyformatting ccc)
![Page 84: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/84.jpg)
Using Libraries
● You can simply specify the libraries that a target directly uses
● Transitive interface dependences of libraries will be linked in as required
● Include directories, etc. From libraries will also be inferred
target_link_libraries(helloworld PRIVATE hellohelper aaa bbb)target_link_libraries(hellohelper INTERFACE fancyformatting ccc)
bin/helloworld
hello.cpp <...>/hello.h <...>/libfancyformatting.a
<...>/libhellohelper.a
![Page 85: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/85.jpg)
Using Libraries
● Note: This means using creating & defining new libraries is easy!
![Page 86: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/86.jpg)
Using Libraries
● Note: This means using creating & defining new libraries is easy!
● How might this affect program structure and design?
![Page 87: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/87.jpg)
Using Libraries
● Note: This means using creating & defining new libraries is easy!
● How might this affect program structure and design?
● How might it help us begin to handle complexity?
![Page 88: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/88.jpg)
Using Libraries
● Note: This means using creating & defining new libraries is easy!
● How might this affect program structure and design?
● How might it help us begin to handle complexity?
CMake has several other mundane build system facilities...
![Page 89: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/89.jpg)
General project management
● Specifying project properties– Define a project to access variables that control that project
project(projectname)
![Page 90: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/90.jpg)
General project management
● Specifying project properties– Define a project to access variables that control that project
● Print information out during the build processmessage(“Built with flags: ${CMAKE_CXX_FLAGS}”)
project(projectname)
![Page 91: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/91.jpg)
General project management
● Specifying project properties– Define a project to access variables that control that project
● Print information out during the build process
● Controlling where things are built
project(projectname)
message(“Built with flags: ${CMAKE_CXX_FLAGS}”)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
![Page 92: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/92.jpg)
General project management
● Finding a resource that you need to use
find_package(externalproject)find_library(library)
![Page 93: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/93.jpg)
General project management
● Finding a resource that you need to use
● Installation
find_package(externalproject)find_library(library)
install(TARGETS target1 target2 ... DESTINATION /tmp/)
![Page 94: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/94.jpg)
Control structures
● IF if(condition)elsif(condition2)else()endif()
![Page 95: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/95.jpg)
Control structures
● IF
● Looping
if(condition)elsif(condition2)else()endif()
foreach(loop_var arg1 arg2 ...) command(${loop_var})endforeach(loop_var)while(condition)...
![Page 96: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/96.jpg)
Control structures
● IF
● Looping
● Functions
foreach(loop_var arg1 arg2 ...) command(${loop_var})endforeach(loop_var)while(condition)...
function(function_name arg1 arg2 ...) command(${arg1})endFunction(function_name)
if(condition)elsif(condition2)else()endif()
![Page 97: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/97.jpg)
In Summary
● A modern build system leverages the dependency graph of a project
![Page 98: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/98.jpg)
In Summary
● A modern build system leverages the dependency graph of a project
● Dependency graphs enable1) inference of build and usage requirements2) compositional reasoning about modules and build management
![Page 99: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/99.jpg)
In Summary
● A modern build system leverages the dependency graph of a project
● Dependency graphs enable1) inference of build and usage requirements2) compositional reasoning about modules and build management
● One dominant system for C and C++ is Cmake
![Page 100: Building Software - Simon Fraser Universitywsumner/teaching/373/02-building.pdf– A script in every directory of your project that controls how to build “things” in that directory](https://reader033.vdocuments.mx/reader033/viewer/2022050716/5e2b561b6cddb87ce72932a9/html5/thumbnails/100.jpg)
In Summary
● A modern build system leverages the dependency graph of a project
● Dependency graphs enable1) inference of build and usage requirements2) compositional reasoning about modules and build management
● One dominant system for C and C++ is Cmake
● You will get more personal experience with it over the semester if you have not already