]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGUD/UPC/CMakeLists.txt
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGUD / UPC / CMakeLists.txt
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 # Module
17 set(MODULE PWGUDupc)
18
19 # Module include folder
20 include_directories(${AliRoot_SOURCE_DIR}/PWGUD/UPC
21                    )
22
23 # Additional include folders in alphabetical order except ROOT
24 include_directories(${ROOT_INCLUDE_DIRS}
25                     ${AliRoot_SOURCE_DIR}/ANALYSIS/ANALYSIS
26                     ${AliRoot_SOURCE_DIR}/ANALYSIS/ANALYSISalice
27                     ${AliRoot_SOURCE_DIR}/PWG/muon
28                     ${AliRoot_SOURCE_DIR}/STEER/AOD
29                     ${AliRoot_SOURCE_DIR}/STEER/ESD
30                     ${AliRoot_SOURCE_DIR}/STEER/STEERBase
31                    )
32
33 # Sources in alphabetical order
34 set(SRCS
35     AliAnalysisTaskUpcFilterSemiforward.cxx
36     AliAnalysisTaskUpcK0sK0s.cxx
37     AliAnalysisTaskUpcPhi.cxx
38     AliAnalysisTaskUpcPsi2s.cxx
39     AliAnalysisTaskUpcTree.cxx
40     AliUPCEvent.cxx
41     AliUPCMuonTrack.cxx
42     AliUpcParticle.cxx
43     AliUPCTrack.cxx
44    )
45
46 # Headers from sources
47 string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
48
49 # Generate the dictionary
50 # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
51 get_directory_property(incdirs INCLUDE_DIRECTORIES)
52 generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
53
54 set(ROOT_DEPENDENCIES Core EG Hist Physics RIO Tree)
55 set(ALIROOT_DEPENDENCIES ANALYSIS ANALYSISalice AOD ESD STEERBase PWGmuon)
56
57 # Generate the ROOT map
58 # Dependecies
59 set(LIBDEPS ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
60 generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
61
62 # Create an object to be reused in case of static libraries 
63 # Otherwise the sources will be compiled twice
64 add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
65 # Add a library to the project using the object
66 add_library(${MODULE} SHARED $<TARGET_OBJECTS:${MODULE}-object>)
67 target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
68
69 # Setting the correct headers for the object as gathered from the dependencies
70 target_include_directories(${MODULE}-object PUBLIC $<TARGET_PROPERTY:${MODULE},INCLUDE_DIRECTORIES>)
71 set_target_properties(${MODULE}-object PROPERTIES COMPILE_DEFINITIONS $<TARGET_PROPERTY:${MODULE},COMPILE_DEFINITIONS>)
72
73 # Public include folders that will be propagated to the dependecies
74 target_include_directories(${MODULE} PUBLIC ${incdirs})
75
76 set(MODULE_COMPILE_FLAGS)
77 set(MODULE_LINK_FLAGS)
78
79 if(DATE_FOUND)
80     set(MODULE_COMPILE_FLAGS "${DATE_CFLAGS}")
81     set(MODULE_LINK_FLAGS "${DATE_LDFLAGS} ${DATE_LIBS}")
82 endif(DATE_FOUND)
83
84 # Additional compilation and linking flags
85 set(MODULE_COMPILE_FLAGS " ${MODULE_COMPILE_FLAGS}")
86
87 # System dependent: Modify the way the library is build
88 if(${CMAKE_SYSTEM} MATCHES Darwin)
89     set(MODULE_LINK_FLAGS "-undefined dynamic_lookup ${MODULE_LINK_FLAGS}")
90 endif(${CMAKE_SYSTEM} MATCHES Darwin)
91
92 # Setting compilation flags for the object
93 set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS "${MODULE_COMPILE_FLAGS}")
94 # Setting the linking flags for the library
95 set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "${MODULE_LINK_FLAGS}")
96
97 # Installation
98 install(TARGETS ${MODULE}
99         ARCHIVE DESTINATION lib
100         LIBRARY DESTINATION lib)
101
102 install(FILES ${HDRS} DESTINATION include)
103
104 # Installing the macros
105 install(DIRECTORY . DESTINATION PWGUD/UPC FILES_MATCHING PATTERN "*.C")