From db0ed1604882842ba0f6f83c56bda0b924f3b6b0 Mon Sep 17 00:00:00 2001 From: Penthurion Date: Wed, 26 Aug 2020 14:20:29 +0200 Subject: [PATCH 01/25] index.html translated --- module1/index.html | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/module1/index.html b/module1/index.html index 758c51e..15f9c4a 100644 --- a/module1/index.html +++ b/module1/index.html @@ -31,8 +31,8 @@
-

Narzędzia #3

-

Systemy budowania

+

Tools #3

+

Build Systems

Coders School @@ -53,7 +53,7 @@

Łukasz Ziobroń

From 5a5ebda3f2d9b2b5da829d49b7a3b23c79b2252c Mon Sep 17 00:00:00 2001 From: Penthurion Date: Wed, 26 Aug 2020 14:55:34 +0200 Subject: [PATCH 02/25] presentation_cmake.md translated --- module1/presentation_cmake.md | 128 +++++++++++++++++----------------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/module1/presentation_cmake.md b/module1/presentation_cmake.md index 0b7f847..43f89db 100644 --- a/module1/presentation_cmake.md +++ b/module1/presentation_cmake.md @@ -10,16 +10,16 @@ ___ ## CMake -* automatyzuje proces budowania dla C/C++ -* obsługuje generowanie projektów dla wielu IDE -* może składać się z wielu modułów, które się łączy (odpowiednik #include) -* niezależny od platformy (jeśli jest dobrze napisany) -* konfiguracja budowania w pliku CMakeLists.txt -* generuje system budowania (np. pliki Makefile) +* automates the build process for C/C++ +* supports generating projects for multiple IDEs +* can consists of many modules that are combined (equivalent of #include) +* platform independent (if well written) +* build configuration in CMakeLists.txt file +* generate a build systems (e.g. Makefiles) ___ -## Minimalny `CMakeLists.txt` +## Minimal `CMakeLists.txt` ```cmake cmake_minimum_required(VERSION 3.10) @@ -30,28 +30,28 @@ add_executable(execName main.cpp file.cpp) ___ -## Budowanie za pomocą CMake'a +## Building with CMake'a ```bash -mkdir build # tworzymy katalog z wynikami budowania -cd build # wchodzimy do tego katalogu -cmake .. # generujemy system budowania podając ścieżkę do pliku CMakeLists.txt -cmake --build . # budujemy projekt +mkdir build # create a directory with the results of the building +cd build # enter this directory +cmake .. # generate the build system by specifying the path to the CMakeLists.txt file +cmake --build . # build a project ``` -`cmake --build` można zamienić na `make` jeśli wiemy, że na pewno generujemy Makefile. +`cmake --build` can be changed for `make` if we're sure, that we're generating Makefile. -`cmake --build` jest uniwersalne. +`cmake --build` is universal. ___ -## Zadanie +## Exercise -Napisz prosty CMakeLists.txt dla programu z katalogu `greeter`, zbuduj go za pomocą `cmake` i uruchom. +Write simple CMakeLists.txt for program from `greeter` directory, build it with `cmake` and run. -Zauważ, że są tutaj też testy. Dopisz dodatkowy target dla testów. +Notice that there is also a tests. Write additional target for tests. ___ @@ -59,17 +59,17 @@ ___ ___ -## CMake - zmienne +## CMake - variables -Zmienne tworzymy za pomocą komendy `set` +Variables are created with `set` command ```cmake -set(VARIABLE value) # Konwencja - UPPERCASE_WITH_UNDERSCORE +set(VARIABLE value) # Convention - UPPERCASE_WITH_UNDERSCORE ``` -Przykładowo +For example ```cmake @@ -77,7 +77,7 @@ set(NAME TheGreatestProject) ``` -Odnosimy się do nich później obejmując w nawiasy `{}` i poprzedzając znakiem `$` +We refer to them later by enclosing them in `{}` parentheses and preceding them with the `$` sign ```cmake @@ -85,17 +85,17 @@ add_executable(${NAME} main.cpp) ``` -Spowoduje to utworzenie targetu `TheGreatestProject`, w ramach którego skompilowany zostanie plik `main.cpp` +That will create a target `TheGreatestProject` in which `main.cpp` file will be compiled ___ -## CMake - predefiniowane zmienne +## CMake - predefined variables -CMake domyślnie dostarcza kilka zmiennych. Odwoływanie się do nich bezpośrednio lub ich modyfikacja zazwyczaj nie są uznawane za dobre praktyki. +CMake supplies several variables by default. Referring to them directly or modifying them is usually not considered good practice. -Możemy za to bez większych problemów wykorzystać zmienną `${PROJECT_NAME}`. Zawiera ona nazwę projektu zdefiniowaną przez komendę `project()` +We can use the `$ {PROJECT_NAME}` variable without any problems. It contains the project name defined by the `project ()` command ```cmake @@ -106,11 +106,11 @@ add_executable(${PROJECT_NAME} main.cpp vectorFunctions.cpp) ___ -## Tworzenie aplikacji i bibliotek +## Create applications and libraries [CMake manual](https://cmake.org/cmake/help/latest/manual/cmake-commands.7.html#id4) -Poniższe komendy możesz potraktować jako "konstruktory". Tworzą one "targety". +You can treat the following commands as "constructors". They form "targets" ```cmake add_executable( [source1] [source2 ...]) @@ -130,61 +130,61 @@ add_executable(${PROJECT_NAME}-ut test.cpp functions.cpp modules.cpp) ### Problem -Powielona lista plików w różnych "targetach" +Duplicated list of files in different "targets" ___ ### Problem #1 -Powielona lista plików w różnych "targetach" +Duplicated list of files in different "targets" -### Rozwiązanie +### Solution -Wrzucenie listy plików do zmiennej +Putting a list of files into a variable -## Zadanie +## Exercise -Wrzuć listę plików do zmiennej i skorzystaj z niej +Put a list of files into a variable and use it ___ ### Problem #2 -Drobne różnice w plikach pomiędzy targetami +Minor differences in files between targets -### Rozwiązanie +### Solution -Utworzenie biblioteki +Creating a library ___ -## Biblioteki +## Libraries -Moja definicja biblioteki - zlepek wielu plików cpp bez funkcji `main()`. Biblioteki nie można z tego powodu uruchomić. +My library definition - a cluster of multiple cpp files without the `main ()` function. Therefore, the library cannot be run. -### Analogia do programowania obiektowego +### Analogy to object oriented programming -* Biblioteka = klasa (bazowa) - * pola, metody = pliki cpp -* Binarka = klasa pochodna - * finalna, nie można po niej dziedziczyć -* Linkowanie = dziedziczenie - * zlinkowanie binarki z biblioteką oznacza dorzucenie do niej kodu z biblioteki - * biblioteki można ze sobą wzajemnie linkować +* Library = class (base) + * fields, methods = cpp files +* Binary = derived class + * final, cannot be inherited from it +* Linking = inheritance + * linking a binary to a library means adding code from the library to it + * libraries can be linked with each other ___ -## Linkowanie bibliotek +## Linking libraries ```cmake target_link_libraries( ... ... ...) @@ -200,15 +200,15 @@ target_link_libraries(ut lib) ``` -### Zadanie +### Exercise -Utwórz bibliotekę, która będzie zawierać powtarzające się pliki cpp i zlinkuj z nią targety, które ich używały. +Create a library that will contain duplicate cpp files and link to it with the targets that used them. ___ -## Flagi kompilacji +## Build flags ```cmake target_compile_options( [BEFORE] @@ -224,15 +224,15 @@ target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror) ``` -### Zadanie +### Exercise -Dodaj flagi kompilacji `-Wall -Wextra -Werror -pedantic -Wconversion -O3` do projektu greeter +Add build flags `-Wall -Wextra -Werror -pedantic -Wconversion -O3` to the greeter project ___ -## Włączanie standardu C++17 +## Enabling the C ++ 17 standard ```cmake set(CMAKE_CXX_STANDARD 17) @@ -240,7 +240,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) ``` -Powyższe może nie działać dla MSVC. +The above may not work for MSVC. ```cmake @@ -256,15 +256,15 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) ``` -### Zadanie +### Exercise -Włącz standard C++17 w projekcie greeter +Enable the C++17 standard in the greeter project ___ -## Dodawanie testów do `ctest` +## Adding tests to `ctest` ```cmake enable_testing() @@ -278,17 +278,17 @@ add_test(NAME someTests COMMAND ${PROJECT_NAME}-ut) ``` -### Zadanie +### Exercise -Dodaj binarkę z testami, która powinna być odpalana za pomocą `ctest` +Add a test binary that should be run with `ctest` ___ -## Budowanie w trybie debug +## Build in debug mode -Domyślnie budowany jest tryb "Release" (bez symboli debugowania) +By default, the "Release" mode is built (no debugging symbols) ```cmake @@ -296,7 +296,7 @@ cmake -DCMAKE_BUILD_TYPE=Debug .. ``` -Jeśli chcemy wspierać budowanie w trybach Debug i Release powinniśmy mieć do nich oddzielne katalogi z rezultatami budowania +If we want to support building in Debug and Release modes, we should have separate directories with build results ```bash @@ -309,7 +309,7 @@ cmake --build ___ -## Linki dla poszerzenia wiedzy +## Links for learning more * [CMake - from zero to something - prezentacja z Wro.cpp](https://muttleyxd.github.io) * [19 reasons why CMake is actually awesome](https://kubasejdak.com/19-reasons-why-cmake-is-actually-awesome) From e7538e00072c00d1b5702b94f07dd0714b4e929c Mon Sep 17 00:00:00 2001 From: Penthurion Date: Thu, 27 Aug 2020 12:13:57 +0200 Subject: [PATCH 03/25] presentation_make.md translated --- module1/presentation_make.md | 46 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/module1/presentation_make.md b/module1/presentation_make.md index b0d7b6b..982a9a7 100644 --- a/module1/presentation_make.md +++ b/module1/presentation_make.md @@ -8,9 +8,9 @@ ___ -## Pliki Makefile +## Makefiles -### Struktura pliku Makefile +### The structure of the Makefile ```Makefile VARIABLE = value @@ -24,7 +24,7 @@ targetB: dependencyB1 ___ -## Przykład - generowanie prezentacji w LaTeX +## Example - generating a presentation in LaTeX ```Makefile TEX = pdflatex -shell-escape -interaction=nonstopmode -file-line-error @@ -47,9 +47,9 @@ calculator: ___ -## Kompilacja w C++ +## Compilation in C ++ -### Pamiętacie fazy kompilacji? +### Do you remember the build phases? ```Makefile @@ -64,24 +64,24 @@ $(OBJECTS): src/%.o : src/%.cpp src/%.hpp ``` -### Zmienne pamiętające kontekst +### Variables remembering the context -* $@ - nazwa pliku targetu w aktualnie uruchomionej regule -* $< - nazwa pierwszej zależności -* $^ - lista wszystkich zależności (zawiera ewentualne duplikaty) -* $? - lista wszystkich zależności, które są nowsze niż target +* $@ - the name of the target file in the currently running rule +* $< - first dependency name +* $^ - list of all dependencies (includes any duplicates) +* $? - a list of all dependencies that are newer than target ___ -## Zadanie +## Exercise -W katalogu greeter znajdziesz malutki program. Zapoznaj się z jego kodem. +In the greeter directory you will find a small program. Familiarize yourself with its code. -* Skompiluj program z linii komend i uruchom go. -* Napisz prosty Makefile dla tego programu. Zbuduj go za pomocą `make` i uruchom. +* Compile the program from the command line and run it. +* Write a simple Makefile for this program. Build it with `make` and run it. -### Zaklęcie kompilacji +### Spell of building ```bash g++ -std=c++17 -Wall -Werror -Wextra -pedantic *.cpp -o greeter @@ -90,19 +90,19 @@ g++ -std=c++17 -Wall -Werror -Wextra -pedantic *.cpp -o greeter ___ -## Polecenie `make` +## `make` command -* domyślnie szuka w bieżącym katalogu pliku Makefile -* automatyzuje czynności poprzez wykonywanie receptur zapisanych w plikach Makefile -* domyślnie wykonuje pierwszą recepturę -* pozwala na warunkowe wykonywanie czynności -* pozwala definiować wiele zależności -* domyślnie uwzględnia daty modyfikacji zależności i na tej podstawie podejmuje decyzję, czy wykonać daną recepturę +* by default it looks for a Makefile in the current directory +* automates activities by executing recipes saved in Makefile files +* executes the first recipe by default +* allows for conditional performance of activities +* allows defining many dependencies +* by default, it takes into account dependency modification dates and on this basis decides whether to execute a given recipe ___ ## Q&A -### Linki +### links [cpp-polska.pl](https://cpp-polska.pl/post/potwor-przeszlosci-makefile-cz-2) From ec9c7bfffd85d5455a98f26164f997bb1543ffb2 Mon Sep 17 00:00:00 2001 From: Penthurion Date: Thu, 27 Aug 2020 12:30:13 +0200 Subject: [PATCH 04/25] presentation_homework.md translated --- module1/presentation_homework.md | 46 ++++++++++++++++---------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/module1/presentation_homework.md b/module1/presentation_homework.md index 56e55e1..205bc09 100644 --- a/module1/presentation_homework.md +++ b/module1/presentation_homework.md @@ -1,8 +1,8 @@ -# Narzędzia #3 +# Tools #3 -## Podsumowanie +## Summary Coders School @@ -10,48 +10,48 @@ ___ -## Co pamiętasz z dzisiaj? +## What do you remember from today? -### Napisz na czacie jak najwięcej haseł +### Write as many topics as possible in the chat ___ ### Pre-work -* Poczytajcie o zasadach SOLID, dotyczących pisania dobrego kodu obiektowego -* Poczytajcie o zasadach dobrego kodu w C++ na [CppCoreGuidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md) -* Dowiedzcie się czym jest problem diamentowy na Obiektowość #4 +* Read about the SOLID rules for writing good object-oriented code +* Read about the principles of good code in C ++ at [CppCoreGuidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md) +* Find out what the diamond problem is on Object Orientation #4 ___ ### Post-work -* Dorzućcie do projektu SHM system budowania `cmake` (10 punktów, 2 za każdy podpunkt) -* Przygotujcie SHM do testowania (10 punktów, 2 za każdy podpunkt) +* Add the `cmake` building system to the SHM project (10 points, 2 for each subtask) +* Prepare SHM for testing (10 points, 2 for each subtask) #### Bonus -* Dostarczenie przed niedzielą 05.07.2020 23:59 (2 punkty za zadanie, razem 4) +* Delivery before Sunday 05.07.2020 23:59 (2 points per task, 4 in total) ___ -### `cmake` w SHM +### `cmake` in SHM -* Użyjcie zmiennej `${PROJECT_NAME}` -* Lista plików cpp w zmiennej -* Wszystko poza plikiem `main.cpp` powinno kompilować się do biblioteki statycznej -* Binarka (main.cpp) powinna linkować się z powyższą biblioteką. -* Napiszcie odpowiedni plik `.github/workflows/main.yml` który spowoduje, że GitHub będzie automatycznie uruchamiał kompilację projektu dla każdego nowego commita. +* Use the variable `${PROJECT_NAME}` +* List of cpp files in the variable +* Everything except `main.cpp` should compile to a static library +* Binary (main.cpp) should be linked with the above library. +* Write an appropriate file `.github/workflows/main.yml` which will cause GitHub to automatically run a project build for each new commit. ___ -### Podwaliny pod testy w SHM +### The foundations for testing in SHM -Na podstawie lektury plików CMakeLists.txt z prac domowych wywnioskujcie, w jaki sposób dodawana jest biblioteka `gtest` do testów +On the basis of reading CMakeLists.txt files from homework, deduce how the `gtest` library is added to tests -* Utwórzcie proste testy do projektu SHM (co najmniej 1 test metodą Copy&Paste z innych prac domowych) -* Skopiujcie odpowiednie pliki, które pozwolą na użycie `gtesta` -* Dodajcie binarkę z testami do CMakeLists.txt. Nazwijcie ją `${PROJECT_NAME}-ut` -* Dodajcie odpalanie testów za pomocą `ctest` -* Zmodyfikujcie plik `.github/workflows/main.yml` aby GitHub dodatkowo uruchamiał jeszcze testy +* Create simple tests for SHM project (at least 1 test with Copy&Paste method from other homework) +* Copy the appropriate files that will allow the use of `gtest` +* Add the test binary to CMakeLists.txt. Name it `${PROJECT_NAME}-ut` +* Add test run with `ctest` +* Modify the file `.github/workflows/main.yml` so GitHub will also run tests From 15cd3932f1690dbd1e56df054221a599c653a2e8 Mon Sep 17 00:00:00 2001 From: Penthurion Date: Thu, 27 Aug 2020 12:35:23 +0200 Subject: [PATCH 05/25] changed filenames --- .../{presentation_make.md => 01_presentation_make.en.md} | 0 .../{presentation_cmake.md => 02_presentation_cmake.en.md} | 0 ...sentation_homework.md => 03_presentation_homework.en.md} | 0 module1/{index.html => index.en.html} | 6 +++--- 4 files changed, 3 insertions(+), 3 deletions(-) rename module1/{presentation_make.md => 01_presentation_make.en.md} (100%) rename module1/{presentation_cmake.md => 02_presentation_cmake.en.md} (100%) rename module1/{presentation_homework.md => 03_presentation_homework.en.md} (100%) rename module1/{index.html => index.en.html} (96%) diff --git a/module1/presentation_make.md b/module1/01_presentation_make.en.md similarity index 100% rename from module1/presentation_make.md rename to module1/01_presentation_make.en.md diff --git a/module1/presentation_cmake.md b/module1/02_presentation_cmake.en.md similarity index 100% rename from module1/presentation_cmake.md rename to module1/02_presentation_cmake.en.md diff --git a/module1/presentation_homework.md b/module1/03_presentation_homework.en.md similarity index 100% rename from module1/presentation_homework.md rename to module1/03_presentation_homework.en.md diff --git a/module1/index.html b/module1/index.en.html similarity index 96% rename from module1/index.html rename to module1/index.en.html index 15f9c4a..40f1d66 100644 --- a/module1/index.html +++ b/module1/index.en.html @@ -107,15 +107,15 @@

