Skip to content

Commit 678c8f7

Browse files
CI: build with hidden symbols using Clang (#1675)
* CI: build with hidden symbols using Clang Good to able to do this. No tests as not exposed classes are accessed in tests Relates-To: MINOR Signed-off-by: Rustam Gamidov <ext-rustam.gamidov@here.com> * Examples: export functions from libs To utilize in the common binary Relates-To: MINOR Signed-off-by: Rustam Gamidov <ext-rustam.gamidov@here.com> * Make boost::json header only in the read lib Otherwise there are unresolved external symbols when built with visibility=hidden Relates-To: MINOR Signed-off-by: Rustam Gamidov <ext-rustam.gamidov@here.com> --------- Signed-off-by: Rustam Gamidov <ext-rustam.gamidov@here.com>
1 parent 83e0549 commit 678c8f7

File tree

9 files changed

+101
-17
lines changed

9 files changed

+101
-17
lines changed

.github/workflows/psv_pipelines.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,25 @@ jobs:
173173
run: scripts/linux/psv/build_psv.sh
174174
shell: bash
175175

176+
psv-linux-22-04-clang-hidden-build:
177+
name: PSV.Linux.22.04.clang.hidden
178+
runs-on: ubuntu-22.04
179+
env:
180+
BUILD_TYPE: RelWithDebInfo
181+
CC: clang-11
182+
CXX: clang++-11
183+
CXXFLAGS: -Wno-deprecated-copy
184+
EXTRA_CMAKE_OPTIONS: -DCMAKE_CXX_VISIBILITY_PRESET=hidden -DOLP_SDK_ENABLE_TESTING=OFF
185+
steps:
186+
- name: Check out repository
187+
uses: actions/checkout@v4
188+
- name: Install Ubuntu dependencies
189+
run: sudo apt-get update -y && sudo apt-get install clang-11 ccache libcurl4-openssl-dev -y --no-install-recommends --fix-missing
190+
shell: bash
191+
- name: Compile project on Clang
192+
run: scripts/linux/psv/build_psv.sh
193+
shell: bash
194+
176195
psv-android-22-04-build:
177196
name: PSV.Linux.Android.22.04
178197
runs-on: ubuntu-22.04

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: 14 additions & 3 deletions
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,10 +19,21 @@
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

24-
struct AccessKey
25-
{
36+
struct AccessKey {
2637
std::string id; // Your here.access.key.id
2738
std::string secret; // Your here.access.key.secret
2839
};

examples/ProtectedCacheExample.h

Lines changed: 12 additions & 7 deletions
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.
@@ -21,14 +21,19 @@
2121

2222
#include "Examples.h"
2323

24+
#include <string>
25+
2426
/**
25-
* @brief Dataservice cache example.
27+
* @brief Dataservice cache example.
2628
*
27-
* Gets the partition data using the HERE Open Location Platform with mutable cache.
28-
* Makes the mutable cache path
29-
* protected. Reads the same data from the protected cache.
29+
* Gets the partition data using the HERE Open Location Platform with mutable
30+
* cache. Makes the mutable cache path protected. Reads the same data from the
31+
* protected cache.
3032
* @param access_key Your access key ID and access key secret.
31-
* @param The HERE Resource Name (HRN) of the catalog from which you want to read data.
33+
* @param The HERE Resource Name (HRN) of the catalog from which you want to
34+
* read data.
3235
* @return 0 if data was published successfully.
3336
*/
34-
int RunExampleProtectedCache(const AccessKey& access_key, const std::string& catalog);
37+
EXAMPLES_API
38+
int RunExampleProtectedCache(const AccessKey& access_key,
39+
const std::string& catalog);

examples/ReadExample.h

Lines changed: 3 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.
@@ -22,6 +22,7 @@
2222
#include "Examples.h"
2323

2424
#include <olp/core/porting/optional.h>
25+
#include <string>
2526

2627
/**
2728
* @brief Dataservice read example. Authenticate client using access key id and
@@ -33,6 +34,7 @@
3334
* @param catalog_version The desired version of the catalog.
3435
* @return result of publish data(0 - if succeed)
3536
*/
37+
EXAMPLES_API
3638
int RunExampleRead(const AccessKey& access_key, const std::string& catalog,
3739
const olp::porting::optional<int64_t>& catalog_version =
3840
olp::porting::none);

examples/StreamLayerReadExample.h

Lines changed: 3 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.
@@ -22,6 +22,7 @@
2222
#include "Examples.h"
2323

2424
#include <olp/dataservice/read/SubscribeRequest.h>
25+
#include <string>
2526

2627
/**
2728
* @brief Dataservice read from stream layer example. Authenticate client using
@@ -34,6 +35,7 @@
3435
* @param subscription_mode The type of client subscription.
3536
* @return 0 on success, -1 otherwise.
3637
*/
38+
EXAMPLES_API
3739
int RunStreamLayerExampleRead(
3840
const AccessKey& access_key, const std::string& catalog,
3941
const std::string& layer_id,

examples/WriteExample.h

Lines changed: 8 additions & 3 deletions
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.
@@ -21,13 +21,18 @@
2121

2222
#include "Examples.h"
2323

24+
#include <string>
25+
2426
/**
2527
* @brief Dataservice write example. Authenticate client using access key id and
2628
* secret. Publish data to some layer in HRN catalog.
2729
* @param access_key Your access key ID and access key secret.
28-
* @param The HERE Resource Name (HRN) of the catalog to which you want to publish data.
29-
* @param layer_id The layer ID of the catalog to which you want to publish data.
30+
* @param The HERE Resource Name (HRN) of the catalog to which you want to
31+
* publish data.
32+
* @param layer_id The layer ID of the catalog to which you want to publish
33+
* data.
3034
* @return result of publish data(0 - if succeed)
3135
*/
36+
EXAMPLES_API
3237
int RunExampleWrite(const AccessKey& access_key, const std::string& catalog,
3338
const std::string& layer_id);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright (C) 2026 HERE Europe B.V.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
* License-Filename: LICENSE
18+
*/
19+
20+
#include <boost/json/src.hpp>

scripts/linux/psv/build_psv.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash -ex
22
#
3-
# Copyright (C) 2019-2020 HERE Europe B.V.
3+
# Copyright (C) 2019-2026 HERE Europe B.V.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -30,6 +30,7 @@ cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
3030
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
3131
-DOLP_SDK_BUILD_EXAMPLES=ON \
3232
-DBUILD_SHARED_LIBS=ON \
33+
$EXTRA_CMAKE_OPTIONS \
3334
..
3435

3536
make -j$(nproc)

0 commit comments

Comments
 (0)