Print

Print


Commit in lcio on MAIN
CMakeLists.txt+71.53 -> 1.54
src/cpp/CMakeLists.txt+1401.22 -> 1.23
+147
2 modified files
added optional creation of ROOT dictionary

lcio
CMakeLists.txt 1.53 -> 1.54
diff -u -r1.53 -r1.54
--- CMakeLists.txt	18 Nov 2009 11:09:56 -0000	1.53
+++ CMakeLists.txt	21 Jan 2010 16:25:16 -0000	1.54
@@ -33,6 +33,9 @@
 OPTION( INSTALL_DOC "Set to OFF to skip build/install Documentation" ON )
 OPTION( INSTALL_JAR "Set to OFF to skip build/install lcio.jar" ON )
 
+OPTION( BUILD_ROOTDICT "Set to ON to build ROOT dictionary" OFF )
+
+
 # set default cmake build type to RelWithDebInfo
 IF( NOT CMAKE_BUILD_TYPE )
     SET( CMAKE_BUILD_TYPE "RelWithDebInfo" )
@@ -381,6 +384,7 @@
 MESSAGE( STATUS "BUILD_WITH_DCAP = ${BUILD_WITH_DCAP}" )
 MESSAGE( STATUS "INSTALL_DOC = ${INSTALL_DOC}" )
 MESSAGE( STATUS "INSTALL_JAR = ${INSTALL_JAR}" )
+MESSAGE( STATUS "BUILD_ROOTDICT = ${BUILD_ROOTDICT}" )
 MESSAGE( STATUS "Change a value with: cmake -D<Variable>=<Value>" )
 MESSAGE( STATUS "-------------------------------------------------------------------------------" )
 MESSAGE( STATUS )
@@ -407,6 +411,9 @@
     "Set to OFF to skip build/install Documentation" FORCE )
 SET( INSTALL_JAR "${INSTALL_JAR}" CACHE BOOL
     "Set to OFF to skip build/install lcio.jar" FORCE )
+SET( BUILD_ROOTDICT "${BUILD_ROOTDICT}" CACHE BOOL
+     "Set to ON to build LCIO ROOT dictionary" FORCE )
+
 
 # export build settings
 INCLUDE( CMakeExportBuildSettings )

lcio/src/cpp
CMakeLists.txt 1.22 -> 1.23
diff -u -r1.22 -r1.23
--- CMakeLists.txt	27 Nov 2008 16:48:54 -0000	1.22
+++ CMakeLists.txt	21 Jan 2010 16:25:16 -0000	1.23
@@ -211,6 +211,146 @@
 ENDIF()
 
 
