diff --git a/.azure/templates/build-test.yml b/.azure/templates/build-test.yml index 15b92e363c..f28dd12c4d 100644 --- a/.azure/templates/build-test.yml +++ b/.azure/templates/build-test.yml @@ -137,11 +137,16 @@ steps: prefix_path="${BUILD_SOURCESDIRECTORY}/build-sharedlibs/install:${prefix_path}" crosscompiling="-DCMAKE_CROSSCOMPILING=1 -DCMAKE_SYSTEM_NAME=${AGENT_OS}" fi + androidparams= + if [[ "${ANDROID:-off}" == "on" ]] ; then + androidparams="-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=${ARCH} -DANDROID_PLATFORM=${ANDROID_PLATFORM} -DANDROID_NDK=$ANDROID_NDK" + fi cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DCMAKE_INSTALL_PREFIX=install \ -DCMAKE_PREFIX_PATH="${prefix_path//:/;}" \ -DBUILD_SHARED_LIBS=${SHAREDLIBS:-on} \ ${crosscompiling} \ + ${androidparams} \ -DANALYZER=${ANALYZER:-off} \ -DSANITIZER=${SANITIZER:-none} \ -DENABLE_SSL=${SSL:-on} \ @@ -154,10 +159,11 @@ steps: -DENABLE_TOPIC_DISCOVERY=${TOPIC_DISCOVERY:-on} \ -DENABLE_COVERAGE=${COVERAGE:-off} \ -DENABLE_ICEORYX=${ICEORYX:-off} \ - -DBUILD_DDSPERF=on \ -DBUILD_TESTING=${TESTING:-on} \ + -DBUILD_IDLC=${IDLC:-on} \ -DBUILD_IDLC_XTESTS=${IDLC_XTESTS:-on} \ - -DBUILD_EXAMPLES=on \ + -DBUILD_EXAMPLES=${EXAMPLES:-on} \ + -DBUILD_DDSPERF=${DDSPERF:-on} \ -DWERROR=on \ ${GENERATOR:+-G} "${GENERATOR}" -A "${PLATFORM}" -T "${TOOLSET}" .. ${SCAN_BUILD} cmake --build . --config ${BUILD_TYPE} --target install -- ${BUILD_TOOL_OPTIONS} @@ -177,6 +183,7 @@ steps: ${SHELL} ../src/tools/ddsperf/sanity.bash name: sanity_ddsperf displayName: Sanity check ddsperf + condition: eq(variables['android'], 'off') - bash: | set -e -x cd build @@ -191,7 +198,7 @@ steps: ${GENERATOR:+-G} "${GENERATOR}" -A "${PLATFORM}" -T "${TOOLSET}" "${INSTALLPREFIX}/share/CycloneDDS/examples/helloworld" cmake --build . --config ${BUILD_TYPE} -- ${BUILD_TOOL_OPTIONS} ${SHELL} ../../scripts/sanity_helloworld.bash - condition: ne(variables['sharedlibs'], 'off') + condition: and(ne(variables['sharedlibs'], 'off'), eq(variables['android'], 'off')) name: sanity_hello_world displayName: Sanity check Hello World - bash: | @@ -203,7 +210,7 @@ steps: test -e $d/symbol_export_test [[ "${BUILD_TYPE}" == 'Release' ]] || [[ "${AGENT_OS}" == 'Windows_NT' ]] || \ ${SHELL} ../scripts/check_symbol_export.bash $d/symbol_export_test - condition: eq(variables['testing'], 'off') + condition: and(eq(variables['testing'], 'off'), eq(variables['android'], 'off')) name: sanity_symbol_export displayName: Sanity check export symbols - bash: | diff --git a/.gitignore b/.gitignore index 4504a4b573..d889ff4599 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ gen.* .vs/ .vscode/ build/ +build*/ *~ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index deaab3b004..930833682c 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -129,6 +129,19 @@ jobs: build_type: Release sharedlibs: off iceoryx: on + 'Android 13 with API level 33 (Release, armv8)': + image: ubuntu-24.04 + build_type: Release + sanitizer: undefined + testing: off + examples: off + idlc: off + idlc_xtests: off + android: on + android_platform: android-33 + arch: arm64-v8a + ssl: off + ddsperf: off steps: - template: /.azure/templates/build-test.yml diff --git a/src/core/ddsi/src/ddsi_udp.c b/src/core/ddsi/src/ddsi_udp.c index 6fb2aca17b..4bf35b2666 100644 --- a/src/core/ddsi/src/ddsi_udp.c +++ b/src/core/ddsi/src/ddsi_udp.c @@ -118,7 +118,7 @@ static void translate_pktinfo (struct ddsi_network_packet_info *pktinfo, ddsrt_m pktinfo->dst.kind = DDSI_LOCATOR_KIND_UDPv6; pktinfo->dst.port = port; memcpy (pktinfo->dst.address, &pkt6->ipi6_addr, 16); - pktinfo->if_index = pkt6->ipi6_ifindex; + pktinfo->if_index = (uint32_t)pkt6->ipi6_ifindex; return; } } @@ -751,6 +751,8 @@ static int joinleave_asm_mcgroup (ddsrt_socket_t socket, int join, const ddsi_lo ipv6mreq.ipv6mr_multiaddr = mcip.a6.sin6_addr; #if __ZEPHYR__ ipv6mreq.ipv6mr_ifindex = interf ? interf->if_index : 0; +#elif __ANDROID__ + ipv6mreq.ipv6mr_interface = interf ? (int)interf->if_index : 0; #else ipv6mreq.ipv6mr_interface = interf ? interf->if_index : 0; #endif diff --git a/src/ddsrt/src/ifaddrs/posix/ifaddrs.c b/src/ddsrt/src/ifaddrs/posix/ifaddrs.c index e26a768b90..e33291c1f8 100644 --- a/src/ddsrt/src/ifaddrs/posix/ifaddrs.c +++ b/src/ddsrt/src/ifaddrs/posix/ifaddrs.c @@ -193,7 +193,11 @@ static bool is_the_kernel_likely_lying_about_multicast (const ddsrt_ifaddrs_t *i mcaddr.ipv6.sin6_port = bindaddr.ipv6.sin6_port; memset (&ipv6mreq, 0, sizeof (ipv6mreq)); ipv6mreq.ipv6mr_multiaddr = mcaddr.ipv6.sin6_addr; +#ifdef __ANDROID__ + ipv6mreq.ipv6mr_interface = (int)ifa->index; +#else ipv6mreq.ipv6mr_interface = ifa->index; +#endif if (setsockopt (sock, IPPROTO_IPV6, IPV6_JOIN_GROUP, &ipv6mreq, sizeof (ipv6mreq)) != 0 || setsockopt (sock, IPPROTO_IPV6, IPV6_MULTICAST_IF, &ifa->index, sizeof (ifa->index)) != 0 || setsockopt (sock, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, &hops, sizeof (hops)) != 0)