ROOT map generation + RAW module
[u/mrichter/AliRoot.git] / cmake / CMakeALICE.cmake
1 # General purpose functions
2
3 # Generation of the dictionaries
4 # @DNAME  Dictionary name
5 # @LDNAME LinkDef file name, ex: LinkDef.h
6 # @DHDRS  Dictionary headers
7 # @DINCDIR Include folders that need to be passed to cint/cling
8 macro(generate_dictionary DNAME LDNAME DHDRS DINCDIRS)
9     # Creating the INCLUDE path for cint/cling
10     foreach( dir ${DINCDIRS})
11         set(INCLUDE_PATH -I${dir} ${INCLUDE_PATH})
12     endforeach()
13     
14     # Generate the dictionary
15     message(STATUS "Generating dictionary ${DNAME} for ${LDNAME}")
16     
17 #    message(STATUS "${CMAKE_CURRENT_BINARY_DIR}/G__${DNAME}.cxx")
18 #    message(STATUS "${CMAKE_CURRENT_BINARY_DIR}/G__${DNAME}.h")
19 #    message(STATUS "bbb${INCLUDE_PATH}bbb")
20 #    message(STATUS "${DHDRS} ${LDNAME}")
21 #    message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}")
22     
23     add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/G__${DNAME}.cxx ${CMAKE_CURRENT_BINARY_DIR}/G__${DNAME}.h
24                        COMMAND LD_LIBRARY_PATH=${ROOT_LIBDIR}:$ENV{LD_LIBRARY_PATH} ${ROOT_CINT}
25                        ARGS -f ${CMAKE_CURRENT_BINARY_DIR}/G__${DNAME}.cxx -c -p 
26                        ${INCLUDE_PATH} 
27                        ${DHDRS} ${LDNAME}
28                        DEPENDS ${DHDRS} ${LDNAME} ${ROOT_CINT}
29                        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
30                       )
31 endmacro(generate_dictionary)
32
33 # Generate the ROOTmap files
34 # @LIBNAME - library name: libAnalysis.so -> Analysis.rootmap
35 # @LIBDEPS - library dependencies
36 # @LINKDEF - LinkDef header
37 macro(generate_rootmap LIBNAME LIBDEPS LINKDEF)
38     message(STATUS "LIBNAME = ${LIBNAME}")
39     message(STATUS "LIBDEPS = ${LIBDEPS}")
40     message(STATUS "LINKDEF = ${LINKDEF}")
41     
42     message(STATUS "ROOT_LIBMAP=${ROOT_LIBMAP}")
43     
44     foreach(d ${LIBDEPS})
45         get_filename_component(_ext ${d} EXT)
46         if(_ext)
47             set(Int_DEPENDENCIES ${Int_DEPENDENCIES} ${d})
48         else()
49             set(Int_DEPENDENCIES ${Int_DEPENDENCIES} lib${d}.so)
50         endif()
51     endforeach()
52     
53     message(STATUS "Generating ROOT map for ${LIBNAME}")
54     add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib${LIBNAME}.rootmap
55                        COMMAND LD_LIBRARY_PATH=${ROOT_LIBDIR}:$ENV{LD_LIBRARY_PATH} ${ROOT_LIBMAP}
56                        ARGS -o ${CMAKE_CURRENT_BINARY_DIR}/lib${LIBNAME}.rootmap -l lib${LIBNAME}.so -d ${Int_DEPENDENCIES} -c ${LINKDEF}
57                        DEPENDS ${LIBNAME}
58                        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} VERBATIM
59                       )
60     add_custom_target(lib${LIBNAME}.rootmap ALL DEPENDS  ${CMAKE_CURRENT_BINARY_DIR}/lib${LIBNAME}.rootmap)
61     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${LIBNAME}.rootmap DESTINATION lib)
62     
63 endmacro(generate_rootmap)