Łukasz Ziobroń

You can change the port by using npm start -- --port=8001. --> -
-
-
From 771b81991464bef26be745ab133185bedbaab485 Mon Sep 17 00:00:00 2001 From: Penthurion Date: Thu, 27 Aug 2020 12:40:08 +0200 Subject: [PATCH 06/25] changed filenames --- .../{presentation_make.md => 01_presentation_make.pl.md} | 0 .../{presentation_cmake.md => 02_presentation_cmake.pl.md} | 0 ...sentation_homework.md => 03_presentation_homework.pl.md} | 0 module1/{index.html => index.pl.html} | 6 +++--- 4 files changed, 3 insertions(+), 3 deletions(-) rename module1/{presentation_make.md => 01_presentation_make.pl.md} (100%) rename module1/{presentation_cmake.md => 02_presentation_cmake.pl.md} (100%) rename module1/{presentation_homework.md => 03_presentation_homework.pl.md} (100%) rename module1/{index.html => index.pl.html} (96%) diff --git a/module1/presentation_make.md b/module1/01_presentation_make.pl.md similarity index 100% rename from module1/presentation_make.md rename to module1/01_presentation_make.pl.md diff --git a/module1/presentation_cmake.md b/module1/02_presentation_cmake.pl.md similarity index 100% rename from module1/presentation_cmake.md rename to module1/02_presentation_cmake.pl.md diff --git a/module1/presentation_homework.md b/module1/03_presentation_homework.pl.md similarity index 100% rename from module1/presentation_homework.md rename to module1/03_presentation_homework.pl.md diff --git a/module1/index.html b/module1/index.pl.html similarity index 96% rename from module1/index.html rename to module1/index.pl.html index 758c51e..2c63288 100644 --- a/module1/index.html +++ b/module1/index.pl.html @@ -107,15 +107,15 @@

Łukasz Ziobroń

You can change the port by using npm start -- --port=8001. --> -
-
-
From 1cf7562031269d1e2100296db339e2f5f525857b Mon Sep 17 00:00:00 2001 From: Penthurion Date: Thu, 27 Aug 2020 12:53:04 +0200 Subject: [PATCH 07/25] first part of minor fixes --- module1/index.en.html | 4 ---- module1/index.pl.html | 1 - 2 files changed, 5 deletions(-) diff --git a/module1/index.en.html b/module1/index.en.html index 70b642b..d4be72a 100644 --- a/module1/index.en.html +++ b/module1/index.en.html @@ -107,7 +107,6 @@

Łukasz Ziobroń

You can change the port by using npm start -- --port=8001. --> -<<<<<<< HEAD:module1/index.en.html
@@ -117,8 +116,6 @@

Łukasz Ziobroń

data-separator-notes="^Note:">
@@ -127,7 +124,6 @@

Łukasz Ziobroń

data-separator-notes="^Note:">
>>>>>> pl:module1/index.pl.html data-separator-vertical="^___" data-separator-notes="^Note:">
diff --git a/module1/index.pl.html b/module1/index.pl.html index 2d7ac9f..4156ded 100644 --- a/module1/index.pl.html +++ b/module1/index.pl.html @@ -115,7 +115,6 @@

Łukasz Ziobroń

data-separator-vertical="^___" data-separator-notes="^Note:">
-
From 6c133e89d71e128a961824e946cea4b4d927ba2b Mon Sep 17 00:00:00 2001 From: Penthurion Date: Thu, 27 Aug 2020 12:56:11 +0200 Subject: [PATCH 08/25] 2nd part of minor fixes --- module1/index.en.html | 8 -------- module1/index.pl.html | 34 +++++++++++++--------------------- 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/module1/index.en.html b/module1/index.en.html index d4be72a..40f1d66 100644 --- a/module1/index.en.html +++ b/module1/index.en.html @@ -119,14 +119,6 @@

Łukasz Ziobroń

data-separator-vertical="^___" data-separator-notes="^Note:">
-
-
-
-

Coders School

