Skip to content

Commit

Permalink
[JupyROOT] Install properly into CMAKE_INSTALL_PREFIX
Browse files Browse the repository at this point in the history
The Jupyter config falls back to the CMAKE_INSTALL_PREFIX/js folder to
find JSROOT if ROOTSYS is not set. This ensures installations in prefix
directories to find the installed JSROOT libraries.
  • Loading branch information
stwunsch authored and etejedor committed Aug 14, 2020
1 parent f63e471 commit ed0b51e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,14 @@ if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_INSTALL_PREFIX)
DESTINATION ${CMAKE_INSTALL_CMAKEDIR})
endif()

#---Make sure the Jupyter ROOT C++ kernel runs with the same Python version as ROOT-----
set(root_kernel_dir notebook/kernels/root)
#---Add configuration files for kernel and jupyter----------------------------------------------
# Make sure the Jupyter ROOT C++ kernel runs with the same Python version as ROOT
set(root_jupyter_dir notebook)
set(root_jupyter_config jupyter_notebook_config.py)
configure_file(etc/${root_jupyter_dir}/${root_jupyter_config}.in etc/${root_jupyter_dir}/${root_jupyter_config})
install(FILES ${CMAKE_BINARY_DIR}/etc/${root_jupyter_dir}/${root_jupyter_config} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/${root_jupyter_dir})

set(root_kernel_dir ${root_jupyter_dir}/kernels/root)
set(root_kernel_file kernel.json)
configure_file(etc/${root_kernel_dir}/${root_kernel_file}.in etc/${root_kernel_dir}/${root_kernel_file})
install(FILES ${CMAKE_BINARY_DIR}/etc/${root_kernel_dir}/${root_kernel_file} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/${root_kernel_dir})
Expand Down
3 changes: 0 additions & 3 deletions etc/notebook/jupyter_notebook_config.py

This file was deleted.

7 changes: 7 additions & 0 deletions etc/notebook/jupyter_notebook_config.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import os
if 'ROOTSYS' in os.environ:
# Prefer using JSROOT from ROOTSYS if defined
c.NotebookApp.extra_static_paths.append(os.path.join(os.environ['ROOTSYS'], 'js/'))
else:
# Fall back to CMAKE_INSTALL_PREFIX to find JSROOT
c.NotebookApp.extra_static_paths.append(os.path.join("@CMAKE_INSTALL_PREFIX@", 'js/'))

0 comments on commit ed0b51e

Please sign in to comment.