1 # **************************************************************************
2 # * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
4 # * Author: The ALICE Off-line Project. *
5 # * Contributors are mentioned in the code where appropriate. *
7 # * Permission to use, copy, modify and distribute this software and its *
8 # * documentation strictly for non-commercial purposes is hereby granted *
9 # * without fee, provided that the above copyright notice appears in all *
10 # * copies and that both the copyright notice and this permission notice *
11 # * appear in the supporting documentation. The authors make no claims *
12 # * about the suitability of this software for any purpose. It is *
13 # * provided "as is" without express or implied warranty. *
14 # **************************************************************************
17 set(MODULE AliHLTTPCCAGPU)
21 message( FATAL_ERROR "NVIDIA CUDA package not found. Please install or set HLT_CUDA=OFF" )
25 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)
28 set(CAGPUDIR ${AliRoot_SOURCE_DIR}/HLT/TPCLib/tracking-ca/cagpu)
30 # Module include folder
31 include_directories(${AliRoot_SOURCE_DIR}/HLT/TPCLib/tracking-ca/cagpu/cuda
32 ${AliRoot_SOURCE_DIR}/HLT/TPCLib/tracking-ca/cagpu
33 ${AliRoot_SOURCE_DIR}/HLT/TPCLib/tracking-ca
36 # Additional include folders in alphabetical order except ROOT
37 include_directories(${ROOT_INCLUDE_DIR}
38 ${AliRoot_SOURCE_DIR}/HLT/BASE
41 #nvcc fails with std=c++11, remove it temporarily
42 string(FIND ${CMAKE_CXX_FLAGS} "-std=c++11" STDCXX11FOUND )
43 if(STDCXX11FOUND GREATER -1)
44 string(REPLACE "-std=c++11" "-std=c++98" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
47 #compile CUDA object file
48 cuda_compile(CAGPU_O AliHLTTPCCAGPUTrackerNVCC.cu)
51 if(STDCXX11FOUND GREATER -1)
52 string ( REPLACE "-std=c++98" "-std=c++11" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" )
54 #end of CUDA specific stuff; from here on build usual library
57 # bit of a hack, but otherwise dictionary compilation fails:
58 # defines cudaError_t to make it known
59 # defines __ROOT__; triggers "ifdef" in source code to circumvent broken cint behaviour with "volatile" keyword
60 # not sure why __ROOT__ is used here, could just as well be something else
61 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/G__AliHLTTPCCAGPU.cxx PROPERTIES COMPILE_DEFINITIONS "cudaError_t=int;__ROOT__")
63 # Sources in alphabetical order
65 ${CAGPUDIR}/AliHLTTPCCAGPUTrackerBase.cxx
69 # Headers from sources
71 ${CAGPUDIR}/AliHLTTPCCAGPUTrackerBase.h
72 AliHLTTPCCAGPUTrackerNVCC.h
77 ${CAGPUDIR}/AliHLTTPCCAGPUTrackerCommon.h
80 # Generate the dictionary
81 # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
82 get_directory_property(incdirs INCLUDE_DIRECTORIES)
83 generate_dictionary("${MODULE}" "" "${CINTHDRS}" "${incdirs}")
85 # Generate the ROOT map
87 generate_rootmap("${MODULE}" "" "")
89 # Add a library to the project using the specified source files
90 add_library(${MODULE} SHARED ${SRCS} G__${MODULE}.cxx)
91 #CUDA run-time and driver
92 target_link_libraries(${MODULE} ${CUDA_LIBRARIES})
94 # Additional compilation flags
95 set_target_properties(${MODULE} PROPERTIES COMPILE_FLAGS "")
98 install(TARGETS ${MODULE}
99 ARCHIVE DESTINATION lib
100 LIBRARY DESTINATION lib)
102 install(FILES ${HDRS} DESTINATION include)