diff --git a/module1/index.pl.html b/module1/index.pl.html index 4156ded..2c63288 100644 --- a/module1/index.pl.html +++ b/module1/index.pl.html @@ -31,8 +31,8 @@
-

Tools #3

-

Build Systems

+

Narzędzia #3

+

Systemy budowania

Coders School @@ -53,7 +53,7 @@

Łukasz Ziobroń

@@ -107,14 +107,6 @@

Łukasz Ziobroń

You can change the port by using npm start -- --port=8001. --> -
-
-
-
From 17bbc9acfbe741077dd5f9b5952b8981e7ddd6f1 Mon Sep 17 00:00:00 2001 From: Penthurion Date: Thu, 27 Aug 2020 13:00:44 +0200 Subject: [PATCH 09/25] deleted _presentation prefix from filenames --- module1/01_presentation_make.en.md | 108 --------- module1/01_presentation_make.pl.md | 108 --------- module1/02_presentation_cmake.en.md | 321 ------------------------- module1/02_presentation_cmake.pl.md | 321 ------------------------- module1/03_presentation_homework.en.md | 57 ----- module1/03_presentation_homework.pl.md | 57 ----- 6 files changed, 972 deletions(-) delete mode 100644 module1/01_presentation_make.en.md delete mode 100644 module1/01_presentation_make.pl.md delete mode 100644 module1/02_presentation_cmake.en.md delete mode 100644 module1/02_presentation_cmake.pl.md delete mode 100644 module1/03_presentation_homework.en.md delete mode 100644 module1/03_presentation_homework.pl.md diff --git a/module1/01_presentation_make.en.md b/module1/01_presentation_make.en.md deleted file mode 100644 index 982a9a7..0000000 --- a/module1/01_presentation_make.en.md +++ /dev/null @@ -1,108 +0,0 @@ - - -# `make` - - - Coders School - - -___ - -## Makefiles - -### The structure of the Makefile - -```Makefile -VARIABLE = value - -targetA: dependencyA1 dependencyA2 -[TAB] command $(VARIABLE) - -targetB: dependencyB1 -[TAB] command -``` - -___ - -## Example - generating a presentation in LaTeX - -```Makefile -TEX = pdflatex -shell-escape -interaction=nonstopmode -file-line-error -MAKE = make -CODE_DIR = src - -.PHONY: all view - -all: calculator pdf - -view: - evince ContractProgramming.pdf - -pdf: ContractProgramming.tex - $(TEX) ContractProgramming.tex - -calculator: - $(MAKE) -C $(CODE_DIR) -``` - -___ - -## Compilation in C ++ - -### Do you remember the build phases? - - -```Makefile -SOURCES=$(wildcard src/*.cpp) -OBJECTS=$(patsubst %.cpp, %.o, $(SOURCES)) - -main: $(OBJECTS) - g++ $^ -o $@ - -$(OBJECTS): src/%.o : src/%.cpp src/%.hpp - g++ -c $< -o $@ -``` - - -### Variables remembering the context - - -* $@ - the name of the target file in the currently running rule -* $< - first dependency name -* $^ - list of all dependencies (includes any duplicates) -* $? - a list of all dependencies that are newer than target - -___ - -## Exercise - -In the greeter directory you will find a small program. Familiarize yourself with its code. - -* Compile the program from the command line and run it. -* Write a simple Makefile for this program. Build it with `make` and run it. - -### Spell of building - -```bash -g++ -std=c++17 -Wall -Werror -Wextra -pedantic *.cpp -o greeter -./greeter -``` - -___ - -## `make` command - -* by default it looks for a Makefile in the current directory -* automates activities by executing recipes saved in Makefile files -* executes the first recipe by default -* allows for conditional performance of activities -* allows defining many dependencies -* by default, it takes into account dependency modification dates and on this basis decides whether to execute a given recipe - -___ - -## Q&A - -### links - -[cpp-polska.pl](https://cpp-polska.pl/post/potwor-przeszlosci-makefile-cz-2) diff --git a/module1/01_presentation_make.pl.md b/module1/01_presentation_make.pl.md deleted file mode 100644 index 982a9a7..0000000 --- a/module1/01_presentation_make.pl.md +++ /dev/null @@ -1,108 +0,0 @@ - - -# `make` - - - Coders School - - -___ - -## Makefiles - -### The structure of the Makefile - -```Makefile -VARIABLE = value - -targetA: dependencyA1 dependencyA2 -[TAB] command $(VARIABLE) - -targetB: dependencyB1 -[TAB] command -``` - -___ - -## Example - generating a presentation in LaTeX - -```Makefile -TEX = pdflatex -shell-escape -interaction=nonstopmode -file-line-error -MAKE = make -CODE_DIR = src - -.PHONY: all view - -all: calculator pdf - -view: - evince ContractProgramming.pdf - -pdf: ContractProgramming.tex - $(TEX) ContractProgramming.tex - -calculator: - $(MAKE) -C $(CODE_DIR) -``` - -___ - -## Compilation in C ++ - -### Do you remember the build phases? - - -```Makefile -SOURCES=$(wildcard src/*.cpp) -OBJECTS=$(patsubst %.cpp, %.o, $(SOURCES)) - -main: $(OBJECTS) - g++ $^ -o $@ - -$(OBJECTS): src/%.o : src/%.cpp src/%.hpp - g++ -c $< -o $@ -``` - - -### Variables remembering the context - - -* $@ - the name of the target file in the currently running rule -* $< - first dependency name -* $^ - list of all dependencies (includes any duplicates) -* $? - a list of all dependencies that are newer than target - -___ - -## Exercise - -In the greeter directory you will find a small program. Familiarize yourself with its code. - -* Compile the program from the command line and run it. -* Write a simple Makefile for this program. Build it with `make` and run it. - -### Spell of building - -```bash -g++ -std=c++17 -Wall -Werror -Wextra -pedantic *.cpp -o greeter -./greeter -``` - -___ - -## `make` command - -* by default it looks for a Makefile in the current directory -* automates activities by executing recipes saved in Makefile files -* executes the first recipe by default -* allows for conditional performance of activities -* allows defining many dependencies -* by default, it takes into account dependency modification dates and on this basis decides whether to execute a given recipe - -___ - -## Q&A - -### links - -[cpp-polska.pl](https://cpp-polska.pl/post/potwor-przeszlosci-makefile-cz-2) diff --git a/module1/02_presentation_cmake.en.md b/module1/02_presentation_cmake.en.md deleted file mode 100644 index 43f89db..0000000 --- a/module1/02_presentation_cmake.en.md +++ /dev/null @@ -1,321 +0,0 @@ - - -# `cmake` - - - Coders School - - -___ - -## CMake - -* automates the build process for C/C++ -* supports generating projects for multiple IDEs -* can consists of many modules that are combined (equivalent of #include) -* platform independent (if well written) -* build configuration in CMakeLists.txt file -* generate a build systems (e.g. Makefiles) - -___ - -## Minimal `CMakeLists.txt` - -```cmake -cmake_minimum_required(VERSION 3.10) -project(ProjectName) - -add_executable(execName main.cpp file.cpp) -``` - -___ - -## Building with CMake'a - -```bash -mkdir build # create a directory with the results of the building -cd build # enter this directory -cmake .. # generate the build system by specifying the path to the CMakeLists.txt file -cmake --build . # build a project -``` - -`cmake --build` can be changed for `make` if we're sure, that we're generating Makefile. - - -`cmake --build` is universal. - - -___ - -## Exercise - -Write simple CMakeLists.txt for program from `greeter` directory, build it with `cmake` and run. - -Notice that there is also a tests. Write additional target for tests. - -___ - -## Q&A - -___ - -## CMake - variables - -Variables are created with `set` command - - -```cmake -set(VARIABLE value) # Convention - UPPERCASE_WITH_UNDERSCORE -``` - - -For example - - -```cmake -set(NAME TheGreatestProject) -``` - - -We refer to them later by enclosing them in `{}` parentheses and preceding them with the `$` sign - - -```cmake -add_executable(${NAME} main.cpp) -``` - - -That will create a target `TheGreatestProject` in which `main.cpp` file will be compiled - - -___ - -## CMake - predefined variables - -CMake supplies several variables by default. Referring to them directly or modifying them is usually not considered good practice. - - -We can use the `$ {PROJECT_NAME}` variable without any problems. It contains the project name defined by the `project ()` command - - -```cmake -project(vectorFunctions) -add_executable(${PROJECT_NAME} main.cpp vectorFunctions.cpp) -``` - - -___ - -## Create applications and libraries - -[CMake manual](https://cmake.org/cmake/help/latest/manual/cmake-commands.7.html#id4) - -You can treat the following commands as "constructors". They form "targets" - -```cmake -add_executable( [source1] [source2 ...]) -``` - -```cmake -add_library( [STATIC | SHARED | MODULE] [source1] [source2 ...]) -``` - -```cmake -add_library(${PROJECT_NAME}-lib STATIC functions.cpp modules.cpp) -add_executable(${PROJECT_NAME} main.cpp functions.cpp modules.cpp) -add_executable(${PROJECT_NAME}-ut test.cpp functions.cpp modules.cpp) -``` - - -### Problem - - -Duplicated list of files in different "targets" - - -___ - -### Problem #1 - -Duplicated list of files in different "targets" - -### Solution - - -Putting a list of files into a variable - - -## Exercise - - -Put a list of files into a variable and use it - - -___ - -### Problem #2 - -Minor differences in files between targets - - -### Solution - - -Creating a library - - -___ - -## Libraries - -My library definition - a cluster of multiple cpp files without the `main ()` function. Therefore, the library cannot be run. - - -### Analogy to object oriented programming - - -* Library = class (base) - * fields, methods = cpp files -* Binary = derived class - * final, cannot be inherited from it -* Linking = inheritance - * linking a binary to a library means adding code from the library to it - * libraries can be linked with each other - -___ - -## Linking libraries - -```cmake -target_link_libraries( ... ... ...) -``` - - -```cmake -add_library(lib STATIC functions.cpp modules.cpp) -add_executable(main main.cpp) -add_executable(ut tests.cpp) -target_link_libraries(main lib) -target_link_libraries(ut lib) -``` - - -### Exercise - - -Create a library that will contain duplicate cpp files and link to it with the targets that used them. - - -___ - -## Build flags - -```cmake -target_compile_options( [BEFORE] - [items1...] - [ [items2...] - ...]) -``` - - -```cmake -add_executable(${PROJECT_NAME} main.cpp) -target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror) -``` - - -### Exercise - - -Add build flags `-Wall -Wextra -Werror -pedantic -Wconversion -O3` to the greeter project - - -___ - -## Enabling the C ++ 17 standard - -```cmake -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -``` - - -The above may not work for MSVC. - - -```cmake -set_target_properties(${PROJECT_NAME} PROPERTIES - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED ON) -``` - - -```cmake -add_executable(${PROJECT_NAME} main.cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -``` - - -### Exercise - - -Enable the C++17 standard in the greeter project - - -___ - -## Adding tests to `ctest` - -```cmake -enable_testing() -add_test(NAME COMMAND [...]) -``` - - -```cmake -enable_testing() -add_test(NAME someTests COMMAND ${PROJECT_NAME}-ut) -``` - - -### Exercise - - -Add a test binary that should be run with `ctest` - - -___ - -## Build in debug mode - -By default, the "Release" mode is built (no debugging symbols) - - -```cmake -cmake -DCMAKE_BUILD_TYPE=Debug .. -``` - - -If we want to support building in Debug and Release modes, we should have separate directories with build results - - -```bash -mkdir buildDebug -cd buildDebug -cmake -DCMAKE_BUILD_TYPE=Debug .. -cmake --build -``` - - -___ - -## Links for learning more - -* [CMake - from zero to something - prezentacja z Wro.cpp](https://muttleyxd.github.io) -* [19 reasons why CMake is actually awesome](https://kubasejdak.com/19-reasons-why-cmake-is-actually-awesome) -* [Modern CMake is like inheritance](https://kubasejdak.com/modern-cmake-is-like-inheritance) -* [CMake basics](https://www.siliceum.com/en/blog/post/cmake_01_cmake-basics) - -___ - -## Q&A diff --git a/module1/02_presentation_cmake.pl.md b/module1/02_presentation_cmake.pl.md deleted file mode 100644 index 43f89db..0000000 --- a/module1/02_presentation_cmake.pl.md +++ /dev/null @@ -1,321 +0,0 @@ - - -# `cmake` - - - Coders School - - -___ - -## CMake - -* automates the build process for C/C++ -* supports generating projects for multiple IDEs -* can consists of many modules that are combined (equivalent of #include) -* platform independent (if well written) -* build configuration in CMakeLists.txt file -* generate a build systems (e.g. Makefiles) - -___ - -## Minimal `CMakeLists.txt` - -```cmake -cmake_minimum_required(VERSION 3.10) -project(ProjectName) - -add_executable(execName main.cpp file.cpp) -``` - -___ - -## Building with CMake'a - -```bash -mkdir build # create a directory with the results of the building -cd build # enter this directory -cmake .. # generate the build system by specifying the path to the CMakeLists.txt file -cmake --build . # build a project -``` - -`cmake --build` can be changed for `make` if we're sure, that we're generating Makefile. - - -`cmake --build` is universal. - - -___ - -## Exercise - -Write simple CMakeLists.txt for program from `greeter` directory, build it with `cmake` and run. - -Notice that there is also a tests. Write additional target for tests. - -___ - -## Q&A - -___ - -## CMake - variables - -Variables are created with `set` command - - -```cmake -set(VARIABLE value) # Convention - UPPERCASE_WITH_UNDERSCORE -``` - - -For example - - -```cmake -set(NAME TheGreatestProject) -``` - - -We refer to them later by enclosing them in `{}` parentheses and preceding them with the `$` sign - - -```cmake -add_executable(${NAME} main.cpp) -``` - - -That will create a target `TheGreatestProject` in which `main.cpp` file will be compiled - - -___ - -## CMake - predefined variables - -CMake supplies several variables by default. Referring to them directly or modifying them is usually not considered good practice. - - -We can use the `$ {PROJECT_NAME}` variable without any problems. It contains the project name defined by the `project ()` command - - -```cmake -project(vectorFunctions) -add_executable(${PROJECT_NAME} main.cpp vectorFunctions.cpp) -``` - - -___ - -## Create applications and libraries - -[CMake manual](https://cmake.org/cmake/help/latest/manual/cmake-commands.7.html#id4) - -You can treat the following commands as "constructors". They form "targets" - -```cmake -add_executable( [source1] [source2 ...]) -``` - -```cmake -add_library( [STATIC | SHARED | MODULE] [source1] [source2 ...]) -``` - -```cmake -add_library(${PROJECT_NAME}-lib STATIC functions.cpp modules.cpp) -add_executable(${PROJECT_NAME} main.cpp functions.cpp modules.cpp) -add_executable(${PROJECT_NAME}-ut test.cpp functions.cpp modules.cpp) -``` - - -### Problem - - -Duplicated list of files in different "targets" - - -___ - -### Problem #1 - -Duplicated list of files in different "targets" - -### Solution - - -Putting a list of files into a variable - - -## Exercise - - -Put a list of files into a variable and use it - - -___ - -### Problem #2 - -Minor differences in files between targets - - -### Solution - - -Creating a library - - -___ - -## Libraries - -My library definition - a cluster of multiple cpp files without the `main ()` function. Therefore, the library cannot be run. - - -### Analogy to object oriented programming - - -* Library = class (base) - * fields, methods = cpp files -* Binary = derived class - * final, cannot be inherited from it -* Linking = inheritance - * linking a binary to a library means adding code from the library to it - * libraries can be linked with each other - -___ - -## Linking libraries - -```cmake -target_link_libraries( ... ... ...) -``` - - -```cmake -add_library(lib STATIC functions.cpp modules.cpp) -add_executable(main main.cpp) -add_executable(ut tests.cpp) -target_link_libraries(main lib) -target_link_libraries(ut lib) -``` - - -### Exercise - - -Create a library that will contain duplicate cpp files and link to it with the targets that used them. - - -___ - -## Build flags - -```cmake -target_compile_options( [BEFORE] - [items1...] - [ [items2...] - ...]) -``` - - -```cmake -add_executable(${PROJECT_NAME} main.cpp) -target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror) -``` - - -### Exercise - - -Add build flags `-Wall -Wextra -Werror -pedantic -Wconversion -O3` to the greeter project - - -___ - -## Enabling the C ++ 17 standard - -```cmake -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -``` - - -The above may not work for MSVC. - - -```cmake -set_target_properties(${PROJECT_NAME} PROPERTIES - CXX_STANDARD 17 - CXX_STANDARD_REQUIRED ON) -``` - - -```cmake -add_executable(${PROJECT_NAME} main.cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -``` - - -### Exercise - - -Enable the C++17 standard in the greeter project - - -___ - -## Adding tests to `ctest` - -```cmake -enable_testing() -add_test(NAME COMMAND [...]) -``` - - -```cmake -enable_testing() -add_test(NAME someTests COMMAND ${PROJECT_NAME}-ut) -``` - - -### Exercise - - -Add a test binary that should be run with `ctest` - - -___ - -## Build in debug mode - -By default, the "Release" mode is built (no debugging symbols) - - -```cmake -cmake -DCMAKE_BUILD_TYPE=Debug .. -``` - - -If we want to support building in Debug and Release modes, we should have separate directories with build results - - -```bash -mkdir buildDebug -cd buildDebug -cmake -DCMAKE_BUILD_TYPE=Debug .. -cmake --build -``` - - -___ - -## Links for learning more - -* [CMake - from zero to something - prezentacja z Wro.cpp](https://muttleyxd.github.io) -* [19 reasons why CMake is actually awesome](https://kubasejdak.com/19-reasons-why-cmake-is-actually-awesome) -* [Modern CMake is like inheritance](https://kubasejdak.com/modern-cmake-is-like-inheritance) -* [CMake basics](https://www.siliceum.com/en/blog/post/cmake_01_cmake-basics) - -___ - -## Q&A diff --git a/module1/03_presentation_homework.en.md b/module1/03_presentation_homework.en.md deleted file mode 100644 index 205bc09..0000000 --- a/module1/03_presentation_homework.en.md +++ /dev/null @@ -1,57 +0,0 @@ - - -# Tools #3 - -## Summary - - - Coders School - - -___ - -## What do you remember from today? - -### Write as many topics as possible in the chat - - -___ - -### Pre-work - -* Read about the SOLID rules for writing good object-oriented code -* Read about the principles of good code in C ++ at [CppCoreGuidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md) -* Find out what the diamond problem is on Object Orientation #4 - -___ - -### Post-work - -* Add the `cmake` building system to the SHM project (10 points, 2 for each subtask) -* Prepare SHM for testing (10 points, 2 for each subtask) - -#### Bonus - -* Delivery before Sunday 05.07.2020 23:59 (2 points per task, 4 in total) - -___ - -### `cmake` in SHM - -* Use the variable `${PROJECT_NAME}` -* List of cpp files in the variable -* Everything except `main.cpp` should compile to a static library -* Binary (main.cpp) should be linked with the above library. -* Write an appropriate file `.github/workflows/main.yml` which will cause GitHub to automatically run a project build for each new commit. - -___ - -### The foundations for testing in SHM - -On the basis of reading CMakeLists.txt files from homework, deduce how the `gtest` library is added to tests - -* Create simple tests for SHM project (at least 1 test with Copy&Paste method from other homework) -* Copy the appropriate files that will allow the use of `gtest` -* Add the test binary to CMakeLists.txt. Name it `${PROJECT_NAME}-ut` -* Add test run with `ctest` -* Modify the file `.github/workflows/main.yml` so GitHub will also run tests diff --git a/module1/03_presentation_homework.pl.md b/module1/03_presentation_homework.pl.md deleted file mode 100644 index 56e55e1..0000000 --- a/module1/03_presentation_homework.pl.md +++ /dev/null @@ -1,57 +0,0 @@ - - -# Narzędzia #3 - -## Podsumowanie - - - Coders School - - -___ - -## Co pamiętasz z dzisiaj? - -### Napisz na czacie jak najwięcej haseł - - -___ - -### Pre-work - -* Poczytajcie o zasadach SOLID, dotyczących pisania dobrego kodu obiektowego -* Poczytajcie o zasadach dobrego kodu w C++ na [CppCoreGuidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md) -* Dowiedzcie się czym jest problem diamentowy na Obiektowość #4 - -___ - -### Post-work - -* Dorzućcie do projektu SHM system budowania `cmake` (10 punktów, 2 za każdy podpunkt) -* Przygotujcie SHM do testowania (10 punktów, 2 za każdy podpunkt) - -#### Bonus - -* Dostarczenie przed niedzielą 05.07.2020 23:59 (2 punkty za zadanie, razem 4) - -___ - -### `cmake` w SHM - -* Użyjcie zmiennej `${PROJECT_NAME}` -* Lista plików cpp w zmiennej -* Wszystko poza plikiem `main.cpp` powinno kompilować się do biblioteki statycznej -* Binarka (main.cpp) powinna linkować się z powyższą biblioteką. -* Napiszcie odpowiedni plik `.github/workflows/main.yml` który spowoduje, że GitHub będzie automatycznie uruchamiał kompilację projektu dla każdego nowego commita. - -___ - -### Podwaliny pod testy w SHM - -Na podstawie lektury plików CMakeLists.txt z prac domowych wywnioskujcie, w jaki sposób dodawana jest biblioteka `gtest` do testów - -* Utwórzcie proste testy do projektu SHM (co najmniej 1 test metodą Copy&Paste z innych prac domowych) -* Skopiujcie odpowiednie pliki, które pozwolą na użycie `gtesta` -* Dodajcie binarkę z testami do CMakeLists.txt. Nazwijcie ją `${PROJECT_NAME}-ut` -* Dodajcie odpalanie testów za pomocą `ctest` -* Zmodyfikujcie plik `.github/workflows/main.yml` aby GitHub dodatkowo uruchamiał jeszcze testy From e799e5f8f8a31ef4c5b4d646517800611de4df3f Mon Sep 17 00:00:00 2001 From: Penthurion Date: Thu, 27 Aug 2020 13:01:14 +0200 Subject: [PATCH 10/25] deleted _presentation prefix from filenames --- module1/01_make.en.md | 108 +++++++++++++ module1/01_make.pl.md | 108 +++++++++++++ module1/02_cmake.en.md | 321 ++++++++++++++++++++++++++++++++++++++ module1/02_cmake.pl.md | 321 ++++++++++++++++++++++++++++++++++++++ module1/03_homework.en.md | 57 +++++++ module1/03_homework.pl.md | 57 +++++++ 6 files changed, 972 insertions(+) create mode 100644 module1/01_make.en.md create mode 100644 module1/01_make.pl.md create mode 100644 module1/02_cmake.en.md create mode 100644 module1/02_cmake.pl.md create mode 100644 module1/03_homework.en.md create mode 100644 module1/03_homework.pl.md diff --git a/module1/01_make.en.md b/module1/01_make.en.md new file mode 100644 index 0000000..982a9a7 --- /dev/null +++ b/module1/01_make.en.md @@ -0,0 +1,108 @@ + + +# `make` + + + Coders School + + +___ + +## Makefiles + +### The structure of the Makefile + +```Makefile +VARIABLE = value + +targetA: dependencyA1 dependencyA2 +[TAB] command $(VARIABLE) + +targetB: dependencyB1 +[TAB] command +``` + +___ + +## Example - generating a presentation in LaTeX + +```Makefile +TEX = pdflatex -shell-escape -interaction=nonstopmode -file-line-error +MAKE = make +CODE_DIR = src + +.PHONY: all view + +all: calculator pdf + +view: + evince ContractProgramming.pdf + +pdf: ContractProgramming.tex + $(TEX) ContractProgramming.tex + +calculator: + $(MAKE) -C $(CODE_DIR) +``` + +___ + +## Compilation in C ++ + +### Do you remember the build phases? + + +```Makefile +SOURCES=$(wildcard src/*.cpp) +OBJECTS=$(patsubst %.cpp, %.o, $(SOURCES)) + +main: $(OBJECTS) + g++ $^ -o $@ + +$(OBJECTS): src/%.o : src/%.cpp src/%.hpp + g++ -c $< -o $@ +``` + + +### Variables remembering the context + + +* $@ - the name of the target file in the currently running rule +* $< - first dependency name +* $^ - list of all dependencies (includes any duplicates) +* $? - a list of all dependencies that are newer than target + +___ + +## Exercise + +In the greeter directory you will find a small program. Familiarize yourself with its code. + +* Compile the program from the command line and run it. +* Write a simple Makefile for this program. Build it with `make` and run it. + +### Spell of building + +```bash +g++ -std=c++17 -Wall -Werror -Wextra -pedantic *.cpp -o greeter +./greeter +``` + +___ + +## `make` command + +* by default it looks for a Makefile in the current directory +* automates activities by executing recipes saved in Makefile files +* executes the first recipe by default +* allows for conditional performance of activities +* allows defining many dependencies +* by default, it takes into account dependency modification dates and on this basis decides whether to execute a given recipe + +___ + +## Q&A + +### links + +[cpp-polska.pl](https://cpp-polska.pl/post/potwor-przeszlosci-makefile-cz-2) diff --git a/module1/01_make.pl.md b/module1/01_make.pl.md new file mode 100644 index 0000000..982a9a7 --- /dev/null +++ b/module1/01_make.pl.md @@ -0,0 +1,108 @@ + + +# `make` + + + Coders School + + +___ + +## Makefiles + +### The structure of the Makefile + +```Makefile +VARIABLE = value + +targetA: dependencyA1 dependencyA2 +[TAB] command $(VARIABLE) + +targetB: dependencyB1 +[TAB] command +``` + +___ + +## Example - generating a presentation in LaTeX + +```Makefile +TEX = pdflatex -shell-escape -interaction=nonstopmode -file-line-error +MAKE = make +CODE_DIR = src + +.PHONY: all view + +all: calculator pdf + +view: + evince ContractProgramming.pdf + +pdf: ContractProgramming.tex + $(TEX) ContractProgramming.tex + +calculator: + $(MAKE) -C $(CODE_DIR) +``` + +___ + +## Compilation in C ++ + +### Do you remember the build phases? + + +```Makefile +SOURCES=$(wildcard src/*.cpp) +OBJECTS=$(patsubst %.cpp, %.o, $(SOURCES)) + +main: $(OBJECTS) + g++ $^ -o $@ + +$(OBJECTS): src/%.o : src/%.cpp src/%.hpp + g++ -c $< -o $@ +``` + + +### Variables remembering the context + + +* $@ - the name of the target file in the currently running rule +* $< - first dependency name +* $^ - list of all dependencies (includes any duplicates) +* $? - a list of all dependencies that are newer than target + +___ + +## Exercise + +In the greeter directory you will find a small program. Familiarize yourself with its code. + +* Compile the program from the command line and run it. +* Write a simple Makefile for this program. Build it with `make` and run it. + +### Spell of building + +```bash +g++ -std=c++17 -Wall -Werror -Wextra -pedantic *.cpp -o greeter +./greeter +``` + +___ + +## `make` command + +* by default it looks for a Makefile in the current directory +* automates activities by executing recipes saved in Makefile files +* executes the first recipe by default +* allows for conditional performance of activities +* allows defining many dependencies +* by default, it takes into account dependency modification dates and on this basis decides whether to execute a given recipe + +___ + +## Q&A + +### links + +[cpp-polska.pl](https://cpp-polska.pl/post/potwor-przeszlosci-makefile-cz-2) diff --git a/module1/02_cmake.en.md b/module1/02_cmake.en.md new file mode 100644 index 0000000..43f89db --- /dev/null +++ b/module1/02_cmake.en.md @@ -0,0 +1,321 @@ + + +# `cmake` + + + Coders School + + +___ + +## CMake + +* automates the build process for C/C++ +* supports generating projects for multiple IDEs +* can consists of many modules that are combined (equivalent of #include) +* platform independent (if well written) +* build configuration in CMakeLists.txt file +* generate a build systems (e.g. Makefiles) + +___ + +## Minimal `CMakeLists.txt` + +```cmake +cmake_minimum_required(VERSION 3.10) +project(ProjectName) + +add_executable(execName main.cpp file.cpp) +``` + +___ + +## Building with CMake'a + +```bash +mkdir build # create a directory with the results of the building +cd build # enter this directory +cmake .. # generate the build system by specifying the path to the CMakeLists.txt file +cmake --build . # build a project +``` + +`cmake --build` can be changed for `make` if we're sure, that we're generating Makefile. + + +`cmake --build` is universal. + + +___ + +## Exercise + +Write simple CMakeLists.txt for program from `greeter` directory, build it with `cmake` and run. + +Notice that there is also a tests. Write additional target for tests. + +___ + +## Q&A + +___ + +## CMake - variables + +Variables are created with `set` command + + +```cmake +set(VARIABLE value) # Convention - UPPERCASE_WITH_UNDERSCORE +``` + + +For example + + +```cmake +set(NAME TheGreatestProject) +``` + + +We refer to them later by enclosing them in `{}` parentheses and preceding them with the `$` sign + + +```cmake +add_executable(${NAME} main.cpp) +``` + + +That will create a target `TheGreatestProject` in which `main.cpp` file will be compiled + + +___ + +## CMake - predefined variables + +CMake supplies several variables by default. Referring to them directly or modifying them is usually not considered good practice. + + +We can use the `$ {PROJECT_NAME}` variable without any problems. It contains the project name defined by the `project ()` command + + +```cmake +project(vectorFunctions) +add_executable(${PROJECT_NAME} main.cpp vectorFunctions.cpp) +``` + + +___ + +## Create applications and libraries + +[CMake manual](https://cmake.org/cmake/help/latest/manual/cmake-commands.7.html#id4) + +You can treat the following commands as "constructors". They form "targets" + +```cmake +add_executable( [source1] [source2 ...]) +``` + +```cmake +add_library( [STATIC | SHARED | MODULE] [source1] [source2 ...]) +``` + +```cmake +add_library(${PROJECT_NAME}-lib STATIC functions.cpp modules.cpp) +add_executable(${PROJECT_NAME} main.cpp functions.cpp modules.cpp) +add_executable(${PROJECT_NAME}-ut test.cpp functions.cpp modules.cpp) +``` + + +### Problem + + +Duplicated list of files in different "targets" + + +___ + +### Problem #1 + +Duplicated list of files in different "targets" + +### Solution + + +Putting a list of files into a variable + + +## Exercise + + +Put a list of files into a variable and use it + + +___ + +### Problem #2 + +Minor differences in files between targets + + +### Solution + + +Creating a library + + +___ + +## Libraries + +My library definition - a cluster of multiple cpp files without the `main ()` function. Therefore, the library cannot be run. + + +### Analogy to object oriented programming + + +* Library = class (base) + * fields, methods = cpp files +* Binary = derived class + * final, cannot be inherited from it +* Linking = inheritance + * linking a binary to a library means adding code from the library to it + * libraries can be linked with each other + +___ + +## Linking libraries + +```cmake +target_link_libraries( ... ... ...) +``` + + +```cmake +add_library(lib STATIC functions.cpp modules.cpp) +add_executable(main main.cpp) +add_executable(ut tests.cpp) +target_link_libraries(main lib) +target_link_libraries(ut lib) +``` + + +### Exercise + + +Create a library that will contain duplicate cpp files and link to it with the targets that used them. + + +___ + +## Build flags + +```cmake +target_compile_options( [BEFORE] + [items1...] + [ [items2...] + ...]) +``` + + +```cmake +add_executable(${PROJECT_NAME} main.cpp) +target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror) +``` + + +### Exercise + + +Add build flags `-Wall -Wextra -Werror -pedantic -Wconversion -O3` to the greeter project + + +___ + +## Enabling the C ++ 17 standard + +```cmake +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +``` + + +The above may not work for MSVC. + + +```cmake +set_target_properties(${PROJECT_NAME} PROPERTIES + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON) +``` + + +```cmake +add_executable(${PROJECT_NAME} main.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +``` + + +### Exercise + + +Enable the C++17 standard in the greeter project + + +___ + +## Adding tests to `ctest` + +```cmake +enable_testing() +add_test(NAME COMMAND [...]) +``` + + +```cmake +enable_testing() +add_test(NAME someTests COMMAND ${PROJECT_NAME}-ut) +``` + + +### Exercise + + +Add a test binary that should be run with `ctest` + + +___ + +## Build in debug mode + +By default, the "Release" mode is built (no debugging symbols) + + +```cmake +cmake -DCMAKE_BUILD_TYPE=Debug .. +``` + + +If we want to support building in Debug and Release modes, we should have separate directories with build results + + +```bash +mkdir buildDebug +cd buildDebug +cmake -DCMAKE_BUILD_TYPE=Debug .. +cmake --build +``` + + +___ + +## Links for learning more + +* [CMake - from zero to something - prezentacja z Wro.cpp](https://muttleyxd.github.io) +* [19 reasons why CMake is actually awesome](https://kubasejdak.com/19-reasons-why-cmake-is-actually-awesome) +* [Modern CMake is like inheritance](https://kubasejdak.com/modern-cmake-is-like-inheritance) +* [CMake basics](https://www.siliceum.com/en/blog/post/cmake_01_cmake-basics) + +___ + +## Q&A diff --git a/module1/02_cmake.pl.md b/module1/02_cmake.pl.md new file mode 100644 index 0000000..43f89db --- /dev/null +++ b/module1/02_cmake.pl.md @@ -0,0 +1,321 @@ + + +# `cmake` + + + Coders School + + +___ + +## CMake + +* automates the build process for C/C++ +* supports generating projects for multiple IDEs +* can consists of many modules that are combined (equivalent of #include) +* platform independent (if well written) +* build configuration in CMakeLists.txt file +* generate a build systems (e.g. Makefiles) + +___ + +## Minimal `CMakeLists.txt` + +```cmake +cmake_minimum_required(VERSION 3.10) +project(ProjectName) + +add_executable(execName main.cpp file.cpp) +``` + +___ + +## Building with CMake'a + +```bash +mkdir build # create a directory with the results of the building +cd build # enter this directory +cmake .. # generate the build system by specifying the path to the CMakeLists.txt file +cmake --build . # build a project +``` + +`cmake --build` can be changed for `make` if we're sure, that we're generating Makefile. + + +`cmake --build` is universal. + + +___ + +## Exercise + +Write simple CMakeLists.txt for program from `greeter` directory, build it with `cmake` and run. + +Notice that there is also a tests. Write additional target for tests. + +___ + +## Q&A + +___ + +## CMake - variables + +Variables are created with `set` command + + +```cmake +set(VARIABLE value) # Convention - UPPERCASE_WITH_UNDERSCORE +``` + + +For example + + +```cmake +set(NAME TheGreatestProject) +``` + + +We refer to them later by enclosing them in `{}` parentheses and preceding them with the `$` sign + + +```cmake +add_executable(${NAME} main.cpp) +``` + + +That will create a target `TheGreatestProject` in which `main.cpp` file will be compiled + + +___ + +## CMake - predefined variables + +CMake supplies several variables by default. Referring to them directly or modifying them is usually not considered good practice. + + +We can use the `$ {PROJECT_NAME}` variable without any problems. It contains the project name defined by the `project ()` command + + +```cmake +project(vectorFunctions) +add_executable(${PROJECT_NAME} main.cpp vectorFunctions.cpp) +``` + + +___ + +## Create applications and libraries + +[CMake manual](https://cmake.org/cmake/help/latest/manual/cmake-commands.7.html#id4) + +You can treat the following commands as "constructors". They form "targets" + +```cmake +add_executable( [source1] [source2 ...]) +``` + +```cmake +add_library( [STATIC | SHARED | MODULE] [source1] [source2 ...]) +``` + +```cmake +add_library(${PROJECT_NAME}-lib STATIC functions.cpp modules.cpp) +add_executable(${PROJECT_NAME} main.cpp functions.cpp modules.cpp) +add_executable(${PROJECT_NAME}-ut test.cpp functions.cpp modules.cpp) +``` + + +### Problem + + +Duplicated list of files in different "targets" + + +___ + +### Problem #1 + +Duplicated list of files in different "targets" + +### Solution + + +Putting a list of files into a variable + + +## Exercise + + +Put a list of files into a variable and use it + + +___ + +### Problem #2 + +Minor differences in files between targets + + +### Solution + + +Creating a library + + +___ + +## Libraries + +My library definition - a cluster of multiple cpp files without the `main ()` function. Therefore, the library cannot be run. + + +### Analogy to object oriented programming + + +* Library = class (base) + * fields, methods = cpp files +* Binary = derived class + * final, cannot be inherited from it +* Linking = inheritance + * linking a binary to a library means adding code from the library to it + * libraries can be linked with each other + +___ + +## Linking libraries + +```cmake +target_link_libraries( ... ... ...) +``` + + +```cmake +add_library(lib STATIC functions.cpp modules.cpp) +add_executable(main main.cpp) +add_executable(ut tests.cpp) +target_link_libraries(main lib) +target_link_libraries(ut lib) +``` + + +### Exercise + + +Create a library that will contain duplicate cpp files and link to it with the targets that used them. + + +___ + +## Build flags + +```cmake +target_compile_options( [BEFORE] + [items1...] + [ [items2...] + ...]) +``` + + +```cmake +add_executable(${PROJECT_NAME} main.cpp) +target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror) +``` + + +### Exercise + + +Add build flags `-Wall -Wextra -Werror -pedantic -Wconversion -O3` to the greeter project + + +___ + +## Enabling the C ++ 17 standard + +```cmake +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +``` + + +The above may not work for MSVC. + + +```cmake +set_target_properties(${PROJECT_NAME} PROPERTIES + CXX_STANDARD 17 + CXX_STANDARD_REQUIRED ON) +``` + + +```cmake +add_executable(${PROJECT_NAME} main.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +``` + + +### Exercise + + +Enable the C++17 standard in the greeter project + + +___ + +## Adding tests to `ctest` + +```cmake +enable_testing() +add_test(NAME COMMAND [...]) +``` + + +```cmake +enable_testing() +add_test(NAME someTests COMMAND ${PROJECT_NAME}-ut) +``` + + +### Exercise + + +Add a test binary that should be run with `ctest` + + +___ + +## Build in debug mode + +By default, the "Release" mode is built (no debugging symbols) + + +```cmake +cmake -DCMAKE_BUILD_TYPE=Debug .. +``` + + +If we want to support building in Debug and Release modes, we should have separate directories with build results + + +```bash +mkdir buildDebug +cd buildDebug +cmake -DCMAKE_BUILD_TYPE=Debug .. +cmake --build +``` + + +___ + +## Links for learning more + +* [CMake - from zero to something - prezentacja z Wro.cpp](https://muttleyxd.github.io) +* [19 reasons why CMake is actually awesome](https://kubasejdak.com/19-reasons-why-cmake-is-actually-awesome) +* [Modern CMake is like inheritance](https://kubasejdak.com/modern-cmake-is-like-inheritance) +* [CMake basics](https://www.siliceum.com/en/blog/post/cmake_01_cmake-basics) + +___ + +## Q&A diff --git a/module1/03_homework.en.md b/module1/03_homework.en.md new file mode 100644 index 0000000..205bc09 --- /dev/null +++ b/module1/03_homework.en.md @@ -0,0 +1,57 @@ + + +# Tools #3 + +## Summary + + + Coders School + + +___ + +## What do you remember from today? + +### Write as many topics as possible in the chat + + +___ + +### Pre-work + +* Read about the SOLID rules for writing good object-oriented code +* Read about the principles of good code in C ++ at [CppCoreGuidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md) +* Find out what the diamond problem is on Object Orientation #4 + +___ + +### Post-work + +* Add the `cmake` building system to the SHM project (10 points, 2 for each subtask) +* Prepare SHM for testing (10 points, 2 for each subtask) + +#### Bonus + +* Delivery before Sunday 05.07.2020 23:59 (2 points per task, 4 in total) + +___ + +### `cmake` in SHM + +* Use the variable `${PROJECT_NAME}` +* List of cpp files in the variable +* Everything except `main.cpp` should compile to a static library +* Binary (main.cpp) should be linked with the above library. +* Write an appropriate file `.github/workflows/main.yml` which will cause GitHub to automatically run a project build for each new commit. + +___ + +### The foundations for testing in SHM + +On the basis of reading CMakeLists.txt files from homework, deduce how the `gtest` library is added to tests + +* Create simple tests for SHM project (at least 1 test with Copy&Paste method from other homework) +* Copy the appropriate files that will allow the use of `gtest` +* Add the test binary to CMakeLists.txt. Name it `${PROJECT_NAME}-ut` +* Add test run with `ctest` +* Modify the file `.github/workflows/main.yml` so GitHub will also run tests diff --git a/module1/03_homework.pl.md b/module1/03_homework.pl.md new file mode 100644 index 0000000..56e55e1 --- /dev/null +++ b/module1/03_homework.pl.md @@ -0,0 +1,57 @@ + + +# Narzędzia #3 + +## Podsumowanie + + + Coders School + + +___ + +## Co pamiętasz z dzisiaj? + +### Napisz na czacie jak najwięcej haseł + + +___ + +### Pre-work + +* Poczytajcie o zasadach SOLID, dotyczących pisania dobrego kodu obiektowego +* Poczytajcie o zasadach dobrego kodu w C++ na [CppCoreGuidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md) +* Dowiedzcie się czym jest problem diamentowy na Obiektowość #4 + +___ + +### Post-work + +* Dorzućcie do projektu SHM system budowania `cmake` (10 punktów, 2 za każdy podpunkt) +* Przygotujcie SHM do testowania (10 punktów, 2 za każdy podpunkt) + +#### Bonus + +* Dostarczenie przed niedzielą 05.07.2020 23:59 (2 punkty za zadanie, razem 4) + +___ + +### `cmake` w SHM + +* Użyjcie zmiennej `${PROJECT_NAME}` +* Lista plików cpp w zmiennej +* Wszystko poza plikiem `main.cpp` powinno kompilować się do biblioteki statycznej +* Binarka (main.cpp) powinna linkować się z powyższą biblioteką. +* Napiszcie odpowiedni plik `.github/workflows/main.yml` który spowoduje, że GitHub będzie automatycznie uruchamiał kompilację projektu dla każdego nowego commita. + +___ + +### Podwaliny pod testy w SHM + +Na podstawie lektury plików CMakeLists.txt z prac domowych wywnioskujcie, w jaki sposób dodawana jest biblioteka `gtest` do testów + +* Utwórzcie proste testy do projektu SHM (co najmniej 1 test metodą Copy&Paste z innych prac domowych) +* Skopiujcie odpowiednie pliki, które pozwolą na użycie `gtesta` +* Dodajcie binarkę z testami do CMakeLists.txt. Nazwijcie ją `${PROJECT_NAME}-ut` +* Dodajcie odpalanie testów za pomocą `ctest` +* Zmodyfikujcie plik `.github/workflows/main.yml` aby GitHub dodatkowo uruchamiał jeszcze testy From f40e99bafe0818625ead010e84b4ce8d33628c4d Mon Sep 17 00:00:00 2001 From: Penthurion Date: Thu, 27 Aug 2020 13:07:24 +0200 Subject: [PATCH 11/25] README.md modified to have polish and english versions. Also fixed links --- README.md | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 30b3c29..5fb7a5f 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,26 @@ Coders School -## [Moduł 1](module1/) +## [Moduł 1](module1/index.pl.html) -### [`make`](module1/presentation_make.md) +### [`make`](module1/01_make.pl.md) -### [`cmake`](module1/presentation_cmake.md) +### [`cmake`](module1/02_cmake.pl.md) -### [homework](module1/presentation_homework.md) +### [Zadania domowe](module1/03_homework.pl.md) + +___ + +# Build systems + + + Coders School + + +## [Module 1](module1/index.en.html) + +### [`make`](module1/01_make.en.md) + +### [`cmake`](module1/02_cmake.en.md) + +### [homework](module1/03_homework.en.md) \ No newline at end of file From e2823aa59ddd14b851758a23d73324aa7f84e5c5 Mon Sep 17 00:00:00 2001 From: Penthurion Date: Thu, 27 Aug 2020 13:10:00 +0200 Subject: [PATCH 12/25] deleted Coders School logo from english version --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 5fb7a5f..4a7e9c3 100644 --- a/README.md +++ b/README.md @@ -16,10 +16,6 @@ ___ # Build systems - - Coders School - - ## [Module 1](module1/index.en.html) ### [`make`](module1/01_make.en.md) From 23e1e750fab42a01de6c09b728934483874b5307 Mon Sep 17 00:00:00 2001 From: Penthurion <68010070+Penthurion@users.noreply.github.com> Date: Thu, 27 Aug 2020 14:46:39 +0200 Subject: [PATCH 13/25] Update module1/index.en.html Co-authored-by: MrMijagi <45121219+MrMijagi@users.noreply.github.com> --- module1/index.en.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module1/index.en.html b/module1/index.en.html index 40f1d66..a8ebf3d 100644 --- a/module1/index.en.html +++ b/module1/index.en.html @@ -115,7 +115,7 @@

