Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion cmake/modules/RootMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,51 @@ function(ROOT_REPLACE_BUILD_INTERFACE include_dir_var include_dir)
set(${include_dir_var} ${include_dir} PARENT_SCOPE)
endfunction(ROOT_REPLACE_BUILD_INTERFACE)

#---------------------------------------------------------------------------------------------------
#---ROOT_GENERATE_TARGET_DICTIONARY( target OPTIONS opt1 opt2 ...)
#
# Creates the dictionary of a predefined CMake target
# <target> is the CMake target on which header file sets and link libraries have been defined
# The output dictionary will be another CMake target called G__<target> prepended.;
# the macro creates (among other files) the dictionary source as G__<target>.cxx
#---------------------------------------------------------------------------------------------------
function(ROOT_GENERATE_TARGET_DICTIONARY target )
CMAKE_PARSE_ARGUMENTS(ARG "OPTIONS" ${ARGN})
# Check if OPTIONS start with a dash.
if (ARG_OPTIONS)
foreach(ARG_O ${ARG_OPTIONS})
if (NOT ARG_O MATCHES "^-*")
message(FATAL_ERROR "Wrong rootcling option: ${ARG_OPTIONS}")
endif()
endforeach()
endif(ARG_OPTIONS)

get_target_property(type ${target} TYPE)
if(NOT ${type} STREQUAL "INTERFACE_LIBRARY")
get_target_property(SrcList ${target} SOURCES)
get_target_property(SrcDir ${target} SOURCE_DIR)
list(TRANSFORM SrcList PREPEND ${SrcDir}/)
endif()
get_target_property(HeaderList ${target} HEADER_SET)
get_target_property(LinkdefList ${target} HEADER_SET_linkDefs)
# get_target_property(ModuleList ${target} CXX_MODULE_SET) needs 3.28
if("HeaderList-NOTFOUND" IN_LIST HeaderList)
message(SEND_ERROR "ROOT_GENERATE_TARGET_DICTIONARY: Missing header file set in ${target}")
endif()
if("LinkdefList-NOTFOUND" IN_LIST LinkdefList)
message(SEND_ERROR "ROOT_GENERATE_TARGET_DICTIONARY: Missing Linkdef file set in ${target}")
endif()
get_target_property(LinkedLibraries ${target} LINK_LIBRARIES)
ROOT_GENERATE_DICTIONARY(G__${target} ${HeaderList} LINKDEF ${LinkdefList} DEPENDENCIES ${LinkedLibraries} OPTIONS ${ARG_OPTIONS})
# TODO: Probably one could directly call rootcling without all the shenanigan inside ROOT_GENERATE_DICTIONARY with include dirs, now that file_sets are used
endfunction(ROOT_GENERATE_TARGET_DICTIONARY)

#---------------------------------------------------------------------------------------------------
#---ROOT_GENERATE_DICTIONARY( dictionary headerfiles NODEPHEADERS ghdr1 ghdr2 ...
# MODULE module DEPENDENCIES dep1 dep2
# EXTRA_DEPENDENCIES
# BUILTINS dep1 dep2
# STAGE1 LINKDEF linkdef OPTIONS opt1 opt2 ...)
# STAGE1 LINKDEF linkdef OPTIONS opt1 opt2 ... NO_CXXMODULE MULTIDICT NOINSTALL)
#
# <dictionary> is the dictionary stem; the macro creates (among other files) the dictionary source as
# <dictionary>.cxx
Expand Down
149 changes: 96 additions & 53 deletions roofit/xroofit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,59 +1,102 @@
set (XROOFIT_HEADERS
RooBrowser.h
XRooFit.h
RooFit/xRooFit/xRooFit.h
RooFit/xRooFit/xRooNode.h
RooFit/xRooFit/xRooNLLVar.h
RooFit/xRooFit/xRooHypoSpace.h
RooFit/xRooFit/xRooBrowser.h
)

