Commit Graph

115 Commits

Author SHA1 Message Date
Brad King 6a9b30aea3 Merge topic 'cuda_use_cudadevrt_with_separable_compilation'
891e0ebd FindCUDA: find cudadevrt and link it if CUDA_SEPARABLE_COMPILATION is ON
2016-09-20 08:40:42 -04:00
Robert Maynard 891e0ebdce FindCUDA: find cudadevrt and link it if CUDA_SEPARABLE_COMPILATION is ON
Issue: #15157
Patch-by: l0calh05t on gitlab.kitware.com
2016-09-20 08:04:30 -04:00
Stephen Sorley 900ee0b800 FindCUDA: Allow cuda_compile* macros to be called more than once per directory
Added a counter as a directory property that gets incremented every time one
of the cuda_compile* macros is called. The value of this counter is then added
to the phony target name passed to CUDA_WRAP_SRCS. This ensures that every call
to one of these macros has its own unique intermediate output directory.
2016-08-31 11:53:01 -04:00
Stephen Sorley 6442709bae FindCUDA: Fix for broken cuda_compile* commands.
The macros CUDA_COMPILE, CUDA_COMPILE_PTX, CUDA_COMPILE_FATBIN, and
CUDA_COMPILE_CUBIN were broken by commit 7ded655 (FindCUDA: Take NVCC
include directories from target properties, 2016-08-16).  This bug is
due to the fact that all of these macros call CUDA_WRAP_SRCS with a
target name that's not an actual target, causing the new generator
expressions to fail.

Fix the bug by changing these macros to pass "PHONY" to CUDA_WRAP_SRCS.
Now, when CUDA_WRAP_SRCS sees "PHONY", it falls back to the old behavior
of populating the include directories and compile definitions from
directory properties, instead of using target generator expressions.
2016-08-31 11:52:43 -04:00
Peter Boettcher 7ded655f7b FindCUDA: Take NVCC include directories from target properties
Fixes issue where include directories specified on the target are
not passed on to NVCC.  This includes both target_include_directories()
as well as include directories added by dependency chaining.

Closes: #14201
2016-08-16 14:16:35 -04:00
Stephen Sorley 1aa5c1bec8 FindCUDA: Fix missing librt on Linux when using static cuda runtime.
Commit 7229ae72 (FindCUDA: Refactor Android(Tegra) support, 2016-04-19)
changed the logic to only add librt to the link line for CUDA versions
6.5 and older.  However, newer versions of CUDA still require librt.
2016-08-12 09:28:38 -04:00
Stephen Sorley aab1f6e984 FindCUDA: Restore default behavior of CUDA_USE_STATIC_CUDA_RUNTIME
Fix bug introduced by commit 7229ae72 (FindCUDA: Refactor Android(Tegra)
support, 2016-04-19).  `CUDA_USE_STATIC_CUDA_RUNTIME` should be enabled
by default if `cudart_static` is available, and silently disabled if
it is not.
2016-08-12 09:26:30 -04:00
Brad King 8ba870bad6 Merge topic 'FindCUDA-no-windows-librt'
f4e979b1 FindCUDA: Do not look for librt on Windows
2016-08-03 09:20:35 -04:00
Hans Gaiser 15a6ae5cb7 FindCUDA: Add search path for nvcc on Arch 2016-08-02 15:36:07 -04:00
Stephen Sorley f4e979b126 FindCUDA: Do not look for librt on Windows
Otherwise an incorrect warning appears when compiling with CUDA SDK 6.5
or older and CUDA_USE_STATIC_CUDA_RUNTIME is true.
2016-08-02 09:15:22 -04:00
Daniel Pfeifer 5d0d980d99 Use string(APPEND) in Modules
Automate with:

find Modules -type f -print0 | xargs -0 perl -i -0pe \
's/set\(([a-zA-Z0-9_]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g'
2016-07-28 00:41:13 +02:00
Felix Geyer 566086187f Fix typos. 2016-07-10 11:05:56 +02:00
Chuck Atkins 90d114ed8c FindCUDA: Use the correct runtime in REQUIRED_VARS check
When enabling the CUDA static runtime, the current module always uses
the shared runtime in the REQUIRED_VARS check.  This change should
select the correct runtime to be checked for as required based on the
CUDA_USE_STATIC_CUDA_RUNTIME option.

