]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - MUON/MUONtrigger/CMakeLists.txt
VZERO DAs + Object target dependencies
[u/mrichter/AliRoot.git] / MUON / MUONtrigger / CMakeLists.txt
... / ...
CommitLineData
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
17set(MODULE MUONtrigger)
18
19# Module include folder
20include_directories(${AliRoot_SOURCE_DIR}/MUON/${MODULE})
21
22# Additional include folders in alphabetical order except ROOT
23include_directories(${ROOT_INCLUDE_DIRS}
24 ${AliRoot_SOURCE_DIR}/MUON/MUONcalib
25 ${AliRoot_SOURCE_DIR}/MUON/MUONcore
26 ${AliRoot_SOURCE_DIR}/MUON/MUONmapping
27 ${AliRoot_SOURCE_DIR}/MUON/MUONraw
28 ${AliRoot_SOURCE_DIR}/STEER/STEERBase
29 )
30
31# Sources in alphabetical order
32set(SRCS
33 AliMUONGlobalTriggerBoard.cxx
34 AliMUONGlobalTrigger.cxx
35 AliMUONLocalTriggerBoard.cxx
36 AliMUONLocalTrigger.cxx
37 AliMUONRegionalTriggerBoard.cxx
38 AliMUONRegionalTrigger.cxx
39 AliMUONTriggerBoard.cxx
40 AliMUONTriggerCrate.cxx
41 AliMUONTriggerCrateStore.cxx
42 )
43
44# Headers from sources
45string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
46
47# Generate the dictionary
48# It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
49get_directory_property(incdirs INCLUDE_DIRECTORIES)
50generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
51
52# Dependencies
53set(ROOT_DEPENDENCIES Core)
54set(ALIROOT_DEPENDENCIES STEERBase MUONcore MUONraw MUONmapping MUONcalib)
55
56# Generate the ROOT map
57# Dependecies
58set(LIBDEPS ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
59generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
60
61# Create an object to be reused in case of static libraries
62# Otherwise the sources will be compiled twice
63add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
64# Follow headers dependencies
65add_dependencies(${MODULE}-object ${ALIROOT_DEPENDENCIES})
66# Add a library to the project using the object
67add_library(${MODULE} SHARED $<TARGET_OBJECTS:MUONtrigger-object>)
68
69# linking
70target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
71
72# Additional compilation flags
73set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS "-O -g -fPIC")
74
75# System dependent: Modify the way the library is build
76if(${CMAKE_SYSTEM} MATCHES Darwin)
77 set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
78endif(${CMAKE_SYSTEM} MATCHES Darwin)
79
80# Installation
81install(TARGETS ${MODULE}
82 ARCHIVE DESTINATION lib
83 LIBRARY DESTINATION lib)
84
85install(FILES ${HDRS} DESTINATION include)
86
87# Static version if DA enabled
88if(ALIROOT_STATIC)
89 add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:MUONtrigger-object>)
90 set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
91
92 # list of shared dependencies / the name of the variable containing the list of static ones
93 generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
94 target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root)
95 set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
96
97 # Installation
98 install(TARGETS ${MODULE}-static
99 ARCHIVE DESTINATION lib
100 LIBRARY DESTINATION lib)
101endif(ALIROOT_STATIC)