2018-03-22 18:11:39 +01:00
|
|
|
# Configure the version
|
|
|
|
configure_file(version.py.in version.py)
|
|
|
|
|
|
|
|
# All Python files. Copy them in the build dir to have a complete package for the tests.
|
2019-04-03 00:07:03 +02:00
|
|
|
file(GLOB_RECURSE python_sources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.py)
|
2019-04-25 19:54:23 +02:00
|
|
|
file(GLOB_RECURSE wrap_generators RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *_desc.py)
|
|
|
|
list(REMOVE_ITEM python_sources "${wrap_generators}")
|
2019-04-03 00:07:03 +02:00
|
|
|
foreach(file ${python_sources})
|
|
|
|
configure_file(${file} ${file} COPYONLY)
|
2018-03-22 18:11:39 +01:00
|
|
|
endforeach()
|
|
|
|
|
2019-09-04 23:34:00 +02:00
|
|
|
# Build any python modules
|
|
|
|
foreach(gen ${wrap_generators})
|
2020-06-08 20:49:39 +02:00
|
|
|
string(REPLACE "_desc.py" "" gen ${gen})
|
|
|
|
get_filename_component(module_name ${gen} NAME_WE)
|
|
|
|
get_filename_component(module_dir ${gen} DIRECTORY)
|
|
|
|
add_cpp2py_module(NAME ${module_name} DIRECTORY ${module_dir})
|
2020-06-04 17:47:23 +02:00
|
|
|
target_link_libraries(${module_name} ${PROJECT_NAME}_c triqs_py)
|
2019-09-04 23:34:00 +02:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# Install python modules to proper location
|
2020-05-28 17:09:35 +02:00
|
|
|
set(PYTHON_LIB_DEST ${TRIQS_PYTHON_LIB_DEST_ROOT}/${PROJECT_NAME})
|
2019-08-06 17:14:57 +02:00
|
|
|
get_property(CPP2PY_MODULES_LIST GLOBAL PROPERTY CPP2PY_MODULES_LIST)
|
|
|
|
install(TARGETS ${CPP2PY_MODULES_LIST} DESTINATION ${PYTHON_LIB_DEST})
|
2019-04-03 00:07:03 +02:00
|
|
|
install(FILES ${python_sources} ${CMAKE_CURRENT_BINARY_DIR}/version.py DESTINATION ${PYTHON_LIB_DEST})
|