Skip to content

Commit

Permalink
refactor: use shared library in stunning example
Browse files Browse the repository at this point in the history
This program is the same as `mdsanima-fantastic` but in different
file extension for the demo purpose only.

Related: #40
  • Loading branch information
mdsanima committed Apr 25, 2024
1 parent 99c3fe5 commit c460bc3
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@ set(CMAKE_CXX_EXTENSIONS OFF)

project(mdsanima VERSION 0.2.1)

# Example demo fantastic program
# Example demo program fantastic
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)

# Example demo incredible program
# Example demo program incredible
add_executable(${PROJECT_NAME}-incredible example/mdsanima-incredible/main.cpp)
add_library(incredible SHARED example/mdsanima-incredible/lib.cpp)
target_link_libraries(${PROJECT_NAME}-incredible incredible)

# Example demo stunning program
# Example demo program stunning
add_executable(${PROJECT_NAME}-stunning example/mdsanima-stunning/main.cxx)
add_library(stunning SHARED example/mdsanima-stunning/lib.cxx)
target_link_libraries(${PROJECT_NAME}-stunning stunning)

# Project demo programs
add_executable(${PROJECT_NAME}-amarok project/mdsanima-amarok/main.c)
Expand Down
10 changes: 10 additions & 0 deletions example/mdsanima-stunning/lib.cxx
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 `STUNNING` shared library implementation.

#include "lib.hxx"

#include <iostream>

void mprint(const char* text) { std::cout << text << '\n'; }
13 changes: 13 additions & 0 deletions example/mdsanima-stunning/lib.hxx
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 `STUNNING` 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-stunning/main.cxx
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 STUNNING` demo project.
// The main C++ program of `MDSANIMA STUNNING` example demo project.

#include <iostream>
#include "lib.hxx"

auto main() -> int { std::cout << "Hello World from the MDSANIMA STUNNING" << '\n'; }
auto main() -> int {
const char* message = "Hello World from the MDSANIMA STUNNING";
mprint(message);
}

0 comments on commit c460bc3

Please sign in to comment.