Fixes #16096
2016-06-14 09:55:35 -04:00
Boris Fomitchev 7229ae728f FindCUDA: Refactor Android(Tegra) support
Reviewed-by: James Bigler <jamesbigler@gmail.com>
2016-06-09 09:25:55 -04:00
Boris Fomitchev e9bfe8da04 FindCUDA: Adjust vertical whitespace 2016-06-09 09:24:40 -04:00
James Sharpe 81e73b7240 FindCUDA: Add support for finding the cublas_device library 2016-05-25 09:42:25 -04:00
Chuck Atkins 6b190b5c52 FindCUDA: Add support for generator expressions in CUDA_NVCC_FLAGS
Follow the configure_file by a file(GENERATE) so the resulting cmake
scripts used by FindCUDA for wrapping nvcc calls can now support
generator expressions in the CUDA_NVCC_FLAGS variable.
2016-05-25 09:31:35 -04:00
Boris Fomitchev cc95001b1c FindCUDA: Detect and report FP16 support
Reviewed-by: James Bigler <jamesbigler@gmail.com>
2016-05-19 10:52:32 -04:00
Felix Geyer 49e82c15d5 Fix spelling typos in comments and documentation (#16037)
The Debian package checker tool (lintian) detected several typos in
CMake.
2016-03-29 14:31:02 -04:00
Brad King 72a97b7a76 FindCUDA: Fix regression in separate compilation (#16027)
Since commit v3.5.0-rc1~47^2 (FindCUDA: Support special characters in
path, 2016-01-15) our add_custom_command calls use VERBATIM so that
CMake will automatically quote special characters correctly.  Fix the
separate compilation code path to not add its own quoting when the
VERBATIM option will be used.
2016-03-22 11:05:02 -04:00
Brad King 1911cda03e FindCUDA: Fix regression under Visual Studio generators
Since commit v3.5.0-rc1~47^2 (FindCUDA: Support special characters in
path, 2016-01-15) our add_custom_command calls use VERBATIM so that
CMake will automatically quote special characters correctly.  However,
this breaks the special `$(VCInstallDir)` placeholder used with Visual
Studio generators.  Since we do not support preservation of such
placeholders with VERBATIM (see issue #15001) we must fall back to not
using VERBATIM when the placeholder is used.

A better fix would be to stop using `$(VCInstallDir)` and use the value
of `CMAKE_${CUDA_C_OR_CXX}_COMPILER` instead, but that will require
additional semantic and documentation changes.  For now simply fix the
regression with the above approach.

Reported-by: Stephen Sorley <Stephen.Sorley@jhuapl.edu>
2016-02-17 15:20:56 -05:00
Brad King 6ccc307053 FindCUDA: Support special characters in path (#15919)
Add `VERBATIM` to all `add_custom_command` calls so that CMake will
escape arguments properly even when special characters such as "()" are
present.

Suggested-by: Nils Gladitz <nilsgladitz@gmail.com>
2016-01-15 08:46:20 -05:00
Alexander Szakaly ae1003cdb9 FindCUDA: Add paths for crosscompiling to aarch64
Choose a CUDA_TOOLKIT_TARGET_DIR for the aarch64 architecture
automatically.
2015-11-23 14:34:08 -05:00
Rolf Eike Beer b1efb0233e FindCUDA: drop CUDA_dl_LIBRARY
There is the global CMAKE_DL_LIBS setting which can be used instead. There are
even platforms where this is either empty because those functions are part of
the libc or is called entirely different, so this code wouldn't work reliable
anyway.
2015-11-03 23:04:29 +01:00
Dominic Meiser 9b2f69925a FindCUDA: Fix object build rule for separate compilation on VS 2013+ (#15697)
The handling of multilevel dependencies has been fixed in Visual Studio 2013.
The work around used for VS 2010 and VS 2012 does not work for VS 2013 any more.
Switch to normal object build rules for VS 2013 and newer.
2015-08-20 11:52:11 -04:00
Bill Hoffman b405f01daa FindCUDA: Resolve a host compiler symlink only if it is Apple cc -> clang
Otherwise using a "cc -> ccache" or similar symlink as the compiler
causes FindCUDA to select ccache as the host compiler.  Update the logic
added by commit v3.1.0-rc1~354^2 (FindCUDA: Fix OSX Clang & no C
language enabled, 2014-06-12) to apply only in the specific case it is
needed.
2015-06-15 09:41:10 -04:00
James Bigler 0ed22502a6 FindCUDA: Create output dir while compiling intermediate link file (#15016)
During compilation of the intermediate link file, the output directory
may not be present in Visual Studio builds.  This fix makes sure the
output directory exists before generating the output file.

Suggested-by: Irwin Zaid
2015-04-20 14:44:17 -04:00
James Bigler 1b0c77a33d FindCUDA: Add specific cuda_language_flag instead of using nvcc.
I was previously appending to nvcc_flags inside the file loop.  This
caused the flag to be appended multiple times which freaks out nvcc.
Now the flag is specifically handled per file.
2015-04-09 11:41:36 -04:00
James Bigler 8313de2d5a FindCUDA: Allow setting CUDA_SOURCE_PROPERTY_FORMAT for non-.cu files.
A previously undocumented feature allowed overriding the format
specified to CUDA_WRAP_SRCS with a source file property called
CUDA_SOURCE_PROPERTY_FORMAT.  I added documentation for this feature as
well as added the ability to let nvcc compile any file regardless of
type if this property was found.

In addition, I also fixed a couple of bugs with the calls to
_cuda_get_important_host_flags that weren't garding the arguments with
"" to prevent empty values from causing errors.
2015-04-09 11:41:36 -04:00
Brad King 48040c19d5 Merge topic 'FindCUDA.cmake/C++11Flags'
99abebde FindCUDA: Handle c++11 host flag
2015-04-09 11:32:39 -04:00
James Bigler 99abebdea0 FindCUDA: Handle c++11 host flag
If the host flags contain a c++11 flag (at least for gcc), then we can't
automatically propagate to nvcc it using -Xcompiler.  This is because
nvcc can't use any C++ only flags.  Instead we find this flag and add it
to nvcc's flags (it has a special flag for dealing with c++11 code) and
remove it from the host flags.

Co-Author: Guillermo Marcus <gmarcus@nvidia.com>
2015-04-08 16:25:47 -04:00
James Bigler 7fea2b77df FindCUDA: Use the static CUDA runtime library if available (#15482)
Beginning in CUDA 5.5 a static version of the cuda runtime library
became available.  Since nvcc defaults to using this library over the
shared version, FindCUDA will also default to using this version.  There
are many advantages to using the static version (most importantly to
avoid conflicts with multiple versions when building a CUDA based
library).  Offer a CUDA_USE_STATIC_CUDA_RUNTIME option to control
this behavior.
2015-04-03 10:15:17 -04:00
Mark Abraham 005b409d6a FindCUDA: Mark more cache variables as advanced
Mark variables pertaining to specific situations relevant to CUDA
compilation as advanced since they are not part of normal usage.
2015-01-22 11:44:05 -05:00
Andrew Seidl e56c932795 FindCUDA: Add cuSOLVER library from CUDA 7.0 2015-01-21 15:54:12 -05:00
Brad King 56324568cf Merge topic 'FindCUDA.cmake/UseCMAKE_CXX_FLAGS_separableCompilation'
b4e54f9b FindCUDA: Add relevant CMAKE_{C,CXX}_FLAGS for separable compilation
2015-01-11 12:00:28 -05:00
Mark Abraham d5846eb153 FindCUDA: Do not assume CMAKE_SYSTEM_PROCESSOR is set
CMAKE_SYSTEM_PROCESSOR is not guaranteed to be defined (per
http://www.cmake.org/Wiki/CMake_Cross_Compiling), and when cross
compiling where it happens to be undefined, this module was broken.

Reviewed-by: Rolf Eike Beer <eike@sf-mail.de>
2015-01-08 14:39:16 -05:00
James Bigler b4e54f9b8c FindCUDA: Add relevant CMAKE_{C,CXX}_FLAGS for separable compilation
Previously only the CMAKE_{C,CXX}_FLAGS_<CONFIG> flags were inspected
for relevant flags when compiling the intermediate link file.  We need
to also consider the configuration agnostic flags, CMAKE_{C,CXX}_FLAGS
as well.
2015-01-06 16:28:05 -07:00
Brad King b71399a189 Merge branch 'release-doc-formatting' into release 2014-11-07 10:20:58 -05:00
Brad King 67c4be51a3 Merge branch 'release-doc-formatting' into doc-formatting
Resolve conflict in Modules/ExternalProject.cmake by keeping our side,
which is more completely revised.
2014-11-06 14:52:49 -05:00
Brad King 20c5f4fbd9 Modules: Wrap long lines in pre-formatted documentation blocks
Help format the blocks better for display without a wide screen.
2014-11-06 14:52:26 -05:00
Clinton Stimpson 59814cb430 FindCUDA: Remove rpath logic outdated by CMake's own @rpath support
Otherwise binaries end up with two copies of the same value and the OS X
install_name_tool may corrupt them.
2014-10-22 10:50:15 -04:00
Adam Strzelecki 84e3fde94d FindCUDA: Avoid if() auto-dereference in string comparisons
This silences possible CMP0054 warnings.
2014-09-24 10:10:42 -04:00
Adam Strzelecki 32bcec5fab FindCUDA: Fix OSX Clang & no C language enabled
When setting default CUDA_HOST_COMPILER we must dereference CMAKE_C_COMPILER,
i.e. /usr/bin/clang should be used instead /usr/bin/cc which is symlink.
Otherwise CUDA thinks it is GCC and issues -dumpspecs which is unknown option
to Clang.

Also in case neither CMAKE_C_COMPILER is defined (project does not use C
language) nor CUDA_HOST_COMPILER is specified manually we should skip -ccbin
and let nvcc use its own default C compiler.
2014-06-30 11:23:36 -04:00
Daniele E. Domenichelli 81a3f22882 Do not change minimum required version in modules
Some modules change CMake minimum required version when they are
included. For example:

  cmake_minimum_required(VERSION 2.8.12)
  message("${CMAKE_MINIMUM_REQUIRED_VERSION}")
  include(CheckTypeSize)
  message("${CMAKE_MINIMUM_REQUIRED_VERSION}")

will produce the following output:

  2.8.12
  2.6

This patch ensures that when you include a CMake module the minimum
required version and the policies set are left unchanged.

Fixes Issue #14864
2014-05-19 16:55:12 +02:00
Brad King 7019152aa2 Merge topic 'FindCUDA-separable-compilation-flags'
6ad14c71 FindCUDA: Use CUDA_NVCC_FLAGS* for separable compilation
2014-05-19 10:40:24 -04:00
James Bigler 6ad14c71bb FindCUDA: Use CUDA_NVCC_FLAGS* for separable compilation
Previously when linking the intermediate link file for separable compilation
the CUDA_NVCC_FLAGS* were not used.  This caused tremendous confusion when
using this feature, and I consider it to be a bug.  This change should fix
this.
2014-05-19 09:14:15 -04:00
Tobias Zirr 231b30dbfb FindCUDA: Add support for compilation to fatbin & cubin modules 2014-04-30 09:02:52 -04:00
Rolf Eike Beer b0b4b4602f Remove .* expressions from beginning and end of MATCHES regexs
All these expressions work the same:
  "foo"
  ".*foo.*"
  "^.*foo.*$"

This assumes that the "Intel*" expressions were meant to be "Intel.*".
2014-04-14 18:17:11 +02:00
Ben Boeckel a599611116 FindCUDA: Fix a typo 2014-03-08 13:05:31 -05:00
Brad King 1f8eb5db1c FindCUDA: Fix literal block formatting
Fix locations of '::' manually to group literal blocks as desired.
2014-01-29 14:26:05 -05:00