Fix for DA
[u/mrichter/AliRoot.git] / cmake / ALICE_CMake.cmake
index 0603fbcb10b5f87e154bdff71ebec843309c5d0c..b75fc85658973e53d46f110dc3ff01034683b455 100644 (file)
@@ -306,15 +306,17 @@ macro(ALICE_BuildPackage)
   endif(CINTAUTOLINK)
 
   if(lib)
-    list(APPEND ${MODULE}LIBS ${PACKAGE})
+    list(APPEND PMLIBS ${PACKAGE})
     list(APPEND ALLLIBS ${PACKAGE})
-    list(APPEND ${MODULE}ALIBS ${PACKAGE}_a)
-    list(APPEND ALLALIBS ${PACKAGE}_a)
+    list(APPEND PMALIBS ${PACKAGE}-static)
+    list(APPEND ALLALIBS ${PACKAGE}-static)
     list(APPEND BINLIBS ${PACKAGE})
   else()
     list(APPEND ALLEXECS ${PACKAGE})
   endif(lib)
-
+  set(${MODULE}ALIBS "${PMALIBS}" PARENT_SCOPE)
+  set(${MODULE}LIBS "${PMLIBS}" PARENT_SCOPE)
+  set(${MODULE}INC "${EINCLUDE}" PARENT_SCOPE)
   list(APPEND INCLUDEFILES ${PEXPORTDEST})
   ALICE_CopyHeaders()
   if(WITHDICT)  
@@ -435,12 +437,13 @@ macro(ALICE_BuildLibrary)
   
   add_dependencies(${MODULE}-all ${PACKAGE})
      
-  add_library(${PACKAGE}_a STATIC EXCLUDE_FROM_ALL ${PCS} ${PFS} ${PS} ${PDS})
+  add_library(${PACKAGE}-static STATIC EXCLUDE_FROM_ALL ${PCS} ${PFS} ${PS} ${PDS})
+  set_target_properties(${PACKAGE}-static PROPERTIES OUTPUT_NAME ${PACKAGE})
   if(PELIBS OR ALLIB)
-    target_link_libraries(${PACKAGE}_a ${PELIBSDIR} ${PELIBS} ${ALLIB})
+    target_link_libraries(${PACKAGE}-static ${PELIBSDIR} ${PELIBS} ${ALLIB})
   endif(PELIBS OR ALLIB)
 
-  add_dependencies(${MODULE}-static ${PACKAGE}_a)
+  add_dependencies(${MODULE}-all-static ${PACKAGE}-static)
   if(ALIPROFILE STREQUAL "YES")
     add_dependencies(${MODULE}-all ${MODULE}-static)
   endif(ALIPROFILE STREQUAL "YES")
@@ -495,6 +498,46 @@ macro(ALICE_BuildExecutable)
     add_dependencies(${MODULE}-all ${PACKAGE})
   endif(ALIPROFILE STREQUAL "YES")
 
+# AliMDC
+# ------------------------------
+  if(PACKAGE STREQUAL "alimdc" AND GENERATEPACKAGES)
+
+    add_executable(${PACKAGE}-static ${PFS} ${PCS} ${PS} ${PDS})
+    set_target_properties(${PACKAGE}-static PROPERTIES OUTPUT_NAME alimdca)
+    add_custom_target( libAliMDC
+                        COMMAND rm -rf ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libAliMDC.a
+                       COMMAND rm -rf junkmdc
+                       COMMAND mkdir junkmdc && cd junkmdc && ar x ../libRAWDatabase.a && ar x ../libMDC.a && ar x ../libESD.a && ar x ../libSTEERBase.a && ar r ../libAliMDC.a *.o && cd .. && rm -rf junkmdc
+                       WORKING_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
+    add_custom_target( root-static-libs 
+                       COMMAND make static
+                      WORKING_DIRECTORY ${ROOTSYS} )
+                      
+    add_dependencies(libAliMDC RAWDatabase-static STEERBase-static MDC-static ESD-static)
+    add_dependencies(${PACKAGE}-static libAliMDC root-static-libs)
+    target_link_libraries(${PACKAGE}-static ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libAliMDC.a ${ROOTLIBDIR}/libRoot.a ${ROOTLIBDIR}/libfreetype.a ${ROOTLIBDIR}/libpcre.a -pthread -ldl -lcurses)
+
+    install(TARGETS ${PACKAGE}-static RUNTIME DESTINATION bin COMPONENT MDC)
+    install(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libAliMDC.a ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libAliMDC.a ${ROOTLIBDIR}/libRoot.a ${ROOTLIBDIR}/libfreetype.a ${ROOTLIBDIR}/libpcre.a DESTINATION lib COMPONENT MDC)
+    install(FILES ${PROJECT_SOURCE_DIR}/RAW/mdc.h DESTINATION include COMPONENT MDC)
+    set(CPACK_RPM_PACKAGE_SUMMARY "AliMDC static libraries")
+    set(CPACK_RPM_PACKAGE_NAME "alimdc")
+    set(CPACK_RPM_PACKAGE_VERSION "${ALIMDCVERSION}")
+    set(CPACK_RPM_PACKAGE_RELEASE "${ALIMDCRELEASE}")
+    set(CPACK_RPM_PACKAGE_LICENSE "Copyright: CERN ALICE Off-line Group")
+    set(CPACK_RPM_PACKAGE_VENDOR "ALICE Core Off-line Group")
+    set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "AliMDC static libraries")
+    set(CPACK_RPM_PACKAGE_GROUP "Applications/Alice")
+    set(CPACK_RPM_PACKAGE_REQUIRES "glibc")
+    set(CPACK_PACKAGE_VERSION "1.0.0")
+    set(CPACK_PACKAGE_VERSION_MAJOR "1")
+    set(CPACK_PACKAGE_VERSION_MINOR "0")
+    set(CPACK_PACKAGE_VERSION_PATCH "0")
+    set(CPACK_PACKAGE_INSTALL_DIRECTORY "/opt/")
+    add_component_package(MDC alimdc-rpm)
+
+  endif(PACKAGE STREQUAL "alimdc" AND GENERATEPACKAGES)
+
   list(FIND EXCLUDEMODULES ${MODULE} RESULT)
   if(NOT RESULT STREQUAL "-1")
     set_property(TARGET ${PACKAGE} PROPERTY EXCLUDE_FROM_ALL TRUE)
@@ -531,3 +574,5 @@ macro(ALICE_GenerateLinkDef)
   endforeach(class)
   file (APPEND ${PDAL} "#endif\n")
 endmacro(ALICE_GenerateLinkDef)
+
+