diff --git a/bindings/python/CMakeLists.txt b/bindings/python/CMakeLists.txt index 96eeb1dda34e582713b451de4dd3dc08f0d62e9b..93fd50a56e290e554dcc680468c983623f534c0b 100644 --- a/bindings/python/CMakeLists.txt +++ b/bindings/python/CMakeLists.txt @@ -24,13 +24,16 @@ if(ADIOS2_HAVE_MPI) endif() string(REGEX REPLACE "^${PYTHON_PREFIX}/" "" - python_package_dir "${PYTHON_SITE_PACKAGES}" + CMAKE_INSTALL_PYTHONDIR "${PYTHON_SITE_PACKAGES}" +) +set(CMAKE_INSTALL_PYTHONDIR "${CMAKE_INSTALL_PYTHONDIR}" + CACHE INTERNAL "" FORCE ) set_target_properties(adios2py PROPERTIES OUTPUT_NAME adios2 - LIBRARY_OUTPUT_DIRECTORY ${ADIOS2_BINARY_DIR}/${python_package_dir} - RUNTIME_OUTPUT_DIRECTORY ${ADIOS2_BINARY_DIR}/${python_package_dir} + LIBRARY_OUTPUT_DIRECTORY ${ADIOS2_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR} + RUNTIME_OUTPUT_DIRECTORY ${ADIOS2_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR} ) install(TARGETS adios2py - DESTINATION ${python_package_dir} + DESTINATION ${CMAKE_INSTALL_PYTHONDIR} ) diff --git a/cmake/ADIOSFunctions.cmake b/cmake/ADIOSFunctions.cmake index b0f6cb8e60f1edaee1b799af4739519f3a13f9c1..37b4cf2e02b2d01c9267f51e1a742efd752ab491 100644 --- a/cmake/ADIOSFunctions.cmake +++ b/cmake/ADIOSFunctions.cmake @@ -37,3 +37,12 @@ function(message_pad msg out_len out_msg) set(${out_msg} "${msg}${pad}" PARENT_SCOPE) endif() endfunction() + +function(python_add_test name script) + add_test(NAME ${name} + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${script} ${ARGN} + ) + set_property(TEST ${name} PROPERTY + ENVIRONMENT "PYTHONPATH=${ADIOS2_BINARY_DIR}/${CMAKE_INSTALL_PYTHONDIR}:$ENV{PYTHONPATH}" + ) +endfunction() diff --git a/testing/adios2/CMakeLists.txt b/testing/adios2/CMakeLists.txt index ef043c0c9c5223cb95f2dca238b0cf0687c6594e..f78866fa0d87db8eca34abf94b39e1cac4a25c3f 100644 --- a/testing/adios2/CMakeLists.txt +++ b/testing/adios2/CMakeLists.txt @@ -5,3 +5,4 @@ add_subdirectory(interface) add_subdirectory(engine) +add_subdirectory(bindings) diff --git a/testing/adios2/bindings/CMakeLists.txt b/testing/adios2/bindings/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..8aa1ecd22b23c1ddd515657bde6f8ac8c6ec7af1 --- /dev/null +++ b/testing/adios2/bindings/CMakeLists.txt @@ -0,0 +1,8 @@ +#------------------------------------------------------------------------------# +# Distributed under the OSI-approved Apache License, Version 2.0. See +# accompanying file Copyright.txt for details. +#------------------------------------------------------------------------------# + +if(ADIOS2_HAVE_Python) + add_subdirectory(python) +endif() diff --git a/testing/adios2/bindings/python/CMakeLists.txt b/testing/adios2/bindings/python/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..8da6af4e7613e9b777cfb092d9c805fa583282f5 --- /dev/null +++ b/testing/adios2/bindings/python/CMakeLists.txt @@ -0,0 +1,6 @@ +#------------------------------------------------------------------------------# +# Distributed under the OSI-approved Apache License, Version 2.0. See +# accompanying file Copyright.txt for details. +#------------------------------------------------------------------------------# + +python_add_test(PythonBPWrite TestBPWriteTypes.py) diff --git a/testing/adios2/bindings/python/TestBPWriteTypes.py b/testing/adios2/bindings/python/TestBPWriteTypes.py index bec5aa3c08ef4e00b3ddaa29add274b1030106cd..842adacd8cf1e9b87c53a66725ab50d7b3269aef 100644 --- a/testing/adios2/bindings/python/TestBPWriteTypes.py +++ b/testing/adios2/bindings/python/TestBPWriteTypes.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + # # Distributed under the OSI-approved Apache License, Version 2.0. See # accompanying file Copyright.txt for details.