3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 11:43:47 +01:00
dft_tools/pytriqs/CMakeLists.txt
Olivier Parcollet 5b8113b46a pytriqs: add option to use mpi4py instead of boost.python.mpi
- to choose mpi4py over boost.python.mpi, pass -DPython_use_mpi4py=ON

- boost.mpi stays the default for python, but
  adding the possibility of using mpi4py instead.

- Due to numerous pbs on recent OS X + brew installation.
  boost.mpi does not work (crash in openmpi ??), mpi4py does

- the pytriqs/utility/mpi.py is now configured by the cmake (like
  version.py) to prepare one of the two possibilities.

- TODO:  not tested carefully : to be done in other machines.
2013-12-30 22:32:09 +01:00

31 lines
1.2 KiB
CMake

option(Python_use_mpi4py "Use mpi4py instead of boost.mpi" OFF)
if (Python_use_mpi4py)
SET (TRIQS_PYTHON_MPI_USE_MPI4PY 1)
else()
SET(TRIQS_PYTHON_MPI_USE_MPI4PY 0)
endif()
# Create a temporary copy of the python modules so that we can run before installation with the test
FILE(GLOB_RECURSE all_py_files RELATIVE ${CMAKE_SOURCE_DIR}/pytriqs *.py )
SET(py_copy_tar ${CMAKE_BINARY_DIR}/py_copy.tar)
add_custom_command (OUTPUT ${py_copy_tar} DEPENDS ${all_py_files}
COMMAND cd ${CMAKE_SOURCE_DIR}/pytriqs && tar cf ${py_copy_tar} ${all_py_files} && cd ${CMAKE_BINARY_DIR}/pytriqs && tar xf ${py_copy_tar} )
add_custom_target(py_copy ALL DEPENDS ${py_copy_tar})
find_package(CythonModuleMacro)
SET(PYTHON_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/__init__.py
${CMAKE_CURRENT_BINARY_DIR}/version.py
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.py.in ${CMAKE_CURRENT_BINARY_DIR}/version.py)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/utility/mpi.py.in ${CMAKE_CURRENT_BINARY_DIR}/utility/mpi.py)
install (FILES ${PYTHON_SOURCES} DESTINATION ${TRIQS_PYTHON_LIB_DEST})
add_all_subdirectories_with_cmakelist()
add_custom_target(wrap_clean COMMAND find ${CMAKE_BINARY_DIR} -name \"*.cpp\" |xargs rm)