Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,21 @@ cc_test(
name = "math_lib_test",
srcs = ["math_lib_test.cpp"],
deps = [":math_lib"],
linkstatic = True,
)

cc_shared_library(
name = "math_lib_shared",
shared_lib_name = "libmath_lib.so",
deps = [":math_lib"],
)

cc_test(
name = "math_lib_dyn_test",
srcs = ["math_lib_test.cpp"],
deps = [":math_lib"],
dynamic_deps = [":math_lib_shared"],
linkstatic = False,
)

cc_test(
Expand All @@ -45,4 +60,4 @@ cc_test(
"@googletest//:gtest",
"@googletest//:gtest_main",
]
)
)
2 changes: 2 additions & 0 deletions examples/math_lib_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
********************************************************************************/

#include "math_lib.h"
#include <iostream>
#include <cassert>

int main() {
assert(add(2, 3) == 5);
assert(sub(5, 3) == 2);
std::cout << "add(2, 3) = " << add(2, 3) << std::endl;

// Note: sub(3, 5) is NOT tested → coverage will show a missed branch
return 0;
Expand Down
21 changes: 21 additions & 0 deletions templates/qnx/cc_toolchain_config.bzl.template
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,26 @@ def _impl(ctx):
],
)

# QNX uses -Wl,-rpath instead of -rpath
runtime_library_search_directories_feature = feature(
name = "runtime_library_search_directories",
flag_sets = [
flag_set(
actions = all_link_actions,
flag_groups = [
flag_group(
iterate_over = "runtime_library_search_directories",
flag_groups = [
flag_group(
flags = ["-Wl,-rpath,$EXEC_ORIGIN/%{runtime_library_search_directories}"],
),
],
),
],
),
],
)

# The order of the features is relevant, they are applied in this specific order.
# A command line parameter from a feature at the end of the list will appear
# after a command line parameter from a feature at the beginning of the list.
Expand All @@ -420,6 +440,7 @@ def _impl(ctx):
use_license_env_info_feautre,
sdp_env_feature,
supports_pic_feature,
runtime_library_search_directories_feature,
]

cxx_builtin_include_directories = [
Expand Down