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

Add example for cross-build to android with CCI recipe #113

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 34 additions & 0 deletions examples/cross_build/android/cci_recipe/run_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import platform

from test.examples_tools import run, tmp_dir

# ############# Example ################
print("- Use the Android NDK Recipe from ConanCenter to cross-build a package -")


profile = """
[settings]
arch=armv8
build_type=Release
compiler=clang
compiler.cppstd=17
compiler.libcxx=c++_static
compiler.version=14
os=Android
os.api_level=31

[tool_requires]
android-ndk/r25c
"""

with tmp_dir("tmp"):
with open("android", "w") as _f:
_f.write(profile)
run("conan new -d name=foo -d version=1.0 cmake_lib")
output = run("conan create . --profile ./android")
# Since we are cross-building and no not run the binary
# We can inspect it
if platform.system() != "Windows": # This is a *nix command for inspect binaries
output = run("strings -a test_package/build/clang-14-armv8-17-release/example | head")
assert "Android" in output
assert "r25c" in output