Łukasz Ziobroń

data-separator-vertical="^___" data-separator-notes="^Note:">
-
From 328020c96fa16d0f5d4ec1677ae0de457d78d7c7 Mon Sep 17 00:00:00 2001 From: Penthurion <68010070+Penthurion@users.noreply.github.com> Date: Thu, 27 Aug 2020 14:46:50 +0200 Subject: [PATCH 14/25] Update module1/index.en.html Co-authored-by: MrMijagi <45121219+MrMijagi@users.noreply.github.com> --- module1/index.en.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module1/index.en.html b/module1/index.en.html index a8ebf3d..ebde480 100644 --- a/module1/index.en.html +++ b/module1/index.en.html @@ -107,7 +107,7 @@

Łukasz Ziobroń

You can change the port by using npm start -- --port=8001. --> -
From 68016a31ec5fd16412968fea32ab9d26d592661d Mon Sep 17 00:00:00 2001 From: Penthurion <68010070+Penthurion@users.noreply.github.com> Date: Thu, 27 Aug 2020 14:47:09 +0200 Subject: [PATCH 15/25] Update module1/01_make.en.md Co-authored-by: MrMijagi <45121219+MrMijagi@users.noreply.github.com> --- module1/01_make.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module1/01_make.en.md b/module1/01_make.en.md index 982a9a7..10f0d1b 100644 --- a/module1/01_make.en.md +++ b/module1/01_make.en.md @@ -47,7 +47,7 @@ calculator: ___ -## Compilation in C ++ +## Compilation in C++ ### Do you remember the build phases? From 7d913f5f6245245121f436973072867c5bd7bc12 Mon Sep 17 00:00:00 2001 From: Penthurion <68010070+Penthurion@users.noreply.github.com> Date: Thu, 27 Aug 2020 14:47:17 +0200 Subject: [PATCH 16/25] Update module1/02_cmake.en.md Co-authored-by: MrMijagi <45121219+MrMijagi@users.noreply.github.com> --- module1/02_cmake.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module1/02_cmake.en.md b/module1/02_cmake.en.md index 43f89db..a5c12c2 100644 --- a/module1/02_cmake.en.md +++ b/module1/02_cmake.en.md @@ -51,7 +51,7 @@ ___ Write simple CMakeLists.txt for program from `greeter` directory, build it with `cmake` and run. -Notice that there is also a tests. Write additional target for tests. +Notice that there are also tests. Write additional target for tests. ___ From 2979439348ae445b8ea12f2ae28ca2d70b858ef3 Mon Sep 17 00:00:00 2001 From: Penthurion <68010070+Penthurion@users.noreply.github.com> Date: Thu, 27 Aug 2020 14:47:25 +0200 Subject: [PATCH 17/25] Update module1/index.pl.html Co-authored-by: MrMijagi <45121219+MrMijagi@users.noreply.github.com> --- module1/index.pl.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module1/index.pl.html b/module1/index.pl.html index 2c63288..d3d34b5 100644 --- a/module1/index.pl.html +++ b/module1/index.pl.html @@ -115,7 +115,7 @@

