Problem 2215

Summary: INVENTOR_INCLUDE_DIR not being properly added to CXX_INCLUDES for building
Product: Geant4 Reporter: Michael Kelsey <kelsey>
Component: cmakeAssignee: Ben Morgan <Ben.Morgan>
Status: CLOSED FIXED    
Severity: major    
Priority: P4    
Version: 10.6   
Hardware: All   
OS: Linux   

Description Michael Kelsey 2020-01-20 03:13:34 CET
When building recent Geant4 releases, we include the CMake options

  -DGEANT4_USE_INVENTOR=ON
  -DINVENTOR_INCLUDE_DIR=<Coin-path>/include
  -DINVENTOR_LIBRARY=<Coin-path>/lib/libCoin.so 
  -DINVENTOR_SOXT_LIBRARY=<Coin-path>/lib/libSoXt.so
  -DINVENTOR_SOXT_INCLUDE_DIR=<Coin-path>/include/Inventor/Xt 

Where <Coin-path> is the path to our local Coin3D installation.  With G4 10.04 and 10.05 this works as expected.  With G4 10.06, the build of visualization/OpenInventor fails on the first file, because the OI include files (e.g., Inventor/fields/SoSFFloat.h) are not found.

Inspecting the CMake-generated file source/visualization/OpenInventor/CMakeFiles/G4OpenInventor.dir/flags.make, I see that none of the Coin directories are included in the CXX_INCLUDES setting.
(As an aside, I also see that essentially the entire collection of G4 directories is included, which wasn't the case in 10.05).

I have not yet managed to dig through the convoluted CMake configuration system to identify why INVENTOR_INCLUDE_DIR and INVENTOR_SOXT_INCLUDE_DIR are not properly used, but it's clear that something is broken.
Comment 1 Michael Kelsey 2020-01-20 05:02:55 CET
Just to follow up, I compared the visualization/OpenInventor/sources.cmake files for 10.05 and 10.06, and they are functionally identical.  Only the line "include(${QT_USE_FILE})" was removed in going to 10.06.  In particular, all of the "include_directories()" actions are identical, and in the same order, in both releases; specifically, "include_directories(${INVENTOR_INCLUDE_DIR})" appears in both.
Comment 2 Gabriele Cosmo 2020-01-21 14:15:51 CET
I could reproduce the problem on a build made from scratch.
It simply seems that the headers of the OpenInventor driver are not being installed at all. Ben, can you take a look?
Comment 3 Gabriele Cosmo 2020-01-22 08:08:41 CET
Sorry... correction to my previous post... Open Inventor driver headers are not found while building (not at installation...).
Comment 4 Gabriele Cosmo 2020-01-22 10:05:41 CET
More info on this (which also explains why I had my Inventor installation working in the past)...
- My installation of Coin/Inventor is on /usr/local. INVENTOR_INCLUDE_DIR is properly set to /usr/local/include;
- At compilation, "-isystem /usr/local/include" does not show up, leading to the compilation errors;
- If, at configuration, I also turn on XM (GEANT4_USE_XM, and in my case Xm is also installed in /usr/local), the path is being properly added and everything works.
Comment 5 Ben Morgan 2020-01-22 11:46:49 CET
O.k., I'll take a look, but won't be immediately as I'm pretty busy right now.
Comment 6 Michael Kelsey 2020-01-22 17:01:03 CET
Thank you for fixing this so quickly, Ben.  I noticed that you changed "include_directories()" to "target_include_directories()" for OI.  Is it possible that the underlying change (no longer using include_directories() for each directory's dependencies) affects other directories?  Especially other visualization stuff, which often depends on externally installed systems?
Comment 7 Ben Morgan 2020-01-22 18:30:50 CET
Theoretically yes, but as far as I know, Inventor's the only external package that doesn't have CMake imported targets created when it's found (on the todo list).

Any Geant4 -> Geant4 includes are consistent as each category/subcategory uses target_include_directories() to describe the paths they expose. Any problems here will immediately be picked up in Continuous and/or Nightly tests.
Comment 8 Ben Morgan 2020-02-04 11:21:56 CET
Just to close out - this was fixed in MR 782 on gitlab, and will be applied to the upcoming 10.6.1 patch.