Skip to content

Commit 8113b2e

Browse files
Examples: export functions from libs
To utilize in the common binary Relates-To: MINOR Signed-off-by: Rustam Gamidov <ext-rustam.gamidov@here.com>
1 parent d1bfa5d commit 8113b2e

File tree

6 files changed

+41
-6
lines changed

6 files changed

+41
-6
lines changed

examples/CMakeLists.txt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2019-2020 HERE Europe B.V.
1+
# Copyright (C) 2019-2026 HERE Europe B.V.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -81,6 +81,25 @@ else()
8181
olp-cpp-sdk-authentication
8282
olp-cpp-sdk-dataservice-read)
8383

84+
target_compile_definitions(${OLP_SDK_DATASERVICE_READ_EXAMPLE_TARGET}
85+
PRIVATE EXAMPLES_LIBRARY)
86+
target_compile_definitions(${OLP_SDK_DATASERVICE_WRITE_EXAMPLE_TARGET}
87+
PRIVATE EXAMPLES_LIBRARY)
88+
target_compile_definitions(${OLP_SDK_DATASERVICE_CACHE_EXAMPLE_TARGET}
89+
PRIVATE EXAMPLES_LIBRARY)
90+
target_compile_definitions(${OLP_SDK_DATASERVICE_READ_STREAM_LAYER_EXAMPLE_TARGET}
91+
PRIVATE EXAMPLES_LIBRARY)
92+
if(BUILD_SHARED_LIBS)
93+
target_compile_definitions(${OLP_SDK_DATASERVICE_READ_EXAMPLE_TARGET}
94+
PUBLIC EXAMPLES_SHARED_LIBRARY)
95+
target_compile_definitions(${OLP_SDK_DATASERVICE_WRITE_EXAMPLE_TARGET}
96+
PUBLIC EXAMPLES_SHARED_LIBRARY)
97+
target_compile_definitions(${OLP_SDK_DATASERVICE_CACHE_EXAMPLE_TARGET}
98+
PUBLIC EXAMPLES_SHARED_LIBRARY)
99+
target_compile_definitions(${OLP_SDK_DATASERVICE_READ_STREAM_LAYER_EXAMPLE_TARGET}
100+
PUBLIC EXAMPLES_SHARED_LIBRARY)
101+
endif()
102+
84103
add_executable(${OLP_SDK_DATASERVICE_EXAMPLE_TARGET}
85104
./main.cpp
86105
./Examples.h

examples/Examples.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2020 HERE Europe B.V.
2+
* Copyright (C) 2019-2026 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,6 +19,18 @@
1919

2020
#pragma once
2121

22+
#include <olp/core/porting/export.h>
23+
24+
#ifdef EXAMPLES_SHARED_LIBRARY
25+
#ifdef EXAMPLES_LIBRARY
26+
#define EXAMPLES_API OLP_CPP_SDK_DECL_EXPORT
27+
#else
28+
#define EXAMPLES_API OLP_CPP_SDK_DECL_IMPORT
29+
#endif // EXAMPLES_LIBRARY
30+
#else
31+
#define EXAMPLES_API
32+
#endif // EXAMPLES_SHARED_LIBRARY
33+
2234
#include <string>
2335

2436
struct AccessKey

examples/ProtectedCacheExample.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2020 HERE Europe B.V.
2+
* Copyright (C) 2020-2026 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,4 +31,5 @@
3131
* @param The HERE Resource Name (HRN) of the catalog from which you want to read data.
3232
* @return 0 if data was published successfully.
3333
*/
34+
EXAMPLES_API
3435
int RunExampleProtectedCache(const AccessKey& access_key, const std::string& catalog);

examples/ReadExample.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2020 HERE Europe B.V.
2+
* Copyright (C) 2019-2026 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,6 +33,7 @@
3333
* @param catalog_version The desired version of the catalog.
3434
* @return result of publish data(0 - if succeed)
3535
*/
36+
EXAMPLES_API
3637
int RunExampleRead(const AccessKey& access_key, const std::string& catalog,
3738
const olp::porting::optional<int64_t>& catalog_version =
3839
olp::porting::none);

examples/StreamLayerReadExample.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2020 HERE Europe B.V.
2+
* Copyright (C) 2019-2026 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@
3434
* @param subscription_mode The type of client subscription.
3535
* @return 0 on success, -1 otherwise.
3636
*/
37+
EXAMPLES_API
3738
int RunStreamLayerExampleRead(
3839
const AccessKey& access_key, const std::string& catalog,
3940
const std::string& layer_id,

examples/WriteExample.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2019-2020 HERE Europe B.V.
2+
* Copyright (C) 2019-2026 HERE Europe B.V.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,5 +29,6 @@
2929
* @param layer_id The layer ID of the catalog to which you want to publish data.
3030
* @return result of publish data(0 - if succeed)
3131
*/
32+
EXAMPLES_API
3233
int RunExampleWrite(const AccessKey& access_key, const std::string& catalog,
3334
const std::string& layer_id);

0 commit comments

Comments
 (0)