]>
Commit | Line | Data |
---|---|---|
c6ac942a | 1 | # -*- mode: CMake -*- |
2 | # $Id$ | |
3 | #--------------------------------------------------------------------------------# | |
4 | # Package File for AliHLTTPCCAGPU # | |
5 | # Author : Johny Jose (johny.jose@cern.ch) # | |
6 | # Variables Defined : # | |
7 | # # | |
8 | # SRCS - C++ source files # | |
9 | # HDRS - C++ header files # | |
10 | # DHDR - ROOT Dictionary Linkdef header file # | |
11 | # CSRCS - C source files # | |
12 | # CHDRS - C header files # | |
13 | # EINCLUDE - Include directories # | |
14 | # EDEFINE - Compiler definitions # | |
15 | # ELIBS - Extra libraries to link # | |
16 | # ELIBSDIR - Extra library directories # | |
17 | # PACKFFLAGS - Fortran compiler flags for package # | |
18 | # PACKCXXFLAGS - C++ compiler flags for package # | |
19 | # PACKCFLAGS - C compiler flags for package # | |
20 | # PACKSOFLAGS - Shared library linking flags # | |
21 | # PACKLDFLAGS - Module linker flags # | |
22 | # PACKBLIBS - Libraries to link (Executables only) # | |
23 | # EXPORT - Header files to be exported # | |
24 | # CINTHDRS - Dictionary header files # | |
25 | # CINTAUTOLINK - Set automatic dictionary generation # | |
26 | # ARLIBS - Archive Libraries and objects for linking (Executables only) # | |
27 | # SHLIBS - Shared Libraries and objects for linking (Executables only) # | |
28 | #--------------------------------------------------------------------------------# | |
29 | ||
30 | find_package ( CUDA ) | |
31 | if ( NOT CUDA_FOUND ) | |
32 | #fail if CUDA wasn't found | |
33 | message ( FATAL_ERROR "NVIDIA CUDA package not found. Please install or set HLT_CUDA=OFF" ) | |
34 | endif ( NOT CUDA_FOUND ) | |
35 | ||
36 | #set nvcc flags | |
37 | set ( CUDA_NVCC_FLAGS --use_fast_math --maxrregcount 64 -O4 -Xptxas -O4 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 ) | |
38 | #for convenience | |
39 | set ( CAGPUDIR TPCLib/tracking-ca/cagpu ) | |
40 | #add include path | |
41 | include_directories( ${CAGPUDIR} ) | |
42 | #nvcc fails with std=c++11, remove it temporarily | |
43 | string ( FIND ${CMAKE_CXX_FLAGS} "-std=c++11" STDCXX11FOUND ) | |
44 | if ( STDCXX11FOUND GREATER -1 ) | |
45 | string ( REPLACE "-std=c++11" "-std=c++98" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" ) | |
46 | endif ( ) | |
47 | #compile CUDA object file | |
48 | cuda_compile ( CAGPU_O ${CAGPUDIR}/AliHLTTPCCAGPUTrackerNVCC.cu ) | |
49 | #set it back | |
50 | if ( STDCXX11FOUND GREATER -1 ) | |
51 | string ( REPLACE "-std=c++98" "-std=c++11" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" ) | |
52 | endif ( ) | |
53 | #end of CUDA specific stuff; from here on build usual library | |
54 | ||
55 | set ( CLASS_HDRS | |
56 | AliHLTTPCCAGPUTrackerBase.h | |
57 | AliHLTTPCCAGPUTrackerNVCC.h | |
58 | ) | |
59 | ||
60 | set ( MODULE_SRCS | |
61 | AliHLTTPCCAGPUTrackerBase.cxx | |
62 | ) | |
63 | ||
64 | set ( MODULE_HDRS | |
65 | ${CLASS_HDRS} | |
66 | AliHLTTPCCAGPUTrackerCommon.h | |
67 | ) | |
68 | ||
69 | set ( MODULE_DHDR ) | |
70 | ||
71 | set ( EINCLUDE HLT/${CAGPUDIR} HLT/TPCLib/tracking-ca HLT/BASE ) | |
72 | ||
73 | #CUDA run-time and driver | |
74 | set ( ELIBS ${CUDA_LIBRARIES} -lcuda ) | |
75 | ||
76 | include ("CMakehlt.conf") | |
77 | ||
78 | if (MODULE_SRCS) | |
79 | ALICE_Format (SRCS "${CAGPUDIR}/" "" "${MODULE_SRCS}") | |
80 | endif(MODULE_SRCS) | |
81 | if (CLASS_HDRS) | |
82 | ALICE_Format (CINTHDRS "${CAGPUDIR}/" "" "${CLASS_HDRS}") | |
83 | endif(CLASS_HDRS) | |
84 | if (MODULE_HDRS) | |
85 | ALICE_Format (HDRS "${CAGPUDIR}/" "" "${MODULE_HDRS}") | |
86 | endif(MODULE_HDRS) | |
87 | if (MODULE_DHDR) | |
88 | ALICE_Format (DHDR "${CAGPUDIR}/" "" "${MODULE_DHDR}") | |
89 | endif(MODULE_DHDR) | |
90 | ||
91 | #add CUDA object file(s) as library (link) dependency | |
92 | list(APPEND SRCS ${CAGPU_O}) | |
93 | ||
94 | # bit of a hack, but otherwise dictionary compilation fails: | |
95 | # defines cudaError_t to make it known | |
96 | # defines __ROOT__; triggers "ifdef" in source code to circumvent broken cint behaviour with "volatile" keyword | |
97 | # not sure why __ROOT__ is used here, could just as well be something else | |
98 | set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/G__AliHLTTPCCAGPU.cxx PROPERTIES COMPILE_DEFINITIONS "cudaError_t=int;__ROOT__") | |
99 | ||
100 | if(NOT DHDR) | |
101 | set(CINTAUTOLINK 1) | |
102 | endif(NOT DHDR) | |
103 | ||
104 | set ( EDEFINE ${HLTDEFS} ) | |
e31f5817 | 105 | #set ( PACKCXXFLAGS "${HLTCXXFLAGS} -Wshadow -Wall -O3") |
c6ac942a | 106 | set ( PACKCFLAGS ${HLTCLFAGS}) |
107 | set ( PACKDCXXFLAGS ${HLTDCXXFLAGS}) | |
108 | set ( PACKSOFLAGS ${HLTSOFLAGS}) | |
109 | #set ( CINTFLAGS ) |