ROOT_STANDARD_LIBRARY_PACKAGE(RooFitXRooFit
HEADERS
${XROOFIT_HEADERS}
SOURCES
src/Asymptotics.cxx
src/xRooBrowser.cxx
src/xRooFit.cxx
src/xRooHypoSpace.cxx
src/xRooNLLVar.cxx
src/xRooNode.cxx
src/xRooNode_interactive.cxx
src/PythonInterface.cxx
DICTIONARY_OPTIONS
"-writeEmptyRootPCM"
DEPENDENCIES
HistFactory
RooFit
RooFitHS3
RooStats
FitPanel
Gui
Ged
RooFitCore
FitPanel
LINKDEF
inc/LinkDef.h
)

target_include_directories(RooFitXRooFit PRIVATE inc/RooFit)
if(CMAKE_VERSION VERSION_LESS "3.23.0")
ROOT_STANDARD_LIBRARY_PACKAGE(RooFitXRooFit
HEADERS
RooBrowser.h
XRooFit.h
RooFit/xRooFit/xRooFit.h
RooFit/xRooFit/xRooNode.h
RooFit/xRooFit/xRooNLLVar.h
RooFit/xRooFit/xRooHypoSpace.h
RooFit/xRooFit/xRooBrowser.h
SOURCES
src/Asymptotics.cxx
src/xRooBrowser.cxx
src/xRooFit.cxx
src/xRooHypoSpace.cxx
src/xRooNLLVar.cxx
src/xRooNode.cxx
src/xRooNode_interactive.cxx
src/PythonInterface.cxx
DICTIONARY_OPTIONS
"-writeEmptyRootPCM"
DEPENDENCIES
HistFactory
RooFit
RooFitHS3
RooStats
FitPanel
Gui
Ged
RooFitCore
FitPanel
LINKDEF
inc/LinkDef.h
)

set(RELATIVE_INC_HEADERS ${XROOFIT_HEADERS})
list(TRANSFORM RELATIVE_INC_HEADERS PREPEND inc/)
if(NOT CMAKE_VERSION VERSION_LESS "3.23.0")
target_include_directories(RooFitXRooFit PRIVATE inc/RooFit)
else()
add_library(RooFitXRooFit SHARED)
target_sources(
RooFitXRooFit
PRIVATE
FILE_SET private_header_files
TYPE HEADERS
BASE_DIRS inc/ src/
FILES
${RELATIVE_INC_HEADERS}
RooFitXRooFit
PRIVATE
src/Asymptotics.cxx
src/xRooBrowser.cxx
src/xRooFit.cxx
src/xRooHypoSpace.cxx
src/xRooNLLVar.cxx
src/xRooNode.cxx
src/xRooNode_interactive.cxx
src/PythonInterface.cxx
# These below could be also a PRIVATE header file_set if wanted
src/PythonInterface.h
src/coutCapture.h
src/xRooFitVersion.h
PUBLIC
FILE_SET HEADERS
TYPE HEADERS
BASE_DIRS inc/
FILES
inc/RooBrowser.h
inc/XRooFit.h
inc/RooFit/xRooFit/xRooFit.h
inc/RooFit/xRooFit/xRooNode.h
inc/RooFit/xRooFit/xRooNLLVar.h
inc/RooFit/xRooFit/xRooHypoSpace.h
inc/RooFit/xRooFit/xRooBrowser.h
inc/RooFit/xRooFit/Config.h # was not part of XROOFIT_HEADERS earlier
PUBLIC
FILE_SET linkDefs
TYPE HEADERS
BASE_DIRS inc/
FILES
inc/LinkDef.h
inc/RooFit/xRooFit/Config.h # was not part of XROOFIT_HEADERS
src/PythonInterface.h
src/coutCapture.h
src/xRooFitVersion.h
)
target_link_libraries(RooFitXRooFit
PUBLIC
HistFactory
RooFit
RooFitHS3
RooStats
FitPanel
Gui
Ged
RooFitCore
FitPanel
)
ROOT_GENERATE_TARGET_DICTIONARY(RooFitXRooFit
OPTIONS "-writeEmptyRootPCM")
install(TARGETS RooFitXRooFit
EXPORT ${CMAKE_PROJECT_NAME}Exports
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT applications

# with this we no longer need the moveheader target etc
FILE_SET HEADERS
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # add /ROOT to make Debian happy

FILE_SET linkDefs
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # add /ROOT to make Debian happy
)
endif()

Expand Down