Łukasz Ziobroń

data-separator-vertical="^___" data-separator-notes="^Note:">
-
From cc2c4799109a4372fe5aa9def29ea3849ac94323 Mon Sep 17 00:00:00 2001 From: Penthurion <68010070+Penthurion@users.noreply.github.com> Date: Thu, 27 Aug 2020 14:47:34 +0200 Subject: [PATCH 18/25] Update module1/index.en.html Co-authored-by: MrMijagi <45121219+MrMijagi@users.noreply.github.com> --- module1/index.en.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module1/index.en.html b/module1/index.en.html index ebde480..cb3c8d9 100644 --- a/module1/index.en.html +++ b/module1/index.en.html @@ -111,7 +111,7 @@

Łukasz Ziobroń

data-separator-vertical="^___" data-separator-notes="^Note:">
-
From c45393fe149765fa6d6f1ee4a053c5649d0248cb Mon Sep 17 00:00:00 2001 From: Penthurion <68010070+Penthurion@users.noreply.github.com> Date: Thu, 27 Aug 2020 14:48:46 +0200 Subject: [PATCH 19/25] Update module1/02_cmake.en.md Co-authored-by: MrMijagi <45121219+MrMijagi@users.noreply.github.com> --- module1/02_cmake.en.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module1/02_cmake.en.md b/module1/02_cmake.en.md index a5c12c2..0efd02d 100644 --- a/module1/02_cmake.en.md +++ b/module1/02_cmake.en.md @@ -30,7 +30,7 @@ add_executable(execName main.cpp file.cpp) ___ -## Building with CMake'a +## Building with CMake ```bash mkdir build # create a directory with the results of the building From ce81fdf3123e7e0490efce5369a986d91478e7ae Mon Sep 17 00:00:00 2001 From: Penthurion Date: Thu, 27 Aug 2020 14:59:27 +0200 Subject: [PATCH 20/25] fixed problem with mixed english and polish in files --- module1/01_make.pl.md | 46 +++++++-------- module1/02_cmake.pl.md | 128 ++++++++++++++++++++--------------------- 2 files changed, 87 insertions(+), 87 deletions(-) diff --git a/module1/01_make.pl.md b/module1/01_make.pl.md index 982a9a7..b0d7b6b 100644 --- a/module1/01_make.pl.md +++ b/module1/01_make.pl.md @@ -8,9 +8,9 @@ ___ -## Makefiles +## Pliki Makefile -### The structure of the Makefile +### Struktura pliku Makefile ```Makefile VARIABLE = value @@ -24,7 +24,7 @@ targetB: dependencyB1 ___ -## Example - generating a presentation in LaTeX +## Przykład - generowanie prezentacji w LaTeX ```Makefile TEX = pdflatex -shell-escape -interaction=nonstopmode -file-line-error @@ -47,9 +47,9 @@ calculator: ___ -## Compilation in C ++ +## Kompilacja w C++ -### Do you remember the build phases? +### Pamiętacie fazy kompilacji? ```Makefile @@ -64,24 +64,24 @@ $(OBJECTS): src/%.o : src/%.cpp src/%.hpp ``` -### Variables remembering the context +### Zmienne pamiętające kontekst -* $@ - the name of the target file in the currently running rule -* $< - first dependency name -* $^ - list of all dependencies (includes any duplicates) -* $? - a list of all dependencies that are newer than target +* $@ - nazwa pliku targetu w aktualnie uruchomionej regule +* $< - nazwa pierwszej zależności +* $^ - lista wszystkich zależności (zawiera ewentualne duplikaty) +* $? - lista wszystkich zależności, które są nowsze niż target ___ -## Exercise +## Zadanie -In the greeter directory you will find a small program. Familiarize yourself with its code. +W katalogu greeter znajdziesz malutki program. Zapoznaj się z jego kodem. -* Compile the program from the command line and run it. -* Write a simple Makefile for this program. Build it with `make` and run it. +* Skompiluj program z linii komend i uruchom go. +* Napisz prosty Makefile dla tego programu. Zbuduj go za pomocą `make` i uruchom. -### Spell of building +### Zaklęcie kompilacji ```bash g++ -std=c++17 -Wall -Werror -Wextra -pedantic *.cpp -o greeter @@ -90,19 +90,19 @@ g++ -std=c++17 -Wall -Werror -Wextra -pedantic *.cpp -o greeter ___ -## `make` command +## Polecenie `make` -* by default it looks for a Makefile in the current directory -* automates activities by executing recipes saved in Makefile files -* executes the first recipe by default -* allows for conditional performance of activities -* allows defining many dependencies -* by default, it takes into account dependency modification dates and on this basis decides whether to execute a given recipe +* domyślnie szuka w bieżącym katalogu pliku Makefile +* automatyzuje czynności poprzez wykonywanie receptur zapisanych w plikach Makefile +* domyślnie wykonuje pierwszą recepturę +* pozwala na warunkowe wykonywanie czynności +* pozwala definiować wiele zależności +* domyślnie uwzględnia daty modyfikacji zależności i na tej podstawie podejmuje decyzję, czy wykonać daną recepturę ___ ## Q&A -### links +### Linki [cpp-polska.pl](https://cpp-polska.pl/post/potwor-przeszlosci-makefile-cz-2) diff --git a/module1/02_cmake.pl.md b/module1/02_cmake.pl.md index 43f89db..0b7f847 100644 --- a/module1/02_cmake.pl.md +++ b/module1/02_cmake.pl.md @@ -10,16 +10,16 @@ ___ ## CMake -* automates the build process for C/C++ -* supports generating projects for multiple IDEs -* can consists of many modules that are combined (equivalent of #include) -* platform independent (if well written) -* build configuration in CMakeLists.txt file -* generate a build systems (e.g. Makefiles) +* automatyzuje proces budowania dla C/C++ +* obsługuje generowanie projektów dla wielu IDE +* może składać się z wielu modułów, które się łączy (odpowiednik #include) +* niezależny od platformy (jeśli jest dobrze napisany) +* konfiguracja budowania w pliku CMakeLists.txt +* generuje system budowania (np. pliki Makefile) ___ -## Minimal `CMakeLists.txt` +## Minimalny `CMakeLists.txt` ```cmake cmake_minimum_required(VERSION 3.10) @@ -30,28 +30,28 @@ add_executable(execName main.cpp file.cpp) ___ -## Building with CMake'a +## Budowanie za pomocą CMake'a ```bash -mkdir build # create a directory with the results of the building -cd build # enter this directory -cmake .. # generate the build system by specifying the path to the CMakeLists.txt file -cmake --build . # build a project +mkdir build # tworzymy katalog z wynikami budowania +cd build # wchodzimy do tego katalogu +cmake .. # generujemy system budowania podając ścieżkę do pliku CMakeLists.txt +cmake --build . # budujemy projekt ``` -`cmake --build` can be changed for `make` if we're sure, that we're generating Makefile. +`cmake --build` można zamienić na `make` jeśli wiemy, że na pewno generujemy Makefile. -`cmake --build` is universal. +`cmake --build` jest uniwersalne. ___ -## Exercise +## Zadanie -Write simple CMakeLists.txt for program from `greeter` directory, build it with `cmake` and run. +Napisz prosty CMakeLists.txt dla programu z katalogu `greeter`, zbuduj go za pomocą `cmake` i uruchom. -Notice that there is also a tests. Write additional target for tests. +Zauważ, że są tutaj też testy. Dopisz dodatkowy target dla testów. ___ @@ -59,17 +59,17 @@ ___ ___ -## CMake - variables +## CMake - zmienne -Variables are created with `set` command +Zmienne tworzymy za pomocą komendy `set` ```cmake -set(VARIABLE value) # Convention - UPPERCASE_WITH_UNDERSCORE +set(VARIABLE value) # Konwencja - UPPERCASE_WITH_UNDERSCORE ``` -For example +Przykładowo ```cmake @@ -77,7 +77,7 @@ set(NAME TheGreatestProject) ``` -We refer to them later by enclosing them in `{}` parentheses and preceding them with the `$` sign +Odnosimy się do nich później obejmując w nawiasy `{}` i poprzedzając znakiem `$` ```cmake @@ -85,17 +85,17 @@ add_executable(${NAME} main.cpp) ``` -That will create a target `TheGreatestProject` in which `main.cpp` file will be compiled +Spowoduje to utworzenie targetu `TheGreatestProject`, w ramach którego skompilowany zostanie plik `main.cpp` ___ -## CMake - predefined variables +## CMake - predefiniowane zmienne -CMake supplies several variables by default. Referring to them directly or modifying them is usually not considered good practice. +CMake domyślnie dostarcza kilka zmiennych. Odwoływanie się do nich bezpośrednio lub ich modyfikacja zazwyczaj nie są uznawane za dobre praktyki. -We can use the `$ {PROJECT_NAME}` variable without any problems. It contains the project name defined by the `project ()` command +Możemy za to bez większych problemów wykorzystać zmienną `${PROJECT_NAME}`. Zawiera ona nazwę projektu zdefiniowaną przez komendę `project()` ```cmake @@ -106,11 +106,11 @@ add_executable(${PROJECT_NAME} main.cpp vectorFunctions.cpp) ___ -## Create applications and libraries +## Tworzenie aplikacji i bibliotek [CMake manual](https://cmake.org/cmake/help/latest/manual/cmake-commands.7.html#id4) -You can treat the following commands as "constructors". They form "targets" +Poniższe komendy możesz potraktować jako "konstruktory". Tworzą one "targety". ```cmake add_executable( [source1] [source2 ...]) @@ -130,61 +130,61 @@ add_executable(${PROJECT_NAME}-ut test.cpp functions.cpp modules.cpp) ### Problem -Duplicated list of files in different "targets" +Powielona lista plików w różnych "targetach" ___ ### Problem #1 -Duplicated list of files in different "targets" +Powielona lista plików w różnych "targetach" -### Solution +### Rozwiązanie -Putting a list of files into a variable +Wrzucenie listy plików do zmiennej -## Exercise +## Zadanie -Put a list of files into a variable and use it +Wrzuć listę plików do zmiennej i skorzystaj z niej ___ ### Problem #2 -Minor differences in files between targets +Drobne różnice w plikach pomiędzy targetami -### Solution +### Rozwiązanie -Creating a library +Utworzenie biblioteki ___ -## Libraries +## Biblioteki -My library definition - a cluster of multiple cpp files without the `main ()` function. Therefore, the library cannot be run. +Moja definicja biblioteki - zlepek wielu plików cpp bez funkcji `main()`. Biblioteki nie można z tego powodu uruchomić. -### Analogy to object oriented programming +### Analogia do programowania obiektowego -* Library = class (base) - * fields, methods = cpp files -* Binary = derived class - * final, cannot be inherited from it -* Linking = inheritance - * linking a binary to a library means adding code from the library to it - * libraries can be linked with each other +* Biblioteka = klasa (bazowa) + * pola, metody = pliki cpp +* Binarka = klasa pochodna + * finalna, nie można po niej dziedziczyć +* Linkowanie = dziedziczenie + * zlinkowanie binarki z biblioteką oznacza dorzucenie do niej kodu z biblioteki + * biblioteki można ze sobą wzajemnie linkować ___ -## Linking libraries +## Linkowanie bibliotek ```cmake target_link_libraries( ... ... ...) @@ -200,15 +200,15 @@ target_link_libraries(ut lib) ``` -### Exercise +### Zadanie -Create a library that will contain duplicate cpp files and link to it with the targets that used them. +Utwórz bibliotekę, która będzie zawierać powtarzające się pliki cpp i zlinkuj z nią targety, które ich używały. ___ -## Build flags +## Flagi kompilacji ```cmake target_compile_options( [BEFORE] @@ -224,15 +224,15 @@ target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Werror) ``` -### Exercise +### Zadanie -Add build flags `-Wall -Wextra -Werror -pedantic -Wconversion -O3` to the greeter project +Dodaj flagi kompilacji `-Wall -Wextra -Werror -pedantic -Wconversion -O3` do projektu greeter ___ -## Enabling the C ++ 17 standard +## Włączanie standardu C++17 ```cmake set(CMAKE_CXX_STANDARD 17) @@ -240,7 +240,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) ``` -The above may not work for MSVC. +Powyższe może nie działać dla MSVC. ```cmake @@ -256,15 +256,15 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) ``` -### Exercise +### Zadanie -Enable the C++17 standard in the greeter project +Włącz standard C++17 w projekcie greeter ___ -## Adding tests to `ctest` +## Dodawanie testów do `ctest` ```cmake enable_testing() @@ -278,17 +278,17 @@ add_test(NAME someTests COMMAND ${PROJECT_NAME}-ut) ``` -### Exercise +### Zadanie -Add a test binary that should be run with `ctest` +Dodaj binarkę z testami, która powinna być odpalana za pomocą `ctest` ___ -## Build in debug mode +## Budowanie w trybie debug -By default, the "Release" mode is built (no debugging symbols) +Domyślnie budowany jest tryb "Release" (bez symboli debugowania) ```cmake @@ -296,7 +296,7 @@ cmake -DCMAKE_BUILD_TYPE=Debug .. ``` -If we want to support building in Debug and Release modes, we should have separate directories with build results +Jeśli chcemy wspierać budowanie w trybach Debug i Release powinniśmy mieć do nich oddzielne katalogi z rezultatami budowania ```bash @@ -309,7 +309,7 @@ cmake --build ___ -## Links for learning more +## Linki dla poszerzenia wiedzy * [CMake - from zero to something - prezentacja z Wro.cpp](https://muttleyxd.github.io) * [19 reasons why CMake is actually awesome](https://kubasejdak.com/19-reasons-why-cmake-is-actually-awesome) From 55d3101490d9b5d8a8f786f13999547206761b10 Mon Sep 17 00:00:00 2001 From: Penthurion Date: Thu, 27 Aug 2020 15:06:54 +0200 Subject: [PATCH 21/25] fixed polish/english mix problem --- module1/01_make.en.md | 2 +- module1/02_cmake.en.md | 4 ++-- module1/index.en.html | 6 +++--- module1/index.pl.html | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/module1/01_make.en.md b/module1/01_make.en.md index 10f0d1b..982a9a7 100644 --- a/module1/01_make.en.md +++ b/module1/01_make.en.md @@ -47,7 +47,7 @@ calculator: ___ -## Compilation in C++ +## Compilation in C ++ ### Do you remember the build phases? diff --git a/module1/02_cmake.en.md b/module1/02_cmake.en.md index 0efd02d..43f89db 100644 --- a/module1/02_cmake.en.md +++ b/module1/02_cmake.en.md @@ -30,7 +30,7 @@ add_executable(execName main.cpp file.cpp) ___ -## Building with CMake +## Building with CMake'a ```bash mkdir build # create a directory with the results of the building @@ -51,7 +51,7 @@ ___ Write simple CMakeLists.txt for program from `greeter` directory, build it with `cmake` and run. -Notice that there are also tests. Write additional target for tests. +Notice that there is also a tests. Write additional target for tests. ___ diff --git a/module1/index.en.html b/module1/index.en.html index cb3c8d9..40f1d66 100644 --- a/module1/index.en.html +++ b/module1/index.en.html @@ -107,15 +107,15 @@

