From 0272f5e79d3333a2d0bc754a1fed416d935bda1d Mon Sep 17 00:00:00 2001 From: "Y. Velkov" Date: Fri, 30 Aug 2024 10:14:35 +0300 Subject: [PATCH] initial code --- .gitignore | 2 ++ CMakeLists.txt | 9 +++++++++ src/main.cpp | 11 +++++++++++ src/my_shared_lib.cpp | 4 ++++ src/my_static_lib.cpp | 4 ++++ 5 files changed, 30 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 src/main.cpp create mode 100644 src/my_shared_lib.cpp create mode 100644 src/my_static_lib.cpp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b159eae --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build/ +compile_commands.json \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..69da88d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,9 @@ +project(coverage_action) + + +add_library(my_static_lib STATIC src/my_static_lib.cpp) +add_library(my_shared_lib SHARED src/my_shared_lib.cpp) + + +add_executable(main src/main.cpp) +target_link_libraries(main my_static_lib my_shared_lib) \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..fa5c2bb --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,11 @@ +#include + +int method_in_shared_lib(); +int method_in_static_lib(); + +int main() { + std::cout << "Hello, World!" << std::endl; + std::cout << "method_in_shared_lib() returned: " << method_in_shared_lib() << std::endl; + std::cout << "method_in_static_lib() returned: " << method_in_static_lib() << std::endl; + return 0; +} \ No newline at end of file diff --git a/src/my_shared_lib.cpp b/src/my_shared_lib.cpp new file mode 100644 index 0000000..6cdbb71 --- /dev/null +++ b/src/my_shared_lib.cpp @@ -0,0 +1,4 @@ + +int method_in_shared_lib() { + return 42; +} \ No newline at end of file diff --git a/src/my_static_lib.cpp b/src/my_static_lib.cpp new file mode 100644 index 0000000..271923b --- /dev/null +++ b/src/my_static_lib.cpp @@ -0,0 +1,4 @@ + +int method_in_static_lib() { + return 42; +} \ No newline at end of file