CMake för C/C++ byggnation
CMake är ett av de mest populära byggnations-verktyget för C/C++ applikationer. Det är enkelt att hantera komplexa byggnationer med många bibliotek. Bibliotek som länkas till en applikation kan vara i många former, såsom archive (.a), shared-object (.so) och header-only. Förutom att vara en del av aktuellt projekt, så kan bibliotek länkas från redan installerade eller laddas ned automatiskt från en git repo eller webb-server.
- Linux
- GNU/Clang C/C++ compilers
- make, ninja and cmake
- Text editor
Du sitter bekvämt framför datorn och deltar i kursen via internet. Vi använder programvaran Zoom för alla våra fjärrkurser.
I priset ingår kursmaterial som PDF.
Pris: 10 000 kr + MOMS/VAT (25%)
Du sitter bekvämt i ett av våra klassrum, vilka finns centralt placerade i Stockholms innerstad (Östermalmstorg).
I priset ingår tryckt kursmaterial (och som PDF), samt kaffe/te med smörgås på förmiddagen och kaffe/te med bulle på eftermiddagen.
Pris: 16 000 kr + MOMS/VAT (25%)
Om ni är tre eller fler personer från samma företags, kan ni beställa en företagsanpassad kurs. Då håller vi kursen på ett datum som passar er. Antingen på plats i era lokaler eller som en fjärrkurs. Vi kan även mixa fjärr- och klassrumskurs, om några av er önskar delta på distans medan resten föredrar att ses på plats.
Här är ett sammandrag av vad du får lära dig på kursen.
- Configure CMake for C/C++ projects
- Configure build of executables
- Configure build of static libraries
- Configure build of shared libraries
- Link external libraries
- Download automatically and link remote libraries
- Generate source code
- Execute various tools as part of the build
Background
- Why CMake was created
- Properties of CMake
- Compilers
- Build tools
- Build tool generators
Understanding Compilation and Linkage Steps
- Using GCC
- Pre-processor
- Front-End compilation
- AST and RTL
- Back-end compilation
- Assembler
- Linker
- Loader
- Useful compiler flags
- Linking libraries
- Creating static libraries
- Creating shared libraries
- Executing with shared libraries
Brief about Makefiles
- What is make
- Structure of a Makefile
- Targets
- Actions
- Dependencies
- Rules
- Ninja instead of Make
Installation of CMake
- Installation via a package manager
- Installation on Windows
- Installation via TAR.GZ archive
- Compiling from sources
- CMake executables
- CMake command-line help
- CMake documentation
CMake Syntax
- Structure of CMakeLists.txt
- CMake stages
- Comments
- Command syntax
- Text strings
- Quoted vs. unquotes strings
- Value lists
- Variables
- Conditional blocks
- Looping blocks
- CMake scopes
- Subdirectories and includes
- CMake GUI
Building Executables
- Creating a CMake project
- Build steps and commands
- Programming language
- Language standard
- Compiler options
- Linking standard libraries
Configure Build Variants
- Debug vs. Release build
- C++ vs. C sources
- GCC vs. CLang compiler
- Make vs. Ninja builder
- Linux vs. Windows build
Building Libraries
- Building a static library
- Where to find the *.a file
- Building a shared library
- Where to find the *.so file
- Propagating header files to an executable
- Defining an object library
- Defining a header-only library
- Using an imported library
Linking External Libraries
- What is an external library
- Finding libraries
- Configuration variables
Linking Remote Libraries
- What is a remote library
- Downloading and linking a remote library
- Understanding FetchContent
- Fetching a GIT library
- Fetching a TAR.GZ file
Configuring and Running Tests
- How cmake perceives a test
- Using CTest
- Configuring a simple test
- Configuring a test based on a header-only testing framework (Catch2)
- Configuring a test based on a linked testing framework (Google Test)
- Fetching and using a remote test framework
Generating Sources
- Copying files
- Variable substitution
- Managing application version
- Assembling build info
Running External Programs
- Custom targets
- Running the generated executable
- Running arbitrary scripts and programs
- Generating API documentation using doxygen