@ -31,10 +31,8 @@
# T h e f o l l o w i n g v a r i a b l e s a f f e c t t h e b e h a v i o r o f t h e m a c r o s i n t h e
# script ( in alphebetical order ) . N o t e t h a t a n y o f t h e s e f l a g s c a n b e
# c h a n g e d m u l t i p l e t i m e s i n t h e s a m e d i r e c t o r y b e f o r e c a l l i n g
# C U D A _ A D D _ E X E C U T A B L E , C U D A _ A D D _ L I B R A R Y , C U D A _ C O M P I L E , C U D A _ C O M P I L E _ P T X
# o r C U D A _ W R A P _ S R C S .
#
# : :
# C U D A _ A D D _ E X E C U T A B L E , C U D A _ A D D _ L I B R A R Y , C U D A _ C O M P I L E , C U D A _ C O M P I L E _ P T X ,
# C U D A _ C O M P I L E _ F A T B I N , C U D A _ C O M P I L E _ C U B I N o r C U D A _ W R A P _ S R C S : :
#
# CUDA_64_BIT_DEVICE_CODE ( Default matches host bit size )
# - - S e t t o O N t o c o m p i l e f o r 6 4 b i t d e v i c e c o d e , O F F f o r 3 2 b i t d e v i c e c o d e .
@ -43,19 +41,11 @@
# n v c c i n t h e g e n e r a t e d s o u r c e . I f y o u c o m p i l e t o P T X a n d t h e n l o a d t h e
# f i l e y o u r s e l f , y o u c a n m i x b i t s i z e s b e t w e e n d e v i c e a n d h o s t .
#
#
#
# : :
#
# CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE ( Default ON )
# - - S e t t o O N i f y o u w a n t t h e c u s t o m b u i l d r u l e t o b e a t t a c h e d t o t h e s o u r c e
# f i l e i n V i s u a l S t u d i o . T u r n O F F i f y o u a d d t h e s a m e c u d a f i l e t o m u l t i p l e
# t a r g e t s .
#
#
#
# : :
#
# T h i s a l l o w s t h e u s e r t o b u i l d t h e t a r g e t f r o m t h e C U D A f i l e ; h o w e v e r , b a d
# t h i n g s c a n h a p p e n i f t h e C U D A s o u r c e f i l e i s a d d e d t o m u l t i p l e t a r g e t s .
# W h e n p e r f o r m i n g p a r a l l e l b u i l d s i t i s p o s s i b l e f o r t h e c u s t o m b u i l d
@ -68,44 +58,24 @@
# t h i s s c r i p t c o u l d d e t e c t t h e r e u s e o f s o u r c e f i l e s a c r o s s m u l t i p l e t a r g e t s
# a n d t u r n t h e o p t i o n o f f f o r t h e u s e r , b u t n o g o o d s o l u t i o n c o u l d b e f o u n d .
#
#
#
# : :
#
# CUDA_BUILD_CUBIN ( Default OFF )
# - - S e t t o O N t o e n a b l e a n d e x t r a c o m p i l a t i o n p a s s w i t h t h e - c u b i n o p t i o n i n
# D e v i c e m o d e . T h e o u t p u t i s p a r s e d a n d r e g i s t e r , s h a r e d m e m o r y u s a g e i s
# p r i n t e d d u r i n g b u i l d .
#
#
#
# : :
#
# CUDA_BUILD_EMULATION ( Default OFF for device mode )
# - - S e t t o O N f o r E m u l a t i o n m o d e . - D _ D E V I C E E M U i s d e f i n e d f o r C U D A C f i l e s
# w h e n C U D A _ B U I L D _ E M U L A T I O N i s T R U E .
#
#
#
# : :
#
# CUDA_GENERATED_OUTPUT_DIR ( Default CMAKE_CURRENT_BINARY_DIR )
# - - S e t t o t h e p a t h y o u w i s h t o h a v e t h e g e n e r a t e d f i l e s p l a c e d . I f i t i s
# b l a n k o u t p u t f i l e s w i l l b e p l a c e d i n C M A K E _ C U R R E N T _ B I N A R Y _ D I R .
# I n t e r m e d i a t e f i l e s w i l l a l w a y s b e p l a c e d i n
# C M A K E _ C U R R E N T _ B I N A R Y _ D I R / C M a k e F i l e s .
#
#
#
# : :
#
# CUDA_HOST_COMPILATION_CPP ( Default ON )
# - - S e t t o O F F f o r C c o m p i l a t i o n o f h o s t c o d e .
#
#
#
# : :
#
# CUDA_HOST_COMPILER ( Default CMAKE_C_COMPILER, $ ( VCInstallDir ) /bin for VS )
# - - S e t t h e h o s t c o m p i l e r t o b e u s e d b y n v c c . I g n o r e d i f - c c b i n o r
# - - c o m p i l e r - b i n d i r i s a l r e a d y p r e s e n t i n t h e C U D A _ N V C C _ F L A G S o r
@ -113,19 +83,11 @@
# $ ( V C I n s t a l l D i r ) / b i n i s a s p e c i a l v a l u e t h a t e x p a n d s o u t t o t h e p a t h w h e n
# t h e c o m m a n d i s r u n f r o m w i t h i n g V S .
#
#
#
# : :
#
# C U D A _ N V C C _ F L A G S
# C U D A _ N V C C _ F L A G S _ < C O N F I G >
# - - A d d i t i o n a l N V C C c o m m a n d l i n e a r g u m e n t s . N O T E : m u l t i p l e a r g u m e n t s m u s t b e
# s e m i - c o l o n delimited ( e.g. --compiler-options;-Wall )
#
#
#
# : :
#
# CUDA_PROPAGATE_HOST_FLAGS ( Default ON )
# - - S e t t o O N t o p r o p a g a t e C M A K E _ { C , C X X } _ F L A G S a n d t h e i r c o n f i g u r a t i o n
# d e p e n d e n t counterparts ( e.g. CMAKE_C_FLAGS_DEBUG ) a u t o m a t i c a l l y t o t h e
@ -137,10 +99,6 @@
# C U D A _ A D D _ L I B R A R Y , C U D A _ A D D _ E X E C U T A B L E , o r C U D A _ W R A P _ S R C S . F l a g s u s e d f o r
# s h a r e d l i b r a r y c o m p i l a t i o n a r e n o t a f f e c t e d b y t h i s f l a g .
#
#
#
# : :
#
# CUDA_SEPARABLE_COMPILATION ( Default OFF )
# - - I f s e t t h i s w i l l e n a b l e s e p a r a b l e c o m p i l a t i o n f o r a l l C U D A r u n t i m e o b j e c t
# f i l e s . I f u s e d o u t s i d e o f C U D A _ A D D _ E X E C U T A B L E a n d C U D A _ A D D _ L I B R A R Y
@ -148,38 +106,22 @@
# C U D A _ C O M P U T E _ S E P A R A B L E _ C O M P I L A T I O N _ O B J E C T _ F I L E _ N A M E a n d
# C U D A _ L I N K _ S E P A R A B L E _ C O M P I L A T I O N _ O B J E C T S s h o u l d b e c a l l e d .
#
#
#
# : :
#
# CUDA_VERBOSE_BUILD ( Default OFF )
# - - S e t t o O N t o s e e a l l t h e c o m m a n d s u s e d w h e n b u i l d i n g t h e C U D A f i l e . W h e n
# u s i n g a M a k e f i l e g e n e r a t o r t h e v a l u e d e f a u l t s t o VERBOSE ( run make
# V E R B O S E = 1 t o s e e o u t p u t ) , a l t h o u g h s e t t i n g C U D A _ V E R B O S E _ B U I L D t o O N w i l l
# a l w a y s p r i n t t h e o u t p u t .
#
#
#
# T h e s c r i p t c r e a t e s t h e f o l l o w i n g macros ( in alphebetical order ) :
#
# : :
# T h e s c r i p t c r e a t e s t h e f o l l o w i n g macros ( in alphebetical order ) : :
#
# CUDA_ADD_CUFFT_TO_TARGET ( cuda_target )
# - - A d d s t h e c u f f t l i b r a r y t o t h e target ( can be any target ) . H a n d l e s w h e t h e r
# y o u a r e i n e m u l a t i o n m o d e o r n o t .
#
#
#
# : :
#
# CUDA_ADD_CUBLAS_TO_TARGET ( cuda_target )
# - - A d d s t h e c u b l a s l i b r a r y t o t h e target ( can be any target ) . H a n d l e s
# w h e t h e r y o u a r e i n e m u l a t i o n m o d e o r n o t .
#
#
#
# : :
#
# CUDA_ADD_EXECUTABLE ( cuda_target file0 file1 ...
# [ WIN32 ] [ M A C O S X _ B U N D L E ] [ E X C L U D E _ F R O M _ A L L ] [ O P T I O N S . . . ] )
# - - C r e a t e s a n e x e c u t a b l e " c u d a _ t a r g e t " w h i c h i s m a d e u p o f t h e f i l e s
@ -193,42 +135,28 @@
# n v c c . S u c h f l a g s s h o u l d b e m o d i f i e d b e f o r e c a l l i n g C U D A _ A D D _ E X E C U T A B L E ,
# C U D A _ A D D _ L I B R A R Y o r C U D A _ W R A P _ S R C S .
#
#
#
# : :
#
# CUDA_ADD_LIBRARY ( cuda_target file0 file1 ...
# [ S T A T I C | S H A R E D | M O D U L E ] [ E X C L U D E _ F R O M _ A L L ] [ O P T I O N S . . . ] )
# - - S a m e a s C U D A _ A D D _ E X E C U T A B L E e x c e p t t h a t a l i b r a r y i s c r e a t e d .
#
#
#
# : :
#
# CUDA_BUILD_CLEAN_TARGET ( )
# - - C r e a t e s a c o n v i e n c e t a r g e t t h a t d e l e t e s a l l t h e d e p e n d e n c y f i l e s
# g e n e r a t e d . Y o u s h o u l d m a k e c l e a n a f t e r r u n n i n g t h i s t a r g e t t o e n s u r e t h e
# d e p e n d e n c y f i l e s g e t r e g e n e r a t e d .
#
#
#
# : :
#
# CUDA_COMPILE ( generated_files file0 file1 ... [STATIC | SHARED | MODULE]
# [ O P T I O N S . . . ] )
# - - R e t u r n s a l i s t o f g e n e r a t e d f i l e s f r o m t h e i n p u t s o u r c e f i l e s t o b e u s e d
# w i t h A D D _ L I B R A R Y o r A D D _ E X E C U T A B L E .
#
#
#
# : :
#
# CUDA_COMPILE_PTX ( generated_files file0 file1 ... [OPTIONS ...] )
# - - R e t u r n s a l i s t o f P T X f i l e s g e n e r a t e d f r o m t h e i n p u t s o u r c e f i l e s .
#
# CUDA_COMPILE_FATBIN ( generated_files file0 file1 ... [OPTIONS ...] )
# - - R e t u r n s a l i s t o f F A T B I N f i l e s g e n e r a t e d f r o m t h e i n p u t s o u r c e f i l e s .
#
#
# : :
# CUDA_COMPILE_CUBIN ( generated_files file0 file1 ... [OPTIONS ...] )
# - - R e t u r n s a l i s t o f C U B I N f i l e s g e n e r a t e d f r o m t h e i n p u t s o u r c e f i l e s .
#
# CUDA_COMPUTE_SEPARABLE_COMPILATION_OBJECT_FILE_NAME ( output_file_var
# c u d a _ t a r g e t
@ -242,10 +170,6 @@
# a u t o m a t i c a l l y f o r C U D A _ A D D _ L I B R A R Y a n d C U D A _ A D D _ E X E C U T A B L E . N o t e t h a t
# t h i s i s a f u n c t i o n a n d n o t a m a c r o .
#
#
#
# : :
#
# CUDA_INCLUDE_DIRECTORIES ( path0 path1 ... )
# - - S e t s t h e d i r e c t o r i e s t h a t s h o u l d b e p a s s e d t o n v c c
# ( e . g . n v c c - I p a t h 0 - I p a t h 1 . . . ) . T h e s e p a t h s u s u a l l y c o n t a i n o t h e r . c u
@ -253,17 +177,9 @@
#
#
#
#
#
# : :
#
# CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS ( output_file_var cuda_target
# n v c c _ f l a g s o b j e c t _ f i l e s )
#
#
#
# : :
#
# - - G e n e r a t e s t h e l i n k o b j e c t r e q u i r e d b y s e p a r a b l e c o m p i l a t i o n f r o m t h e g i v e n
# o b j e c t f i l e s . T h i s i s c a l l e d a u t o m a t i c a l l y f o r C U D A _ A D D _ E X E C U T A B L E a n d
# C U D A _ A D D _ L I B R A R Y , b u t c a n b e c a l l e d m a n u a l l y w h e n u s i n g C U D A _ W R A P _ S R C S
@ -273,91 +189,51 @@
# s p e c i f i e d b y C U D A _ 6 4 _ B I T _ D E V I C E _ C O D E . N o t e t h a t t h i s i s a f u n c t i o n
# i n s t e a d o f a m a c r o .
#
#
#
# : :
#
# CUDA_WRAP_SRCS ( cuda_target format generated_files file0 file1 ...
# [ S T A T I C | S H A R E D | M O D U L E ] [ O P T I O N S . . . ] )
# - - T h i s i s w h e r e a l l t h e m a g i c h a p p e n s . C U D A _ A D D _ E X E C U T A B L E ,
# C U D A _ A D D _ L I B R A R Y , C U D A _ C O M P I L E , a n d C U D A _ C O M P I L E _ P T X a l l c a l l t h i s
# f u n c t i o n u n d e r t h e h o o d .
#
#
#
# : :
#
# G i v e n t h e l i s t o f files ( file0 file1 ... fileN ) t h i s m a c r o g e n e r a t e s
# c u s t o m c o m m a n d s t h a t g e n e r a t e e i t h e r P T X o r l i n k a b l e objects ( use "PTX" or
# " O B J " f o r t h e f o r m a t a r g u m e n t t o s w i t c h ) . F i l e s t h a t d o n ' t e n d w i t h . c u
# o r h a v e t h e H E A D E R _ F I L E _ O N L Y p r o p e r t y a r e i g n o r e d .
#
#
#
# : :
#
# T h e a r g u m e n t s p a s s e d i n a f t e r O P T I O N S a r e e x t r a c o m m a n d l i n e o p t i o n s t o
# g i v e t o n v c c . Y o u c a n a l s o s p e c i f y p e r c o n f i g u r a t i o n o p t i o n s b y
# s p e c i f y i n g t h e n a m e o f t h e c o n f i g u r a t i o n f o l l o w e d b y t h e o p t i o n s . G e n e r a l
# o p t i o n s m u s t p r e c e e d c o n f i g u r a t i o n s p e c i f i c o p t i o n s . N o t a l l
# c o n f i g u r a t i o n s n e e d t o b e s p e c i f i e d , o n l y t h e o n e s p r o v i d e d w i l l b e u s e d .
#
#
#
# : :
#
# O P T I O N S - D F L A G = 2 " - D F L A G _ O T H E R = s p a c e i n f l a g "
# D E B U G - g
# R E L E A S E - - u s e _ f a s t _ m a t h
# R E L W I T H D E B I N F O - - u s e _ f a s t _ m a t h ; - g
# M I N S I Z E R E L - - u s e _ f a s t _ m a t h
#
#
#
# : :
#
# F o r c e r t a i n configurations ( namely VS generating object files with
# C U D A _ A T T A C H _ V S _ B U I L D _ R U L E _ T O _ C U D A _ F I L E s e t t o O N ) , n o g e n e r a t e d f i l e w i l l
# b e p r o d u c e d f o r t h e g i v e n c u d a f i l e . T h i s i s b e c a u s e w h e n y o u a d d t h e
# c u d a f i l e t o V i s u a l S t u d i o i t k n o w s t h a t t h i s f i l e p r o d u c e s a n o b j e c t f i l e
# a n d w i l l l i n k i n t h e r e s u l t i n g o b j e c t f i l e a u t o m a t i c a l l y .
#
#
#
# : :
#
# T h i s s c r i p t w i l l a l s o g e n e r a t e a s e p a r a t e c m a k e s c r i p t t h a t i s u s e d a t
# b u i l d t i m e t o i n v o k e n v c c . T h i s i s f o r s e v e r a l r e a s o n s .
#
#
#
# : :
#
# 1 . n v c c c a n r e t u r n n e g a t i v e n u m b e r s a s r e t u r n v a l u e s w h i c h c o n f u s e s
# V i s u a l S t u d i o i n t o t h i n k i n g t h a t t h e c o m m a n d s u c c e e d e d . T h e s c r i p t n o w
# c h e c k s t h e e r r o r c o d e s a n d p r o d u c e s e r r o r s w h e n t h e r e w a s a p r o b l e m .
#
#
#
# : :
#
# 2 . n v c c h a s b e e n k n o w n t o n o t d e l e t e i n c o m p l e t e r e s u l t s w h e n i t
# e n c o u n t e r s p r o b l e m s . T h i s c o n f u s e s b u i l d s y s t e m s i n t o t h i n k i n g t h e
# t a r g e t w a s g e n e r a t e d w h e n i n f a c t a n u n u s a b l e f i l e e x i s t s . T h e s c r i p t
# n o w d e l e t e s t h e o u t p u t f i l e s i f t h e r e w a s a n e r r o r .
#
#
#
# : :
#
# 3 . B y p u t t i n g a l l t h e o p t i o n s t h a t a f f e c t t h e b u i l d i n t o a f i l e a n d t h e n
# m a k e t h e b u i l d r u l e d e p e n d e n t o n t h e f i l e , t h e o u t p u t f i l e s w i l l b e
# r e g e n e r a t e d w h e n t h e o p t i o n s c h a n g e .
#
#
#
# : :
#
# T h i s s c r i p t a l s o l o o k s a t o p t i o n a l a r g u m e n t s S T A T I C , S H A R E D , o r M O D U L E t o
# d e t e r m i n e w h e n t o t a r g e t t h e o b j e c t c o m p i l a t i o n f o r a s h a r e d l i b r a r y .
# B U I L D _ S H A R E D _ L I B S i s i g n o r e d i n C U D A _ W R A P _ S R C S , b u t i t i s r e s p e c t e d i n
@ -366,27 +242,17 @@
# < t a r g e t _ n a m e > _ E X P O R T S i s d e f i n e d w h e n a s h a r e d l i b r a r y c o m p i l a t i o n i s
# d e t e c t e d .
#
#
#
# : :
#
# F l a g s p a s s e d i n t o a d d _ d e f i n i t i o n s w i t h - D o r / D a r e p a s s e d a l o n g t o n v c c .
#
#
#
# T h e s c r i p t d e f i n e s t h e f o l l o w i n g v a r i a b l e s :
#
# : :
# T h e s c r i p t d e f i n e s t h e f o l l o w i n g v a r i a b l e s : :
#
# C U D A _ V E R S I O N _ M A J O R - - T h e m a j o r v e r s i o n o f c u d a a s r e p o r t e d b y n v c c .
# C U D A _ V E R S I O N _ M I N O R - - T h e m i n o r v e r s i o n .
# C U D A _ V E R S I O N
# C U D A _ V E R S I O N _ S T R I N G - - C U D A _ V E R S I O N _ M A J O R . C U D A _ V E R S I O N _ M I N O R
#
#
#
# : :
#
# C U D A _ T O O L K I T _ R O O T _ D I R - - P a t h t o t h e C U D A Toolkit ( defined if not set ) .
# C U D A _ S D K _ R O O T _ D I R - - P a t h t o t h e C U D A S D K . U s e t h i s t o f i n d f i l e s i n t h e
# S D K . T h i s s c r i p t w i l l n o t d i r e c t l y s u p p o r t f i n d i n g
@ -412,13 +278,13 @@
# O n l y a v a i l a b l e f o r C U D A v e r s i o n 3 . 2 + .
# C U D A _ c u s p a r s e _ L I B R A R Y - - C U D A S p a r s e M a t r i x l i b r a r y .
# O n l y a v a i l a b l e f o r C U D A v e r s i o n 3 . 2 + .
# C U D A _ n p p _ L I B R A R Y - - N V I D I A P e r f o r m a n c e P r i m i t i v e s l i b r a r y .
# C U D A _ n p p _ L I B R A R Y - - N V I D I A P e r f o r m a n c e P r i m i t i v e s l i b .
# O n l y a v a i l a b l e f o r C U D A v e r s i o n 4 . 0 + .
# C U D A _ n p p c _ L I B R A R Y - - N V I D I A P e r f o r m a n c e P r i m i t i v e s library ( core ) .
# C U D A _ n p p c _ L I B R A R Y - - N V I D I A P e r f o r m a n c e P r i m i t i v e s lib ( core ) .
# O n l y a v a i l a b l e f o r C U D A v e r s i o n 5 . 5 + .
# C U D A _ n p p i _ L I B R A R Y - - N V I D I A P e r f o r m a n c e P r i m i t i v e s library ( image processing ) .
# C U D A _ n p p i _ L I B R A R Y - - N V I D I A P e r f o r m a n c e P r i m i t i v e s lib ( image processing ) .
# O n l y a v a i l a b l e f o r C U D A v e r s i o n 5 . 5 + .
# C U D A _ n p p s _ L I B R A R Y - - N V I D I A P e r f o r m a n c e P r i m i t i v e s library ( signal processing ) .
# C U D A _ n p p s _ L I B R A R Y - - N V I D I A P e r f o r m a n c e P r i m i t i v e s lib ( signal processing ) .
# O n l y a v a i l a b l e f o r C U D A v e r s i o n 5 . 5 + .
# C U D A _ n v c u v e n c _ L I B R A R Y - - C U D A V i d e o E n c o d e r l i b r a r y .
# O n l y a v a i l a b l e f o r C U D A v e r s i o n 3 . 2 + .
@ -427,32 +293,15 @@
# O n l y a v a i l a b l e f o r C U D A v e r s i o n 3 . 2 + .
# W i n d o w s o n l y .
#
#
#
#
#
# : :
#
# J a m e s B i g l e r , N V I D I A Corp ( nvidia.com - jbigler )
# A b e S t e p h e n s , S C I I n s t i t u t e - - h t t p : / / w w w . s c i . u t a h . e d u / ~ a b e / F i n d C u d a . h t m l
#
#
#
# : :
#
# Copyright ( c ) 2 0 0 8 - 2 0 0 9 N V I D I A C o r p o r a t i o n . A l l r i g h t s r e s e r v e d .
#
#
#
# : :
#
# Copyright ( c ) 2 0 0 7 - 2 0 0 9
# S c i e n t i f i c C o m p u t i n g a n d I m a g i n g I n s t i t u t e , U n i v e r s i t y o f U t a h
#
#
#
# : :
#
# T h i s c o d e i s l i c e n s e d u n d e r t h e M I T L i c e n s e . S e e t h e F i n d C U D A . c m a k e s c r i p t
# f o r t h e t e x t o f t h e l i c e n s e .
@ -481,11 +330,6 @@
# F i n d C U D A . c m a k e
# W e n e e d t o h a v e a t l e a s t t h i s v e r s i o n t o s u p p o r t t h e V E R S I O N _ L E S S a r g u m e n t t o ' i f ' ( 2 . 6 . 2 ) a n d unset ( 2.6.3 )
cmake_policy ( PUSH )
cmake_minimum_required ( VERSION 2.6.3 )
cmake_policy ( POP )
# T h i s m a c r o h e l p s u s f i n d t h e l o c a t i o n o f h e l p e r f i l e s w e w i l l n e e d t h e f u l l p a t h t o
macro ( CUDA_FIND_HELPER_FILE _name _extension )
set ( _full_name "${_name}.${_extension}" )
@ -608,7 +452,17 @@ set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.")
if ( CMAKE_GENERATOR MATCHES "Visual Studio" )
set ( CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC" )
else ( )
set ( CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC" )
# U s i n g c c w h i c h i s s y m l i n k t o c l a n g m a y l e t N V C C t h i n k i t i s G C C a n d i s s u e
# u n h a n d l e d - d u m p s p e c s o p t i o n t o c l a n g . A l s o i n c a s e n e i t h e r
# C M A K E _ C _ C O M P I L E R i s defined ( project does not use C language ) n o r
# C U D A _ H O S T _ C O M P I L E R i s s p e c i f i e d m a n u a l l y w e s h o u l d s k i p - c c b i n a n d l e t
# n v c c u s e i t s o w n d e f a u l t C c o m p i l e r .
if ( DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER )
get_filename_component ( c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH )
else ( )
set ( c_compiler_realpath "" )
endif ( )
set ( CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC" )
endif ( )
# P r o p a g a t e t h e h o s t f l a g s t o t h e h o s t c o m p i l e r v i a - X c o m p i l e r
@ -675,14 +529,16 @@ endmacro()
# C h e c k t o s e e i f t h e C U D A _ T O O L K I T _ R O O T _ D I R a n d C U D A _ S D K _ R O O T _ D I R h a v e c h a n g e d ,
# i f t h e y h a v e t h e n c l e a r t h e c a c h e v a r i a b l e s , s o t h a t w i l l b e d e t e c t e d a g a i n .
if ( NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}" )
if ( DEFINED CUDA_TOOLKIT_ROOT_DIR_INTERNAL AND ( NOT "${CUDA_TOOLKIT_ROOT_DIR}" STREQUAL "${CUDA_TOOLKIT_ROOT_DIR_INTERNAL}" ) )
unset ( CUDA_TARGET_TRIPLET CACHE )
unset ( CUDA_TOOLKIT_TARGET_DIR CACHE )
unset ( CUDA_NVCC_EXECUTABLE CACHE )
unset ( CUDA_VERSION CACHE )
cuda_unset_include_and_libraries ( )
endif ( )
if ( NOT "${CUDA_TOOLKIT_TARGET_DIR}" STREQUAL "${CUDA_TOOLKIT_TARGET_DIR_INTERNAL}" )
if ( DEFINED CUDA_TARGET_TRIPLET_INTERNAL AND ( NOT "${CUDA_TARGET_TRIPLET}" STREQUAL "${CUDA_TARGET_TRIPLET_INTERNAL}" ) OR
( D E F I N E D C U D A _ T O O L K I T _ T A R G E T _ D I R A N D D E F I N E D C U D A _ T O O L K I T _ T A R G E T _ D I R _ I N T E R N A L A N D N O T " $ { C U D A _ T O O L K I T _ T A R G E T _ D I R } " S T R E Q U A L " $ { C U D A _ T O O L K I T _ T A R G E T _ D I R _ I N T E R N A L } " ) )
cuda_unset_include_and_libraries ( )
endif ( )
@ -758,27 +614,46 @@ endif()
# A l w a y s s e t t h i s c o n v e n i e n c e v a r i a b l e
set ( CUDA_VERSION_STRING "${CUDA_VERSION}" )
# S u p p o r t f o r a r m c r o s s c o m p i l a t i o n w i t h C U D A 5 . 5
set ( __cuda_toolkit_target_dir_initial "${CUDA_TOOLKIT_ROOT_DIR}" )
if ( CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND ${ CMAKE_SYSTEM_PROCESSOR } MATCHES "arm" )
if ( ANDROID AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-androideabi" )
set ( __cuda_toolkit_target_dir_initial "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-androideabi" )
elseif ( EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf" )
set ( __cuda_toolkit_target_dir_initial "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf" )
endif ( )
endif ( )
set ( CUDA_TOOLKIT_TARGET_DIR "${__cuda_toolkit_target_dir_initial}" CACHE PATH "Toolkit target location." )
mark_as_advanced ( CUDA_TOOLKIT_TARGET_DIR )
# T a r g e t C P U a r c h i t e c t u r e
if ( CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND ${ CMAKE_SYSTEM_PROCESSOR } MATCHES "arm" )
if ( DEFINED CUDA_TARGET_CPU_ARCH )
set ( _cuda_target_cpu_arch_initial "${CUDA_TARGET_CPU_ARCH}" )
elseif ( CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm|ARM)" )
set ( _cuda_target_cpu_arch_initial "ARM" )
else ( )
set ( _cuda_target_cpu_arch_initial "" )
endif ( )
set ( CUDA_TARGET_CPU_ARCH ${ _cuda_target_cpu_arch_initial } CACHE STRING "Specify the name of the class of CPU architecture for which the input files must be compiled." )
set ( CUDA_TARGET_CPU_ARCH "${_cuda_target_cpu_arch_initial}" CACHE STRING "Specify the name of the class of CPU architecture for which the input files must be compiled." )
mark_as_advanced ( CUDA_TARGET_CPU_ARCH )
# T a r g e t O S v a r i a n t
if ( DEFINED CUDA_TARGET_OS_VARIANT )
set ( _cuda_target_os_variant_initial "${CUDA_TARGET_OS_VARIANT}" )
else ( )
set ( _cuda_target_os_variant_initial "" )
endif ( )
set ( CUDA_TARGET_OS_VARIANT "${_cuda_target_os_variant_initial}" CACHE STRING "Specify the name of the class of OS for which the input files must be compiled." )
mark_as_advanced ( CUDA_TARGET_OS_VARIANT )
# T a r g e t t r i p l e t
if ( DEFINED CUDA_TARGET_TRIPLET )
set ( _cuda_target_triplet_initial "${CUDA_TARGET_TRIPLET}" )
elseif ( CUDA_VERSION VERSION_GREATER "5.0" AND CMAKE_CROSSCOMPILING AND "${CUDA_TARGET_CPU_ARCH}" STREQUAL "ARM" )
if ( "${CUDA_TARGET_OS_VARIANT}" STREQUAL "Android" AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-androideabi" )
set ( _cuda_target_triplet_initial "armv7-linux-androideabi" )
elseif ( EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/armv7-linux-gnueabihf" )
set ( _cuda_target_triplet_initial "armv7-linux-gnueabihf" )
endif ( )
endif ( )
set ( CUDA_TARGET_TRIPLET "${_cuda_target_triplet_initial}" CACHE STRING "Specify the target triplet for which the input files must be compiled." )
file ( GLOB __cuda_available_target_tiplets RELATIVE "${CUDA_TOOLKIT_ROOT_DIR}/targets" "${CUDA_TOOLKIT_ROOT_DIR}/targets/*" )
set_property ( CACHE CUDA_TARGET_TRIPLET PROPERTY STRINGS ${ __cuda_available_target_tiplets } )
mark_as_advanced ( CUDA_TARGET_TRIPLET )
# T a r g e t d i r e c t o r y
if ( NOT DEFINED CUDA_TOOLKIT_TARGET_DIR AND CUDA_TARGET_TRIPLET AND EXISTS "${CUDA_TOOLKIT_ROOT_DIR}/targets/${CUDA_TARGET_TRIPLET}" )
set ( CUDA_TOOLKIT_TARGET_DIR "${CUDA_TOOLKIT_ROOT_DIR}/targets/${CUDA_TARGET_TRIPLET}" )
endif ( )
# C U D A _ T O O L K I T _ I N C L U D E
find_path ( CUDA_TOOLKIT_INCLUDE
d e v i c e _ f u n c t i o n s . h # H e a d e r i n c l u d e d i n t o o l k i t
@ -802,10 +677,16 @@ macro(cuda_find_library_local_first_with_path_ext _var _names _doc _path_ext )
# a n d o l d p a t h s .
set ( _cuda_64bit_lib_dir "${_path_ext}lib/x64" "${_path_ext}lib64" "${_path_ext}libx64" )
endif ( )
if ( CUDA_VERSION VERSION_GREATER "6.0" )
set ( _cuda_static_lib_names "" )
foreach ( name ${ _names } )
list ( APPEND _cuda_static_lib_names "${name}_static" )
endforeach ( )
endif ( )
# C U D A 3 . 2 + o n W i n d o w s m o v e d t h e l i b r a r y d i r e c t o r i e s , s o w e n e e d t o n e w
# ( l i b / W i n 3 2 ) a n d t h e o l d path ( lib ) .
find_library ( ${ _var }
N A M E S $ { _ n a m e s }
N A M E S $ { _ n a m e s } $ { _ c u d a _ s t a t i c _ l i b _ n a m e s }
P A T H S " $ { C U D A _ T O O L K I T _ T A R G E T _ D I R } " " $ { C U D A _ T O O L K I T _ R O O T _ D I R } "
E N V C U D A _ P A T H
E N V C U D A _ L I B _ P A T H
@ -815,7 +696,7 @@ macro(cuda_find_library_local_first_with_path_ext _var _names _doc _path_ext )
)
# S e a r c h d e f a u l t s e a r c h p a t h s , a f t e r w e s e a r c h o u r o w n s e t o f p a t h s .
find_library ( ${ _var }
N A M E S $ { _ n a m e s }
N A M E S $ { _ n a m e s } $ { _ c u d a _ s t a t i c _ l i b _ n a m e s }
P A T H S " / u s r / l i b / n v i d i a - c u r r e n t "
D O C $ { _ d o c }
)
@ -853,18 +734,6 @@ if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY)
else ( )
set ( CUDA_LIBRARIES ${ CUDA_CUDART_LIBRARY } )
endif ( )
if ( APPLE )
# W e n e e d t o a d d t h e p a t h t o c u d a r t t o t h e l i n k e r u s i n g r p a t h , s i n c e t h e
# l i b r a r y n a m e f o r t h e c u d a l i b r a r i e s i s p r e p e n d e d w i t h @ r p a t h .
if ( CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY )
get_filename_component ( _cuda_path_to_cudart "${CUDA_CUDARTEMU_LIBRARY}" PATH )
else ( )
get_filename_component ( _cuda_path_to_cudart "${CUDA_CUDART_LIBRARY}" PATH )
endif ( )
if ( _cuda_path_to_cudart )
list ( APPEND CUDA_LIBRARIES -Wl,-rpath "-Wl,${_cuda_path_to_cudart}" )
endif ( )
endif ( )
# 1 . 1 t o o l k i t o n l i n u x d o e s n ' t a p p e a r t o h a v e a s e p a r a t e l i b r a r y o n
# s o m e p l a t f o r m s .
@ -997,6 +866,8 @@ set(CUDA_FOUND TRUE)
set ( CUDA_TOOLKIT_ROOT_DIR_INTERNAL "${CUDA_TOOLKIT_ROOT_DIR}" CACHE INTERNAL
" T h i s i s t h e v a l u e o f t h e l a s t t i m e C U D A _ T O O L K I T _ R O O T _ D I R w a s s e t s u c c e s s f u l l y . " F O R C E )
set ( CUDA_TARGET_TRIPLET_INTERNAL "${CUDA_TARGET_TRIPLET}" CACHE INTERNAL
" T h i s i s t h e v a l u e o f t h e l a s t t i m e C U D A _ T A R G E T _ T R I P L E T w a s s e t s u c c e s s f u l l y . " F O R C E )
set ( CUDA_TOOLKIT_TARGET_DIR_INTERNAL "${CUDA_TOOLKIT_TARGET_DIR}" CACHE INTERNAL
" T h i s i s t h e v a l u e o f t h e l a s t t i m e C U D A _ T O O L K I T _ T A R G E T _ D I R w a s s e t s u c c e s s f u l l y . " F O R C E )
set ( CUDA_SDK_ROOT_DIR_INTERNAL "${CUDA_SDK_ROOT_DIR}" CACHE INTERNAL
@ -1044,15 +915,15 @@ macro(CUDA_GET_SOURCES_AND_OPTIONS _sources _cmake_options _options)
set ( ${ _options } )
set ( _found_options FALSE )
foreach ( arg ${ ARGN } )
if ( arg STREQUAL "OPTIONS" )
if ( "x${ arg}" STREQUAL "x OPTIONS" )
set ( _found_options TRUE )
elseif (
a r g S T R E Q U A L " WIN3 2" O R
a r g S T R E Q U A L " M A C O S X _ B U N D L E " O R
a r g S T R E Q U A L " E X C L U D E _ F R O M _ A L L " O R
a r g S T R E Q U A L " S T A T I C " O R
a r g S T R E Q U A L " S H A R E D " O R
a r g S T R E Q U A L " M O D U L E "
" x $ { a r g } " S T R E Q U A L " x W I N 3 2 " O R
" x $ { a r g } " S T R E Q U A L " x M A C O S X _ B U N D L E " O R
" x $ { a r g } " S T R E Q U A L " x E X C L U D E _ F R O M _ A L L " O R
" x $ { a r g } " S T R E Q U A L " x S T A T I C " O R
" x $ { a r g } " S T R E Q U A L " x S H A R E D " O R
" x $ { a r g } " S T R E Q U A L " x M O D U L E "
)
list ( APPEND ${ _cmake_options } ${ arg } )
else ( )
@ -1148,7 +1019,7 @@ function(CUDA_COMPUTE_BUILD_PATH path build_path)
endif ( )
endif ( )
# T h i s r e c i p i e i s f r o m c m L o c a l G e n e r a t o r : : C r e a t e S a f e U n i q u e O b j e c t F i l e N a m e i n t h e
# T h i s r e c i p e i s f r o m c m L o c a l G e n e r a t o r : : C r e a t e S a f e U n i q u e O b j e c t F i l e N a m e i n t h e
# C M a k e s o u r c e .
# R e m o v e l e a d i n g /
@ -1177,7 +1048,7 @@ endfunction()
# a . c p p o r . p t x f i l e .
# I N P U T :
# c u d a _ t a r g e t - T a r g e t n a m e
# f o r m a t - P T X o r O B J
# f o r m a t - P T X , C U B I N , F A T B I N o r O B J
# F I L E 1 . . F I L E N - T h e r e m a i n i n g a r g u m e n t s a r e t h e s o u r c e s t o b e w r a p p e d .
# O P T I O N S - E x t r a o p t i o n s t o N V C C
# O U T P U T :
@ -1227,6 +1098,10 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set ( nvcc_flags ${ nvcc_flags } "--target-cpu-architecture=${CUDA_TARGET_CPU_ARCH}" )
endif ( )
if ( CUDA_TARGET_OS_VARIANT AND CUDA_VERSION VERSION_LESS "7.0" )
set ( nvcc_flags ${ nvcc_flags } "-target-os-variant=${CUDA_TARGET_OS_VARIANT}" )
endif ( )
# T h i s n e e d s t o b e p a s s e d i n a t t h i s s t a g e , b e c a u s e V S n e e d s t o f i l l o u t t h e
# v a l u e o f V C I n s t a l l D i r f r o m w i t h i n V S . N o t e t h a t C C B I N i s o n l y u s e d i f
# - c c b i n o r - - c o m p i l e r - b i n d i r i s n ' t u s e d a n d C U D A _ H O S T _ C O M P I L E R m a t c h e s
@ -1355,7 +1230,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
foreach ( file ${ ARGN } )
# I g n o r e a n y f i l e m a r k e d a s a H E A D E R _ F I L E _ O N L Y
get_source_file_property ( _is_header ${ file } HEADER_FILE_ONLY )
if ( ${ file } MATCHES ".* \\.cu$" AND NOT _is_header )
if ( ${ file } MATCHES "\\.cu$" AND NOT _is_header )
# A l l o w p e r s o u r c e f i l e o v e r r i d e s o f t h e f o r m a t .
get_source_file_property ( _cuda_source_format ${ file } CUDA_SOURCE_PROPERTY_FORMAT )
@ -1363,16 +1238,22 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set ( _cuda_source_format ${ format } )
endif ( )
if ( ${ _cuda_source_format } MATCHES "PTX" )
set ( compile_to_ptx ON )
elseif ( ${ _cuda_source_format } MATCHES "OBJ" )
set ( compile_to_ptx OFF )
if ( ${ _cuda_source_format } MATCHES "OBJ" )
set ( cuda_compile_to_external_module OFF )
else ( )
message ( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS for file '${file}': '${_cuda_source_format}'. Use OBJ or PTX." )
set ( cuda_compile_to_external_module ON )
if ( ${ _cuda_source_format } MATCHES "PTX" )
set ( cuda_compile_to_external_module_type "ptx" )
elseif ( ${ _cuda_source_format } MATCHES "CUBIN" )
set ( cuda_compile_to_external_module_type "cubin" )
elseif ( ${ _cuda_source_format } MATCHES "FATBIN" )
set ( cuda_compile_to_external_module_type "fatbin" )
else ( )
message ( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS for file '${file}': '${_cuda_source_format}'. Use OBJ, PTX, CUBIN or FATBIN." )
endif ( )
endif ( )
if ( compile_to_ptx )
if ( cuda_compile_to_external_module )
# D o n ' t u s e a n y o f t h e h o s t c o m p i l a t i o n f l a g s f o r P T X t a r g e t s .
set ( CUDA_HOST_FLAGS )
set ( CUDA_NVCC_FLAGS_CONFIG )
@ -1387,7 +1268,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
if ( CUDA_GENERATED_OUTPUT_DIR )
set ( cuda_compile_output_dir "${CUDA_GENERATED_OUTPUT_DIR}" )
else ( )
if ( compile_to_ptx )
if ( cuda_compile_to_external_module )
set ( cuda_compile_output_dir "${CMAKE_CURRENT_BINARY_DIR}" )
else ( )
set ( cuda_compile_output_dir "${cuda_compile_intermediate_directory}" )
@ -1397,10 +1278,10 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
# A d d a c u s t o m t a r g e t t o g e n e r a t e a c o r p t x f i l e . # # # # # # # # # # # # # # # # # # # # # #
get_filename_component ( basename ${ file } NAME )
if ( compile_to_ptx )
if ( cuda_compile_to_external_module )
set ( generated_file_path "${cuda_compile_output_dir}" )
set ( generated_file_basename "${cuda_target}_generated_${basename}.ptx" )
set ( format_flag "-ptx" )
set ( generated_file_basename "${cuda_target}_generated_${basename}.${cuda_com pile_ to_e xternal_module_type} " )
set ( format_flag "-${cuda_com pile_ to_e xternal_module_type} " )
file ( MAKE_DIRECTORY "${cuda_compile_output_dir}" )
else ( )
set ( generated_file_path "${cuda_compile_output_dir}/${CMAKE_CFG_INTDIR}" )
@ -1423,7 +1304,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set ( custom_target_script "${cuda_compile_intermediate_directory}/${generated_file_basename}.cmake" )
# S e t u p p r o p e r t i e s f o r o b j f i l e s :
if ( NOT compile_to_ptx )
if ( NOT cuda_compile_to_external_module )
set_source_files_properties ( "${generated_file}"
P R O P E R T I E S
E X T E R N A L _ O B J E C T t r u e # T h i s i s a n o b j e c t f i l e n o t t o b e c o m p i l e d , b u t o n l y b e l i n k e d .
@ -1438,7 +1319,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
set ( source_file "${CMAKE_CURRENT_SOURCE_DIR}/${file}" )
endif ( )
if ( NOT compile_to_ptx AND CUDA_SEPARABLE_COMPILATION )
if ( NOT cuda_compile_to_external_module AND CUDA_SEPARABLE_COMPILATION )
list ( APPEND ${ cuda_target } _SEPARABLE_COMPILATION_OBJECTS "${generated_file}" )
endif ( )
@ -1455,7 +1336,7 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
# B u i l d t h e N V C C m a d e d e p e n d e n c y f i l e # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
set ( build_cubin OFF )
if ( NOT CUDA_BUILD_EMULATION AND CUDA_BUILD_CUBIN )
if ( NOT compile_to_ptx )
if ( NOT cuda_compile_to_external_module )
set ( build_cubin ON )
endif ( )
endif ( )
@ -1482,8 +1363,8 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
# C r e a t e u p t h e c o m m e n t s t r i n g
file ( RELATIVE_PATH generated_file_relative_path "${CMAKE_BINARY_DIR}" "${generated_file}" )
if ( compile_to_ptx )
set ( cuda_build_comment_string "Building NVCC ptx file ${generated_file_relative_path}" )
if ( cuda_compile_to_external_module )
set ( cuda_build_comment_string "Building NVCC ${cuda_com pile_ to_e xternal_module_type} file ${generated_file_relative_path}" )
else ( )
set ( cuda_build_comment_string "Building NVCC (${cuda_build_type}) object ${generated_file_relative_path}" )
endif ( )
@ -1576,18 +1457,27 @@ function(CUDA_LINK_SEPARABLE_COMPILATION_OBJECTS output_file cuda_target options
# I f - c c b i n , - - c o m p i l e r - b i n d i r h a s b e e n s p e c i f i e d , d o n ' t d o a n y t h i n g . O t h e r w i s e a d d i t h e r e .
list ( FIND nvcc_flags "-ccbin" ccbin_found0 )
list ( FIND nvcc_flags "--compiler-bindir" ccbin_found1 )
if ( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 )
if ( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
list ( APPEND nvcc_flags -ccbin "\" ${ CUDA_HOST_COMPILER } \"")
endif ( )
# C r e a t e a l i s t o f f l a g s s p e c i f i e d b y C U D A _ N V C C _ F L A G S _ $ { C O N F I G }
set ( config_specific_flags )
set ( flags )
foreach ( config ${ CUDA_configuration_types } )
string ( TOUPPER ${ config } config_upper )
# A d d c o n f i g s p e c i f i c f l a g s
foreach ( f ${ CUDA_NVCC_FLAGS_${config_upper } } )
list ( APPEND config_specific_flags $< $<CONFIG:${config} > : ${ f } > )
endforeach ( )
set ( important_host_flags )
_cuda_get_important_host_flags ( important_host_flags ${ CMAKE_${CUDA_C_OR_CXX } _FLAGS_ ${ config_upper } } )
foreach ( f ${ important_host_flags } )
list ( APPEND flags $< $<CONFIG:${config} > :-Xcompiler> $< $<CONFIG:${config} > : ${ f } > )
endforeach ( )
endforeach ( )
# A d d o u r g e n e r a l C U D A _ N V C C _ F L A G S w i t h t h e c o n f i g u r a t i o n s p e c i f i g f l a g s
set ( nvcc_flags ${ CUDA_NVCC_FLAGS } ${ config_specific_flags } ${ nvcc_flags } )
file ( RELATIVE_PATH output_file_relative_path "${CMAKE_BINARY_DIR}" "${output_file}" )
# S o m e g e n e r a t o r s d o n ' t h a n d l e t h e m u l t i p l e l e v e l s o f c u s t o m c o m m a n d
@ -1713,21 +1603,29 @@ endmacro()
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# C U D A C O M P I L E
# ( I n t e r n a l ) h e l p e r f o r m a n u a l l y a d d e d c u d a s o u r c e f i l e s w i t h s p e c i f i c t a r g e t s
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
macro ( CUDA_COMPILE generated_files )
macro ( cuda_compile_base cuda_target format generated_files )
# S e p a r a t e t h e s o u r c e s f r o m t h e o p t i o n s
CUDA_GET_SOURCES_AND_OPTIONS ( _sources _cmake_options _options ${ ARGN } )
# C r e a t e c u s t o m c o m m a n d s a n d t a r g e t s f o r e a c h f i l e .
CUDA_WRAP_SRCS ( cuda_compile OBJ _generated_files ${ _sources } ${ _cmake_options }
CUDA_WRAP_SRCS ( ${ cuda_target } ${ format } _generated_files ${ _sources } ${ _cmake_options }
O P T I O N S $ { _ o p t i o n s } )
set ( ${ generated_files } ${ _generated_files } )
endmacro ( )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# C U D A C O M P I L E
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
macro ( CUDA_COMPILE generated_files )
cuda_compile_base ( cuda_compile OBJ ${ generated_files } ${ ARGN } )
endmacro ( )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
@ -1735,17 +1633,28 @@ endmacro()
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
macro ( CUDA_COMPILE_PTX generated_files )
cuda_compile_base ( cuda_compile_ptx PTX ${ generated_files } ${ ARGN } )
endmacro ( )
# S e p a r a t e t h e s o u r c e s f r o m t h e o p t i o n s
CUDA_GET_SOURCES_AND_OPTIONS ( _sources _cmake_options _options ${ ARGN } )
# C r e a t e c u s t o m c o m m a n d s a n d t a r g e t s f o r e a c h f i l e .
CUDA_WRAP_SRCS ( cuda_compile_ptx PTX _generated_files ${ _sources } ${ _cmake_options }
O P T I O N S $ { _ o p t i o n s } )
set ( ${ generated_files } ${ _generated_files } )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# C U D A C O M P I L E F A T B I N
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
macro ( CUDA_COMPILE_FATBIN generated_files )
cuda_compile_base ( cuda_compile_fatbin FATBIN ${ generated_files } ${ ARGN } )
endmacro ( )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# C U D A C O M P I L E C U B I N
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
macro ( CUDA_COMPILE_CUBIN generated_files )
cuda_compile_base ( cuda_compile_cubin CUBIN ${ generated_files } ${ ARGN } )
endmacro ( )
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# C U D A A D D C U F F T T O T A R G E T