From cc9143058fe3bb4fd59b8bc1b41736c07f46233c Mon Sep 17 00:00:00 2001 From: Tim Geypens Date: Mon, 16 Sep 2024 20:09:13 +0200 Subject: [PATCH] fix CMAKE_SYSTEM_NAME for Android and QNX (#372) Co-authored-by: Milan Vukov --- repositories/cyclonedds.BUILD.bazel | 55 ++++++++++++++++++++++------- repositories/iceoryx.BUILD.bazel | 12 +++++-- 2 files changed, 52 insertions(+), 15 deletions(-) diff --git a/repositories/cyclonedds.BUILD.bazel b/repositories/cyclonedds.BUILD.bazel index 180eec47..c530bee5 100644 --- a/repositories/cyclonedds.BUILD.bazel +++ b/repositories/cyclonedds.BUILD.bazel @@ -40,17 +40,17 @@ selects.config_setting_group( ) selects.config_setting_group( - name = "android_or_qnx", - match_any = [ + name = "android_with_shm", + match_all = [ "@platforms//os:android", - "@platforms//os:qnx", + ":enable_shm_on", ], ) selects.config_setting_group( - name = "android_or_qnx_with_shm", + name = "qnx_with_shm", match_all = [ - ":android_or_qnx", + "@platforms//os:qnx", ":enable_shm_on", ], ) @@ -64,9 +64,17 @@ selects.config_setting_group( ) selects.config_setting_group( - name = "android_or_qnx_without_shm", + name = "android_without_shm", match_all = [ - ":android_or_qnx", + "@platforms//os:android", + ":enable_shm_off", + ], +) + +selects.config_setting_group( + name = "qnx_without_shm", + match_all = [ + "@platforms//os:qnx", ":enable_shm_off", ], ) @@ -104,10 +112,17 @@ cache_entries_linux_and_macos = { "ENABLE_SOURCE_SPECIFIC_MULTICAST": "ON", } -cache_entries_qnx = { +cache_entries_android_and_qnx = { "ENABLE_SOURCE_SPECIFIC_MULTICAST": "OFF", "ENABLE_IPV6": "OFF", - "CMAKE_SYSTEM_NAME": "ANDROID_OR_QNX", +} + +cache_entries_android = { + "CMAKE_SYSTEM_NAME": "Android", +} + +cache_entries_qnx = { + "CMAKE_SYSTEM_NAME": "QNX", } cache_entries_with_shm = { @@ -132,9 +147,16 @@ cmake( cache_entries_linux_and_macos, cache_entries_with_shm, ), - ":android_or_qnx_with_shm": dicts.add( + ":android_with_shm": dicts.add( + cache_entries, + cache_entries_android, + cache_entries_android_and_qnx, + cache_entries_with_shm, + ), + ":qnx_with_shm": dicts.add( cache_entries, cache_entries_qnx, + cache_entries_android_and_qnx, cache_entries_with_shm, ), ":linux_or_macos_without_shm": dicts.add( @@ -142,9 +164,16 @@ cmake( cache_entries_linux_and_macos, cache_entries_without_shm, ), - ":android_or_qnx_without_shm": dicts.add( + ":android_without_shm": dicts.add( + cache_entries, + cache_entries_android, + cache_entries_android_and_qnx, + cache_entries_without_shm, + ), + ":qnx_without_shm": dicts.add( cache_entries, cache_entries_qnx, + cache_entries_android_and_qnx, cache_entries_without_shm, ), }, @@ -152,10 +181,10 @@ cmake( ), generate_args = ["-GNinja"], lib_source = ":all_srcs", - linkopts = select( + linkopts = selects.with_or( { ":linux_or_macos": ["-lpthread"], - ":android_or_qnx": [], + ("@platforms//os:android", "@platforms//os:qnx"): [], }, no_match_error = "Supported OSs: Android, Linux, macOS, QNX", ), diff --git a/repositories/iceoryx.BUILD.bazel b/repositories/iceoryx.BUILD.bazel index df339dc8..b2a701ae 100644 --- a/repositories/iceoryx.BUILD.bazel +++ b/repositories/iceoryx.BUILD.bazel @@ -13,8 +13,12 @@ cache_entries = { "CCACHE": "OFF", } +cache_entries_android = { + "CMAKE_SYSTEM_NAME": "Android", +} + cache_entries_qnx = { - "CMAKE_SYSTEM_NAME": "ANDROID_OR_QNX", + "CMAKE_SYSTEM_NAME": "QNX", } # Depends on libacl. On Ubuntu install as `sudo apt-get install libacl1-dev`. @@ -27,7 +31,11 @@ cmake( cache_entries = selects.with_or( { ("@platforms//os:linux", "@platforms//os:macos"): cache_entries, - ("@platforms//os:android", "@platforms//os:qnx"): dicts.add( + "@platforms//os:android": dicts.add( + cache_entries, + cache_entries_android, + ), + "@platforms//os:qnx": dicts.add( cache_entries, cache_entries_qnx, ),