MUON DAs
[u/mrichter/AliRoot.git] / FMD / FMDbase / CMakeLists.txt
CommitLineData
547d0dfe 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 FMDbase)
18
19# Module include folder
427d561c 20include_directories(${AliRoot_SOURCE_DIR}/FMD/${MODULE})
547d0dfe 21
22# Additional include folders in alphabetical order except ROOT
23include_directories(${ROOT_INCLUDE_DIRS}
427d561c 24 ${AliRoot_SOURCE_DIR}/FMD/FMDrec
25 ${AliRoot_SOURCE_DIR}/RAW/RAWDatabase
26 ${AliRoot_SOURCE_DIR}/STEER/CDB
27 ${AliRoot_SOURCE_DIR}/STEER/ESD
28 ${AliRoot_SOURCE_DIR}/STEER/STEER
29 ${AliRoot_SOURCE_DIR}/STEER/STEERBase
547d0dfe 30 )
31
32# Sources in alphabetical order
33set(SRCS
34 AliFMD1.cxx
35 AliFMD2.cxx
36 AliFMD3.cxx
37 AliFMDAltroMapping.cxx
38 AliFMDBaseDigit.cxx
39 AliFMDBoolMap.cxx
40 AliFMDCalibGain.cxx
41 AliFMDCalibPedestal.cxx
42 AliFMDCalibSampleRate.cxx
43 AliFMDCalibStripRange.cxx
44 AliFMDDetector.cxx
45 AliFMDDigit.cxx
46 AliFMDGeometryBuilder.cxx
47 AliFMDGeometry.cxx
48 AliFMDIndex.cxx
49 AliFMDParameters.cxx
50 AliFMDPreprocessor.cxx
51 AliFMDQAChecker.cxx
52 AliFMDRing.cxx
53 AliFMDSDigit.cxx
54 AliFMDSurveyToAlignObjs.cxx
55 AliFMDUShortMap.cxx
56 )
57
58# Headers from sources
59string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
60set(HDRS ${HDRS} AliFMDCalibFwd.h)
61
62# Generate the dictionary
63# It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument
64get_directory_property(incdirs INCLUDE_DIRECTORIES)
65generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
66
48bb5b02 67# Dependencies
68set(ROOT_DEPENDENCIES)
69set(ALIROOT_DEPENDENCIES STEERBase STEER ESD CDB RAWDatabase FMDrec)
70
547d0dfe 71# Generate the ROOT map
72# Dependecies
48bb5b02 73set(LIBDEPS ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
547d0dfe 74generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
75
48bb5b02 76# Create an object to be reused in case of static libraries
77# Otherwise the sources will be compiled twice
78add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
79# Add a library to the project using the object
80add_library(${MODULE} SHARED $<TARGET_OBJECTS:FMDbase-object>)
547d0dfe 81
48bb5b02 82# linking
83target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
547d0dfe 84
85# Additional compilation flags
48bb5b02 86set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS "-O -g -fPIC")
547d0dfe 87
88# System dependent: Modify the way the library is build
89if(${CMAKE_SYSTEM} MATCHES Darwin)
90 set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
91endif(${CMAKE_SYSTEM} MATCHES Darwin)
92
93# Installation
94install(TARGETS ${MODULE}
95 ARCHIVE DESTINATION lib
96 LIBRARY DESTINATION lib)
97
48bb5b02 98install(FILES ${HDRS} DESTINATION include)
99
100# Static version if DA enabled
101if(ALIROOT_STATIC)
102 add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:FMDbase-object>)
103 set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
104
105 # list of shared dependencies / the name of the variable containing the list of static ones
106 generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
107 target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root)
108 set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
109
110 # Installation
111 install(TARGETS ${MODULE}-static
112 ARCHIVE DESTINATION lib
113 LIBRARY DESTINATION lib)
114endif(ALIROOT_STATIC)