Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add badges and improve make output #879

Merged
merged 15 commits into from
Mar 15, 2019

Conversation

MohammadAlTurany
Copy link
Contributor

  • Add license badge
  • Use the FairMQ style implemented by Dennis in FairRoot

EndMacro (SetBasicVariables)
################################################################################
macro(find_package2 qualifier pkgname)
Copy link
Member

@dennisklein dennisklein Mar 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use this improved version of the find_package2 macro: https://github.com/FairRootGroup/FairMQ/blob/master/cmake/FairMQLib.cmake#L296-L341

It allows to write this (in top level CMakeLists.txt)

set(FairRoot_Boost_COMPONENTS thread system timer program_options random filesystem chrono exception regex serialization log log_setup atomic date_time signals)
list(APPEND FairRoot_Boost_COMPONENTS ${FairMQ_Boost_COMPONENTS})
list(REMOVE_DUPLICATES FairRoot_Boost_COMPONENTS)
find_package2(PUBLIC Boost VERSION 1.67 COMPONENTS ${FairRoot_Boost_COMPONENTS})

as just

find_package2(PUBLIC Boost
  VERSION 1.67 ${FairMQ_Boost_VERSION}
  COMPONENTS thread system timer program_options random filesystem chrono exception regex serialization log log_setup atomic date_time signals ${FairMQ_Boost_COMPONENTS}
)

It will pick highest listed version and automatically make the components list unique. I was also thinking about a syntax like this:

find_package2(PUBLIC Boost
  VERSION 1.67
  COMPONENTS thread system timer program_options random filesystem chrono exception regex serialization log log_setup atomic date_time signals
  ADD_REQUIREMENTS_OF FairMQ
)

or similar. What do you think?

Copy link
Member

@dennisklein dennisklein Mar 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reminds me, we should also add find_package2 to FairLogger, which now has an optional dependency to Boost as well. With generate_package_dependencies() one can generate a cmake string, that can be exported in the cmake package, which defines ${FairLogger_Boost_VERSION} and ${FairLogger_Boost_COMPONENTS} - basically for any find_package2 call, if PUBLIC and VERSION/COMPONENTS are specified. Made an issue FairRootGroup/FairLogger#14.

Then it would read

find_package2(PUBLIC Boost
  VERSION 1.67 ${FairMQ_Boost_VERSION} ${FairLogger_Boost_VERSION}
  COMPONENTS thread system timer program_options random filesystem chrono exception regex serialization log log_setup atomic date_time signals ${FairMQ_Boost_COMPONENTS} ${FairLogger_Boost_COMPONENTS}
)

or

find_package2(PUBLIC Boost
  VERSION 1.67
  COMPONENTS thread system timer program_options random filesystem chrono exception regex serialization log log_setup atomic date_time signals
  ADD_REQUIREMENTS_OF FairMQ FairLogger
)

Actually, I like second one even better, will add it at some point.

Copy link
Member

@dennisklein dennisklein Mar 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This topic has another aspect: The reason for exporting the public package dependency versions/components, is obviously, that we do not have to hardcode any requirements of the dependent package. But what about the list of dependencies itself? Currently, we hardcode it. For Boost, it is somewhat hidden, because we depend on it directly in FairRoot, FairMQ, and FairLogger. E.g. FairMQ also exports a variable ${FairMQ_PACKAGE_DEPENDENCIES} that could be used to loop over all public FairMQ dependencies and "find_package" them, even if FairRoot does not directly depend on them.

So far, so good, but this is not enough. Imagine multiple dependencies exporting such a list of their dependencies and they overlap partly. Then one would first have to "fuse" those lists together preserving their topological properties (doable, if the order is the original call order !currently not the case! those lines would be a bug) and figure out a call order together with the direct dependencies FairRoot "finds" explicitely. All doable, but it is not yet done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding here is to clean and simplify the CMake output so that the users see in one shot what he has. The real issue of dependancies between packages is solved in AliBuild or FairSoft, OR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those tools will build, install and decide on the package versions. But the public package dependencies must be discovered by each project for the whole subtree.

E.g. if a dependency uses a symbol of yet another library in its header, that is included in a FairRoot source file. Then, we only know about the target name, that we need to link against. But that target is not defined unless we find_package the righr dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a way, it is a standard way of doing, what the config.sh does.

Copy link
Member

@dennisklein dennisklein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the package components, you may want to have a look at generate_package_components. It picks up the list of components in the variable ${PROJECT_PACKAGE_COMPONENTS} and generates component checking code that can be exported in a cmake package (code similar to this and that). This will enable that the user can find a FairRoot with specific components enabled (even without find_package2), e.g.

find_package(FairRoot COMPONENTS base eve)

In FairMQ, I chose to keep the component names in sync with the table output when running cmake. E.g.

find_package(FairMQ 1.3.8 COMPONENTS nanomsg_transport)

will explicitely require a FairMQ installation with enabled nanomsg transport.

@MohammadAlTurany
Copy link
Contributor Author

@dennisklein Thanks, I will adapt to your suggestions.

Copy link
Member

@fuhlig1 fuhlig1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I only add some comments at specific places. What I only saw in the end is that we use exec_program() at several places. Since this function is deprecated we should use execute_process() instead.

cmake/modules/CheckCompiler.cmake Outdated Show resolved Hide resolved
cmake/modules/ROOTMacros.cmake Outdated Show resolved Hide resolved
@@ -1,8 +1,8 @@
################################################################################
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this Find module? We use the CLHEP which comes with Geant4.

@@ -9,7 +9,7 @@ if (GENERATORS_LIBRARY_DIR)
SET (GENERATORS_LIBRARY_DIR GENERATORS_LIBRARY_DIR-NOTFOUND)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this Find module?

CMakeLists.txt Outdated
# Set project version
SET(FAIRROOT_MAJOR_VERSION 18)
SET(FAIRROOT_MINOR_VERSION 0)
SET(FAIRROOT_PATCH_VERSION 1)
SET(FAIRROOT_PATCH_VERSION 3)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are already at patch version 6 for the v18.0 branch. So for the development branch we should choose a higher number or decide on a different numbering scheme.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will change it to 7 now.

@fuhlig1
Copy link
Member

fuhlig1 commented Mar 13, 2019 via email

@MohammadAlTurany MohammadAlTurany merged commit 3475c41 into FairRootGroup:dev Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants