Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lesson 5 materials #5

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lesson5/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.15)
project(formatter CXX)

find_package(fmt REQUIRED)

add_executable(formatter src/main.cpp)
target_link_libraries(formatter fmt::fmt)
15 changes: 15 additions & 0 deletions lesson5/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from conan import ConanFile
from conan.tools.cmake import cmake_layout

class FormatterRecipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeToolchain", "CMakeDeps"

def requirements(self):
self.requires("fmt/11.0.2")

def build_requirements(self):
self.tool_requires("cmake/3.31.5")

def layout(self):
cmake_layout(self)
12 changes: 12 additions & 0 deletions lesson5/profiles/raspberry
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[settings]
os=Linux
arch=armv7hf
compiler=gcc
build_type=Release
compiler.cppstd=gnu14
compiler.libcxx=libstdc++11
compiler.version=12
[buildenv]
CC=arm-linux-gnueabihf-gcc-12
CXX=arm-linux-gnueabihf-g++-12
LD=arm-linux-gnueabihf-ld
19 changes: 19 additions & 0 deletions lesson5/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <fmt/core.h>
#include <fmt/color.h>

int main() {
fmt::print(fmt::fg(fmt::color::cyan) | fmt::emphasis::bold,
"Conan is a MIT-licensed, Open Source ");
fmt::print(fmt::fg(fmt::color::white),
"package manager for C and C++ development\n");

#ifdef NDEBUG
fmt::print(fmt::fg(fmt::color::green) | fmt::emphasis::italic,
"Release configuration!\n");
#else
fmt::print(fmt::fg(fmt::color::yellow) | fmt::emphasis::italic,
"Debug configuration!\n");
#endif

return 0;
}