-
Notifications
You must be signed in to change notification settings - Fork 990
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added XXXX_FOR_BUILD variables and android extra flags mechanism
- Loading branch information
1 parent
2db8976
commit 35d8d91
Showing
4 changed files
with
154 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
test/functional/toolchains/gnu/test_gnutoolchain_android.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import os | ||
import platform | ||
import textwrap | ||
|
||
import pytest | ||
|
||
from conan.test.utils.mocks import ConanFileMock | ||
from conan.test.utils.tools import TestClient | ||
from conan.tools.files import replace_in_file | ||
from test.conftest import tools_locations | ||
|
||
|
||
@pytest.mark.parametrize("arch, expected_arch", [('armv8', 'aarch64'), | ||
('armv7', 'arm'), | ||
('x86', 'i386'), | ||
('x86_64', 'x86_64') | ||
]) | ||
# @pytest.mark.tool("android_ndk") | ||
# @pytest.mark.tool("autotools") | ||
@pytest.mark.skipif(platform.system() != "Darwin", reason="NDK only installed on MAC") | ||
def test_android_gnutoolchain_cross_compiling(arch, expected_arch): | ||
profile_host = textwrap.dedent(""" | ||
include(default) | ||
[settings] | ||
os = Android | ||
os.api_level = 21 | ||
arch = {arch} | ||
[conf] | ||
tools.android:ndk_path={ndk_path} | ||
""") | ||
# ndk_path = tools_locations["android_ndk"]["system"]["path"][platform.system()] | ||
ndk_path = "/Users/franchuti/Library/Android/sdk/ndk/24.0.8215888" | ||
profile_host = profile_host.format( | ||
arch=arch, | ||
ndk_path=ndk_path | ||
) | ||
|
||
client = TestClient(path_with_spaces=False) | ||
# FIXME: Change this when we have gnu_lib as template in the new command | ||
client.run("new autotools_lib -d name=hello -d version=1.0") | ||
replace_in_file(ConanFileMock(), os.path.join(client.current_folder, "conanfile.py"), | ||
"AutotoolsToolchain", "GnuToolchain") | ||
client.save({"profile_host": profile_host}) | ||
client.run("build . --profile:build=default --profile:host=profile_host") | ||
libhello = os.path.join("build-release", "src", ".libs", "libhello.a") | ||
# Check binaries architecture | ||
client.run_command('objdump -f "%s"' % libhello) | ||
assert "architecture: %s" % expected_arch in client.out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters