FindFASTJET
[u/mrichter/AliRoot.git] / cmake / CMakeALICE.cmake
1 # **************************************************************************
2 # * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
3 # *                                                                        *
4 # * Author: The ALICE Off-line Project.                                    *
5 # * Contributors are mentioned in the code where appropriate.              *
6 # *                                                                        *
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 # **************************************************************************
15
16 # General purpose functions
17
18 # Generation of the dictionaries
19 # @DNAME  Dictionary name
20 # @LDNAME LinkDef file name, ex: LinkDef.h
21 # @DHDRS  Dictionary headers
22 # @DINCDIR Include folders that need to be passed to cint/cling
23 macro(generate_dictionary DNAME LDNAME DHDRS DINCDIRS)
24     # Creating the INCLUDE path for cint/cling
25     foreach( dir ${DINCDIRS})
26         set(INCLUDE_PATH -I${dir} ${INCLUDE_PATH})
27     endforeach()
28     
29     # Generate the dictionary
30 #    message(STATUS "Generating dictionary ${DNAME} for ${LDNAME}")
31     
32 #    message(STATUS "${CMAKE_CURRENT_BINARY_DIR}/G__${DNAME}.cxx")
33 #    message(STATUS "${CMAKE_CURRENT_BINARY_DIR}/G__${DNAME}.h")
34 #    message(STATUS "bbb${INCLUDE_PATH}bbb")
35 #    message(STATUS "${DHDRS} ${LDNAME}")
36 #    message(STATUS "${CMAKE_CURRENT_SOURCE_DIR}")
37     
38     add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/G__${DNAME}.cxx ${CMAKE_CURRENT_BINARY_DIR}/G__${DNAME}.h
39                        COMMAND LD_LIBRARY_PATH=${ROOT_LIBDIR}:$ENV{LD_LIBRARY_PATH} ${ROOT_CINT}
40                        ARGS -f ${CMAKE_CURRENT_BINARY_DIR}/G__${DNAME}.cxx -c -p 
41                        ${INCLUDE_PATH} 
42                        ${DHDRS} ${LDNAME}
43                        DEPENDS ${DHDRS} ${LDNAME} ${ROOT_CINT}
44                        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
45                       )
46 endmacro(generate_dictionary)
47
48 # Generate the ROOTmap files
49 # @LIBNAME - library name: libAnalysis.so -> Analysis.rootmap
50 # @LIBDEPS - library dependencies
51 # @LINKDEF - LinkDef header
52 macro(generate_rootmap LIBNAME LIBDEPS LINKDEF)
53 #    message(STATUS "LIBNAME = ${LIBNAME}")
54 #    message(STATUS "LIBDEPS = ${LIBDEPS}")
55 #    message(STATUS "LINKDEF = ${LINKDEF}")
56 #    message(STATUS "ROOT_LIBMAP=${ROOT_LIBMAP}")
57     
58     foreach(file ${LIBDEPS})
59         get_filename_component(ext ${file} EXT)
60         if(ext)
61             set(LOCAL_DEPS ${LOCAL_DEPS} ${file})
62         else()
63             set(LOCAL_DEPS ${LOCAL_DEPS} lib${file}.so)
64         endif()
65     endforeach()
66     
67 #    message(STATUS "Generating ROOT map for ${LIBNAME}")
68     add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib${LIBNAME}.rootmap
69                        COMMAND LD_LIBRARY_PATH=${ROOT_LIBDIR}:$ENV{LD_LIBRARY_PATH} ${ROOT_LIBMAP}
70                        ARGS -o ${CMAKE_CURRENT_BINARY_DIR}/lib${LIBNAME}.rootmap -l lib${LIBNAME}.so -d ${LOCAL_DEPS} -c ${LINKDEF}
71                        DEPENDS ${LIBNAME}
72                        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} VERBATIM
73                       )
74     add_custom_target(lib${LIBNAME}.rootmap ALL DEPENDS  ${CMAKE_CURRENT_BINARY_DIR}/lib${LIBNAME}.rootmap)
75     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lib${LIBNAME}.rootmap DESTINATION lib)
76     
77 endmacro(generate_rootmap)