From d4d492e0dde966e017804f7ebdc567855bb252bb Mon Sep 17 00:00:00 2001 From: Kamil Skwarczynski Date: Mon, 2 Sep 2024 16:28:41 +0000 Subject: [PATCH] Minor fixes to cmake related to python binding and now Python interface is being used for containers and CI --- CMakeLists.txt | 3 +-- Doc/MaCh3DockerFiles/Alma9/Dockerfile | 2 +- Doc/MaCh3DockerFiles/Fedora32/Dockerfile | 2 +- Doc/MaCh3DockerFiles/Ubuntu22.04/Dockerfile | 2 +- README.md | 2 +- cmake/Templates/MaCh3Config.cmake.in | 1 + plotting/plottingUtils/CMakeLists.txt | 4 +--- plotting/plottingUtils/inputManager.cpp | 4 ++-- 8 files changed, 9 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fef31ca38..c3b5cdd14 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,6 +188,7 @@ LIST(APPEND ALL_FEATURES DEBUG MULTITHREAD GPU + PYTHON LOW_MEMORY_STRUCTS Oscillator Fitter @@ -232,8 +233,6 @@ if( MaCh3_PYTHON_ENABLED ) endif() - - #This is to export the target properties of MaCh3 #Anything that links to "MaCh3" will get all of these target properties add_library(MaCh3 INTERFACE) diff --git a/Doc/MaCh3DockerFiles/Alma9/Dockerfile b/Doc/MaCh3DockerFiles/Alma9/Dockerfile index 1509d59e6..fd9eec0d1 100644 --- a/Doc/MaCh3DockerFiles/Alma9/Dockerfile +++ b/Doc/MaCh3DockerFiles/Alma9/Dockerfile @@ -18,7 +18,7 @@ RUN git checkout ${MACH3_VERSION} RUN mkdir -p ${MACH3_INSTALL_DIR} WORKDIR ${MACH3_INSTALL_DIR} -RUN cmake ${MACH3_WORK_DIR} +RUN cmake -DMaCh3_PYTHON_ENABLED=ON ${MACH3_WORK_DIR} RUN make VERBOSE=1 && make install # KS: Need to set them here, otherwise container using this container will not be able to find MaCh3 diff --git a/Doc/MaCh3DockerFiles/Fedora32/Dockerfile b/Doc/MaCh3DockerFiles/Fedora32/Dockerfile index 0586ccf94..cc5f457a4 100644 --- a/Doc/MaCh3DockerFiles/Fedora32/Dockerfile +++ b/Doc/MaCh3DockerFiles/Fedora32/Dockerfile @@ -18,7 +18,7 @@ RUN git checkout ${MACH3_VERSION} RUN mkdir -p ${MACH3_INSTALL_DIR} WORKDIR ${MACH3_INSTALL_DIR} -RUN cmake ${MACH3_WORK_DIR} +RUN cmake -DMaCh3_PYTHON_ENABLED=ON ${MACH3_WORK_DIR} RUN make VERBOSE=1 RUN make install diff --git a/Doc/MaCh3DockerFiles/Ubuntu22.04/Dockerfile b/Doc/MaCh3DockerFiles/Ubuntu22.04/Dockerfile index bc8423eca..8670c54f8 100644 --- a/Doc/MaCh3DockerFiles/Ubuntu22.04/Dockerfile +++ b/Doc/MaCh3DockerFiles/Ubuntu22.04/Dockerfile @@ -24,7 +24,7 @@ RUN git checkout ${MACH3_VERSION} RUN mkdir -p ${MACH3_INSTALL_DIR} WORKDIR ${MACH3_INSTALL_DIR} -RUN cmake ${MACH3_WORK_DIR} +RUN cmake -DMaCh3_PYTHON_ENABLED=ON ${MACH3_WORK_DIR} RUN make VERBOSE=1 RUN make install diff --git a/README.md b/README.md index da36cd2f5..153ab0978 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Some functionalities rely on setting `Env{MACH3}` which should point to path exp MaCh3 can be compiled with a python interface by specifying the cmake option ``` -cmake ../ MaCh3_PYTHON_ENABLED=ON +cmake ../ -DMaCh3_PYTHON_ENABLED=ON make && make install ``` and then adding the path to the installed module to your `PYTHONPATH` environment variable: diff --git a/cmake/Templates/MaCh3Config.cmake.in b/cmake/Templates/MaCh3Config.cmake.in index 20cabb4a5..37344f915 100644 --- a/cmake/Templates/MaCh3Config.cmake.in +++ b/cmake/Templates/MaCh3Config.cmake.in @@ -10,6 +10,7 @@ set(DEBUG_LEVEL @DEBUG_LEVEL@) set(MaCh3_DEBUG_ENABLED @MaCh3_DEBUG_ENABLED@) set(MaCh3_MULTITHREAD_ENABLED @MaCh3_MULTITHREAD_ENABLED@) set(MaCh3_GPU_ENABLED @MaCh3_GPU_ENABLED@) +set(MaCh3_PYTHON_ENABLED @MaCh3_PYTHON_ENABLED@) set(MaCh3_MINUIT2_ENABLED @MaCh3_MINUIT2_ENABLED@) get_filename_component(MaCh3_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) diff --git a/plotting/plottingUtils/CMakeLists.txt b/plotting/plottingUtils/CMakeLists.txt index 58bb07fcd..004c03378 100644 --- a/plotting/plottingUtils/CMakeLists.txt +++ b/plotting/plottingUtils/CMakeLists.txt @@ -21,9 +21,7 @@ target_link_libraries( Plotting ${ROOT_LIBRARIES} MaCh3::Manager ) ## to be compiled into python module needs to be compiled as position independent library if( MaCh3_PYTHON_ENABLED ) - set_property( TARGET Plotting PROPERTY POSITION_INDEPENDENT_CODE ON ) - endif() install(TARGETS Plotting @@ -32,4 +30,4 @@ install(TARGETS Plotting PUBLIC_HEADER DESTINATION include/plotting ) -add_library(MaCh3::Plotting ALIAS Plotting) \ No newline at end of file +add_library(MaCh3::Plotting ALIAS Plotting) diff --git a/plotting/plottingUtils/inputManager.cpp b/plotting/plottingUtils/inputManager.cpp index 47a33a950..8e9e69811 100644 --- a/plotting/plottingUtils/inputManager.cpp +++ b/plotting/plottingUtils/inputManager.cpp @@ -205,7 +205,7 @@ std::vector InputManager::getTaggedValues(const std::vector