Skip to content

Commit 96fc0fd

Browse files
committed
Add library example with C++
1 parent 4af3ad9 commit 96fc0fd

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

examples/cpp/lib/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# cmake
2+
build/

examples/cpp/lib/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
cmake_minimum_required(VERSION 3.16) # default of ubuntu:20.04
2+
project(ocipkg_example_cpp_lib)
3+
add_library(ocipkg_static_cpp STATIC lib.cpp)
4+
install(TARGETS ocipkg_static_cpp ARCHIVE)
5+
include(CPack)

examples/cpp/lib/lib.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include <iostream>
2+
3+
extern "C" {
4+
void hello_from_cpp() {
5+
std::cout << "Hello from C++!" << std::endl;
6+
}
7+
}

0 commit comments

Comments
 (0)