Łukasz Ziobroń

You can change the port by using npm start -- --port=8001. --> -
-
-
diff --git a/module1/index.pl.html b/module1/index.pl.html index d3d34b5..2c63288 100644 --- a/module1/index.pl.html +++ b/module1/index.pl.html @@ -115,7 +115,7 @@

Łukasz Ziobroń

data-separator-vertical="^___" data-separator-notes="^Note:">
-
From 864f9fe61a776f6d80a98ef3c6fbc72b57e5d58f Mon Sep 17 00:00:00 2001 From: Penthurion Date: Thu, 27 Aug 2020 15:14:30 +0200 Subject: [PATCH 22/25] fixed filenames linked in index.pl.html --- module1/index.pl.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module1/index.pl.html b/module1/index.pl.html index 2c63288..356d48d 100644 --- a/module1/index.pl.html +++ b/module1/index.pl.html @@ -107,15 +107,15 @@

Łukasz Ziobroń

You can change the port by using npm start -- --port=8001. --> -
-
-
From f2501928d56712f8612c62c2417f722c0e484776 Mon Sep 17 00:00:00 2001 From: Penthurion <68010070+Penthurion@users.noreply.github.com> Date: Fri, 28 Aug 2020 14:59:31 +0200 Subject: [PATCH 23/25] Update module1/index.en.html Co-authored-by: MrMijagi <45121219+MrMijagi@users.noreply.github.com> --- module1/index.en.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module1/index.en.html b/module1/index.en.html index 40f1d66..2857cac 100644 --- a/module1/index.en.html +++ b/module1/index.en.html @@ -107,7 +107,7 @@

