Skip to content

Fix FullSimLight and FSL builds for distribution kits, and make HepMC3 dependency optional

Riccardo Maria Bianchi requested to merge fsl-cmake-and-hepmc3-optional into master

Single build-jobs for distribution kits

This MR fixes the builds of the FullSimLight and FSL sub-packages for the distribution kits.

In particular, this fixes the single-build jobs used for the macOS Homebrew 'bottles', for which the sub-packages are built one on top of the other.

This is achieved by the use of a new CMake variable, which triggers different include paths during the build; for example:

if( FullSimLight_INDIVIDUAL_BUILD )
    target_include_directories( ExamplePrimaryGeneratorPlugin PUBLIC  ${CMAKE_SOURCE_DIR} )
else() # all-in-one--build
    target_include_directories( ExamplePrimaryGeneratorPlugin PUBLIC  ${CMAKE_SOURCE_DIR}/FullSimLight )
endif()

HepMC3 dependency

This MR also makes the dependency on the HepMC3 exchange format optional, in the sense that the user can disable the support for HepMC3 at compile time if not needed/installed.

This can be done with the use of the newly introduced CMake option: GEOMODEL_USE_HEPMC3.

NOTE: The new flag is ON by default, so the support for the HepMC3 exchange format is always enabled unless the user explicitly disables it with the use of the -DGEOMODEL_USE_HEPMC3=0 flag at compile time, which sets the need for HepMC3 in the CMake configuraion:

option(GEOMODEL_USE_HEPMC3 "Buil GeoModel tools with support for the HepMC3 exchancge format (Note: HepMC3 must be installed on the target machine)" ON)
if(GEOMODEL_USE_HEPMC3)
    find_package(HepMC3 REQUIRED) # required by default, but it can be disabled 
endif()
if(HepMC3_FOUND)
    target_compile_definitions(fullSimLight PRIVATE USE_HEPMC3)
endif()

This triggers the creation of the USE_HEPMC3 preprocessor variable, which is then used to disable in the C++ code the functions, tools, and GUI elements that use HepMC3; e.g.:

#ifndef USE_HEPMC3
    ui->cB_gen_options->setItemData(2, false, Qt::UserRole -1);
    ui->groupBox_hepmc3->setEnabled(false);
#endif

Merge request reports