PHOS - Fixing circular dependecies + initial DA files
[u/mrichter/AliRoot.git] / PHOS / PHOSbase / CMakeLists.txt
index 1ffa016..9118b10 100644 (file)
@@ -23,8 +23,7 @@ include_directories(${AliRoot_SOURCE_DIR}/PHOS/${MODULE})
 include_directories(${ROOT_INCLUDE_DIRS}
                     ${AliRoot_SOURCE_DIR}/RAW/RAWDatabase
                     ${AliRoot_SOURCE_DIR}/RAW/RAWDatarec
-                    ${AliRoot_SOURCE_DIR}/PHOS/PHOSrec
-                    ${AliRoot_SOURCE_DIR}/PHOS/PHOSsim
+                    ${AliRoot_SOURCE_DIR}/RAW/RAWDatasim
                     ${AliRoot_SOURCE_DIR}/PHOS/PHOSUtils
                     ${AliRoot_SOURCE_DIR}/STEER/CDB
                     ${AliRoot_SOURCE_DIR}/STEER/ESD
@@ -34,8 +33,10 @@ include_directories(${ROOT_INCLUDE_DIRS}
 
 # Sources in alphabetical order
 set(SRCS
+    AliPHOS.cxx
     AliPHOSCalibData.cxx
     AliPHOSClusterizer.cxx
+    AliPHOSClusterizerv1.cxx
     AliPHOSCpvCalibData.cxx
     AliPHOSCpvRecPoint.cxx
     AliPHOSDigit.cxx
@@ -47,6 +48,7 @@ set(SRCS
     AliPHOSGeometry.cxx
     AliPHOSHit.cxx
     AliPHOSImpact.cxx
+    AliPHOSLink.cxx
     AliPHOSLoader.cxx
     AliPHOSModuleMisalignment.cxx
     AliPHOSPID.cxx
@@ -59,16 +61,26 @@ set(SRCS
     AliPHOSRawFitterv3.cxx
     AliPHOSRawFitterv4.cxx
     AliPHOSRecoParam.cxx
+    AliPHOSReconstructor.cxx
     AliPHOSRecParticle.cxx
     AliPHOSRecPoint.cxx
+    AliPHOSPIDv1.cxx
     AliPHOSSDigitizer.cxx
     AliPHOSSimParam.cxx
     AliPHOSSurvey1.cxx
     AliPHOSSurvey.cxx
+    AliPHOSTick.cxx
+    AliPHOSTracker.cxx
     AliPHOSTrackSegment.cxx
     AliPHOSTrackSegmentMaker.cxx
+    AliPHOSTrackSegmentMakerv1.cxx
     AliPHOSTrigger.cxx
     AliPHOSTriggerParameters.cxx
+    AliPHOSTriggerRawDigit.cxx
+    AliPHOSTriggerRawDigiProducer.cxx
+    AliPHOSTriggerRawReader.cxx
+    AliPHOSTRURawReader.cxx
+
    )
 
 # Headers from sources
@@ -79,17 +91,25 @@ string(REPLACE ".cxx" ".h" HDRS "${SRCS}")
 get_directory_property(incdirs INCLUDE_DIRECTORIES)
 generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}")
 
+set(ROOT_DEPENDENCIES)
+set(ALIROOT_DEPENDENCIES STEERBase STEER CDB ESD RAWDatabase RAWDatarec PHOSUtils)
+
 # Generate the ROOT map
 # Dependecies
-set(LIBDEPS STEERBase STEER CDB ESD RAWDatabase RAWDatarec PHOSUtils PHOSrec PHOSsim)
+set(LIBDEPS ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES})
 generate_rootmap("${MODULE}" "${LIBDEPS}" "${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}LinkDef.h")
 
+# Create an object to be reused in case of static libraries 
+# Otherwise the sources will be compiled twice
+add_library(${MODULE}-object OBJECT ${SRCS} G__${MODULE}.cxx)
+# Add a library to the project using the object
+add_library(${MODULE} SHARED $<TARGET_OBJECTS:PHOSbase-object>)
 
-# Add a library to the project using the specified source files
-add_library(${MODULE} SHARED ${SRCS} G__${MODULE}.cxx)
+# Linking
+target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ALIROOT_DEPENDENCIES})
 
 # Additional compilation flags
-set_target_properties(${MODULE} PROPERTIES COMPILE_FLAGS "-O -g")
+set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS "-O -g -fPIC")
 
 # System dependent: Modify the way the library is build
 if(${CMAKE_SYSTEM} MATCHES Darwin)
@@ -101,4 +121,20 @@ install(TARGETS ${MODULE}
         ARCHIVE DESTINATION lib
         LIBRARY DESTINATION lib)
 
-install(FILES ${HDRS} DESTINATION include)
\ No newline at end of file
+install(FILES ${HDRS} DESTINATION include)
+
+# Static version if DA enabled
+if(ALIROOT_STATIC)
+    add_library(${MODULE}-static STATIC $<TARGET_OBJECTS:PHOSbase-object>)
+    set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE})
+
+    # list of shared dependencies / the name of the variable containing the list of static ones
+    generate_static_dependencies("${ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES")
+    target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root)
+    set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive")
+
+    # Installation
+    install(TARGETS ${MODULE}-static
+            ARCHIVE DESTINATION lib
+            LIBRARY DESTINATION lib)
+endif(ALIROOT_STATIC)