]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/cagpu/CMakelibAliHLTTPCCAGPUOpenCL.pkg
removing pre-package cxxflags
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / cagpu / CMakelibAliHLTTPCCAGPUOpenCL.pkg
1 # -*- mode: CMake -*- 
2 # $Id$
3 #--------------------------------------------------------------------------------#
4 # Package File for AliHLTTPCCAGPUOpenCL                                          #
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
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} )
37 endif()
38
39 if ( NOT AMDAPPSDKROOT )
40   #fail if not set
41   message ( FATAL_ERROR "AMDAPPSDKROOT not set. Please install AMD APP SDK and set $AMDAPPSDKROOT or disable HLT_OPENCL." )
42 endif()
43
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.")
46 endif()
47
48 #convenience variables
49 set ( CAGPUDIR TPCLib/tracking-ca/cagpu )
50
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 )
56
57 #convenience variables
58 set (CL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/${CAGPUDIR}/AliHLTTPCCAGPUTrackerOpenCL.cl )
59 set (CL_BIN ${CMAKE_CURRENT_BINARY_DIR}/AliHLTTPCCAGPUTrackerOpenCLCode.bin )
60 set (CL_INC 
61   -I${CMAKE_CURRENT_SOURCE_DIR}/BASE 
62   -I${CMAKE_CURRENT_SOURCE_DIR}/TPCLib/tracking-ca 
63   -I${CMAKE_CURRENT_SOURCE_DIR}/${CAGPUDIR}
64 )
65
66 # executes OpenCL compiler wrapper to build binary object
67 add_custom_command(
68   OUTPUT ${CL_BIN}
69   COMMAND opencl_compiler -output-file ${CL_BIN} ${CL_SRC} -- ${CL_INC} -x clc++
70   MAIN_DEPENDENCY ${CL_SRC}
71 )
72
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})
77
78
79 #usual aliroot library stuff...
80 set ( CLASS_HDRS
81   AliHLTTPCCAGPUTrackerBase.h
82   AliHLTTPCCAGPUTrackerOpenCL.h
83 )
84
85 set ( MODULE_SRCS 
86   AliHLTTPCCAGPUTrackerBase.cxx
87   AliHLTTPCCAGPUTrackerOpenCL.cxx
88   makefiles/include.S
89 )
90
91 set ( MODULE_HDRS
92   ${CLASS_HDRS}
93   AliHLTTPCCAGPUTrackerCommon.h
94   AliHLTTPCCAGPUTrackerOpenCLInternals.h
95 )
96
97 set ( MODULE_DHDR )
98
99 set ( EINCLUDE ${AMDAPPSDKROOT}/include HLT/${CAGPUDIR} HLT/${CAGPUDIR}/makefiles HLT/TPCLib/tracking-ca HLT/BASE )
100
101 set ( ELIBS -L$(AMDAPPSDKROOT)/lib/x86_64 -lOpenCL )
102
103 include ("CMakehlt.conf")
104
105 if (MODULE_SRCS)
106 ALICE_Format (SRCS "${CAGPUDIR}/" "" "${MODULE_SRCS}")
107 endif(MODULE_SRCS)
108 if (CLASS_HDRS)
109 ALICE_Format (CINTHDRS "${CAGPUDIR}/" "" "${CLASS_HDRS}")
110 endif(CLASS_HDRS)
111 if (MODULE_HDRS)
112 ALICE_Format (HDRS "${CAGPUDIR}/" "" "${MODULE_HDRS}")
113 endif(MODULE_HDRS)
114 if (MODULE_DHDR)
115 ALICE_Format (DHDR "${CAGPUDIR}/" "" "${MODULE_DHDR}")
116 endif(MODULE_DHDR)
117
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__")
122
123 if(NOT DHDR)
124   set(CINTAUTOLINK 1)
125 endif(NOT DHDR)
126
127 set ( EDEFINE  ${HLTDEFS} )
128 #set ( PACKCXXFLAGS  "${HLTCXXFLAGS} -Wshadow -Wall -O3")
129 set ( PACKCFLAGS  ${HLTCLFAGS})
130 set ( PACKDCXXFLAGS  ${HLTDCXXFLAGS})
131 set ( PACKSOFLAGS ${HLTSOFLAGS})
132 #set ( CINTFLAGS )