Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android-ndk: Use clang for AS & LD as per docs. #23346

Merged
merged 10 commits into from
Jun 19, 2024
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
9 changes: 2 additions & 7 deletions recipes/android-ndk/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,12 +300,13 @@ def package_info(self):
self.conf_info.update("tools.build:compiler_executables", compiler_executables)
self.buildenv_info.define_path("CC", compiler_executables["c"])
self.buildenv_info.define_path("CXX", compiler_executables["cpp"])
self.buildenv_info.define_path("AS", compiler_executables["c"])
self.buildenv_info.define_path("LD", compiler_executables["cpp"])

# Versions greater than 23 had the naming convention
# changed to no longer include the triplet.
bare = self._ndk_version_major >= 23
self.buildenv_info.define_path("AR", self._define_tool_var("AR", "ar", bare))
self.buildenv_info.define_path("AS", self._define_tool_var("AS", "as", bare))
self.buildenv_info.define_path("RANLIB", self._define_tool_var("RANLIB", "ranlib", bare))
self.buildenv_info.define_path("STRIP", self._define_tool_var("STRIP", "strip", bare))
self.buildenv_info.define_path("ADDR2LINE", self._define_tool_var("ADDR2LINE", "addr2line", bare))
Expand All @@ -317,12 +318,6 @@ def package_info(self):
if self._ndk_version_major < 23:
self.buildenv_info.define_path("ELFEDIT", self._define_tool_var("ELFEDIT", "elfedit", bare))

# The `ld` tool changed naming conventions earlier than others
if self._ndk_version_major >= 22:
self.buildenv_info.define_path("LD", self._define_tool_var_naked("LD", "ld"))
else:
self.buildenv_info.define_path("LD", self._define_tool_var("LD", "ld"))

self.buildenv_info.define("ANDROID_PLATFORM", f"android-{self.settings_target.os.api_level}")
self.buildenv_info.define("ANDROID_TOOLCHAIN", "clang")
self.buildenv_info.define("ANDROID_ABI", self._android_abi)
Expand Down
12 changes: 9 additions & 3 deletions recipes/android-ndk/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.scm import Version
import os
import platform


class TestPackgeConan(ConanFile):
Expand All @@ -22,10 +24,14 @@ def build(self):
cmake.build()

def test(self):
if self.settings.os == "Windows":
self.run("ndk-build.cmd --version")
ndk_build = "ndk-build.cmd" if self.settings.os == "Windows" else "ndk-build"
ndk_version = Version(self.tested_reference_str.split('/')[1])
skip_run = platform.system() == "Darwin" and "arm" in platform.processor() and ndk_version < "r23c"
if not skip_run:
self.run(f"{ndk_build} --version", env="conanbuild")
else:
self.run("ndk-build --version")
self.output.warning("Skipped running ndk-build on macOS Apple Silicon in arm64 mode, please use a newer"
" version of the Android NDK")

# INFO: Run the project that was built using Android NDK
if self.settings.os == "Android":
Expand Down
8 changes: 0 additions & 8 deletions recipes/android-ndk/all/test_v1_package/CMakeLists.txt

This file was deleted.

32 changes: 0 additions & 32 deletions recipes/android-ndk/all/test_v1_package/conanfile.py

This file was deleted.

Loading