Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,6 @@ install(
PATTERN "pkgconfig" EXCLUDE
)

if(Vc_INCLUDE_DIR)
set(MODULES_ROOT_INCPATH "ROOT_INCLUDE_PATH=${Vc_INCLUDE_DIR}:${ROOT_INCLUDE_PATH}")
endif()

# modules.idx
if(runtime_cxxmodules)
ROOT_GET_LIBRARY_OUTPUT_DIR(library_output_dir)
Expand All @@ -561,6 +557,7 @@ if(runtime_cxxmodules)
ROOTIGNOREPREFIX=1 ROOT_HIST=0 $<TARGET_FILE:root.exe> -l -q -b)
else()
set(modules_idx_cmd COMMAND ${ld_library_path}=${library_output_dir}:$ENV{${ld_library_path}}
ROOT_INCLUDE_PATH=${DEFAULT_ROOT_INCLUDE_PATH}
ROOTIGNOREPREFIX=1 ROOT_HIST=0 $<TARGET_FILE:root.exe> -l -q -b)
endif()
add_custom_command(OUTPUT ${library_output_dir}/modules.idx
Expand All @@ -582,9 +579,10 @@ add_custom_target(hsimple ALL DEPENDS tutorials/hsimple.root)
add_dependencies(hsimple onepcm)
if(WIN32)
set(hsimple_cmd COMMAND ${CMAKE_COMMAND} -E env PATH="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}\\\;%PATH%"
ROOT_INCLUDE_PATH="${DEFAULT_ROOT_INCLUDE_PATH}"
ROOTIGNOREPREFIX=1 ROOT_HIST=0 $<TARGET_FILE:root.exe> -l -q -b -n -x ${CMAKE_SOURCE_DIR}/tutorials/hsimple.C -e return)
else()
set(hsimple_cmd COMMAND ${MODULES_ROOT_INCPATH} ${ld_library_path}=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}:$ENV{${ld_library_path}}
set(hsimple_cmd COMMAND ROOT_INCLUDE_PATH="${DEFAULT_ROOT_INCLUDE_PATH}" ${ld_library_path}=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}:$ENV{${ld_library_path}}
ROOTIGNOREPREFIX=1 ROOT_HIST=0 $<TARGET_FILE:root.exe> -l -q -b -n -x ${CMAKE_SOURCE_DIR}/tutorials/hsimple.C -e return)
endif()
add_custom_command(OUTPUT tutorials/hsimple.root
Expand Down
43 changes: 43 additions & 0 deletions cmake/modules/RootMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2114,6 +2114,49 @@ function(ROOT_APPEND_LIBDIR_TO_INSTALL_RPATH target install_dir)
set_property(TARGET ${target} APPEND PROPERTY INSTALL_RPATH "${new_rpath}")
endfunction()

#----------------------------------------------------------------------------
# If path is a system include path, set the return variable
# is_system_include_path to true.
# The 1st argument is the path that should be checked
# The 2nd argument is the return value
#----------------------------------------------------------------------------
function (IS_SYSTEM_INCLUDE_PATH path is_system_include_path)
foreach (dir ${CMAKE_SYSTEM_INCLUDE_PATH})
if ("${path}" STREQUAL "${dir}")
set(${is_system_include_path} TRUE PARENT_SCOPE)
return()
endif()
endforeach()
set(${is_system_include_path} FALSE PARENT_SCOPE)
endfunction()

#----------------------------------------------------------------------------
# Include paths of third-party libraries stored outside of system directories
# must be added to the DEFAULT_ROOT_INCLUDE_PATH variable to ensure that the
# C++ interpreter 'cling' can locate these header files at runtime.
# Use this function to add these paths to DEFAULT_ROOT_INCLUDE_PATH.
#----------------------------------------------------------------------------
function (BUILD_ROOT_INCLUDE_PATH path)
# filter out paths into the ROOT src, build, and install directories
if((${path} MATCHES "${CMAKE_SOURCE_DIR}(/.*)?") OR
(${path} MATCHES "${CMAKE_BINARY_DIR}(/.*)?") OR
(${path} MATCHES "${CMAKE_INSTALL_PREFIX}(/.*)?"))
return()
endif()
IS_SYSTEM_INCLUDE_PATH("${path}" is_system_include_path)
if (NOT is_system_include_path)
if ("${DEFAULT_ROOT_INCLUDE_PATH}" STREQUAL "")
set(DEFAULT_ROOT_INCLUDE_PATH "${path}" PARENT_SCOPE)
else()
if(WIN32)
set(ROOT_PATH_SEPARATOR ";")
elseif(UNIX)
set(ROOT_PATH_SEPARATOR ":")
endif()
set(DEFAULT_ROOT_INCLUDE_PATH "${DEFAULT_ROOT_INCLUDE_PATH}${ROOT_PATH_SEPARATOR}${path}" PARENT_SCOPE)
endif()
endif()
endfunction()

#-------------------------------------------------------------------------------
#
Expand Down
3 changes: 3 additions & 0 deletions cmake/modules/SearchInstalledSoftware.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1383,6 +1383,7 @@ elseif(vc)
endif()
if(Vc_FOUND)
set_property(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES ${Vc_INCLUDE_DIR})
BUILD_ROOT_INCLUDE_PATH("${Vc_INCLUDE_DIR}")
endif()
endif()

Expand Down Expand Up @@ -1616,6 +1617,8 @@ if(vdt OR builtin_vdt)
install(DIRECTORY ${CMAKE_BINARY_DIR}/include/vdt
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT extra-headers)
set_property(GLOBAL APPEND PROPERTY ROOT_BUILTIN_TARGETS VDT::VDT)
else()
BUILD_ROOT_INCLUDE_PATH("${VDT_INCLUDE_DIR}")
endif()
endif()

Expand Down
1 change: 1 addition & 0 deletions config/thisroot.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ cd /D %OLDPATH%
set PATH=%ROOTSYS%\bin;%PATH%
set CMAKE_PREFIX_PATH=%ROOTSYS%;%CMAKE_PREFIX_PATH%
set PYTHONPATH=%ROOTSYS%\bin;%PYTHONPATH%
set ROOT_INCLUDE_PATH=@DEFAULT_ROOT_INLUCDE_PATH@;%ROOT_INCLUDE_PATH%
set OLDPATH=
set THIS=
14 changes: 14 additions & 0 deletions config/thisroot.csh
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,14 @@ if ($?old_rootsys) then
-e "s;^$old_rootsys/etc/notebook${DOLLAR};;g"`
endif

if ($?ROOT_INCLUDE_PATH) then
setenv ROOT_INCLUDE_PATH `set DOLLAR='$'; echo $ROOT_INCLUDE_PATH | \
sed -e "s;:@DEFAULT_ROOT_INCLUDE_PATH@:;:;g" \
-e "s;:@DEFAULT_ROOT_INCLUDE_PATH@${DOLLAR};;g" \
-e "s;^@DEFAULT_ROOT_INCLUDE_PATH@:;;g" \
-e "s;^@DEFAULT_ROOT_INCLUDE_PATH@${DOLLAR};;g"`
endif

endif


Expand Down Expand Up @@ -239,6 +247,12 @@ else
setenv JUPYTER_CONFIG_PATH ${ROOTSYS}/etc/notebook
endif

if ($?ROOT_INCLUDE_PATH) then
setenv ROOT_INCLUDE_PATH @DEFAULT_ROOT_INLUCDE_PATH@:$ROOT_INCLUDE_PATH
else
setenv ROOT_INCLUDE_PATH @DEFAULT_ROOT_INLUCDE_PATH@
endif

endif # if ("$thisrootdir" != "")

set thisrootdir=
Expand Down
1 change: 1 addition & 0 deletions config/thisroot.fish
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ update_path MANPATH "$old_rootsys" "/man" @mandir@
update_path CMAKE_PREFIX_PATH "$old_rootsys" "" $ROOTSYS
update_path JUPYTER_PATH "$old_rootsys" "/etc/notebook" $ROOTSYS/etc/notebook
update_path JUPYTER_CONFIG_PATH "$old_rootsys" "/etc/notebook" $ROOTSYS/etc/notebook
update_path ROOT_INCLUDE_PATH "@DEFAULT_ROOT_INCLUDE_PATH@" "" "@DEFAULT_ROOT_INCLUDE_PATH@"

functions -e update_path
set -e old_rootsys
Expand Down
1 change: 1 addition & 0 deletions config/thisroot.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ $ROOTSYS = split-path -parent (get-item $scriptPath)
$env:PATH = $ROOTSYS + '\bin;' + $env:PATH
$env:CMAKE_PREFIX_PATH = $ROOTSYS + ';' + $env:CMAKE_PREFIX_PATH
$env:PYTHONPATH = $ROOTSYS + '\bin;' + $env:PYTHONPATH
$env:ROOT_INCLUDE_PATH = "@DEFAULT_ROOT_INCLUDE_PATH@" + ';' + $env:ROOT_INCLUDE_PATH
12 changes: 12 additions & 0 deletions config/thisroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ clean_environment()
default_manpath=""
fi
fi
if [ -n "${ROOT_INCLUDE_PATH-}" ]; then
drop_from_path "$ROOT_INCLUDE_PATH" "@DEFAULT_ROOT_INCLUDE_PATH@"
ROOT_INCLUDE_PATH=$newpath
fi
}

set_environment()
Expand Down Expand Up @@ -162,6 +166,14 @@ set_environment()
else
JUPYTER_CONFIG_PATH=$ROOTSYS/etc/notebook:$JUPYTER_CONFIG_PATH; export JUPYTER_CONFIG_PATH
fi

if [ -z "${ROOT_INCLUDE_PATH-}" ]; then
ROOT_INCLUDE_PATH=@DEFAULT_ROOT_INCLUDE_PATH@
export ROOT_INCLUDE_PATH
else
ROOT_INCLUDE_PATH=@DEFAULT_ROOT_INCLUDE_PATH@:$ROOT_INCLUDE_PATH
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you consider this an issue if DEFAULT_ROOT_INCLUDE_PATH is empty? Not just here but in the other shell setups?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think this should be an issue. This case is also covered by all GHA runners.

export ROOT_INCLUDE_PATH
fi
}

getTrueShellExeName() { # mklement0 https://stackoverflow.com/a/23011530/7471760
Expand Down
2 changes: 1 addition & 1 deletion roottest/root/io/transient/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ ROOTTEST_ADD_TEST(hadd_autoload
COMMAND hadd -f data_merge.root data1.root data2.root
OUTREF hadd_autoload${outref_suffix}.ref
FIXTURES_REQUIRED root-io-transient-base-WriteFile-fixture
ENVIRONMENT ROOT_INCLUDE_PATH=${CMAKE_CURRENT_SOURCE_DIR})
ENVIRONMENT ROOT_INCLUDE_PATH=${CMAKE_CURRENT_SOURCE_DIR}:${DEFAULT_ROOT_INCLUDE_PATH})
11 changes: 10 additions & 1 deletion roottest/root/meta/countIncludePaths.C
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,18 @@ int countIncludePaths()
// Exclude from the test the builds with R as external package
if (std::string::npos != includePath.find("RInside/include")) return 0;

// count paths coming from the ROOT_INCLUDE_PATH environment variable
// and exclude them
int nEnvVarPaths = 0;
auto *envVarCStr = std::getenv("ROOT_INCLUDE_PATH");
if (envVarCStr) {
std::string envVar(envVarCStr);
nEnvVarPaths = countSubstring(envVar, ":") + 1 - (envVar.back() == ':') - (envVar.front() == ':');
}

// At most 10
auto nPaths = countSubstring(includePath, "-I");
if (nPaths > 10){
if ((nPaths - nEnvVarPaths) > 10) {
std::cerr << "The number of include paths is too high (>9) " << nPaths
<< ". The number of \"-I\"s has been counted in the include path of ROOT (gSystem->GetIncludePath()=" << includePath << ")." << std::endl;
return nPaths;
Expand Down
Loading