Open tclune opened 6 months ago
Hmm. Yeah this is...hard to do generically. UDUNITS is just looking for UDUNITS2_XML_PATH
in the environment. For Baselibs builds, I could maybe figure out a hack for that because we know exactly where it will be ($BASEDIR/share/udunits/udunits2.xml
). But then that means altering the environment, so I suppose that then means changes to the tests that require that variable? A la:
set_property(TEST MAPL.history3g.tests PROPERTY ENVIRONMENT "${LD_PATH}=${CMAKE_CURRENT_BINARY_DIR}/gridcomps:$ENV{${LD_PATH}}")
So we could do something like:
set_property(TEST udunits2f.tests PROPERTY ENVIRONMENT "${UDUNITS2_XML_PATH}=${CMAKE_UDUNITS2_XML_PATH}")
with a lot of logic to make sure things don't go boom if that isn't set or not to do it at all if it's in the environment...
Now for spack life, I'll probably need to work with @AlexanderRichert-NOAA on the udunits package. It doesn't set UDUNITS2_XML_PATH
and we'd want it to. (Maybe using setup_run_environment
?)
There is one more thought. We could add something to the Findudunits.cmake
file as well. I mean, most likely the share/
directory of a UDUNITS2 install will be "next" to, say, the include dir. I could do a find_path
looking for udunits2.xml
and then set a variable...
Maybe that's best of all. Wouldn't even need to update spack...
Okay. I think I have the MAPL solution here:
https://github.com/GEOS-ESM/MAPL/pull/2702
but this isn't a runtime fix. For that g5_modules
or spack will need to set the variable.
@tclune This is a comment.
With the advent of use of udunits in MAPL3, we now have a requirement to set the udunits path which will be different for each build of baselibs.
One possibility is to modify FindBaselibs to set this path. Alternatively, MAPL could use the BASEDIR env variable and append as necessary itself.
Needs to propagate down to ctests in MAPL. Ideally we could also still run manually with
mpirun -np 1 ./MAPL.generic3g.tests
but probably no good way to automatically support that.