Skip to content

Commit

Permalink
use cmake default FindPython, remove old method, introduce Docker con…
Browse files Browse the repository at this point in the history
…tainer
  • Loading branch information
Andrej Dundovic committed Jan 12, 2024
1 parent 1629951 commit 0b0743f
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 108 deletions.
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -345,12 +345,11 @@ target_link_libraries(hermes ${HERMES_EXTRA_LIBRARIES})
# Python
# ----------------------------------------------------------------------------
option(ENABLE_PYTHON "Create python library via Pybind11" OFF)
include(FindPython3)
find_package(Python3 COMPONENTS Interpreter Development)
include(FindPython)
find_package(Python COMPONENTS Interpreter Development)

if(ENABLE_PYTHON AND PYTHONLIBS_FOUND)
include_directories(${PYTHON_INCLUDE_DIRS})
include(cmake/FindPython.cmake)
set(PYBIND11_PYTHON_VERSION ${PYTHON_DOT_VERSION})
add_subdirectory(lib/pybind11)
# for PYBIND11_EXPAND_SIDE_EFFECTS in pybind11.h - temporary,
Expand Down
52 changes: 52 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright (c) HERMES Development Team.
# Distributed under the terms of the GPLv3.
ARG REGISTRY=quay.io
ARG OWNER=jupyter
ARG BASE_CONTAINER=$REGISTRY/$OWNER/scipy-notebook
FROM $BASE_CONTAINER

LABEL maintainer="HERMES Developers <[email protected]>"

USER root

RUN apt-get update --yes && \
apt-get install --yes --no-install-recommends \
build-essential \
cmake \
doxygen \
libgsl-dev \
libfftw3-dev \
libcfitsio-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/*

USER ${NB_UID}

# Install Python 3 packages
RUN mamba install --yes \
'healpy' && \
mamba clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

# Install facets package which does not have a `pip` or `conda-forge` package at the moment
WORKDIR /tmp
RUN git clone https://github.com/cosmicrays/hermes.git
WORKDIR /tmp/hermes
RUN conda init
RUN mkdir build && \
cd build && \
CMAKE_PREFIX_PATH=${CONDA_DIR} cmake \
-DPython_EXECUTABLE=${CONDA_DIR}/bin/${PYTHON_VERSION} \
-DPython_INCLUDE_DIRS=${CONDA_DIR}/include/${PYTHON_VERSION} \
-DPython_LIBRARIES=${CONDA_DIR}/lib/${PYTHON_VERSION} \
-DCMAKE_INSTALL_PREFIX=${CONDA_DIR} \
-DENABLE_TESTING=On .. && \
make -j && \
make install && \
rm -rf /tmp/hermes && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"

USER ${NB_UID}

WORKDIR "${HOME}"
105 changes: 0 additions & 105 deletions cmake/FindPython.cmake

This file was deleted.

0 comments on commit 0b0743f

Please sign in to comment.