3 #--------------------------------------------------------------------------------#
4 # Package File for AliHLTTPCCAGPUOpenCL #
5 # Author : Johny Jose (johny.jose@cern.ch) #
6 # Variables Defined : #
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 #--------------------------------------------------------------------------------#
31 # AMD APP SDK required for OpenCL tracker; it's using specific
32 # extensions (currently) not provided by other vendors.
33 # either set cmake variable via "-D$AMDAPPSDKROOT=/path/to/amdappsdkroot"
34 # or via environment variable $AMDAPPSDKROOT
35 if ( NOT AMDAPPSDKROOT )
36 set ( AMDAPPSDKROOT $ENV{AMDAPPSDKROOT} )
39 if ( NOT AMDAPPSDKROOT )
41 message ( FATAL_ERROR "AMDAPPSDKROOT not set. Please install AMD APP SDK and set $AMDAPPSDKROOT or disable HLT_OPENCL." )
44 if ( NOT "$ENV{GPU_FORCE_64BIT_PTR}" STREQUAL "1" )
45 message ( FATAL_ERROR "Please set env variable $GPU_FORCE_64BIT_PTR=1, required by HLT OpenCL tracker.")
48 #convenience variables
49 set ( CAGPUDIR TPCLib/tracking-ca/cagpu )
51 # build the OpenCL compile wrapper:
52 # -- checks the correct vendor implementation (AMD)
53 # -- builds binary code (blob) for the found platform(s)
54 add_executable ( opencl_compiler ${CAGPUDIR}/makefiles/makefile_opencl_compiler.cpp )
55 target_link_libraries ( opencl_compiler -L${AMDAPPSDKROOT}/lib/x86_64 OpenCL )
57 #convenience variables
58 set (CL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/${CAGPUDIR}/AliHLTTPCCAGPUTrackerOpenCL.cl )
59 set (CL_BIN ${CMAKE_CURRENT_BINARY_DIR}/AliHLTTPCCAGPUTrackerOpenCLCode.bin )
61 -I${CMAKE_CURRENT_SOURCE_DIR}/BASE
62 -I${CMAKE_CURRENT_SOURCE_DIR}/TPCLib/tracking-ca
63 -I${CMAKE_CURRENT_SOURCE_DIR}/${CAGPUDIR}
66 # executes OpenCL compiler wrapper to build binary object
69 COMMAND opencl_compiler -output-file ${CL_BIN} ${CL_SRC} -- ${CL_INC} -x clc++
70 MAIN_DEPENDENCY ${CL_SRC}
73 # make cmake compile the assembler file
74 set_source_files_properties(${CAGPUDIR}/makefiles/include.S PROPERTIES LANGUAGE CXX)
75 # add proper dependency on included binary code
76 set_source_files_properties(${CAGPUDIR}/makefiles/include.S PROPERTIES OBJECT_DEPENDS ${CL_BIN})
79 #usual aliroot library stuff...
81 AliHLTTPCCAGPUTrackerBase.h
82 AliHLTTPCCAGPUTrackerOpenCL.h
86 AliHLTTPCCAGPUTrackerBase.cxx
87 AliHLTTPCCAGPUTrackerOpenCL.cxx
93 AliHLTTPCCAGPUTrackerCommon.h
94 AliHLTTPCCAGPUTrackerOpenCLInternals.h
99 set ( EINCLUDE ${AMDAPPSDKROOT}/include HLT/${CAGPUDIR} HLT/${CAGPUDIR}/makefiles HLT/TPCLib/tracking-ca HLT/BASE )
101 set ( ELIBS -L$(AMDAPPSDKROOT)/lib/x86_64 -lOpenCL )
103 include ("CMakehlt.conf")
106 ALICE_Format (SRCS "${CAGPUDIR}/" "" "${MODULE_SRCS}")
109 ALICE_Format (CINTHDRS "${CAGPUDIR}/" "" "${CLASS_HDRS}")
112 ALICE_Format (HDRS "${CAGPUDIR}/" "" "${MODULE_HDRS}")
115 ALICE_Format (DHDR "${CAGPUDIR}/" "" "${MODULE_DHDR}")
118 # bit of a hack, but otherwise dictionary compilation fails:
119 # defines __ROOT__; triggers "ifdef" in source code to circumvent broken cint behaviour with "volatile" keyword
120 # not sure why __ROOT__ is used here, could just as well be something else
121 set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/G__AliHLTTPCCAGPUOpenCL.cxx PROPERTIES COMPILE_DEFINITIONS "__ROOT__")
127 set ( EDEFINE ${HLTDEFS} )
128 #set ( PACKCXXFLAGS "${HLTCXXFLAGS} -Wshadow -Wall -O3")
129 set ( PACKCFLAGS ${HLTCLFAGS})
130 set ( PACKDCXXFLAGS ${HLTDCXXFLAGS})
131 set ( PACKSOFLAGS ${HLTSOFLAGS})