Commit Graph

12 Commits

Author SHA1 Message Date
Haibo Huang
61e6fc26bc Android: Fix search for binutils
Set `CMAKE_SYSTEM_PROGRAM_PATH` in `Platform/Android-Initialize` instead
of `Platform/Android` so it can be used in `CMakeFindBinUtils`.

Also add the names `llvm-strip` and `llvm-ranlib` for the corresponding
tools.
2021-03-30 10:06:02 -04:00
Haibo Huang
cbc51a8be3 Android: restructure android search paths
1. Set CMAKE_FIND_ROOT_PATH unconditionally.

Revise the implementation from commit a7f41a7ee4 (Android: Fix find_*
search order within NDK for unified toolchains, 2020-10-13).  In the old
implementation, if people set CMAKE_FIND_ROOT_PATH, CMAKE_ANDROID_NDK
won't be added to find root. And all paths added to CMAKE_SYSTEM_*_PATH
below will be rerooted to the user specified root.

2. Add api level specific library path to CMAKE_SYSTEM_PREFIX_PATH.

As the discussion in [1], some people want the paths added by
UnixPaths.cmake. They install their libraries according to
GNUInstallDirs [2].

As a result, we cannot clear CMAKE_SYSTEM_PREFIX_PATH. It includes /usr
so no matter what we specify in CMAKE_SYSTEM_LIBRARY_PATH,
/usr/lib/<arch> will be searched first.

The author also pointed out a way to solve this issue [3]. In addition
to other paths, CMake also searches <root>/<prefix> [4]. So we can add
the API specific lib path to the beginning of CMAKE_SYSTEM_PREFIX_PATH,
to have it searched first.

[1] https://android-review.googlesource.com/c/platform/ndk/+/1486800
[2] https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
[3] https://github.com/android/ndk/issues/1179#issuecomment-613435081
[4] 11425041f0/Source/cmSearchPath.cxx (L202)
2020-11-09 08:15:46 -05:00
Haibo Huang
707a06761f Android: add NDK hooks
This change adds hooks to key Android support files, so that NDK can
inject information or change cmake behaviors.
2020-10-29 17:52:41 -07:00
Haibo Huang
a7f41a7ee4 Android: Fix find_* search order within NDK for unified toolchains 2020-10-23 09:36:48 -04:00
Haibo Huang
5cdf37e4cc Android: Root searches within the NDK for unified toolchains
Set `CMAKE_FIND_ROOT_PATH_MODE_*` appropriately.
2020-10-23 09:36:40 -04:00
Butta
c5892e484e Android: add support for native compilation, such as with the Termux app
The CMake support for Android assumes cross-compilation using the NDK,
so stub out that Android NDK support and use the Linux support that's
already invoked. Set CMAKE_HOST_SYSTEM_NAME to "Android", rather than
"Linux".

Issue: #19840
2019-10-15 21:13:51 +05:30
Tom Yan
64e2c14c4a Android: allow user to enable versioned soname 2019-03-05 23:44:42 +08:00
Brad King
7b637ebdc9 Android: Add ANDROID variable to indicate the target
Allow projects to use `if(ANDROID)` to condition their Android-specific
code paths.
2016-08-23 13:10:51 -04:00
Brad King
178f56a579 VS: Fix Tegra-Android platform linking of libraries by name
Nsight Tegra Visual Studio Edition handles prefixing of library names
with '-l' automatically, so teach the generator not to do so.

Reported-by: Mourad Boufarguine <mourad@boufarguine.name>
2014-09-30 08:45:35 -04:00
Brad King
42f74df6d4 Add basic Android platform module
Create a Platform/Android module that includes Platform/Linux since
Android is based on Linux.  Provide only the minimal settings needed to
get builds with Android NDK toolchains to work.

Disable use of RPATH since the Android loader ignores it and we cannot
predict the install destination anyway.

Android supports soname but shared library names must end in ".so" and
we cannot represent the versioned names with associated symlinks on all
host operating systems anyway.  However, we do want the SONAME of
library files to be set so that linking to them by path to the library
file produces NEEDED entries with the soname and not the path.  Add a
new CMAKE_PLATFORM_NO_VERSIONED_SONAME setting to tell the
cmTarget::GetLibraryNames method that not to use the VERSION or
SOVERSION target properties in the soname.
2014-06-06 14:03:42 -04:00
Stephen Kelly
4b31f0649c Revert "Modules: Add an Andriod platform file"
This reverts commit 77f06b145d.

It may be re-added in the future when the requirements for that
platform are better known and supported by CMake.
2014-04-10 17:34:41 +02:00
Stephen Kelly
77f06b145d Modules: Add an Andriod platform file
It is much like Linux but has no SONAME or RPATH.
2014-03-20 09:04:31 -04:00