From bac1101163a436096fe0b71bed79094658bba3b2 Mon Sep 17 00:00:00 2001 From: Jonathan Schwender <55576758+jschwe@users.noreply.github.com> Date: Wed, 30 Oct 2024 05:40:59 +0100 Subject: [PATCH] Fix CMake issues on OpenHarmony (#34062) - We should use the CMake version from the NDK - ignore errors from unused commandline parameters, which can easily happen due to --gcc-toolchain, which is added by the default CMake code when compiling with Clang. - Previously servo didn't have any CMake dependency projects anymore, so these issues didn't surface. Signed-off-by: Jonathan Schwender --- python/servo/platform/build_target.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/servo/platform/build_target.py b/python/servo/platform/build_target.py index 2118e2e1efe..408dfcdff0f 100644 --- a/python/servo/platform/build_target.py +++ b/python/servo/platform/build_target.py @@ -343,7 +343,8 @@ class OpenHarmonyTarget(CrossBuildTarget): env['HOST_CFLAGS'] = '' env['HOST_CXXFLAGS'] = '' - ohos_cflags = ['-D__MUSL__', f' --target={clang_target_triple}', f' --sysroot={ohos_sysroot}'] + ohos_cflags = ['-D__MUSL__', f' --target={clang_target_triple}', f' --sysroot={ohos_sysroot}', + "-Wno-error=unused-command-line-argument"] if clang_target_triple.startswith('armv7-'): ohos_cflags.extend(['-march=armv7-a', '-mfloat-abi=softfp', '-mtune=generic-armv7-a', '-mthumb']) ohos_cflags_str = " ".join(ohos_cflags) @@ -352,6 +353,7 @@ class OpenHarmonyTarget(CrossBuildTarget): env['TARGET_CXXFLAGS'] = ohos_cflags_str # CMake related flags + env['CMAKE'] = ndk_root.joinpath("build-tools", "cmake", "bin", "cmake") cmake_toolchain_file = ndk_root.joinpath("build", "cmake", "ohos.toolchain.cmake") if cmake_toolchain_file.is_file(): env[f'CMAKE_TOOLCHAIN_FILE_{rust_target_triple}'] = str(cmake_toolchain_file)