Łukasz Ziobroń

You can change the port by using npm start -- --port=8001. --> -
From f0605db63a3789270b84e34af961e8787bc119c7 Mon Sep 17 00:00:00 2001 From: Penthurion <68010070+Penthurion@users.noreply.github.com> Date: Fri, 28 Aug 2020 14:59:40 +0200 Subject: [PATCH 24/25] Update module1/index.en.html Co-authored-by: MrMijagi <45121219+MrMijagi@users.noreply.github.com> --- module1/index.en.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module1/index.en.html b/module1/index.en.html index 2857cac..d0da602 100644 --- a/module1/index.en.html +++ b/module1/index.en.html @@ -111,7 +111,7 @@

Łukasz Ziobroń

data-separator-vertical="^___" data-separator-notes="^Note:">
-
From c533a467c36057870d7adb909b9fed8e60ee1125 Mon Sep 17 00:00:00 2001 From: Penthurion <68010070+Penthurion@users.noreply.github.com> Date: Fri, 28 Aug 2020 14:59:48 +0200 Subject: [PATCH 25/25] Update module1/index.en.html Co-authored-by: MrMijagi <45121219+MrMijagi@users.noreply.github.com> --- module1/index.en.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module1/index.en.html b/module1/index.en.html index d0da602..cb3c8d9 100644 --- a/module1/index.en.html +++ b/module1/index.en.html @@ -115,7 +115,7 @@

Łukasz Ziobroń

data-separator-vertical="^___" data-separator-notes="^Note:">
-