From 7b0a9d94ee234df9912e7f910eeba9336714ad28 Mon Sep 17 00:00:00 2001 From: agrigora Date: Wed, 3 Dec 2014 17:17:18 +0100 Subject: [PATCH] Revert "Nicer comments" This reverts commit 4f1f38e6a74aad101e39083cd65a232b1119db59. Revert "generate_shared_library and generate_static_library macros" This reverts commit 9238b38d637e1099044e242b28cdf9c69482a9ae. --- RAW/RAWDatabase/CMakeLists.txt | 115 +++++++++++++++++++-------------- cmake/CMakeALICE.cmake | 76 ++-------------------- 2 files changed, 74 insertions(+), 117 deletions(-) diff --git a/RAW/RAWDatabase/CMakeLists.txt b/RAW/RAWDatabase/CMakeLists.txt index 6c94ac1df3a..378f0256f69 100644 --- a/RAW/RAWDatabase/CMakeLists.txt +++ b/RAW/RAWDatabase/CMakeLists.txt @@ -13,36 +13,20 @@ # * provided "as is" without express or implied warranty. * # ************************************************************************** -# Mandatory fields, set empty if not needed -# MODULE - target name -# MODULE_SRCS - list of sources that belong to the library -# MODULE_HDRS - list of headers that belong to the library -# MODULE_HDRS_INSTALL - list of headers that will be installed -# MODULE_INCLUDES - list of include directories -# ROOT and current folder are taken by default -# To add extra include folders use either -# - include_directories(${MODULE} FOLDER) -# - target_include_directories(${MODULE}-object FOLDER) -# MODULE_ROOT_DEPENDENCIES -# MODULE_ALIROOT_DEPENDENCIES -# MODULE_COMPILE_FLAGS - compilation flags for the ${MODULE}-object target -# MODULE_LINK_FLAGS - linking flags for ${MODULE} target -# - other flags accesible thorough standard cmake procedures -# -# Target/directory properties are accesible thorough cmake standard procedures -# Target object name = ${MODULE}-object -# Target library name = ${MODULE} -# Shared and static library targets are using the same object target - -########################################################################### -# Library description -########################################################################### - -# Module name +# Module set(MODULE RAWDatabase) +# Module include folder +include_directories(${AliRoot_SOURCE_DIR}/RAW/${MODULE}) + +# Additional include folders in alphabetical order except ROOT +include_directories(${ROOT_INCLUDE_DIRS} + ${AliRoot_SOURCE_DIR}/STEER/ESD + ${AliRoot_SOURCE_DIR}/STEER/STEERBase + ) + # Sources in alphabetical order -set(MODULE_SRCS +set(SRCS AliAltroMapping.cxx AliCaloAltroMapping.cxx AliRawDataArray.cxx @@ -61,30 +45,44 @@ set(MODULE_SRCS ) # Headers from sources -string(REPLACE ".cxx" ".h" MODULE_HDRS "${MODULE_SRCS}") +string(REPLACE ".cxx" ".h" HDRS "${SRCS}") # Extra headers in alphabetical order -set(MODULE_HDRS ${MODULE_HDRS} +set(HDRS ${HDRS} AliRawDataHeader.h AliRawDataHeaderV3.h AliRawEventHeaderVersions.h ) -# List of headers to be installed -set(MODULE_HDRS_INSTALL ${MODULE_HDRS}) +# Generate the dictionary +# It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument +get_directory_property(incdirs INCLUDE_DIRECTORIES) +generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${HDRS}" "${incdirs}") -# List of include folders -set(MODULE_INCLUDES - STEER/ESD - STEER/STEERBase - ) +set(ROOT_DEPENDENCIES Core Hist RIO) +set(ALIROOT_DEPENDENCIES ESD STEERBase) + +# Generate the ROOT map +# Dependecies +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) +# Follow headers dependencies +add_dependencies(${MODULE}-object ${ALIROOT_DEPENDENCIES}) +# Add a library to the project using the object +add_library(${MODULE} SHARED $) +target_link_libraries(${MODULE} ${ALIROOT_DEPENDENCIES} ${ROOT_DEPENDENCIES}) -# Root dependecies - please solve all symbols by searching them inside the *.rootmap files -set(MODULE_ROOT_DEPENDENCIES Core Hist RIO) -# AliRoot dependencies -set(MODULE_ALIROOT_DEPENDENCIES ESD STEERBase) +# Setting the correct headers for the object as gathered from the dependencies +target_include_directories(${MODULE}-object PUBLIC $) +set_target_properties(${MODULE}-object PROPERTIES COMPILE_DEFINITIONS $) + +# Public include folders that will be propagated to the dependecies +target_include_directories(${MODULE} PUBLIC ${incdirs}) -# Compilation and linking flags set(MODULE_COMPILE_FLAGS) set(MODULE_LINK_FLAGS) @@ -101,13 +99,34 @@ if(${CMAKE_SYSTEM} MATCHES Darwin) set(MODULE_LINK_FLAGS "-undefined dynamic_lookup ${MODULE_LINK_FLAGS}") endif(${CMAKE_SYSTEM} MATCHES Darwin) -########################################################################### -# Generating the libraries -########################################################################### -# Shared librarys -generate_shared_library() +# Setting compilation flags for the object +set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS "${MODULE_COMPILE_FLAGS}") +# Setting the linking flags for the library +set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "${MODULE_LINK_FLAGS}") + +# Installation +install(TARGETS ${MODULE} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) + +install(FILES ${HDRS} DESTINATION include) -# Static library +# Static version if DA enabled if(ALIROOT_STATIC) - generate_static_library() + add_library(${MODULE}-static STATIC $) + + # 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) + + # Public include folders that will be propagated to the dependecies + target_include_directories(${MODULE}-static PUBLIC ${incdirs}) + + set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE}) + 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) diff --git a/cmake/CMakeALICE.cmake b/cmake/CMakeALICE.cmake index 0b3ea92b4d4..a99f2d7c804 100644 --- a/cmake/CMakeALICE.cmake +++ b/cmake/CMakeALICE.cmake @@ -15,9 +15,9 @@ # General purpose functions -########################################################################### +######################### # ROOT utilities -########################################################################### +######################### # Generation of the dictionaries # @DNAME Dictionary name @@ -85,51 +85,9 @@ macro(generate_rootmap LIBNAME LIBDEPS LINKDEF) endmacro(generate_rootmap) -########################################################################### -# Shared librarires utilities -########################################################################### -macro(generate_shared_library) - # Generate the dictionary - # It will create G_ARG1.cxx and G_ARG1.h / ARG1 = function first argument - get_directory_property(incdirs INCLUDE_DIRECTORIES) - set(incdirs ${MODULE_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${incdirs}) - generate_dictionary("${MODULE}" "${MODULE}LinkDef.h" "${MODULE_HDRS}" "${incdirs}") - - # Generate the ROOT map - # Dependecies - set(MODULE_LIBDEPS ${MODULE_ALIROOT_DEPENDENCIES} ${MODULE_ROOT_DEPENDENCIES}) - generate_rootmap("${MODULE}" "${MODULE_LIBDEPS}" "${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_link_libraries(${MODULE} ${MODULE_LIBDEPS}) - - # Setting the correct headers for the object as gathered from the dependencies - target_include_directories(${MODULE}-object PUBLIC $) - set_target_properties(${MODULE}-object PROPERTIES COMPILE_DEFINITIONS $) - - # Public include folders that will be propagated to the dependecies - target_include_directories(${MODULE} PUBLIC ${incdirs}) - - # Setting compilation flags for the object - set_target_properties(${MODULE}-object PROPERTIES COMPILE_FLAGS "${MODULE_COMPILE_FLAGS}") - # Setting the linking flags for the library - set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "${MODULE_LINK_FLAGS}") - - # Installation - install(TARGETS ${MODULE} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib) - - install(FILES ${MODULE_HDRS_INSTALL} DESTINATION include) -endmacro() - -########################################################################### -# Static libraries utilities -########################################################################### +######################### +# Static utilities +######################### # Generate the static dependecies from dynamic list # @ shared_list - list of shared libraries @@ -146,29 +104,9 @@ macro(generate_static_dependencies shared_list static_list) set(${static_list} PARENT_SCOPE) endmacro(generate_static_dependencies) -# Generate the static library -macro(generate_static_library) - add_library(${MODULE}-static STATIC $) - - # list of shared dependencies / the name of the variable containing the list of static ones - generate_static_dependencies("${MODULE_ALIROOT_DEPENDENCIES}" "STATIC_ALIROOT_DEPENDENCIES") - target_link_libraries(${MODULE}-static ${STATIC_ALIROOT_DEPENDENCIES} Root RootExtra) - - # Public include folders that will be propagated to the dependecies - target_include_directories(${MODULE}-static PUBLIC ${incdirs}) - - set_target_properties(${MODULE}-static PROPERTIES OUTPUT_NAME ${MODULE}) - set_target_properties(${MODULE}-static PROPERTIES LINK_FLAGS "-Wl,--whole-archive") - - # Installation - install(TARGETS ${MODULE}-static - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib) -endmacro() - -########################################################################### +######################### # DA utilities -########################################################################### +######################### # Extract the first comment from a DA file # Find the position for first /* and */ and extract the substring -- 2.39.3