Skip to content

Commit 8994fb6

Browse files
committed
Add boson API as module
1 parent 02b7bf3 commit 8994fb6

File tree

5 files changed

+55
-3
lines changed

5 files changed

+55
-3
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
cmake:
1212
type: string
1313
# This default value shows off how to inline the desktop and loop module to produce a single shared library that contains all commonly required functionality
14-
default: -Dsaucer_bindings_static=ON -Dsaucer_bindings_modules="desktop;loop" -Dsaucer_bindings_inline_modules="desktop;loop"
14+
default: -Dsaucer_bindings_static=ON -Dsaucer_bindings_modules="desktop;loop;boson" -Dsaucer_bindings_inline_modules="desktop;loop;boson"
1515
description: Additional CMake Arguments to pass
1616

1717
concurrency:

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ option(saucer_bindings_static "Build saucer as a static library" OFF)
1111
# | Library options |
1212
# +-------------------------------------------------------------------------------------------------------+
1313

14-
set(saucer_bindings_modules "desktop;pdf;loop" CACHE STRING "A list of modules to build")
15-
set(saucer_bindings_inline_modules "loop" CACHE STRING "A list of modules to inline into the built library")
14+
set(saucer_bindings_modules "desktop;pdf;loop;boson" CACHE STRING "A list of modules to build")
15+
set(saucer_bindings_inline_modules "loop" CACHE STRING "A list of modules to inline into the built library")
1616

1717
# +-------------------------------------------------------------------------------------------------------+
1818
# | Convenience wrapper over `message` |

modules/boson/CMakeLists.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# --------------------------------------------------------------------------------------------------------
2+
# Setup library
3+
# --------------------------------------------------------------------------------------------------------
4+
5+
saucer_bindings_add_module(desktop "BOSON_EXPORT")
6+
7+
# --------------------------------------------------------------------------------------------------------
8+
# Include directories
9+
# --------------------------------------------------------------------------------------------------------
10+
11+
target_include_directories(${MODULE_NAME} PUBLIC "include")
12+
target_include_directories(${MODULE_NAME} PRIVATE "include/saucer")
13+
14+
# --------------------------------------------------------------------------------------------------------
15+
# Add Sources
16+
# --------------------------------------------------------------------------------------------------------
17+
18+
add_compile_definitions(BOSON_VERSION="0.6.0")
19+
20+
target_sources(${MODULE_NAME} PRIVATE
21+
"src/boson.cpp"
22+
)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#pragma once
2+
3+
#ifdef __cplusplus
4+
extern "C"
5+
{
6+
#endif
7+
8+
#include "export.h"
9+
10+
BOSON_EXPORT const char* boson_version();
11+
12+
#ifdef __cplusplus
13+
}
14+
#endif

modules/boson/src/boson.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include "boson.h"
2+
3+
#define BOSON_STRING(value) #value
4+
#define BOSON_STRING_EXPAND(value) BOSON_STRING(value)
5+
6+
extern "C"
7+
{
8+
const char* boson_version()
9+
{
10+
#ifndef BOSON_VERSION
11+
#define unknown-dev
12+
#endif
13+
14+
return BOSON_STRING_EXPAND(BOSON_VERSION) "";
15+
}
16+
}

0 commit comments

Comments
 (0)