# CMake for GammaWare/ADFE # O. Stezowski # # To add a file, add it in the with_dictionnary list or in the without_dictionnary list depending # whether or not the ROOT dictionnary is to be generated. # !! Do not forget to fill the LinkDef file !! # !! Do not forget to add EXTRA_INTERNAL_LIBRARIES and EXTRA_EXTERNAL_LIBRARIES with the names of the libraries this one relies on !! # project (adfe) # MESSAGE("[GW] + root/${PROJECT_NAME}") # # set(GWLIBNAME GWADFE) # # headers / dictionnary / sources # # so far no automatic methods for computing which class has a dictionnary or not # manual method : base file name separated in two lists with different treatment. # set( with_dictionnaries TTreeWatchers FrameDispatcher Watchers ) set( without_dictionnaries WatcherProducer BasicReplica BaseEmulator AnActorConnection ALoadedActor RootAFP DEmulator ReadMezzAFP ) # add includes : root + current (before to have the latest) + all gw includes copied in CMAKE_BINARY_DIR/include # include_directories(${ROOT_INCLUDES}) include_directories(${CMAKE_BINARY_DIR}/include) include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}) # set (ALL_GW_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_BINARY_DIR}/include ${ROOT_INCLUDES}) # link_directories(${ROOT_LIBRARY_DIR}) link_directories(${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) # # headers / linkdef etc ... # set(headers "") set(all_headers "") set(sources "") # # set headers/ etc and generate dictionnary for the files which require it # foreach( f ${with_dictionnaries} ) set(sources ${sources} ${CMAKE_CURRENT_SOURCE_DIR}/${f}.cpp) set(headers ${headers} ${CMAKE_CURRENT_SOURCE_DIR}/${f}.h) endforeach() # # Dictionnary from one file only 'a la ROOT' + internal and external dependencies # if ( RDICTIONNARY EQUAL 1 ) ROOT_GENERATE_DICTIONARY(G__${GWLIBNAME} ${headers} MODULE ${GWLIBNAME} LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/LinkDef.h OPTIONS "") set( EXTRA_EXTERNAL_LIBRARIES Core Graf MathCore Gpad Hist Tree RIO Thread Net TreePlayer) # MESSAGE("[GW-CLING]") else () ROOT_GENERATE_DICTIONARY(G__${GWLIBNAME} ${headers} LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/LinkDef.h) set( EXTRA_EXTERNAL_LIBRARIES Core Graf MathCore Gpad Hist Tree RIO Thread Net TreePlayer) # MESSAGE("[GW-CINT]") endif() set(EXTRA_INTERNAL_LIBRARIES GWCORE GWADF GWPHYSICS) # foreach( f ${without_dictionnaries} ) set(sources ${sources} ${CMAKE_CURRENT_SOURCE_DIR}/${f}.cpp) set(headers ${headers} ${CMAKE_CURRENT_SOURCE_DIR}/${f}.h) endforeach() # #---------------------------------------------------------------------------- # # Use root functions to generate the library and the root map file # if ( with_dictionnaries ) ROOT_LINKER_LIBRARY(${GWLIBNAME} ${sources} G__${GWLIBNAME}.cxx DEPENDENCIES ${EXTRA_INTERNAL_LIBRARIES} ${EXTRA_EXTERNAL_LIBRARIES}) ROOT_GENERATE_ROOTMAP(${GWLIBNAME} LINKDEF ${CMAKE_CURRENT_SOURCE_DIR}/LinkDef.h DEPENDENCIES ${EXTRA_INTERNAL_LIBRARIES} ${EXTRA_EXTERNAL_LIBRARIES}) else () ROOT_LINKER_LIBRARY(${GWLIBNAME} ${sources} DEPENDENCIES ${EXTRA_INTERNAL_LIBRARIES} ${EXTRA_EXTERNAL_LIBRARIES}) endif() # # copy headers file in a single directory so that is becomes available for ohers # # because cmake2.6 does not provide COPY in file, do it another way if( ${CMAKE_VERSION} VERSION_GREATER "2.8.0" ) file(COPY ${headers} DESTINATION ${CMAKE_BINARY_DIR}/include) else() if ( EXISTS ${CMAKE_BINARY_DIR}/include ) else() execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/ ) endif() foreach ( f ${headers} ) execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${f} ${CMAKE_BINARY_DIR}/include/ ) endforeach() endif() # # Install lib and headers # install(TARGETS ${GWLIBNAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib COMPONENT libraries) # install(FILES ${headers} DESTINATION ${GW_INCLUDE_DIR} COMPONENT headers ) if ( with_dictionnaries ) if ( RDICTIONNARY EQUAL 1 ) install(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${GWLIBNAME}_rdict.pcm DESTINATION lib COMPONENT libraries ) endif() install(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${GWLIBNAME}.rootmap DESTINATION lib COMPONENT libraries ) endif()