+#------ create a root dictionary -----------------------------
+IF( BUILD_ROOTDICT )
+#-----------------------------------------------------------------
+
+  INCLUDE( ${PROJECT_SOURCE_DIR}/FindROOT.cmake )
+
+
+  IF( ROOT_FOUND )
+    
+    
+    SET( ENV{ROOTSYS} "${ROOT_HOME}" )
+    SET( ENV{PATH} $ENV{ROOTSYS}/bin:$ENV{PATH} )
+    SET( ENV{LD_LIBRARY_PATH} $ENV{ROOTSYS}/lib:$ENV{LD_LIBRARY_PATH} )
+    
+    
+    #TODO test ROOT_FOUND and ${ROOT_HOME}/bin/rootcint
+    
+    # list of headers
+    FILE( GLOB_RECURSE lcio_headers include/*.h )
+    
+    # list of headers to exclude
+    FILE( GLOB_RECURSE exclude_headers include/empty_ignore.h include/SIO/*.h include/CPPFORT/*.h include/UTIL/CellIDDecoder.h)
+    
+    # remove items to exclude
+    LIST( REMOVE_ITEM lcio_headers ${exclude_headers} )
+    
+    SET( DICT_OUTPUT_DIR "${PROJECT_BINARY_DIR}/dict" )
+    
+    # create output directory
+#    ADD_CUSTOM_COMMAND(
+#      OUTPUT  "${DICT_OUTPUT_DIR}"
+#      COMMAND "${CMAKE_COMMAND}"
+#      ARGS -E make_directory "${DICT_OUTPUT_DIR}"
+#      COMMENT "create directory ${DICT_OUTPUT_DIR}"
+#      )
+    file(MAKE_DIRECTORY ${DICT_OUTPUT_DIR})
+
+
+
+    SET( dict_lib_srcs )
+    
+    # FIXME variables must be set by FindROOT.cmake
+    #SET( cint_script "${PROJECT_BINARY_DIR}/rootcint.cmake" )
+    #FILE( WRITE "${cint_script}" "# little script to run rootcint\n" )
+    #FILE( APPEND "${cint_script}" "SET( ENV{ROOTSYS} ${ROOT_HOME} )\n" )
+    #FILE( APPEND "${cint_script}" "SET( ENV{PATH} \$ENV{ROOTSYS}/bin:\$ENV{PATH} )\n" )
+    #FILE( APPEND "${cint_script}" "SET( ENV{LD_LIBRARY_PATH} \$ENV{ROOTSYS}/lib:\$ENV{LD_LIBRARY_PATH} )\n" )
+    #FILE( APPEND "${cint_script}" "EXEC_PROGRAM( rootcint -f \${dict_src_file} -c -DHANDLE_LCIO_EXCEPTIONS=IGNORED_FOR_CINT -Iinclude \${lcio_hdr_rel_path} \${dict_hdr_file} )\n" )
+    
+    
+    FOREACH( lcio_hdr ${lcio_headers} )
+      
+      # get the relative path
+      #FILE( RELATIVE_PATH lcio_hdr_rel_path "${PROJECT_SOURCE_DIR}" ${lcio_hdr} )
+      #STRING( REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "" lcio_hdr_rel_path ${lcio_hdr} )
+      FILE( RELATIVE_PATH lcio_hdr_rel_path "${CMAKE_CURRENT_SOURCE_DIR}" ${lcio_hdr} )
+      
+      # generate a basename from the header + relative path, e.g.:
+      # include/EVENT/TrackerPulse.h  -->>  include_EVENT_TrackerPulse
+      STRING( REPLACE "/" "_" dict_basename ${lcio_hdr_rel_path} )
+      STRING( REPLACE ".h" "" dict_basename ${dict_basename} )
+      
+      
+      SET( dict_hdr "${dict_basename}_Linkdef.h" )
+      SET( dict_hdr_file "${DICT_OUTPUT_DIR}/${dict_hdr}" )
+      
+      SET( dict_src "${dict_basename}_dict.cxx" )
+      SET( dict_src_file "${DICT_OUTPUT_DIR}/${dict_src}" )
+      
+      # generate dict header file
+      ADD_CUSTOM_COMMAND(
+	OUTPUT  ${dict_hdr_file}
+	COMMAND ${CMAKE_COMMAND}
+	ARGS -E echo "\\#pragma link C++ defined_in \\\"${lcio_hdr_rel_path}\\\"\; >${dict_hdr}"
+	#ARGS -E echo "\\#pragma link C++ defined_in ${lcio_hdr_rel_path}\; >${dict_hdr}"
+	WORKING_DIRECTORY "${DICT_OUTPUT_DIR}"
+	DEPENDS ${lcio_hdr}  # ${DICT_OUTPUT_DIR}
+	COMMENT "generating ${dict_hdr}"
+	)
+      
+      # generate dict source file
+      ADD_CUSTOM_COMMAND(
+	OUTPUT  ${dict_src_file}
+	#COMMAND ${ROOT_HOME}/bin/rootcint
+	#COMMAND $ENV{ROOTSYS}/bin/rootcint
+	COMMAND rootcint
+	ARGS -f ${dict_src_file} -c -DHANDLE_LCIO_EXCEPTIONS=IGNORED_FOR_CINT -Iinclude ${lcio_hdr_rel_path} ${dict_hdr_file}
+	WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
+	DEPENDS ${dict_hdr_file}
+	COMMENT "generating ${dict_src}"
+	)
+      
+      LIST( APPEND dict_lib_srcs ${dict_src_file} )
+    ENDFOREACH()
+    
+    INCLUDE_DIRECTORIES( "${DICT_OUTPUT_DIR}" )
+    INCLUDE_DIRECTORIES( "${ROOT_INCLUDE_DIRS}" )
+    # FIXME next line should not be needed
+    # xxx_dict.h files should have:
+    # #include "IOIMPL/TrackerRawDataIOImpl.h"
+    # instead of:
+    # #include "include/IOIMPL/TrackerRawDataIOImpl.h"
+    INCLUDE_DIRECTORIES( "${CMAKE_CURRENT_SOURCE_DIR}" )
+    
+    ADD_LIBRARY( lib_LCIODICT ${dict_lib_srcs} ${LCIO_RIO_SRCS} )
+    INSTALL( TARGETS lib_LCIODICT DESTINATION lib )
+ 
+
+   IF( APPLE )
+     SET( ROOT_DICT_LINK_FLAGS "-single_module -undefined dynamic_lookup -bind_at_load")
+#     ADD_LIBRARY( lib_LCIO ${LCIO_RIO_SRCS} )
+   ELSE( APPLE )
+     SET( ROOT_DICT_LINK_FLAGS " " )
+   ENDIF( APPLE )
+    
+    SET_TARGET_PROPERTIES( lib_LCIODICT PROPERTIES
+      # create *nix style library versions + symbolic links
+      VERSION ${LCIO_VERSION}
+      SOVERSION ${LCIO_SOVERSION}
+      # allow creating static and shared libs without conflicts
+      CLEAN_DIRECT_OUTPUT 1
+      # avoid conflicts between library and binary target names
+      OUTPUT_NAME lcioDict
+      LINKER_FLAGS ${ROOT_DICT_LINK_FLAGS}
+      )
+    
+    ADD_CUSTOM_TARGET( dict DEPENDS  lib_LCIODICT )
+
+    TARGET_LINK_LIBRARIES( lib_LCIODICT ${ROOT_LIBRARIES} lib_LCIO)
+
+
+  ELSE( ROOT_FOUND ) 
+
+     MESSAGE( STATUS " NO ROOT found :-( " ) 
+
+     
+  ENDIF( ROOT_FOUND )
+ENDIF( BUILD_ROOTDICT )
+#----------------------------------------------
+
 
 
 # create symbolic target for calling targets test_XXX
CVSspam 0.2.8