diff --git a/CMakeLists.txt b/CMakeLists.txt index 05d722a..384de0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,8 +9,11 @@ set(CMAKE_CXX_EXTENSIONS OFF) project(mdsanima VERSION 0.2.1) -# Example demo programs +# Example demo program add_executable(${PROJECT_NAME}-fantastic example/mdsanima-fantastic/main.cc) +add_library(fantastic SHARED example/mdsanima-fantastic/lib.cc) +target_link_libraries(${PROJECT_NAME}-fantastic fantastic) + add_executable(${PROJECT_NAME}-incredible example/mdsanima-incredible/main.cpp) add_executable(${PROJECT_NAME}-stunning example/mdsanima-stunning/main.cxx) diff --git a/example/mdsanima-fantastic/lib.cc b/example/mdsanima-fantastic/lib.cc new file mode 100644 index 0000000..7dd6075 --- /dev/null +++ b/example/mdsanima-fantastic/lib.cc @@ -0,0 +1,10 @@ +// Copyright (c) 2024 MDSANIMA LAB. All rights reserved. +// Licensed under the MIT license. + +// Simple C++ example demo of `FANTASTIC` shared library implementation. + +#include "lib.hh" + +#include + +void mprint(const char* text) { std::cout << text << '\n'; } diff --git a/example/mdsanima-fantastic/lib.hh b/example/mdsanima-fantastic/lib.hh new file mode 100644 index 0000000..aa770f6 --- /dev/null +++ b/example/mdsanima-fantastic/lib.hh @@ -0,0 +1,13 @@ +// Copyright (c) 2024 MDSANIMA LAB. All rights reserved. +// Licensed under the MIT license. + +// Simple C++ example demo of `FANTASTIC` shared library header file. + +#pragma once + +/** + * Simple text message printing implementation for the demo purpose only. + * + * @param text The text message to print in the terminal. + */ +void mprint(const char* text); diff --git a/example/mdsanima-fantastic/main.cc b/example/mdsanima-fantastic/main.cc index e27d629..bb8ba69 100644 --- a/example/mdsanima-fantastic/main.cc +++ b/example/mdsanima-fantastic/main.cc @@ -1,8 +1,11 @@ // Copyright (c) 2024 MDSANIMA LAB. All rights reserved. // Licensed under the MIT license. -// Simple C++ implementation of the example `MDSANIMA FANTASTIC` demo project. +// The main program of `MDSANIMA FANTASTIC` example demo project. -#include +#include "lib.hh" -auto main() -> int { std::cout << "Hello World from the MDSANIMA FANTASTIC" << '\n'; } +auto main() -> int { + const char* message = "Hello World from the MDSANIMA FANTASTIC"; + mprint(message); +}