Skip to content

Conversation

@dennisklein
Copy link
Member

@dennisklein dennisklein commented Sep 7, 2017

Most of this work has been merged already.

Missing are the following breaking changes:

  • Switch to root imported targets
  • Add CMake package
  • Modernize config.sh in concert with SPack

Major rework:

  • Provide CMake package config
  • Install exported targets
  • Update ROOT_GENERATE_DICTIONARY and ROOT_LINKER_LIBRARY based on upstream
  • Switch to target properties instead of manual path handling, patch
    ROOT_GENERATE_DICTIONARY to fully support target properties
  • Modernize and cleanup Find* modules
  • Add support for native aliBuild search hints a la *_ROOT
  • Use CMake package configs of dependencies where possible
  • Rewrite old macros with new function interface if beneficial
  • Refactor/Deduplicate old "grown" spaghetti code
  • Clean and improve command line output
  • Remove dead code
  • Drop ROOT5 support
  • Set fairroot install prefix
  • Remove Geant3 dependency for EventDisplay (Review of eventdisplay CMake rules #550)
  • And more

resolves also #464

TODO:
*[x] Get ROOT PR merged. This is a precondition for the new library/dictionary generation code to work. We also need to provide a patch we apply locally for the transition phase, I guess.
[x] Discuss installation directories. Prefix dir or not (after lib and bin)? share/fairbase ?? -> decided in meeting on 8.9.17 to install to bin, lib/fairroot, include/fairroot, and share/fairroot.
[x] There have been other smaller non-critical PRs and bug reports for Geant3 (merged), Geant4 (open) and Geant4VMC (merged). IMHO the package configs of those projects could be extended to provide more info, so we have even less work to do in our Find modules. Do we want to invest this time? -> We can/should make contributions to CMake code of the above projects.
[x] resolve #513, the usage of environment variables should be reduced to Find modules only for aliBuild integration (
_ROOT vars, mostly done) and the last places in cmake/Misc.cmake and cmake/modules/FairRootMacros.cmake need to be looked at.
*[x] resolve #550
*[x] resolve alisw/alibuild#508
*[x] Finish fixing examples directory
*[x] Generate package dependencies
*[x] Provide a feature summary output to get a concise overview, which components are built and which not and how to change that - basically document our build switches with some nice cmake output.
*[ ] Fix macro runtime -> Refactor variable set which is exported currently via config.sh, root_macro.sh and at least partly now in FAIRROOTConfig.cmake. IMHO we should avoid duplicating this logic in three places. I have foreseen the step file cmake/Runtime.cmake to be the authoritative place for this. What do you think? @fuhlig1 We also need to decide which variables to export in our package config.
*[ ] Convert ROOT_GENERATE_DICTIONARY to target_root_dictionary
*[ ] TEST TEST TEST (Mac, AliBuild etc)
*[ ] Update docs and project template!

in separate issue:
*[ ] Contribute to ROOT cmake
*[ ] make check_overlinking

@dennisklein
Copy link
Member Author

@MohammadAlTurany @fuhlig1 I have decided to not use the upstream ROOT_GENERATE_DICTIONARY for now and closed the open PR. I found two more invasive changes needed, which I don't want to fight for right now to get accepted in ROOT. So, I have moved a patched copy of that macro into our own CMake module. In the future when the code is curated and stable and we have time, I guess, we can try to contribute it back.

@dennisklein
Copy link
Member Author

It's almost rebased, looks like current dev changed again. In any case, this is not working yet.

I found another issue with aliBuild I am currently investigating. When you delete the defaults-release.sh recipe, aliBuild crashes. I will update this PR and alfadist simultaneously in a couple of days, once I got it to work.

@dennisklein
Copy link
Member Author

$ pip install alibuild==1.5.1rc1
$ aliBuild --dist dennisklein/alfadist@master --defaults fairroot init FairRoot
$ cd FairRoot
FairRoot$ git remote add dklein https://github.com/dennisklein/FairRoot
FairRoot$ git fetch dklein
FairRoot$ git checkout -b cmake_refactor dklein/cmake_refactor
FairRoot$ git tag v-18.0.0
FairRoot$ cd ..
$ aliBuild --defaults fairroot build FairRoot

This builds now on my machine. There are still couple of open points, I will resolve soon. First to come is fixing the testsuite. It currently does not work yet for the macro based tests. Will post updates here.

Version.h.in Outdated
@@ -1,6 +1,6 @@
#ifndef FAIRROOT_VERSION
#define FAIRROOT_VERSION "@FAIRROOT_VERSION@"
#define FAIRROOT_VERSION_INT (@FairRoot_VERSION_MAJOR@ * 1000000) + (@FairRoot_VERSION_MINOR@ * 1000) + @FairRoot_VERSION_PATCH@
Copy link
Contributor

Choose a reason for hiding this comment

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

Why changing this?

Copy link
Member Author

Choose a reason for hiding this comment

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

FAIRROOT_VERSION_INT was not existing before this PR anyways. The diff you see here is just WIP commits that I have not yet squashed.

thread
timer
)
if(Boost_FOUND)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why defining an extra variable?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have not traced this down yet. I did not invent this variable ;)

OUTPUT_STRIP_TRAILING_WHITESPACE
)

ElseIf(CMAKE_SYSTEM_NAME MATCHES Darwin)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would try to be consistent with case.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, parts of the CMake are still legacy, I have not touched much yet.

list(APPEND LD_LIBRARY_PATH ${FAIRLIBDIR})
list(REMOVE_DUPLICATES LD_LIBRARY_PATH)
set(VMCWORKDIR ${CMAKE_SOURCE_DIR}/examples)
set(MY_LD_LIBRARY_PATH ${LD_LIBRARY_PATH})
Copy link
Contributor

Choose a reason for hiding this comment

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

What about Mac and DYLD_LIBRARY_PATH?

Copy link
Member Author

Choose a reason for hiding this comment

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

The content of MY_LD_LIBRARY_PATH gets emitted in the FairRootConfig.sh script as LD_LIBRARY_PATH and DYLD_LIBRARY_PATH.

)

if(Pythia8_FOUND)
list(APPEND LD_LIBRARY_PATH ${PYTHIA8_LIB_DIR})
Copy link
Contributor

Choose a reason for hiding this comment

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

What about Mac?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is just an internal variable. But this will change again. I don't like having to collect the lib dirs like this.

* Provide CMake package config
* Install exported targets
* Update ROOT_GENERATE_DICTIONARY and ROOT_LINKER_LIBRARY based on upstream
* Switch to target properties instead of manual path handling, patch
ROOT_GENERATE_DICTIONARY to fully support target properties
* Modernize and cleanup Find* modules
* Add support for native aliBuild search hints a la *_ROOT
* Use CMake package configs of dependencies where possible
* Rewrite old macros with new function interface if beneficial
* Refactor/Deduplicate old "grown" spaghetti code
* Clean and improve command line output
* Remove dead code
* Drop ROOT5 support
* Set fairroot install prefix
* Remove Geant3 dependency for EventDisplay (FairRootGroup#550)
* Disable GoTutorial which puts temporary files into source dir
* And more
@dennisklein dennisklein added this to the 18.4 milestone Jun 28, 2019
@dennisklein dennisklein changed the title [WIP] Modernize CMake infrastructure WIP: Modernize CMake infrastructure Dec 16, 2019
@dennisklein
Copy link
Member Author

Superseded by #933.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants