Skip to content
Snippets Groups Projects
Verified Commit 035181f8 authored by Tobias Triffterer's avatar Tobias Triffterer :house_with_garden:
Browse files

Adapt Cling C++ Header Search Paths to Flatpak

This adds additional directories to the CMake variable
CLING_CXX_HEADERS, whose content is later on compiled into
the ROOT libraries.

Cling requires access to the header files even at runtime,
but a Flatpak runtime environment does not contain them,
only the SDK used at compilation time does.

The /usr tree inside a Flatpak sanbox is immutable, everything
the application needs in addition to the underlying runtime has
to be shipped in /app.

This patch adds these paths under /app to the search paths of Cling
so that it does work inside a Flatpak sandbox.

This behaviour is controlled by the new boolean build option
“BUILD_FOR_FLATPAK”.

However, this patch alone does not do the trick. The Flatpak build manifest
needs to contain commands to create the “/app/include” directory and copy
all the include files there from the SDK as well as to install the include
files from ROOT under “/app/include/root”.
parent cb2899c3
No related branches found
No related tags found
No related merge requests found
...@@ -282,6 +282,25 @@ if (UNIX) ...@@ -282,6 +282,25 @@ if (UNIX)
endif() endif()
endif() endif()
# Modification for Fp311Online@Ruhr-Universität
option(BUILD_FOR_FLATPAK "Add include paths under /app to allow Cling to work in the Flatpak sandbox. (Please note that the Flatpak build manifest has to copy include files there in addition to setting this flag.)" OFF)
if (${BUILD_FOR_FLATPAK})
set(CLING_CXX_HEADERS "${CLING_CXX_HEADERS}:/app/include:/app/include/root")
file(GLOB flatpaksdk_cpp_inc_dirs LIST_DIRECTORIES TRUE "/usr/include/c++/*")
foreach(flatpaksdk_cpp_inc_dir ${flatpaksdk_cpp_inc_dirs})
get_filename_component(flatpaksdk_cpp_version ${flatpaksdk_cpp_inc_dir} NAME)
set(CLING_CXX_HEADERS "${CLING_CXX_HEADERS}:/app/include/c++/${flatpaksdk_cpp_version}")
file(GLOB flatpaksdk_cpp_arch_dirs LIST_DIRECTORIES TRUE "/usr/include/c++/${flatpaksdk_cpp_version}/*linux*")
foreach(flatpaksdk_cpp_arch_dir ${flatpaksdk_cpp_arch_dirs})
get_filename_component(flatpaksdk_cpp_arch ${flatpaksdk_cpp_arch_dir} NAME)
set(CLING_CXX_HEADERS "${CLING_CXX_HEADERS}:/app/include/c++/${flatpaksdk_cpp_version}/${flatpaksdk_cpp_arch}")
endforeach()
endforeach()
endif (${BUILD_FOR_FLATPAK})
# End Modification
MESSAGE(STATUS "Cling will look for C++ headers in '${CLING_CXX_HEADERS}' at runtime.") MESSAGE(STATUS "Cling will look for C++ headers in '${CLING_CXX_HEADERS}' at runtime.")
# In modules builds we 'mount' our own stl modulemap for libstdc++. In order to do this, # In modules builds we 'mount' our own stl modulemap for libstdc++. In order to do this,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment