Commit Graph

32453 Commits

Author SHA1 Message Date
Brad King 6b84df8da9 Help: Document cross compiling for Android
CMake now supports cross compiling for Android using the NDK or a
standalone toolchain.  Document the associated variables and how how to
write toolchain files for Android.
2016-08-23 12:53:10 -04:00
Brad King d7d4083025 Android: Select the STL type for NDK builds
Populate standard include directories and link libraries for the
platform.  Select the STL corresponding to CMAKE_ANDROID_STL_TYPE and
matching the current ABI and toolchain to be used.  Refer to the NDK
sources/cxx-stl/*/Android.mk files for the needed file locations.
2016-08-23 12:53:10 -04:00
Brad King b22294bc41 Android: Populate compiler flags for current ABI
Initialize the CMAKE_{C,CXX}_FLAGS{,_<CONFIG>} cache entries with
flags for each ABI as specified by NDK toolchain `setup.mk` files.
2016-08-23 12:51:58 -04:00
Brad King b6a3102a9f Android: Add a CMAKE_BUILD_TYPE default
Android NDK builds are always `debug` or `release`.  We may populate
flags for these configurations that are needed to produce compatible
binaries.  Ensure they are used by default.
2016-08-12 10:40:54 -04:00
Brad King d1e3cec2aa Android: Add Clang -target option for current ABI 2016-08-12 10:40:54 -04:00
Brad King 504db72d99 Android: Add placeholders for compiler/abi-specific settings
The Android NDK source repository at

  https://android.googlesource.com/platform/ndk.git

has `<ndk>/build/core/toolchains/*/setup.mk` files that store tables of
information for their build system.  Add an equivalent file for each
compiler/abi combination.
2016-08-12 10:40:54 -04:00
Brad King fa63257821 Android: Avoid interfering with common pre-existing toolchain files
Commonly used Android toolchain files that pre-date CMake upstream
support may need to be updated to work with our new functionality.
They typically set CMAKE_SYSTEM_VERSION to 1, so detect that and
skip our upstream Android settings.  When such toolchain files are
updated to account for our upstream support, they can then set
CMAKE_SYSTEM_VERSION to a valid Android API and get new behavior.
2016-08-12 10:40:54 -04:00
Brad King 6299693f8a Android: Search for NDK and standalone toolchain in more places
Commonly used Android toolchain files that pre-date CMake upstream
support use a few environment and CMake variables as search locations.
Use them too to aid transition.
2016-08-12 10:40:53 -04:00
Brad King 29b51379de Android: Detect and save a standalone toolchain without the NDK 2016-08-12 10:40:53 -04:00
Brad King 7d9b49fbdf Android: Detect settings from the CMAKE_SYSROOT if it is set 2016-08-12 10:40:53 -04:00
Brad King 4389664a26 Android: Detect and save a toolchain from the NDK 2016-08-12 10:40:53 -04:00
Brad King 328191f65f Android: Set CMAKE_SYSROOT automatically
Compute CMAKE_SYSROOT automatically for the current API and architecture
selection.  This causes the --sysroot option to be passed to GNU and
Clang compilers.
2016-08-12 10:40:52 -04:00
Brad King 9e032304ea Android: Detect and save the architecture, ABI, and processor
Add new CMakeSystem.cmake entries for the architecture and ABI.
Store the processor in CMAKE_SYSTEM_PROCESSOR.
2016-08-12 10:40:52 -04:00
Brad King fde59c4d88 Android: Detect and save the API level
Store the Android API level in CMAKE_SYSTEM_VERSION.  If it is not
provided by the user, initialize it from CMAKE_ANDROID_API or fall back
to finding the latest available in the NDK.
2016-08-12 10:40:52 -04:00
Brad King 52b6effd81 Android: Detect and save the NDK directory
Add a new CMakeSystem.cmake entry for the NDK location.
2016-08-12 10:40:52 -04:00
Brad King 8e0cb45e55 Android: Suppress new functionality with Nsight Tegra in VS IDE builds
Support for NVIDIA Nsight Tegra Visual Studio Edition was previously
implemented in the CMake VS IDE generators.  Avoid interfering with
that functionality for now.  Later we may try to integrate this.
2016-08-12 10:40:52 -04:00
Brad King d5e7d5f3eb Android: Add placeholders for platform-specific initialization
Add infrastructure modules to be loaded when initializing builds
targeting Android platforms.
2016-08-12 10:40:51 -04:00
Brad King 64be1ae4a3 Android: Add placeholders for platform-specific compiler selection
Add infrastructure modules to be loaded for determining a compiler
selection when targeting Android platforms.
2016-08-12 10:40:51 -04:00
Brad King 47866770ce Android: Add placeholders for platform-specific compiler settings
Add infrastructure modules to be loaded for Clang and GNU compilers
when targeting Android platforms.
2016-08-12 10:40:51 -04:00
Brad King 735f168bf0 CMakeDetermine*Compiler: Add hook to save custom compiler information
Provide a way for Platform/<os>-Determine-<lang>.cmake modules to save
platform-specific information about the compiler in the configured
CMake<lang>Compiler.cmake modules.
2016-08-12 10:40:51 -04:00
Brad King c148803a57 CMakeDetermineSystem: Load platform-specific helper modules
Once CMAKE_SYSTEM_NAME is known, load a platform-specific

  Platform/<os>-Determine

module in order to enable custom determination of the other settings
needed for the CMakeSystem module (e.g. CMAKE_SYSTEM_PROCESSOR).  Also
add a hook in Modules/CMakeSystem.cmake.in to allow platform-specific
information to be saved.
2016-08-12 10:40:51 -04:00
Kitware Robot f99df80794 CMake Nightly Date Stamp 2016-08-12 00:01:04 -04:00
Brad King f203694bb8 Merge topic 'cmCryptoHash-raw-digest'
3a5f609c cmCryptoHash: New ByteHash methods that return a byte vector
f582dba6 cmCryptoHash: Return byte vector from internal Finalize method
74f0d4ab cmCryptoHash: New byte hash to string function
94c29976 cmCryptoHash: Documentation comments
2016-08-11 13:48:37 -04:00
Kitware Robot 3c4d2e84d2 CMake Nightly Date Stamp 2016-08-11 00:01:04 -04:00
Sebastian Holtermann 3a5f609cbb cmCryptoHash: New ByteHash methods that return a byte vector 2016-08-10 13:21:32 -04:00
Sebastian Holtermann f582dba666 cmCryptoHash: Return byte vector from internal Finalize method
Some callers may want the raw byte vector instead of the hex character
string.  Convert the internal implementation to use this so that we
can later add public APIs to get it.
2016-08-10 13:21:32 -04:00
Sebastian Holtermann 74f0d4abcd cmCryptoHash: New byte hash to string function 2016-08-10 13:09:55 -04:00
Sebastian Holtermann 94c29976d0 cmCryptoHash: Documentation comments 2016-08-10 13:09:54 -04:00
Brad King 50ada755e3 Merge topic '15687-xcode-support-system-include'
93ac2a78 Xcode: Obey SYSTEM keyword for includes (#15687)
2016-08-10 11:16:01 -04:00
Brad King 655d242b90 Merge topic 'fix-test-macOS-case-sensitive'
677e73cb Tests: Fix RunCMake.Framework on case sensitive file systems.
2016-08-10 11:15:58 -04:00
Brad King e01c576338 Merge topic 'ninja-directory-targets'
02789894 Ninja: Add `$subdir/{test,install,package}` targets
a88c99f1 Ninja: Simplify computation of GLOBAL_TARGET outputs
2016-08-10 11:15:55 -04:00
Brad King 627ffb4bd7 Merge topic 'NAG-Fortran-no-fPIE'
e9c98426 NAG: Use -PIC for Fortran position-independent executable code
2016-08-10 11:15:53 -04:00
Brad King f4cec30b53 Merge topic 'install-export-staging-dir'
c7a319ab install(EXPORT): Fix support for mid-length install destinations on Windows
2016-08-10 11:15:50 -04:00
Brad King 4887640b7a Merge topic 'add-extra-boolean-comparisons'
02d177c9 Add additional <= and >= comparison operators
2016-08-10 11:15:47 -04:00
Kitware Robot 5aabfec930 CMake Nightly Date Stamp 2016-08-10 00:01:04 -04:00
Chaoren Lin 677e73cb8a Tests: Fix RunCMake.Framework on case sensitive file systems.
The file is lowercase: Tests/RunCMake/Framework/osx.cmake
2016-08-09 16:00:27 -04:00
Brad King 0278989405 Ninja: Add `$subdir/{test,install,package}` targets
With the Makefile generator one can use `cd $subdir; make install` to build and
install targets associated with a given subdirectory.  This is not possible to
do with the Ninja generator since there is only one `build.ninja` file at the
top of the build tree.  However, we can approximate it by allowing one to run
`ninja $subdir/install` at the top of the tree to build the targets in the
corresponding subdirectory and install them.

This also makes sense for `test`, `package`, and other GLOBAL_TARGET targets.
It was already done for `all` by commit v3.6.0-rc1~240^2~2 (Ninja: Add
`$subdir/all` targets, 2016-03-11).
2016-08-09 15:15:24 -04:00
Brad King a88c99f1bc Ninja: Simplify computation of GLOBAL_TARGET outputs
In cmGlobalNinjaGenerator::AppendTargetOutputs we previously
handled GLOBAL_TARGET outputs specially in order to avoid adding
directory components to the output.  However, this is not necessary
because cmNinjaTargetGenerator::New already filters out copies of
these targets that are not at the top level.  Instead we can simply
follow the same output computation code path as UTILITY targets.
2016-08-09 14:36:04 -04:00
Gregor Jasny 93ac2a78d5 Xcode: Obey SYSTEM keyword for includes (#15687)
CMake used to put all header search paths into HEADER_SEARCH_PATHS
attribute. Unfortunately this attribute does not support to declare
a search path as a system include.

As a hack one could add a -isystem /path to the cflags but then include
ordering is not deterministic. A better approach was chosen with this
patch by not filling HEADER_SEARCH_PATHS at all and to populate
the C, C++, and Fortran flags directly. The include paths used by
Xcode should be now identical to the ones used by Unix Makefiles and
Ninja generator.
2016-08-09 20:30:07 +02:00
Neil Carlson e9c984267e NAG: Use -PIC for Fortran position-independent executable code
The Numerical Algorithms Group (NAG) Fortran compiler documents -PIC for
position-independent code and does not have a separate option for PIE.
We added `-PIC` for PIC in commit v2.8.11~174^2 (NAG: Use -PIC for
Fortran position-independent code, 2013-02-18).  Follow up for PIE.

Closes: #16236
2016-08-09 11:15:14 -04:00
Brad King c7a319ab05 install(EXPORT): Fix support for mid-length install destinations on Windows
The implementation of `install(EXPORT)` generates files into a staging
directory for later installation.  We use the full install destination
in the path to the staging directory to avoid collisions.  In order to
avoid exceeding maximum path lengths (especially on Windows) we compute
a hash of the install destination when it is too long.  Fix this logic
to account for the length of the file name(s) when deciding whether to
switch to the hashed name.

Reported-by: Alan W. Irwin <irwin@beluga.phys.uvic.ca>
2016-08-09 10:09:52 -04:00
Chuck Atkins 02d177c9cc Add additional <= and >= comparison operators
This adds the LESS_EQUAL, GREATER_EQUAL, and associated STR and VERSION
equivalents to use the combined <= and >= functionality.
2016-08-09 09:30:34 -04:00
Brad King 4689d16e8a Merge topic 'fix-string-append'
551b4c90 Revert the use of string(APPEND) in .cmake.in files
3a7be4f3 prefer list(APPEND) over string(APPEND) where appropriate
2016-08-09 09:20:21 -04:00
Brad King a5b73e719a Merge topic 'GetPrerequisites-grep-a'
5f3c8f6a GetPrerequisites: Always filter objdump output as text
2016-08-09 09:20:18 -04:00
Brad King a8c819659b Merge topic 'ninja-full-path'
955c2a63 Ninja: Use full path for all source files
2016-08-09 09:20:15 -04:00
Brad King 892ffe4ebd Merge topic 'wix-custom-install-dir'
17bbf6af CPackWIX: Implement new CPACK_WIX_SKIP_PROGRAM_FOLDER feature
2016-08-09 09:20:13 -04:00
Kitware Robot 982b4cd602 CMake Nightly Date Stamp 2016-08-09 00:01:04 -04:00
Daniel Pfeifer 551b4c9062 Revert the use of string(APPEND) in .cmake.in files
The generated files may be consumed by older cmake versions which do not
support string(APPEND).
2016-08-08 21:45:41 +02:00
Daniel Pfeifer 3a7be4f394 prefer list(APPEND) over string(APPEND) where appropriate 2016-08-08 21:28:52 +02:00
Alexander Shishenko 5f3c8f6ab2 GetPrerequisites: Always filter objdump output as text
When using `grep` to filter the output, add the `-a` flag to tell
it never to treat the output as binary.  Otherwise when LANG != C
in the environment the non-ascii text may break the filter.
2016-08-08 14:05:21 -04:00