Skip to content
Snippets Groups Projects
Commit 6d09d1e7 authored by Francesco Gasperin fdg@hs.uni-hamburg.de's avatar Francesco Gasperin fdg@hs.uni-hamburg.de
Browse files
parents c35845a5 6e37020c
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,7 @@ index e4689f7..9068fdd 100644 ...@@ -35,7 +35,7 @@ index e4689f7..9068fdd 100644
endforeach(_comp ${_find_components}) endforeach(_comp ${_find_components})
endif(NOT CASACORE_INCLUDE_DIR) endif(NOT CASACORE_INCLUDE_DIR)
diff --git a/CMake/PythonInstall.cmake b/CMake/PythonInstall.cmake diff --git a/CMake/PythonInstall.cmake b/CMake/PythonInstall.cmake
index 173f995..c15bbab 100644 index 173f995..a1357c7 100644
--- a/CMake/PythonInstall.cmake --- a/CMake/PythonInstall.cmake
+++ b/CMake/PythonInstall.cmake +++ b/CMake/PythonInstall.cmake
@@ -24,10 +24,11 @@ @@ -24,10 +24,11 @@
...@@ -48,7 +48,7 @@ index 173f995..c15bbab 100644 ...@@ -48,7 +48,7 @@ index 173f995..c15bbab 100644
# Derive the Python site-packages installation directory and build directory. # Derive the Python site-packages installation directory and build directory.
-if(PYTHON_EXECUTABLE) -if(PYTHON_EXECUTABLE)
+if(Python_EXECUTABLE) +if(Python3_EXECUTABLE)
set(_cmd set(_cmd
"from distutils.sysconfig import get_python_lib" "from distutils.sysconfig import get_python_lib"
"from os.path import join" "from os.path import join"
...@@ -57,7 +57,7 @@ index 173f995..c15bbab 100644 ...@@ -57,7 +57,7 @@ index 173f995..c15bbab 100644
) )
execute_process( execute_process(
- COMMAND "${PYTHON_EXECUTABLE}" "-c" "${_cmd}" - COMMAND "${PYTHON_EXECUTABLE}" "-c" "${_cmd}"
+ COMMAND "${Python_EXECUTABLE}" "-c" "${_cmd}" + COMMAND "${Python3_EXECUTABLE}" "-c" "${_cmd}"
OUTPUT_VARIABLE _pydir OUTPUT_VARIABLE _pydir
ERROR_VARIABLE _pyerr ERROR_VARIABLE _pyerr
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
...@@ -66,7 +66,7 @@ index 173f995..c15bbab 100644 ...@@ -66,7 +66,7 @@ index 173f995..c15bbab 100644
message(STATUS "Installation directory for Python extensions: ${PYTHON_INSTALL_DIR}") message(STATUS "Installation directory for Python extensions: ${PYTHON_INSTALL_DIR}")
endif() endif()
-endif(PYTHON_EXECUTABLE) -endif(PYTHON_EXECUTABLE)
+endif(Python_EXECUTABLE) +endif(Python3_EXECUTABLE)
# #
...@@ -75,10 +75,10 @@ index 173f995..c15bbab 100644 ...@@ -75,10 +75,10 @@ index 173f995..c15bbab 100644
# Precondition check. # Precondition check.
- if(NOT PYTHON_EXECUTABLE) - if(NOT PYTHON_EXECUTABLE)
+ if(NOT Python_EXECUTABLE) + if(NOT Python3_EXECUTABLE)
message(FATAL_ERROR "python_install: Python interpreter not available") message(FATAL_ERROR "python_install: Python interpreter not available")
- endif(NOT PYTHON_EXECUTABLE) - endif(NOT PYTHON_EXECUTABLE)
+ endif(NOT Python_EXECUTABLE) + endif(NOT Python3_EXECUTABLE)
# Parse arguments. # Parse arguments.
# apart from the python files list, there are two additional arguments # apart from the python files list, there are two additional arguments
...@@ -110,16 +110,24 @@ index 9194dc7..c8284a8 100644 ...@@ -110,16 +110,24 @@ index 9194dc7..c8284a8 100644
else() else()
message (WARNING, " Boost-Python not found; PythonDPPP will not be built.") message (WARNING, " Boost-Python not found; PythonDPPP will not be built.")
diff --git a/CMakeLists.txt b/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt
<<<<<<< HEAD
index 9194dc7..c8284a8 100644 index 9194dc7..c8284a8 100644
--- a/CMakeLists.txt --- a/CMakeLists.txt
+++ b/CMakeLists.txt +++ b/CMakeLists.txt
@@ -44,15 +44,49 @@ @@ -44,15 +44,49 @@
=======
index 0ae97ae..3abc84e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,13 +44,14 @@ endif(IDGAPI_LIBRARIES AND IDGAPI_INCLUDE_DIRS)
>>>>>>> 6e37020c9132f4f5257a5c4e48e41465683e0c4e
find_package(CFITSIO REQUIRED) find_package(CFITSIO REQUIRED)
-find_package(PythonLibs 3 REQUIRED) -find_package(PythonLibs 3 REQUIRED)
-find_package(PythonInterp REQUIRED) -find_package(PythonInterp REQUIRED)
-message(STATUS "Using python version ${PYTHON_VERSION_STRING}") -message(STATUS "Using python version ${PYTHON_VERSION_STRING}")
<<<<<<< HEAD
+#find_package(PythonLibs 3 REQUIRED) +#find_package(PythonLibs 3 REQUIRED)
+#find_package(PythonInterp REQUIRED) +#find_package(PythonInterp REQUIRED)
+#message(STATUS "Using python version ${PYTHON_VERSION_STRING}") +#message(STATUS "Using python version ${PYTHON_VERSION_STRING}")
...@@ -147,9 +155,17 @@ index 9194dc7..c8284a8 100644 ...@@ -147,9 +155,17 @@ index 9194dc7..c8284a8 100644
+ set(Python_LIBRARIES ${PYTHON_LIBRARIES}) + set(Python_LIBRARIES ${PYTHON_LIBRARIES})
+ set(Python_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS}) + set(Python_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
+endif() +endif()
=======
+find_package(Python3 COMPONENTS Interpreter Development)
+message(STATUS "Using python version ${Python3_VERSION}")
>>>>>>> 6e37020c9132f4f5257a5c4e48e41465683e0c4e
+ +
+include_directories(${Python3_INCLUDE_DIRS})
#Prevent accidentally finding old BoostConfig.cmake file from casapy
set(Boost_NO_BOOST_CMAKE ON) set(Boost_NO_BOOST_CMAKE ON)
-set(BOOSTPY ${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}) -set(BOOSTPY ${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
<<<<<<< HEAD
-find_package(Boost COMPONENTS date_time filesystem python${BOOSTPY} numpy${BOOSTPY} program_options system unit_test_framework REQUIRED) -find_package(Boost COMPONENTS date_time filesystem python${BOOSTPY} numpy${BOOSTPY} program_options system unit_test_framework REQUIRED)
+#set(BOOSTPY ${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}) +#set(BOOSTPY ${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
+#find_package(Boost COMPONENTS date_time filesystem python${BOOSTPY} numpy${BOOSTPY} program_options system unit_test_framework REQUIRED) +#find_package(Boost COMPONENTS date_time filesystem python${BOOSTPY} numpy${BOOSTPY} program_options system unit_test_framework REQUIRED)
...@@ -163,9 +179,13 @@ index 9194dc7..c8284a8 100644 ...@@ -163,9 +179,13 @@ index 9194dc7..c8284a8 100644
+ find_package(Boost REQUIRED COMPONENTS ${boostcomp} python${boostpy}) + find_package(Boost REQUIRED COMPONENTS ${boostcomp} python${boostpy})
+endif() +endif()
+ +
=======
+set(BOOSTPY ${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})
find_package(Boost COMPONENTS date_time filesystem python${BOOSTPY} numpy${BOOSTPY} program_options system unit_test_framework REQUIRED)
>>>>>>> 6e37020c9132f4f5257a5c4e48e41465683e0c4e
include_directories(${Boost_INCLUDE_DIR}) include_directories(${Boost_INCLUDE_DIR})
+include_directories(${Python_INCLUDE_DIRS})
<<<<<<< HEAD
find_path(LOFAR_STATION_RESPONSE_DIR NAMES StationResponse/Station.h) find_path(LOFAR_STATION_RESPONSE_DIR NAMES StationResponse/Station.h)
find_library(LOFAR_STATION_RESPONSE_LIB stationresponse) find_library(LOFAR_STATION_RESPONSE_LIB stationresponse)
@@ -196,9 +230,11 @@ @@ -196,9 +230,11 @@
...@@ -182,3 +202,46 @@ index 9194dc7..c8284a8 100644 ...@@ -182,3 +202,46 @@ index 9194dc7..c8284a8 100644
${IDGAPI_LIBRARIES} ${IDGAPI_LIBRARIES}
Threads::Threads) Threads::Threads)
=======
@@ -198,7 +199,7 @@ set(EXTRA_LIBRARIES ${EXTRA_LIBRARIES}
${CASACORE_LIBRARIES}
${Boost_LIBRARIES}
${EXTRA_LIBRARIES}
- ${PYTHON_LIBRARIES}
+ ${Python3_LIBRARIES}
${IDGAPI_LIBRARIES}
Threads::Threads)
diff --git a/PythonDPPP/CMakeLists.txt b/PythonDPPP/CMakeLists.txt
index 9194dc7..afd8545 100644
--- a/PythonDPPP/CMakeLists.txt
+++ b/PythonDPPP/CMakeLists.txt
@@ -1,5 +1,7 @@
# If Boost-Python3 found, build this package. Otherwise give a warning.
-if(${Boost_PYTHON3_FOUND})
+#if(${Boost_PYTHON${boostpy}_FOUND})
+# We set Boost-python as reuired in toplevel build file.
+if(TRUE)
include(PythonInstall)
@@ -25,16 +27,7 @@ if(${Boost_PYTHON3_FOUND})
# Install Python modules
python_install(__init__.py DESTINATION lofar/pythondppp)
- find_package(PythonInterp REQUIRED)
- find_package(PythonLibs 3 REQUIRED)
- include_directories(${PYTHON_INCLUDE_DIRS})
-
- find_package(Casacore COMPONENTS python)
-
- find_package(Boost REQUIRED COMPONENTS python3)
- include_directories(${Boost_INCLUDE_DIR})
-
# add_subdirectory(test)
-else()
- message (WARNING, " Boost-Python not found; PythonDPPP will not be built.")
+#else()
+# message (WARNING, " Boost-Python not found; PythonDPPP will not be built.")
endif()
>>>>>>> 6e37020c9132f4f5257a5c4e48e41465683e0c4e
...@@ -34,84 +34,3 @@ index 51d8339..299530f 100644 ...@@ -34,84 +34,3 @@ index 51d8339..299530f 100644
endif(${_comp} STREQUAL casa) endif(${_comp} STREQUAL casa)
endforeach(_comp ${_find_components}) endforeach(_comp ${_find_components})
endif(NOT CASACORE_INCLUDE_DIR) endif(NOT CASACORE_INCLUDE_DIR)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2867d9c..7d41a23 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0.0)
+cmake_minimum_required(VERSION 3.5.0)
project(lofarbeam)
@@ -65,37 +65,40 @@ elseif(DOXYGEN_FOUND)
endif(DOXYGEN_FOUND)
+# ThOr: This is NOT the modern cmake-included FindPython!
find_package (Python COMPONENTS Development)
+
message("Compiling Python ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} support. If this is not the intended target use 'DPYTHON_EXECUTABLE' to control.")
# bind against boost-python for compilation of the python API
# depending on major release version of the python libraries
-if (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
- find_package (Boost REQUIRED COMPONENTS python numpy)
- find_package (Casacore REQUIRED COMPONENTS python)
- message(STATUS "Boost python library: ${Boost_PYTHON_LIBRARY}")
- message(STATUS "Boost numpy library: ${Boost_NUMPY_LIBRARY}")
- message(STATUS "Python library ${PYTHON_LIBRARIES}")
- set(BOOST_PY_FOUND TRUE)
-else (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
- find_package (Boost REQUIRED COMPONENTS python3 numpy3)
- find_package (Casacore REQUIRED COMPONENTS python3)
- message(STATUS "Boost python library: ${Boost_PYTHON3_LIBRARY}")
- message(STATUS "Boost numpy library: ${Boost_NUMPY3_LIBRARY}")
- message(STATUS "Python library ${PYTHON_LIBRARIES}")
- set(BOOST_PY_FOUND TRUE)
-endif (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
-
-
-if(BOOST_PY_FOUND)
- add_library(_stationresponse MODULE pystationresponse.cc)
- set_target_properties(_stationresponse PROPERTIES PREFIX "")
- target_include_directories(_stationresponse PRIVATE ${PYTHON_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
- if (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
- target_link_libraries(_stationresponse stationresponse ${CASA_PYTHON_LIBRARY} ${Boost_PYTHON_LIBRARY} ${Boost_NUMPY_LIBRARY} ${PYTHON_LIBRARIES})
- else (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
- target_link_libraries(_stationresponse stationresponse ${CASA_PYTHON3_LIBRARY} ${Boost_PYTHON3_LIBRARY} ${Boost_NUMPY3_LIBRARY} ${PYTHON_LIBRARIES})
- endif (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
- install(TARGETS _stationresponse DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
- install(FILES __init__.py DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
-endif(BOOST_PY_FOUND)
-
+if(${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
+ set(casapy "")
+ set(oldboostpy "")
+else()
+ set(casapy "3")
+ set(oldboostpy "3")
+endif()
+set(boostpy ${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
+message("trying boostpy=${boostpy}")
+find_package(Boost 1.67.0 COMPONENTS python${boostpy} numpy${boostpy})
+if(NOT Boost_FOUND)
+ message(STATUS "Falling back to old Boost search.")
+ set(boostpy ${oldboostpy})
+ find_package(Boost REQUIRED COMPONENTS python${boostpy} numpy${boostpy})
+endif()
+find_package (Casacore REQUIRED COMPONENTS python${casapy})
+if(${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
+ set(casapylib ${CASA_PYTHON_LIBRARY})
+else()
+endif()
+
+message(STATUS "Boost python library: ${Boost_PYTHON_LIBRARY}")
+message(STATUS "Boost numpy library: ${Boost_NUMPY_LIBRARY}")
+message(STATUS "Python library ${Python_LIBRARIES}")
+
+add_library(_stationresponse MODULE pystationresponse.cc)
+set_target_properties(_stationresponse PROPERTIES PREFIX "")
+target_include_directories(_stationresponse PRIVATE ${PYTHON_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
+target_link_libraries(_stationresponse stationresponse ${casapylib} Boost::python${boostpy} Boost::numpy${boostpy} ${PYTHON_LIBRARIES})
+install(TARGETS _stationresponse DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
+install(FILES __init__.py DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
# The setup on the Hamburg LOFAR GPU Cluster. # The setup on the Hamburg LOFAR GPU Cluster.
aoflagger_version=2.14.0 aoflagger_version=2.14.0
casacore_version=latest casacore_version=3.3.0
dysco_version=1.2.0 dysco_version=1.2.0
pybdsf_version=latest # weird C++ template error with 1.8.12 pybdsf_version=latest # weird C++ template error with 1.8.12
pycasa_version=3.1.1 pycasa_version=3.1.1
...@@ -20,7 +20,7 @@ module load pythonversion/3 ...@@ -20,7 +20,7 @@ module load pythonversion/3
#module load mkl/2020.0.166 #module load mkl/2020.0.166
#idg_mkl=ON #idg_mkl=ON
make_jobs=64 make_jobs=8
export CC=gcc export CC=gcc
export CXX=g++ export CXX=g++
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment