Skip to content

Commit

Permalink
refactor: use shared library in fantastic example (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsanima authored Apr 25, 2024
1 parent aff9c95 commit 1814cea
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
10 changes: 10 additions & 0 deletions example/mdsanima-fantastic/lib.cc
Original file line number Diff line number Diff line change
@@ -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 <iostream>

void mprint(const char* text) { std::cout << text << '\n'; }
13 changes: 13 additions & 0 deletions example/mdsanima-fantastic/lib.hh
Original file line number Diff line number Diff line change
@@ -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);
9 changes: 6 additions & 3 deletions example/mdsanima-fantastic/main.cc
Original file line number Diff line number Diff line change
@@ -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 <iostream>
#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);
}

0 comments on commit 1814cea

Please sign in to comment.