easybuild-framework
easybuild-framework copied to clipboard
add `--search-path-cpp-headers` configuration option to control how EasyBuild sets paths to headers at build time
Partial fix for #3331
EasyBuild (at build time) currently handles paths to headers of dependencies provided by EB through CPPFLAGS. The result is that the compilation command gets additional options of the form -I/path/to/include explicitly pointing the compiler to places with extra headers.
The GCC prepocessor also supports the following environment variables that define the search paths for headers, which have lower precedence than -I command line options:
- CPATH
- C_INCLUDE_PATH, CPLUS_INCLUDE_PATH, OBJC_INCLUDE_PATH
(see https://gcc.gnu.org/onlinedocs/cpp/Environment-Variables.html#Environment-Variables-1)
This PR adds a new build option and toolchain option called cpp-headers-search-path to control how EasyBuild will handle paths to headers at build time:
- CPPFLAGS: current approach by setting
CPPFLAGSand injecting-I/path/to/includeto compilation command - CPATH: new approach by adding paths to include directories to
CPATHenvironment variable - INCLUDE_PATHS: new approach by adding paths to include directories to
C_INCLUDE_PATH,CPLUS_INCLUDE_PATH,OBJC_INCLUDE_PATHindependently
Notes:
- all these options and environment variables are also supported by LLVM and the Intel compilers.
- option CPPFLAGS stays the default. So this PR does not change current behavior.
- the toolchain option has precedence over the build option as it is more specific and (probably) easyconfigs setting this option will not work with any other setting.
- FCC toolchain can now be drastically simplified by leveraging inheritance to the new
Toolchain._add_dependency_cpp_headers()method (@migueldiascosta can you please check that this works on your side?) - replaced hardcoded settings for
LDFLAGSandCPPFLAGSwith newToolchainmethods in ACML toolchain - added unit test for cpp-headers-search-paths option