diff --git a/commonTools/build_stats/BuildStatsWrappers.cmake b/commonTools/build_stats/BuildStatsWrappers.cmake index 5dfcdf03b107..2d1a77f64e3d 100644 --- a/commonTools/build_stats/BuildStatsWrappers.cmake +++ b/commonTools/build_stats/BuildStatsWrappers.cmake @@ -162,7 +162,7 @@ endfunction() macro(get_base_build_dir_for_python) set(get_cwd_for_python ${BUILD_STATS_SRC_DIR}/get_cwd_for_python.py) execute_process( - COMMAND ${PYTHON_EXECUTABLE} ${get_cwd_for_python} + COMMAND ${Python3_EXECUTABLE} ${get_cwd_for_python} WORKING_DIRECTORY ${PROJECT_BINARY_DIR} OUTPUT_VARIABLE BASE_BUILD_DIR_FOR_PYTHON OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/commonTools/build_stats/unit_tests/CMakeLists.txt b/commonTools/build_stats/unit_tests/CMakeLists.txt index 07aed0dabe54..c15684a4c9f0 100644 --- a/commonTools/build_stats/unit_tests/CMakeLists.txt +++ b/commonTools/build_stats/unit_tests/CMakeLists.txt @@ -1,7 +1,7 @@ TRIBITS_ADD_ADVANCED_TEST( summarize_build_stats_UnitTests OVERALL_WORKING_DIRECTORY TEST_NAME OVERALL_NUM_MPI_PROCS 1 - TEST_0 CMND ${PYTHON_EXECUTABLE} + TEST_0 CMND ${Python3_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/summarize_build_stats_UnitTests.py -v PASS_REGULAR_EXPRESSION "OK" ALWAYS_FAIL_ON_NONZERO_RETURN @@ -10,7 +10,7 @@ TRIBITS_ADD_ADVANCED_TEST( summarize_build_stats_UnitTests TRIBITS_ADD_ADVANCED_TEST( gather_build_stats_UnitTests OVERALL_WORKING_DIRECTORY TEST_NAME OVERALL_NUM_MPI_PROCS 1 - TEST_0 CMND ${PYTHON_EXECUTABLE} + TEST_0 CMND ${Python3_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/gather_build_stats_UnitTests.py -v PASS_REGULAR_EXPRESSION "OK" ALWAYS_FAIL_ON_NONZERO_RETURN diff --git a/commonTools/framework/CMakeLists.txt b/commonTools/framework/CMakeLists.txt index 13626d9ac392..c099b5a38427 100644 --- a/commonTools/framework/CMakeLists.txt +++ b/commonTools/framework/CMakeLists.txt @@ -7,7 +7,7 @@ add_subdirectory(github_issue_creator) TRIBITS_ADD_ADVANCED_TEST( ProjectCiFileChangeLogic_UnitTests OVERALL_WORKING_DIRECTORY TEST_NAME OVERALL_NUM_MPI_PROCS 1 - TEST_0 CMND ${PYTHON_EXECUTABLE} + TEST_0 CMND ${Python3_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/ProjectCiFileChangeLogic_UnitTests.py -v PASS_REGULAR_EXPRESSION "OK" ALWAYS_FAIL_ON_NONZERO_RETURN @@ -28,7 +28,7 @@ TRIBITS_ADD_ADVANCED_TEST( clean_all_jobs_UnitTests OVERALL_WORKING_DIRECTORY TEST_NAME OVERALL_NUM_MPI_PROCS 1 EXCLUDE_IF_NOT_TRUE TFW_Python_Testing - TEST_0 CMND ${PYTHON_EXECUTABLE} + TEST_0 CMND ${Python3_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/clean_workspace/unittests/test_clean_all_jobs.py -v PASS_REGULAR_EXPRESSION "OK" ) @@ -38,7 +38,7 @@ TRIBITS_ADD_ADVANCED_TEST( clean_sentinel_UnitTests OVERALL_WORKING_DIRECTORY TEST_NAME OVERALL_NUM_MPI_PROCS 1 EXCLUDE_IF_NOT_TRUE TFW_Python_Testing - TEST_0 CMND ${PYTHON_EXECUTABLE} + TEST_0 CMND ${Python3_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/clean_workspace/unittests/test_clean_sentinel.py -v PASS_REGULAR_EXPRESSION "OK" ) @@ -48,7 +48,7 @@ TRIBITS_ADD_ADVANCED_TEST( clean_workspace_UnitTests OVERALL_WORKING_DIRECTORY TEST_NAME OVERALL_NUM_MPI_PROCS 1 EXCLUDE_IF_NOT_TRUE TFW_Python_Testing - TEST_0 CMND ${PYTHON_EXECUTABLE} + TEST_0 CMND ${Python3_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/clean_workspace/unittests/test_clean_workspace.py -v PASS_REGULAR_EXPRESSION "OK" ) @@ -59,7 +59,7 @@ TRIBITS_ADD_ADVANCED_TEST( PullRequestLinuxDriver_UnitTests OVERALL_NUM_MPI_PROCS 1 EXCLUDE_IF_NOT_TRUE TFW_Python_Testing TEST_0 CMND bash - ARGS pr_python_test_driver.sh ${PYTHON_EXECUTABLE} ${PYTHON_PIP_EXECUTABLE} + ARGS pr_python_test_driver.sh ${Python3_EXECUTABLE} ${PYTHON_PIP_EXECUTABLE} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../../packages/framework/pr_tools SKIP_CLEAN_WORKING_DIRECTORY PASS_REGULAR_EXPRESSION "=+ [0-9]+ passed" diff --git a/commonTools/framework/github_issue_creator/CMakeLists.txt b/commonTools/framework/github_issue_creator/CMakeLists.txt index 003e6d17eb40..24655bd9ff53 100644 --- a/commonTools/framework/github_issue_creator/CMakeLists.txt +++ b/commonTools/framework/github_issue_creator/CMakeLists.txt @@ -1,7 +1,7 @@ tribits_add_advanced_test( create_trilinos_github_test_failure_issue_unit_tests OVERALL_WORKING_DIRECTORY TEST_NAME OVERALL_NUM_MPI_PROCS 1 - TEST_0 CMND ${PYTHON_EXECUTABLE} + TEST_0 CMND ${Python3_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/create_trilinos_github_test_failure_issue_unit_tests.py -v PASS_REGULAR_EXPRESSION "OK" ALWAYS_FAIL_ON_NONZERO_RETURN diff --git a/packages/PyTrilinos/CMakeLists.txt b/packages/PyTrilinos/CMakeLists.txt index 6f39f27d75b7..b80b0457bae4 100644 --- a/packages/PyTrilinos/CMakeLists.txt +++ b/packages/PyTrilinos/CMakeLists.txt @@ -238,7 +238,7 @@ MESSAGE(STATUS " ${PyTrilinos_PACKAGES}") # Determine the PyTrilinos default installation directory prefix. If # CMAKE_INSTALL_PREFIX is set by the user, then use it. Else the # prefix is set to the value of python's sys.prefix. -EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; print(sys.prefix)" +EXECUTE_PROCESS(COMMAND ${Python3_EXECUTABLE} -c "import sys; print(sys.prefix)" OUTPUT_VARIABLE PYTHON_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE ) diff --git a/packages/PyTrilinos/cmake/FindMpi4Py.cmake b/packages/PyTrilinos/cmake/FindMpi4Py.cmake index 0b8caeb15a92..e4d4ae4c8973 100644 --- a/packages/PyTrilinos/cmake/FindMpi4Py.cmake +++ b/packages/PyTrilinos/cmake/FindMpi4Py.cmake @@ -43,7 +43,7 @@ # - Find the python mpi4py module # This cmake module determines whether the python module mpi4py exists -# for the current PYTHON_EXECUTABLE. This code sets the following +# for the current Python3_EXECUTABLE. This code sets the following # variables: # # Mpi4Py_FOUND = Set to TRUE if mpi4py is found @@ -54,7 +54,7 @@ # # If Mpi4Py is required and python executable does not exist, then send # an error -IF(NOT PYTHON_EXECUTABLE) +IF(NOT Python3_EXECUTABLE) IF(Mpi4Py_FIND_REQUIRED) MESSAGE(SEND_ERROR "Python executable not found, so required Mpi4Py module not found" @@ -62,11 +62,11 @@ IF(NOT PYTHON_EXECUTABLE) ENDIF(Mpi4Py_FIND_REQUIRED) # # Continue processing if python executable is known -ELSE(NOT PYTHON_EXECUTABLE) +ELSE(NOT Python3_EXECUTABLE) # Retrieve the Mpi4Py version EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c "import mpi4py; print(mpi4py.__version__)" + ${Python3_EXECUTABLE} -c "import mpi4py; print(mpi4py.__version__)" OUTPUT_VARIABLE Mpi4Py_VERSION ERROR_VARIABLE Mpi4Py_VERSION_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE @@ -76,7 +76,7 @@ ELSE(NOT PYTHON_EXECUTABLE) # now look for the Mpi4Py include directory IF(NOT Mpi4Py_VERSION_ERROR) EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c "import mpi4py; print(mpi4py.get_include())" + ${Python3_EXECUTABLE} -c "import mpi4py; print(mpi4py.get_include())" OUTPUT_VARIABLE Mpi4Py_INCLUDE_DIR ERROR_VARIABLE Mpi4Py_INCLUDE_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE @@ -112,4 +112,4 @@ ELSE(NOT PYTHON_EXECUTABLE) ENDIF(NOT Mpi4Py_VERSION_ERROR) -ENDIF(NOT PYTHON_EXECUTABLE) +ENDIF(NOT Python3_EXECUTABLE) diff --git a/packages/PyTrilinos/cmake/FindNumPy.cmake b/packages/PyTrilinos/cmake/FindNumPy.cmake index 359a394b1a3c..5cb2fe05ecb9 100644 --- a/packages/PyTrilinos/cmake/FindNumPy.cmake +++ b/packages/PyTrilinos/cmake/FindNumPy.cmake @@ -43,7 +43,7 @@ # - Find the python numpy module # This cmake module determines whether the python module numpy exists -# for the current PYTHON_EXECUTABLE. This code sets the following +# for the current Python3_EXECUTABLE. This code sets the following # variable: # # NumPy_FOUND = Set to TRUE if numpy is found @@ -54,7 +54,7 @@ # # If NumPy is required and python executable does not exist, then send # an error -IF(NOT PYTHON_EXECUTABLE) +IF(NOT Python3_EXECUTABLE) IF(NumPy_FIND_REQUIRED) MESSAGE(SEND_ERROR "Python executable not found, so required NumPy module not found" @@ -62,11 +62,11 @@ IF(NOT PYTHON_EXECUTABLE) ENDIF(NumPy_FIND_REQUIRED) # # Continue processing if python executable is known -ELSE(NOT PYTHON_EXECUTABLE) +ELSE(NOT Python3_EXECUTABLE) # Retrieve the NumPy version EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c "import numpy; print(numpy.__version__)" + ${Python3_EXECUTABLE} -c "import numpy; print(numpy.__version__)" OUTPUT_VARIABLE NumPy_VERSION ERROR_VARIABLE NumPy_VERSION_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE @@ -84,7 +84,7 @@ ELSE(NOT PYTHON_EXECUTABLE) # now look for the NumPy include directory IF(NOT NumPy_VERSION_ERROR) EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c "import numpy; print(numpy.get_include())" + ${Python3_EXECUTABLE} -c "import numpy; print(numpy.get_include())" OUTPUT_VARIABLE NumPy_INCLUDE_DIR ERROR_VARIABLE NumPy_INCLUDE_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE @@ -102,7 +102,7 @@ ELSE(NOT PYTHON_EXECUTABLE) # and the wrong function name was called IF(NumPy_INCLUDE_ERROR) EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c "import numpy; print(numpy.get_numpy_include())" + ${Python3_EXECUTABLE} -c "import numpy; print(numpy.get_numpy_include())" OUTPUT_VARIABLE NumPy_INCLUDE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE ) @@ -139,4 +139,4 @@ ELSE(NOT PYTHON_EXECUTABLE) ENDIF(NOT NumPy_VERSION_ERROR) -ENDIF(NOT PYTHON_EXECUTABLE) +ENDIF(NOT Python3_EXECUTABLE) diff --git a/packages/PyTrilinos/cmake/FindPETSc4Py.cmake b/packages/PyTrilinos/cmake/FindPETSc4Py.cmake index 459d582a1233..fc5b1af2d210 100644 --- a/packages/PyTrilinos/cmake/FindPETSc4Py.cmake +++ b/packages/PyTrilinos/cmake/FindPETSc4Py.cmake @@ -8,7 +8,7 @@ IF(PETSC4PY_INCLUDES) ENDIF(PETSC4PY_INCLUDES) EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} -c "import petsc4py; from sys import stdout; stdout.write(petsc4py.get_include())" + COMMAND ${Python3_EXECUTABLE} -c "import petsc4py; from sys import stdout; stdout.write(petsc4py.get_include())" OUTPUT_VARIABLE PETSC4PY_INCLUDES RESULT_VARIABLE PETSC4PY_NOT_FOUND) diff --git a/packages/PyTrilinos/cmake/FindPythonInclude.cmake b/packages/PyTrilinos/cmake/FindPythonInclude.cmake index 99f168cc3acb..6643621714ae 100644 --- a/packages/PyTrilinos/cmake/FindPythonInclude.cmake +++ b/packages/PyTrilinos/cmake/FindPythonInclude.cmake @@ -43,17 +43,17 @@ # - Find the python include path # This module determines where the python include file Python.h is, -# based on the current value of PYTHON_EXECUTABLE. This code sets the +# based on the current value of Python3_EXECUTABLE. This code sets the # following variable: # # PYTHON_INCLUDE_PATH = path to where Python.h is found # -IF(PYTHON_EXECUTABLE) +IF(Python3_EXECUTABLE) # Obtain the Python version string EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c + ${Python3_EXECUTABLE} -c "import sys; print('python' + sys.version[:3])" OUTPUT_VARIABLE PYVERSION OUTPUT_STRIP_TRAILING_WHITESPACE @@ -61,7 +61,7 @@ IF(PYTHON_EXECUTABLE) # Obtain the Python prefix path EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c + ${Python3_EXECUTABLE} -c "import sys; print(sys.prefix)" OUTPUT_VARIABLE PYPREFIX OUTPUT_STRIP_TRAILING_WHITESPACE @@ -69,7 +69,7 @@ IF(PYTHON_EXECUTABLE) # Obtain the Python include path EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c + ${Python3_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_paths()['include'])" OUTPUT_VARIABLE PYTHON_INCLUDE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE @@ -100,4 +100,4 @@ IF(PYTHON_EXECUTABLE) MESSAGE(STATUS "PYTHON_INCLUDE_PATH is ${PYTHON_INCLUDE_PATH}") -ENDIF(PYTHON_EXECUTABLE) +ENDIF(Python3_EXECUTABLE) diff --git a/packages/PyTrilinos/cmake/PyTrilinosMakeTest.cmake b/packages/PyTrilinos/cmake/PyTrilinosMakeTest.cmake index af4ee9247b10..501553ab30bf 100644 --- a/packages/PyTrilinos/cmake/PyTrilinosMakeTest.cmake +++ b/packages/PyTrilinos/cmake/PyTrilinosMakeTest.cmake @@ -44,7 +44,7 @@ MACRO(PyTrilinos_MAKE_TEST TEST_NAME) ADD_CUSTOM_COMMAND(OUTPUT ${TEST_NAME}.py - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python3_EXECUTABLE} ${CMAKE_BINARY_DIR}/packages/PyTrilinos/util/copyWithCMakeSubstitutions.py ${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.py @@ -54,7 +54,7 @@ MACRO(PyTrilinos_MAKE_TEST TEST_NAME) DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${TEST_NAME}.py) TRIBITS_ADD_TEST( - ${PYTHON_EXECUTABLE} + ${Python3_EXECUTABLE} NOEXEPREFIX NOEXESUFFIX NAME ${TEST_NAME} diff --git a/packages/PyTrilinos/doc/Doxygen/CMakeLists.txt b/packages/PyTrilinos/doc/Doxygen/CMakeLists.txt index 37dc7c7e38e7..d46df421389d 100644 --- a/packages/PyTrilinos/doc/Doxygen/CMakeLists.txt +++ b/packages/PyTrilinos/doc/Doxygen/CMakeLists.txt @@ -63,7 +63,7 @@ FOREACH(Package ${PyTrilinos_PACKAGES}) ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_${Package} @ONLY ) - EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/docstrings.py + EXECUTE_PROCESS(COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/docstrings.py --doxygen=${DOXYGEN_EXECUTABLE} ${Package} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ERROR_VARIABLE Doxy_CONVERT_ERROR) diff --git a/packages/PyTrilinos/example/CMakeLists.txt b/packages/PyTrilinos/example/CMakeLists.txt index e0b9d4f89ed2..725334ed2869 100644 --- a/packages/PyTrilinos/example/CMakeLists.txt +++ b/packages/PyTrilinos/example/CMakeLists.txt @@ -47,7 +47,7 @@ ENABLE_TESTING() INCLUDE(PyTrilinosMakeTest) ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/testutil.py - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python3_EXECUTABLE} ${PyTrilinos_BINARY_DIR}/util/copyWithCMakeSubstitutions.py ${CMAKE_CURRENT_SOURCE_DIR}/testutil.py.in ${CMAKE_CURRENT_BINARY_DIR}/testutil.py @@ -57,7 +57,7 @@ ADD_CUSTOM_TARGET(PyTrilinos_Example_testutil ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/testutil.py) ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/gre__115.rua - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python3_EXECUTABLE} ${PyTrilinos_BINARY_DIR}/util/copyWithCMakeSubstitutions.py ${CMAKE_CURRENT_SOURCE_DIR}/gre__115.mx ${CMAKE_CURRENT_BINARY_DIR}/gre__115.rua diff --git a/packages/PyTrilinos/src/CMakeLists.txt b/packages/PyTrilinos/src/CMakeLists.txt index 5e071091841f..5cdc5a45f6bd 100644 --- a/packages/PyTrilinos/src/CMakeLists.txt +++ b/packages/PyTrilinos/src/CMakeLists.txt @@ -262,7 +262,7 @@ SET_TARGET_PROPERTIES(pytrilinos # # Get the python version -EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c +EXECUTE_PROCESS(COMMAND ${Python3_EXECUTABLE} -c "import sys; print(sys.version[:3])" OUTPUT_VARIABLE PYTHON_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE @@ -323,7 +323,7 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${TEUCHOS_RCP_SCRIPT}.in ${CMAKE_CURRENT_BINARY_DIR}/${TEUCHOS_RCP_SCRIPT}) ADD_CUSTOM_COMMAND( OUTPUT "${TEUCHOS_RCP}" - COMMAND "${PYTHON_EXECUTABLE}" + COMMAND "${Python3_EXECUTABLE}" ARGS ${CMAKE_CURRENT_BINARY_DIR}/${TEUCHOS_RCP_SCRIPT} > ${CMAKE_CURRENT_BINARY_DIR}/${TEUCHOS_RCP} ) @@ -343,7 +343,7 @@ SET_TARGET_PROPERTIES(${TEUCHOS_RCP_TARGET} PROPERTIES LINK_FLAGS "${EXTRA_LINK_ARGS}" ) ADD_CUSTOM_COMMAND(TARGET ${TEUCHOS_RCP_TARGET} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/Teuchos/RCP.py', 'PyTrilinos/Teuchos/RCP.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/Teuchos/RCP.py', 'PyTrilinos/Teuchos/RCP.pyc')" COMMENT "Byte compiling Teuchos/RCP.py" VERBATIM) LIST(APPEND ADDITIONAL_CLEAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/${TEUCHOS_RCP}) @@ -399,7 +399,7 @@ FOREACH(MODULE ${PyTrilinos_MODULES}) # causes other packages to "import Teuchos" properly. IF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/Teuchos") ADD_CUSTOM_COMMAND(TARGET ${PyTrilinos_TARGET_NAME} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/Teuchos/${MODULE_NAME}.py', 'PyTrilinos/Teuchos/${MODULE_NAME}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/Teuchos/${MODULE_NAME}.py', 'PyTrilinos/Teuchos/${MODULE_NAME}.pyc')" COMMENT "Byte compiling Teuchos/${MODULE_NAME}.py" VERBATIM) INSTALL(FILES @@ -414,7 +414,7 @@ FOREACH(MODULE ${PyTrilinos_MODULES}) ELSEIF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/NOX/Epetra") SET(TRILINOS_LIBS ${NOXEPETRA_LIBRARIES}) ADD_CUSTOM_COMMAND(TARGET ${PyTrilinos_TARGET_NAME} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/NOX/Epetra/${MODULE_NAME}.py', 'PyTrilinos/NOX/Epetra/${MODULE_NAME}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/NOX/Epetra/${MODULE_NAME}.py', 'PyTrilinos/NOX/Epetra/${MODULE_NAME}.pyc')" COMMENT "Byte compiling NOX/Epetra/${MODULE_NAME}.py" VERBATIM) INSTALL(FILES @@ -430,7 +430,7 @@ FOREACH(MODULE ${PyTrilinos_MODULES}) ELSEIF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/NOX/PETSc") SET(TRILINOS_LIBS ${NOXPETSC_LIBRARIES}) ADD_CUSTOM_COMMAND(TARGET ${PyTrilinos_TARGET_NAME} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/NOX/PETSc/${MODULE_NAME}.py', 'PyTrilinos/NOX/PETSc/${MODULE_NAME}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/NOX/PETSc/${MODULE_NAME}.py', 'PyTrilinos/NOX/PETSc/${MODULE_NAME}.pyc')" COMMENT "Byte compiling NOX/PETSc/${MODULE_NAME}.py" VERBATIM) INSTALL(FILES @@ -446,7 +446,7 @@ FOREACH(MODULE ${PyTrilinos_MODULES}) ELSEIF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/NOX") SET(TRILINOS_LIBS ${NOX_LIBRARIES}) ADD_CUSTOM_COMMAND(TARGET ${PyTrilinos_TARGET_NAME} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/NOX/${MODULE_NAME}.py', 'PyTrilinos/NOX/${MODULE_NAME}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/NOX/${MODULE_NAME}.py', 'PyTrilinos/NOX/${MODULE_NAME}.pyc')" COMMENT "Byte compiling NOX/${MODULE_NAME}.py" VERBATIM) INSTALL(FILES @@ -462,7 +462,7 @@ FOREACH(MODULE ${PyTrilinos_MODULES}) ELSEIF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/LOCA/Hopf") SET(TRILINOS_LIBS ${LOCAEPETRA_LIBRARIES}) ADD_CUSTOM_COMMAND(TARGET ${PyTrilinos_TARGET_NAME} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/LOCA/Hopf/${MODULE_NAME}.py', 'PyTrilinos/LOCA/Hopf/${MODULE_NAME}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/LOCA/Hopf/${MODULE_NAME}.py', 'PyTrilinos/LOCA/Hopf/${MODULE_NAME}.pyc')" COMMENT "Byte compiling LOCA/Hopf/${MODULE_NAME}.py" VERBATIM) INSTALL(FILES @@ -478,7 +478,7 @@ FOREACH(MODULE ${PyTrilinos_MODULES}) ELSEIF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/LOCA/Pitchfork") SET(TRILINOS_LIBS ${LOCAEPETRA_LIBRARIES}) ADD_CUSTOM_COMMAND(TARGET ${PyTrilinos_TARGET_NAME} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/LOCA/Pitchfork/${MODULE_NAME}.py', 'PyTrilinos/LOCA/Pitchfork/${MODULE_NAME}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/LOCA/Pitchfork/${MODULE_NAME}.py', 'PyTrilinos/LOCA/Pitchfork/${MODULE_NAME}.pyc')" COMMENT "Byte compiling LOCA/Pitchfork/${MODULE_NAME}.py" VERBATIM) INSTALL(FILES @@ -494,7 +494,7 @@ FOREACH(MODULE ${PyTrilinos_MODULES}) ELSEIF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/LOCA/TurningPoint") SET(TRILINOS_LIBS ${LOCAEPETRA_LIBRARIES}) ADD_CUSTOM_COMMAND(TARGET ${PyTrilinos_TARGET_NAME} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/LOCA/TurningPoint/${MODULE_NAME}.py', 'PyTrilinos/LOCA/TurningPoint/${MODULE_NAME}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/LOCA/TurningPoint/${MODULE_NAME}.py', 'PyTrilinos/LOCA/TurningPoint/${MODULE_NAME}.pyc')" COMMENT "Byte compiling LOCA/TurningPoint/${MODULE_NAME}.py" VERBATIM) INSTALL(FILES @@ -510,7 +510,7 @@ FOREACH(MODULE ${PyTrilinos_MODULES}) ELSEIF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/LOCA/Epetra") SET(TRILINOS_LIBS ${LOCAEPETRA_LIBRARIES}) ADD_CUSTOM_COMMAND(TARGET ${PyTrilinos_TARGET_NAME} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/LOCA/Epetra/${MODULE_NAME}.py', 'PyTrilinos/LOCA/Epetra/${MODULE_NAME}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/LOCA/Epetra/${MODULE_NAME}.py', 'PyTrilinos/LOCA/Epetra/${MODULE_NAME}.pyc')" COMMENT "Byte compiling LOCA/Epetra/${MODULE_NAME}.py" VERBATIM) INSTALL(FILES @@ -526,7 +526,7 @@ FOREACH(MODULE ${PyTrilinos_MODULES}) ELSEIF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/LOCA") SET(TRILINOS_LIBS ${LOCA_LIBRARIES}) ADD_CUSTOM_COMMAND(TARGET ${PyTrilinos_TARGET_NAME} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/LOCA/${MODULE_NAME}.py', 'PyTrilinos/LOCA/${MODULE_NAME}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/LOCA/${MODULE_NAME}.py', 'PyTrilinos/LOCA/${MODULE_NAME}.pyc')" COMMENT "Byte compiling LOCA/${MODULE_NAME}.py" VERBATIM) INSTALL(FILES @@ -542,7 +542,7 @@ FOREACH(MODULE ${PyTrilinos_MODULES}) ELSEIF("${MODULE_OUTDIR}" MATCHES "PyTrilinos/Isorropia") SET(TRILINOS_LIBS ${ISORROPIA_LIBRARIES}) ADD_CUSTOM_COMMAND(TARGET ${PyTrilinos_TARGET_NAME} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/Isorropia/${MODULE_NAME}.py', 'PyTrilinos/Isorropia/${MODULE_NAME}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/Isorropia/${MODULE_NAME}.py', 'PyTrilinos/Isorropia/${MODULE_NAME}.pyc')" COMMENT "Byte compiling Isorropia/${MODULE_NAME}.py" VERBATIM) INSTALL(FILES @@ -558,7 +558,7 @@ FOREACH(MODULE ${PyTrilinos_MODULES}) ELSE() SET(TRILINOS_LIBS ${${MODULE_UPPER}_LIBRARIES}) ADD_CUSTOM_COMMAND(TARGET ${PyTrilinos_TARGET_NAME} POST_BUILD - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/${MODULE}.py', 'PyTrilinos/${MODULE}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('PyTrilinos/${MODULE}.py', 'PyTrilinos/${MODULE}.pyc')" COMMENT "Byte compiling ${MODULE}.py" VERBATIM) INSTALL(FILES diff --git a/packages/PyTrilinos/src/PyTrilinos/CMakeLists.txt b/packages/PyTrilinos/src/PyTrilinos/CMakeLists.txt index 3ca687f781f8..97fe157c0729 100644 --- a/packages/PyTrilinos/src/PyTrilinos/CMakeLists.txt +++ b/packages/PyTrilinos/src/PyTrilinos/CMakeLists.txt @@ -71,7 +71,7 @@ FOREACH(MODULE ${LOCAL_MODULES}) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.py) ADD_CUSTOM_COMMAND(TARGET PyTrilinos_Pure_Python_Modules - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" COMMENT "Byte compiling ${MODULE}.py" BYPRODUCTS ${MODULE}.pyc VERBATIM) diff --git a/packages/PyTrilinos/src/PyTrilinos/Isorropia/CMakeLists.txt b/packages/PyTrilinos/src/PyTrilinos/Isorropia/CMakeLists.txt index a06fb4c0b452..fcc954bb5e4a 100644 --- a/packages/PyTrilinos/src/PyTrilinos/Isorropia/CMakeLists.txt +++ b/packages/PyTrilinos/src/PyTrilinos/Isorropia/CMakeLists.txt @@ -58,7 +58,7 @@ FOREACH(MODULE ${LOCAL_MODULES}) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.py) ADD_CUSTOM_COMMAND(TARGET PyTrilinos_Isorropia_Pure_Python_Modules - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" COMMENT "Byte compiling Isorropia/${MODULE}.py" BYPRODUCTS ${MODULE}.pyc VERBATIM) diff --git a/packages/PyTrilinos/src/PyTrilinos/LOCA/CMakeLists.txt b/packages/PyTrilinos/src/PyTrilinos/LOCA/CMakeLists.txt index 5d119713bb5a..f9d30e0bb252 100644 --- a/packages/PyTrilinos/src/PyTrilinos/LOCA/CMakeLists.txt +++ b/packages/PyTrilinos/src/PyTrilinos/LOCA/CMakeLists.txt @@ -58,7 +58,7 @@ FOREACH(MODULE ${LOCAL_MODULES}) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.py) ADD_CUSTOM_COMMAND(TARGET PyTrilinos_LOCA_Pure_Python_Modules - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" COMMENT "Byte compiling LOCA/${MODULE}.py" BYPRODUCTS ${MODULE}.pyc VERBATIM) diff --git a/packages/PyTrilinos/src/PyTrilinos/LOCA/Epetra/CMakeLists.txt b/packages/PyTrilinos/src/PyTrilinos/LOCA/Epetra/CMakeLists.txt index 221043450b01..c61356409bf4 100644 --- a/packages/PyTrilinos/src/PyTrilinos/LOCA/Epetra/CMakeLists.txt +++ b/packages/PyTrilinos/src/PyTrilinos/LOCA/Epetra/CMakeLists.txt @@ -58,7 +58,7 @@ FOREACH(MODULE ${LOCAL_MODULES}) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.py) ADD_CUSTOM_COMMAND(TARGET PyTrilinos_LOCA_Epetra_Pure_Python_Modules - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" COMMENT "Byte compiling LOCA/Epetra/${MODULE}.py" BYPRODUCTS ${MODULE}.pyc VERBATIM) diff --git a/packages/PyTrilinos/src/PyTrilinos/LOCA/Hopf/CMakeLists.txt b/packages/PyTrilinos/src/PyTrilinos/LOCA/Hopf/CMakeLists.txt index 13d2e61841cc..ae379cf0475d 100644 --- a/packages/PyTrilinos/src/PyTrilinos/LOCA/Hopf/CMakeLists.txt +++ b/packages/PyTrilinos/src/PyTrilinos/LOCA/Hopf/CMakeLists.txt @@ -58,7 +58,7 @@ FOREACH(MODULE ${LOCAL_MODULES}) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.py) ADD_CUSTOM_COMMAND(TARGET PyTrilinos_LOCA_Hopf_Pure_Python_Modules - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" COMMENT "Byte compiling LOCA/Hopf/${MODULE}.py" BYPRODUCTS ${MODULE}.pyc VERBATIM) diff --git a/packages/PyTrilinos/src/PyTrilinos/LOCA/Pitchfork/CMakeLists.txt b/packages/PyTrilinos/src/PyTrilinos/LOCA/Pitchfork/CMakeLists.txt index ae010fc45c65..885deb0d8ffd 100644 --- a/packages/PyTrilinos/src/PyTrilinos/LOCA/Pitchfork/CMakeLists.txt +++ b/packages/PyTrilinos/src/PyTrilinos/LOCA/Pitchfork/CMakeLists.txt @@ -58,7 +58,7 @@ FOREACH(MODULE ${LOCAL_MODULES}) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.py) ADD_CUSTOM_COMMAND(TARGET PyTrilinos_LOCA_Pitchfork_Pure_Python_Modules - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" COMMENT "Byte compiling LOCA/Pitchfork/${MODULE}.py" BYPRODUCTS ${MODULE}.pyc VERBATIM) diff --git a/packages/PyTrilinos/src/PyTrilinos/LOCA/TurningPoint/CMakeLists.txt b/packages/PyTrilinos/src/PyTrilinos/LOCA/TurningPoint/CMakeLists.txt index e2021357070e..324db7f7e37a 100644 --- a/packages/PyTrilinos/src/PyTrilinos/LOCA/TurningPoint/CMakeLists.txt +++ b/packages/PyTrilinos/src/PyTrilinos/LOCA/TurningPoint/CMakeLists.txt @@ -58,7 +58,7 @@ FOREACH(MODULE ${LOCAL_MODULES}) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.py) ADD_CUSTOM_COMMAND(TARGET PyTrilinos_LOCA_TurningPoint_Pure_Python_Modules - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" COMMENT "Byte compiling LOCA/TurningPoint/${MODULE}.py" BYPRODUCTS ${MODULE}.pyc VERBATIM) diff --git a/packages/PyTrilinos/src/PyTrilinos/NOX/CMakeLists.txt b/packages/PyTrilinos/src/PyTrilinos/NOX/CMakeLists.txt index d7004ed6aea5..561235b3f775 100644 --- a/packages/PyTrilinos/src/PyTrilinos/NOX/CMakeLists.txt +++ b/packages/PyTrilinos/src/PyTrilinos/NOX/CMakeLists.txt @@ -58,7 +58,7 @@ FOREACH(MODULE ${LOCAL_MODULES}) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.py) ADD_CUSTOM_COMMAND(TARGET PyTrilinos_NOX_Pure_Python_Modules - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" COMMENT "Byte compiling NOX/${MODULE}.py" BYPRODUCTS ${MODULE}.pyc VERBATIM) diff --git a/packages/PyTrilinos/src/PyTrilinos/NOX/Epetra/CMakeLists.txt b/packages/PyTrilinos/src/PyTrilinos/NOX/Epetra/CMakeLists.txt index 93c5211c9178..78a05883d212 100644 --- a/packages/PyTrilinos/src/PyTrilinos/NOX/Epetra/CMakeLists.txt +++ b/packages/PyTrilinos/src/PyTrilinos/NOX/Epetra/CMakeLists.txt @@ -58,7 +58,7 @@ FOREACH(MODULE ${LOCAL_MODULES}) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.py) ADD_CUSTOM_COMMAND(TARGET PyTrilinos_NOX_Epetra_Pure_Python_Modules - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" COMMENT "Byte compiling NOX/Epetra/${MODULE}.py" BYPRODUCTS ${MODULE}.pyc VERBATIM) diff --git a/packages/PyTrilinos/src/PyTrilinos/NOX/PETSc/CMakeLists.txt b/packages/PyTrilinos/src/PyTrilinos/NOX/PETSc/CMakeLists.txt index f9632d20df48..1d33fd3cce93 100644 --- a/packages/PyTrilinos/src/PyTrilinos/NOX/PETSc/CMakeLists.txt +++ b/packages/PyTrilinos/src/PyTrilinos/NOX/PETSc/CMakeLists.txt @@ -58,7 +58,7 @@ FOREACH(MODULE ${LOCAL_MODULES}) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.py) ADD_CUSTOM_COMMAND(TARGET PyTrilinos_NOX_PETSc_Pure_Python_Modules - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" COMMENT "Byte compiling NOX/PETSc/${MODULE}.py" BYPRODUCTS ${MODULE}.pyc VERBATIM) diff --git a/packages/PyTrilinos/src/PyTrilinos/Teuchos/CMakeLists.txt b/packages/PyTrilinos/src/PyTrilinos/Teuchos/CMakeLists.txt index 05a0308af428..15e2a717d576 100644 --- a/packages/PyTrilinos/src/PyTrilinos/Teuchos/CMakeLists.txt +++ b/packages/PyTrilinos/src/PyTrilinos/Teuchos/CMakeLists.txt @@ -58,7 +58,7 @@ FOREACH(MODULE ${LOCAL_MODULES}) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${MODULE}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}.py) ADD_CUSTOM_COMMAND(TARGET PyTrilinos_Teuchos_Pure_Python_Modules - COMMAND ${PYTHON_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" + COMMAND ${Python3_EXECUTABLE} -c "import py_compile; py_compile.compile('${MODULE}.py', '${MODULE}.pyc')" COMMENT "Byte compiling Teuchos/${MODULE}.py" BYPRODUCTS ${MODULE}.pyc VERBATIM) diff --git a/packages/PyTrilinos/src/scripts/CMakeLists.txt b/packages/PyTrilinos/src/scripts/CMakeLists.txt index a30e4ff1a47b..4cbacec449a6 100644 --- a/packages/PyTrilinos/src/scripts/CMakeLists.txt +++ b/packages/PyTrilinos/src/scripts/CMakeLists.txt @@ -43,7 +43,7 @@ # @HEADER ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/testutil.py - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python3_EXECUTABLE} ${PyTrilinos_BINARY_DIR}/util/copyWithCMakeSubstitutions.py ${CMAKE_CURRENT_SOURCE_DIR}/testutil.py.in ${CMAKE_CURRENT_BINARY_DIR}/testutil.py @@ -55,7 +55,7 @@ ADD_CUSTOM_TARGET(PyTrilinos_Scripts_testutil ALL MACRO(PyTrilinos_MAKE_SCRIPT SCRIPT_NAME) ADD_CUSTOM_COMMAND(OUTPUT ${SCRIPT_NAME}.py - COMMAND ${PYTHON_EXECUTABLE} + COMMAND ${Python3_EXECUTABLE} ${PyTrilinos_BINARY_DIR}/util/copyWithCMakeSubstitutions.py ${CMAKE_CURRENT_SOURCE_DIR}/${SCRIPT_NAME}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${SCRIPT_NAME}.py diff --git a/packages/PyTrilinos2/CMakeLists.txt b/packages/PyTrilinos2/CMakeLists.txt index 8f22df527dda..d912b7efe078 100644 --- a/packages/PyTrilinos2/CMakeLists.txt +++ b/packages/PyTrilinos2/CMakeLists.txt @@ -33,14 +33,14 @@ TRIBITS_ADD_OPTION_AND_DEFINE(PyTrilinos2_BINDER_VERBOSE SET(PyTrilinos2_BINDER_NUM_FILES "100" CACHE STRING "Maxinum number of generated files by binder.") -MESSAGE("-- PYTHON_EXECUTABLE:") -IF(NOT DEFINED ${PYTHON_EXECUTABLE}) - find_program(PYTHON_EXECUTABLE +MESSAGE("-- Python3_EXECUTABLE:") +IF(NOT DEFINED ${Python3_EXECUTABLE}) + find_program(Python3_EXECUTABLE NAMES python3 python ) - MESSAGE(" -- CMake has set: PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}") + MESSAGE(" -- CMake has set: Python3_EXECUTABLE = ${Python3_EXECUTABLE}") ELSE() - MESSAGE(" -- User has set: PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}") + MESSAGE(" -- User has set: Python3_EXECUTABLE = ${Python3_EXECUTABLE}") ENDIF() function(get_all_include_dirs LIBRARY_NAME all_include_dirs all_visited_libs) @@ -196,7 +196,7 @@ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/src) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/src/PyTrilinos2_Tpetra_ETI.hpp ${CMAKE_CURRENT_BINARY_DIR}/python/getTpetraTypeName.py - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/gather_ETI.py ${CMAKE_CURRENT_BINARY_DIR} ${all_ETI_files_list} ${all_ETI_classes_list} "src/PyTrilinos2_Tpetra_ETI.hpp" + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/gather_ETI.py ${CMAKE_CURRENT_BINARY_DIR} ${all_ETI_files_list} ${all_ETI_classes_list} "src/PyTrilinos2_Tpetra_ETI.hpp" DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/include_tmp ) add_custom_target(generate_ETI_name DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/src/PyTrilinos2_Tpetra_ETI.hpp ${CMAKE_CURRENT_BINARY_DIR}/include_tmp) @@ -206,7 +206,7 @@ list (APPEND PyTrilinos2PyFiles ${PyTrilinos2PyFiles2}) add_custom_command( OUTPUT ${binder_include_name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/gather_includes.py ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${all_header_with_dir_list} ${all_header_without_dir_list} ${binder_include_name} + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/gather_includes.py ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${all_header_with_dir_list} ${all_header_without_dir_list} ${binder_include_name} DEPENDS generate_ETI_name ${CMAKE_CURRENT_BINARY_DIR}/include_tmp ) add_custom_target(generate_include_name DEPENDS ${binder_include_name}) @@ -272,12 +272,12 @@ SET(PyTrilinos2_INSTALL_PREFIX ${PyTrilinos2_DEFAULT_INSTALL_PREFIX} CACHE PATH "The path prefix for where PyTrilinos2 will be installed, e.g. /usr/local") # Get the python version -EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c +EXECUTE_PROCESS(COMMAND ${Python3_EXECUTABLE} -c "import sys; print(sys.version_info.major)" OUTPUT_VARIABLE PYTHON_MAJOR_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) -EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c +EXECUTE_PROCESS(COMMAND ${Python3_EXECUTABLE} -c "import sys; print(sys.version_info.minor)" OUTPUT_VARIABLE PYTHON_MINOR_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE @@ -300,7 +300,7 @@ INSTALL(FILES # Find the pybind11 CMake module EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c "import pybind11; print(pybind11.get_cmake_dir())" + ${Python3_EXECUTABLE} -c "import pybind11; print(pybind11.get_cmake_dir())" OUTPUT_VARIABLE pybind11_DIR ERROR_VARIABLE pybind11_CMAKE_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE @@ -310,7 +310,7 @@ MESSAGE(STATUS "pybind11 CMake path: ${pybind11_DIR}") find_package(pybind11 REQUIRED) EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c "import mpi4py; print(mpi4py.get_include())" + ${Python3_EXECUTABLE} -c "import mpi4py; print(mpi4py.get_include())" OUTPUT_VARIABLE Mpi4Py_INCLUDE_DIR ERROR_VARIABLE Mpi4Py_INCLUDE_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE @@ -323,7 +323,7 @@ ELSE() ENDIF() EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c "import mpi4py; print(mpi4py.get_config()['mpicxx'])" + ${Python3_EXECUTABLE} -c "import mpi4py; print(mpi4py.get_config()['mpicxx'])" OUTPUT_VARIABLE Mpi4Py_MPICXX OUTPUT_STRIP_TRAILING_WHITESPACE ) diff --git a/packages/PyTrilinos2/cmake/PyTrilinos2MakeTest.cmake b/packages/PyTrilinos2/cmake/PyTrilinos2MakeTest.cmake index 4950a10a246e..52691290a084 100644 --- a/packages/PyTrilinos2/cmake/PyTrilinos2MakeTest.cmake +++ b/packages/PyTrilinos2/cmake/PyTrilinos2MakeTest.cmake @@ -4,7 +4,7 @@ MACRO(PyTrilinos2_MAKE_MPI_TEST TEST_NAME) FILE(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${TEST_NAME}.py DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) TRIBITS_ADD_TEST( - ${PYTHON_EXECUTABLE} + ${Python3_EXECUTABLE} NOEXEPREFIX NOEXESUFFIX NAME ${TEST_NAME} diff --git a/packages/compadre/CMakeLists.txt b/packages/compadre/CMakeLists.txt index 61ea762d685d..cd7a2f3f8690 100644 --- a/packages/compadre/CMakeLists.txt +++ b/packages/compadre/CMakeLists.txt @@ -1,556 +1,556 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 3.16.0 FATAL_ERROR) - -# get Compadre_VERSION -file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/cmake/Compadre_Version.txt Compadre_VERSION) - -# Called at the top of every CMakeLists.txt file -macro(include_tribits_build) - if (${PROJECT_NAME}_TRIBITS_DIR) - include("${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.tribits.cmake") - return() - endif() -endmacro() - -# cmake helper functions -include(${CMAKE_CURRENT_LIST_DIR}/cmake/bob.cmake) - -if (${PROJECT_NAME}_TRIBITS_DIR) # TriBITS CMake Project - - # - # A) Define the package - # - - tribits_package(Compadre) - - # - # B) Set up package-specific options - # - TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_DEBUG - Compadre_DEBUG - "Enable debug code in compadre" - ${Trilinos_ENABLE_DEBUG} ) - - TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_EXTREME_DEBUG - Compadre_EXTREME_DEBUG - "Enable extreme debug code in compadre" - OFF ) - - if ("${TPL_ENABLE_CUDA}" STREQUAL "ON") - set(Compadre_USE_CUDA ON CACHE BOOL "Whether to use CUDA") - else () - set(Compadre_USE_CUDA OFF CACHE BOOL "Whether to use CUDA") - endif() - - set(Compadre_USE_MATLAB OFF CACHE BOOL "Don't use Matlab when building in Trilinos") - set(Compadre_USE_MPI ${TPL_ENABLE_MPI} CACHE BOOL "Use MPI for parallelism") - set(Compadre_USE_PYTHON OFF CACHE BOOL "Don't use Python when building in Trilinos") - - # breakdown Compadre_VERSION from Version.cmake for storage in Compadre_Config.h - string(REPLACE "." ";" VLIST ${Compadre_VERSION}) - list(GET VLIST 0 Compadre_VERSION_MAJOR) - list(GET VLIST 1 Compadre_VERSION_MINOR) - list(GET VLIST 2 Compadre_VERSION_PATCH) - -else() # Raw CMake Project - - ########## - # - # Compadre Details - # - ########## - - # Disable in-source builds to prevent source tree corruption. - if( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" ) - message( FATAL_ERROR "FATAL: In-source builds are not allowed. You should create a separate directory for build files and delete CMakeCache.txt." ) - endif() - - PROJECT(Compadre VERSION ${Compadre_VERSION} LANGUAGES CXX) - if (NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 17) - endif() - set(CMAKE_DISABLE_SOURCE_CHANGES ON) - set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) - set(CMAKE_POLICY_DEFAULT_CMP0128 OLD) - set(CMAKE_CXX_EXTENSIONS OFF) - - get_directory_property(Compadre_HAS_PARENT PARENT_DIRECTORY) - - if (NOT Compadre_HAS_PARENT) - include(GNUInstallDirs) - endif() - - bob_begin_package() - - # Set to OFF for significantly faster performance and ON for error tracking - bob_option(Compadre_EXTREME_DEBUG "Run Compadre Toolkit in EXTREME DEBUG mode" OFF) - bob_option(Compadre_DEBUG "Run Compadre Toolkit in DEBUG mode" ON) - if (Compadre_EXTREME_DEBUG) - set(Compadre_DEBUG ON) - message(STATUS "Compadre_DEBUG: ON (because Compadre_EXTREME_DEBUG is ON)") - endif() - - # RPATH related settings - # https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling - SET(CMAKE_SKIP_BUILD_RPATH FALSE) - SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) - SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - SET(CMAKE_INSTALL_RPATH "../${CMAKE_INSTALL_LIBDIR}") - - # RPATH should always include the folder it is called from - bob_option(PYTHON_CALLING_BUILD "Python setuptools calling build" OFF) - bob_option(Compadre_USE_PYTHON "Use PYTHON" OFF) - bob_option(Compadre_USE_MATLAB "Use MATLAB interface for PYTHON" OFF) - bob_option(Compadre_USE_MPI "Use MPI (not needed for Compadre toolkit)" OFF) - set(PYTHON_LIBRARY_PREFIX "..") # relative to examples folder - bob_input(PYTHON_EXECUTABLE "" PATH "Python executable location") - IF(NOT(PYTHON_EXECUTABLE)) - MESSAGE(STATUS "Python executable location PYTHON_EXECUTABLE not given. Search made using 'which python'") - EXECUTE_PROCESS( - COMMAND which "python" - OUTPUT_VARIABLE PYTHON_EXECUTABLE - OUTPUT_STRIP_TRAILING_WHITESPACE ) - ENDIF() - MESSAGE(STATUS "PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}") - if (Compadre_USE_PYTHON) - # change RPATH for a flat directory structure - # when installing pycompadre as Python package - if (PYTHON_CALLING_BUILD) - if (APPLE) - SET(CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} "@loader_path/") - SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} "@loader_path/") - else() - SET(CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} "$ORIGIN/") - SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} "$ORIGIN/") - SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,origin") - endif() - endif() - endif() - - - - ########## - # - # - # TPLS - # - # Three choices for providing TPLs: - # - # a.) None - # - Trilinos_PREFIX, KokkosCore_PREFIX, and KokkosKernels_PREFIX - # not specified - # b.) Trilinos installation with Kokkos AND KokkosKernels - # - Trilinos_PREFIX specified - # c.) Kokkos AND KokkosKernels standalone installations - # - KokkosCore_PREFIX and KokkosKernels_PREFIX specified - # - # For option a, vendored Kokkos and KokkosKernels built for user - # - ########## - - - - #TRILINOS - bob_input(Trilinos_PREFIX "" PATH "Path to Trilinos install") - if (Trilinos_PREFIX) - if(NOT IS_ABSOLUTE ${Trilinos_PREFIX}) - set(Trilinos_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/${Trilinos_PREFIX}") - endif() - set(CMAKE_PREFIX_PATH ${Trilinos_PREFIX} ${CMAKE_PREFIX_PATH}) - endif() - - #KOKKOS - bob_input(KokkosCore_PREFIX "" PATH "Path to KokkosCore install") - if (KokkosCore_PREFIX) - if(NOT IS_ABSOLUTE ${KokkosCore_PREFIX}) - set(KokkosCore_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/${KokkosCore_PREFIX}") - endif() - set(CMAKE_PREFIX_PATH ${KokkosCore_PREFIX} ${CMAKE_PREFIX_PATH}) - endif() - - #KOKKOS-KERNELS - bob_input(KokkosKernels_PREFIX "" PATH "Path to KokkosKernels install") - if (KokkosKernels_PREFIX) - if(NOT IS_ABSOLUTE ${KokkosKernels_PREFIX}) - set(KokkosKernels_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/${KokkosKernels_PREFIX}") - endif() - set(CMAKE_PREFIX_PATH ${KokkosKernels_PREFIX} ${CMAKE_PREFIX_PATH}) - endif() - set(KOKKOS_IN_TRILINOS OFF) - set(KOKKOS_EXISTING_ELSEWHERE OFF) - set(KOKKOS_BUILT_FOR_USER OFF) - set(KOKKOSKERNELS_IN_TRILINOS OFF) - set(KOKKOSKERNELS_EXISTING_ELSEWHERE OFF) - set(KOKKOSKERNELS_BUILT_FOR_USER OFF) - set(KOKKOS_MIN "3.3.01") - - if (Trilinos_PREFIX) - FIND_PACKAGE(Trilinos COMPONENTS Kokkos KokkosKernels OPTIONAL_COMPONENTS Gtest) - - LIST(REVERSE Trilinos_INCLUDE_DIRS) - LIST(REMOVE_DUPLICATES Trilinos_INCLUDE_DIRS) - LIST(REVERSE Trilinos_INCLUDE_DIRS) - - LIST(REVERSE Trilinos_LIBRARIES) - LIST(REMOVE_DUPLICATES Trilinos_LIBRARIES) - LIST(REVERSE Trilinos_LIBRARIES) - - LIST(REVERSE Trilinos_TPL_LIBRARIES) - LIST(REMOVE_DUPLICATES Trilinos_TPL_LIBRARIES) - LIST(REVERSE Trilinos_TPL_LIBRARIES) - - MESSAGE("\nFound Trilinos! Here are the details: ") - MESSAGE(" Trilinos_DIR = ${Trilinos_DIR}") - MESSAGE(" Trilinos_VERSION = ${Trilinos_VERSION}") - MESSAGE(" Trilinos_PACKAGE_LIST = ${Trilinos_PACKAGE_LIST}") - MESSAGE(" Trilinos_LIBRARIES = ${Trilinos_LIBRARIES}") - MESSAGE(" Trilinos_BIN_DIRS = ${Trilinos_BIN_DIRS}") - MESSAGE(" Trilinos_INCLUDE_DIRS = ${Trilinos_INCLUDE_DIRS}") - MESSAGE(" Trilinos_LIBRARY_DIRS = ${Trilinos_LIBRARY_DIRS}") - MESSAGE(" Trilinos_TPL_LIST = ${Trilinos_TPL_LIST}") - MESSAGE(" Trilinos_TPL_INCLUDE_DIRS = ${Trilinos_TPL_INCLUDE_DIRS}") - MESSAGE(" Trilinos_TPL_LIBRARIES = ${Trilinos_TPL_LIBRARIES}") - MESSAGE(" Trilinos_TPL_LIBRARY_DIRS = ${Trilinos_TPL_LIBRARY_DIRS}") - MESSAGE(" Trilinos_BUILD_SHARED_LIBS = ${Trilinos_BUILD_SHARED_LIBS}") - MESSAGE(" Trilinos_CXX_COMPILER_FLAGS = ${Trilinos_CXX_COMPILER_FLAGS}") - MESSAGE("End of Trilinos details\n") - - LIST(REVERSE Trilinos_INCLUDE_DIRS) - LIST(REMOVE_DUPLICATES Trilinos_INCLUDE_DIRS) - LIST(REVERSE Trilinos_INCLUDE_DIRS) - MESSAGE(" Trilinos_INCLUDE_DIRS = ${Trilinos_INCLUDE_DIRS}") - MESSAGE(" Trilinos_CXX_FLAGS = ${Trilinos_CXX_COMPILER_FLAGS}") - - IF (Trilinos_VERSION VERSION_GREATER_EQUAL "14.1") - set(CompadreKokkosPackageName "Kokkos") - ELSE () - set(CompadreKokkosPackageName "KokkosCore") - ENDIF() - LIST(FIND Trilinos_PACKAGE_LIST ${CompadreKokkosPackageName} ${CompadreKokkosPackageName}ID) - IF (${CompadreKokkosPackageName}ID GREATER -1 ) - MESSAGE(STATUS "Found ${CompadreKokkosPackageName} inside Trilinos!") - set(KOKKOS_IN_TRILINOS ON) - ELSE() - MESSAGE(FATAL_ERROR "Found Trilinos but could not find ${CompadreKokkosPackageName}.") - ENDIF() - - LIST(FIND Trilinos_PACKAGE_LIST KokkosKernels KokkosKernelsID) - IF (KokkosKernelsID GREATER -1 ) - MESSAGE(STATUS "Found KokkosKernels inside Trilinos!") - set(KOKKOSKERNELS_IN_TRILINOS ON) - set(KokkosKernels_FOUND ON) - ELSE() - MESSAGE(FATAL_ERROR "Found Trilinos but could not find KokkosKernels.") - ENDIF() - - LIST(FIND Trilinos_PACKAGE_LIST Gtest GtestID) - - if(KOKKOS_IN_TRILINOS AND NOT(KOKKOSKERNELS_IN_TRILINOS)) - MESSAGE(FATAL_ERROR "Kokkos found in Trilinos, but not KokkosKernels") - endif() - - # Check that CUDA_LAMBDA is enabled if using CUDA in Kokkos - list(FIND Kokkos_DEVICES CUDA cuda_index) - if (NOT cuda_index EQUAL -1) - list(FIND Kokkos_OPTIONS CUDA_LAMBDA cuda_lambda_index) - if (cuda_lambda_index EQUAL -1) - message(FATAL_ERROR "Please reconfigure Trilinos with -DKokkos_ENABLE_CUDA_LAMBDA:BOOL=ON") - endif() - set(Compadre_USE_CUDA ON) - endif() - - FIND_PACKAGE(Kokkos) - message(STATUS "Kokkos Version: ${Kokkos_VERSION}") - if (Kokkos_VERSION VERSION_LESS "${KOKKOS_MIN}") - message(FATAL_ERROR "${Kokkos_VERSION}: Requires Trilinos with Kokkos version ${KOKKOS_MIN} or greater") - endif() - - ENDIF() - - if (NOT KOKKOS_IN_TRILINOS) - if (KokkosCore_PREFIX STREQUAL "") - SET(KOKKOS_BUILT_FOR_USER ON) - if (APPLE) - bob_option(Kokkos_ENABLE_CUDA "Whether to use CUDA" OFF) - bob_option(Kokkos_ENABLE_OPENMP "Whether to use OPENMP" OFF) - bob_option(Kokkos_ENABLE_THREADS "Whether to use THREADS" ON) - else() - bob_option(Kokkos_ENABLE_CUDA "Whether to use CUDA" OFF) - bob_option(Kokkos_ENABLE_OPENMP "Whether to use OPENMP" ON) - bob_option(Kokkos_ENABLE_THREADS "Whether to use THREADS" OFF) - endif() - option(Kokkos_ENABLE_DEBUG "" "${Compadre_DEBUG}") - option(Kokkos_ENABLE_CUDA_UVM "" OFF) - option(Kokkos_ENABLE_DEBUG_BOUNDS_CHECK "" "${Compadre_EXTREME_DEBUG}") - option(Kokkos_ENABLE_CUDA_LAMBDA "" "${Kokkos_ENABLE_CUDA}") - option(Kokkos_ENABLE_TESTS "" OFF) - option(Kokkos_ENABLE_EXAMPLES "" OFF) - if (NOT(KokkosKernels_PREFIX STREQUAL "")) - MESSAGE(FATAL_ERROR "KokkosKernels_PREFIX specified but KokkosCore_PREFIX not specified. \ - Either provide KokkosCore_PREFIX as well, or remove KokkosKernels_PREFIX specification.") - endif() - # older version of Kokkos shipped with Compadre still uses PTHREAD naming - set(Kokkos_ENABLE_PTHREAD ${Kokkos_ENABLE_THREADS}) - # set Compadre_USE_ to use whatever Kokkos_ENABLE_ specified, since user is building Kokkos - set(Compadre_USE_CUDA ${Kokkos_ENABLE_CUDA}) - set(Kokkos_PREFIX ${CMAKE_INSTALL_PREFIX}) - else() - # Existing KokkosCore indicated by user by setting KokkosCore_PREFIX, so we look for it - # where specified (only) - find_package(Kokkos PATHS "${KokkosCore_PREFIX}" NO_DEFAULT_PATH REQUIRED) - message(STATUS "Kokkos Version: ${Kokkos_VERSION}") - if (Kokkos_VERSION VERSION_LESS "${KOKKOS_MIN}") - message(FATAL_ERROR "${Kokkos_VERSION}: Requires Kokkos version ${KOKKOS_MIN} or greater") - endif() - set(KOKKOS_EXISTING_ELSEWHERE ON) - # set Compadre_USE_ to whatever is enabled in Kokkos build - if (TARGET Kokkos::CUDA) - set(Compadre_USE_CUDA ON) - endif() - set(Kokkos_PREFIX "${KokkosCore_PREFIX}") - endif() - endif() - message(STATUS "Compadre_USE_CUDA: ${Compadre_USE_CUDA}") - - option(Kokkos_CXX_STANDARD "" "${CMAKE_CXX_STANDARD}") - - if (NOT(KOKKOS_IN_TRILINOS) AND (KokkosCore_PREFIX STREQUAL "")) - add_subdirectory(kokkos) - get_directory_property(Kokkos_VERSION DIRECTORY kokkos DEFINITION Kokkos_VERSION) - message(STATUS "Kokkos Version: ${Kokkos_VERSION}") - endif() - if(Kokkos_VERSION VERSION_LESS "3.7") - set(KOKKOS_THREADS_ARG "--kokkos-threads") - else() - set(KOKKOS_THREADS_ARG "--kokkos-num-threads") - endif() - - if (KOKKOSKERNELS_IN_TRILINOS) - if (Compadre_USE_CUDA) - list(FIND Trilinos_TPL_LIST "CUDA" CUDAID) - if (NOT(CUDAID GREATER -1)) - MESSAGE(FATAL_ERROR "Compadre_USE_CUDA set to ON, but CUDA not defined in Trilinos") - endif() - endif() - # register Trilinos so that it shows up in CompadreConfig.cmake - set(Compadre_EXT_DEPS Trilinos) - else() - if (KokkosKernels_PREFIX STREQUAL "") - SET(KOKKOSKERNELS_BUILT_FOR_USER ON) - # both are required to be sure it finds it - SET(KokkosKernels_ENABLE_EXAMPLES OFF) - SET(KokkosKernels_ENABLE_TESTS OFF) - OPTION(KokkosKernels_ETI_ONLY "" OFF) - SET(KokkosKernels_ETI_ONLY OFF) - OPTION(KokkosKernels_INST_OFFSET_SIZE_T "" OFF) - SET(KokkosKernels_INST_OFFSET_SIZE_T OFF) - OPTION(KokkosKernels_INST_OFFSET_INT "" OFF) - SET(KokkosKernels_INST_OFFSET_INT OFF) - OPTION(KokkosKernels_INST_LAYOUTLEFT "" OFF) - SET(KokkosKernels_INST_LAYOUTLEFT OFF) - OPTION(KokkosKernels_INST_LAYOUTRIGHT "" OFF) - SET(KokkosKernels_INST_LAYOUTRIGHT OFF) - OPTION(KokkosKernels_INST_DOUBLE "" OFF) - SET(KokkosKernels_INST_DOUBLE OFF) - OPTION(KokkosKernels_INST_ORDINAL_INT "" OFF) - SET(KokkosKernels_INST_ORDINAL_INT OFF) - OPTION(KokkosKernels_ENABLE_TPL_CUBLAS "" OFF) - SET(KokkosKernels_ENABLE_TPL_CUBLAS OFF) - OPTION(KokkosKernels_ENABLE_TPL_CUSPARSE "" OFF) - SET(KokkosKernels_ENABLE_TPL_CUSPARSE OFF) - OPTION(KokkosKernels_INST_MEMSPACE_CUDAUVMSPACE "" OFF) - SET(KokkosKernels_INST_MEMSPACE_CUDAUVMSPACE OFF) - OPTION(KokkosKernels_INST_EXECSPACE_THREADS "" ${Kokkos_ENABLE_THREADS}) - SET(KokkosKernels_INST_EXECSPACE_THREADS ${Kokkos_ENABLE_THREADS}) - OPTION(KokkosKernels_INST_EXECSPACE_OPENMP "" ${Kokkos_ENABLE_OPENMP}) - SET(KokkosKernels_INST_EXECSPACE_OPENMP ${Kokkos_ENABLE_OPENMP}) - add_subdirectory(kokkos-kernels) - if (NOT(KokkosCore_PREFIX STREQUAL "")) - MESSAGE(FATAL_ERROR "KokkosCore_PREFIX specified but KokkosKernels_PREFIX not specified. \ - Either provide KokkosKernels_PREFIX as well, or remove KokkosCore_PREFIX specification.") - endif() - set(KokkosKernels_PREFIX ${CMAKE_INSTALL_PREFIX}) - else() - # Existing KokkosCore indicated by user by setting KokkosCore_PREFIX, so we look for it - # where specified (only) - find_package(KokkosKernels PATHS "${KokkosKernels_PREFIX}" NO_DEFAULT_PATH REQUIRED) - if(Compadre_USE_CUDA AND NOT(TARGET Kokkos::CUDA)) - MESSAGE(FATAL_ERROR "Compadre_USE_CUDA set to ON, but Kokkos::CUDA not defined") - endif() - set(KOKKOSKERNELS_EXISTING_ELSEWHERE ON) - endif() - # register Kokkos and KokkosKernels so that they show up in CompadreConfig.cmake - set(Compadre_EXT_DEPS Kokkos KokkosKernels) - endif() - - - - #MPI (Not really needed, only used so that if a kokkos-tool was built with MPI, it won't segfault) - if (Compadre_USE_MPI) - FIND_PACKAGE(MPI QUIET) - bob_option(Compadre_USE_MPI "Use MPI for parallelism" ${MPI_CXX_FOUND}) - message(STATUS "MPI Enabled: ${MPI_CXX_FOUND}") - if (MPI_CXX_FOUND) - MESSAGE(STATUS "MPI_CXX_INCLUDE_PATH: ${MPI_CXX_INCLUDE_PATH}") - MESSAGE(STATUS "MPI_CXX_LIBRARIES: ${MPI_CXX_LIBRARIES}") - endif() - endif (Compadre_USE_MPI) - - - - ########## - # - # - # OPTIONS - # - # - ########## - - - - bob_option(Compadre_TESTS "Compile Compadre tests" ON) - bob_option(Compadre_EXAMPLES "Compile Compadre examples" "${Compadre_TESTS}") - bob_option(Compadre_COVERAGE "Use code coverage" OFF) - - -endif() - -########## -# -# -# PREPROCESSOR DEFINES FOR USE WHEN BUILDING CODE -# -# -########## - - -set(Compadre_CXX_FLAGS "${CMAKE_CXX_FLAGS}") -set(Compadre_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") - -set(Compadre_KEY_BOOLS - Compadre_DEBUG - Compadre_EXTREME_DEBUG - Compadre_USE_CUDA - Compadre_USE_MPI - Compadre_USE_PYTHON - PYTHON_CALLING_BUILD - ) - -set(Compadre_KEY_INTS - Compadre_VERSION_MAJOR - Compadre_VERSION_MINOR - Compadre_VERSION_PATCH - ) - -set(Compadre_KEY_STRINGS - Compadre_SEMVER - Compadre_COMMIT - Compadre_CXX_FLAGS - Compadre_CMAKE_ARGS - Compadre_INSTALL_PREFIX -) - -if (${PROJECT_NAME}_TRIBITS_DIR) # TriBITS CMake Project - - # - # C) Add the libraries, tests, and examples - # - - add_subdirectory(src) - tribits_add_test_directories(examples) - - # - # D) Do standard postprocessing - # - - tribits_package_postprocess() - -else() # Raw CMake Project - - if (NOT(PYTHON_CALLING_BUILD)) - bob_get_commit() - bob_get_semver() - endif() - - ########## - # - # - # COMPADRE LIBRARIES - # - # - ########## - - if (Compadre_COVERAGE) - list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") - include(CodeCoverage) - append_coverage_compiler_flags() - setup_target_for_coverage_lcov( - NAME coverage - EXECUTABLE ctest - EXCLUDE "/Library/*" "${PROJECT_SOURCE_DIR}/kokkos/*" - "${PROJECT_SOURCE_DIR}/kokkos-kernels/*" - "${PROJECT_SOURCE_DIR}/pycompadre/*") - endif() - - - # compadre library - add_subdirectory(src) - - if (Compadre_EXAMPLES AND Compadre_TESTS) - if (NOT Trilinos_PREFIX) - if (NOT TARGET gtest) - # gtest from kokkos - add_library(gtest - kokkos/tpls/gtest/gtest/gtest-all.cc - ) - target_include_directories(gtest PUBLIC kokkos/tpls/gtest) - endif() - endif() - endif() - - if(Compadre_EXAMPLES) - add_subdirectory(examples) - endif() - - if(Compadre_USE_PYTHON) - set(CMAKE_POLICY_DEFAULT_CMP0127 OLD) - if (CMAKE_CXX_COMPILER_ID STREQUAL "XL") - MESSAGE(FATAL_ERROR " - IBM XL compiler not supported for pybind11. - Set Compadre_USE_PYTHON:BOOL=OFF or switch compilers. - ") - endif() - add_subdirectory(pycompadre/pybind11) - if (${PYTHON_VERSION} VERSION_LESS "3.6") - MESSAGE(FATAL_ERROR " - Compadre_USE_PYTHON:BOOL=ON but Python version <3.6 is not supported. - ") - endif() - pybind11_add_module(_pycompadre pycompadre/pycompadre.cpp) - target_link_libraries(_pycompadre PUBLIC compadre) - if (PYTHON_CALLING_BUILD) - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pycompadre/__init__.py.in" "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" COPYONLY) - else() - set_target_properties(_pycompadre PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/pycompadre") - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pycompadre/__init__.py.in" "${CMAKE_CURRENT_BINARY_DIR}/pycompadre/__init__.py" COPYONLY) - endif() - set(CMAKE_POLICY_DEFAULT_CMP0127 NEW) - endif() - - - if (Trilinos_PREFIX) - bob_end_package_no_recurse("${Trilinos_LIBRARIES}") - else() - bob_end_package() - endif() -endif() - -## print variables beginning with some string -#function (getListOfVarsStartingWith _prefix _varResult) -# get_cmake_property(_vars VARIABLES) -# string (REGEX MATCHALL "(^|;)${_prefix}[A-Za-z0-9_]*" _matchedVars "${_vars}") -# set (${_varResult} ${_matchedVars} PARENT_SCOPE) -#endfunction() -#getListOfVarsStartingWith("SomeString" matchedVars) -#foreach (_var IN LISTS matchedVars) -# message("${_var}=${${_var}}") -#endforeach() +CMAKE_MINIMUM_REQUIRED(VERSION 3.16.0 FATAL_ERROR) + +# get Compadre_VERSION +file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/cmake/Compadre_Version.txt Compadre_VERSION) + +# Called at the top of every CMakeLists.txt file +macro(include_tribits_build) + if (${PROJECT_NAME}_TRIBITS_DIR) + include("${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.tribits.cmake") + return() + endif() +endmacro() + +# cmake helper functions +include(${CMAKE_CURRENT_LIST_DIR}/cmake/bob.cmake) + +if (${PROJECT_NAME}_TRIBITS_DIR) # TriBITS CMake Project + + # + # A) Define the package + # + + tribits_package(Compadre) + + # + # B) Set up package-specific options + # + TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_DEBUG + Compadre_DEBUG + "Enable debug code in compadre" + ${Trilinos_ENABLE_DEBUG} ) + + TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_EXTREME_DEBUG + Compadre_EXTREME_DEBUG + "Enable extreme debug code in compadre" + OFF ) + + if ("${TPL_ENABLE_CUDA}" STREQUAL "ON") + set(Compadre_USE_CUDA ON CACHE BOOL "Whether to use CUDA") + else () + set(Compadre_USE_CUDA OFF CACHE BOOL "Whether to use CUDA") + endif() + + set(Compadre_USE_MATLAB OFF CACHE BOOL "Don't use Matlab when building in Trilinos") + set(Compadre_USE_MPI ${TPL_ENABLE_MPI} CACHE BOOL "Use MPI for parallelism") + set(Compadre_USE_PYTHON OFF CACHE BOOL "Don't use Python when building in Trilinos") + + # breakdown Compadre_VERSION from Version.cmake for storage in Compadre_Config.h + string(REPLACE "." ";" VLIST ${Compadre_VERSION}) + list(GET VLIST 0 Compadre_VERSION_MAJOR) + list(GET VLIST 1 Compadre_VERSION_MINOR) + list(GET VLIST 2 Compadre_VERSION_PATCH) + +else() # Raw CMake Project + + ########## + # + # Compadre Details + # + ########## + + # Disable in-source builds to prevent source tree corruption. + if( "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}" ) + message( FATAL_ERROR "FATAL: In-source builds are not allowed. You should create a separate directory for build files and delete CMakeCache.txt." ) + endif() + + PROJECT(Compadre VERSION ${Compadre_VERSION} LANGUAGES CXX) + if (NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 17) + endif() + set(CMAKE_DISABLE_SOURCE_CHANGES ON) + set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) + set(CMAKE_POLICY_DEFAULT_CMP0128 OLD) + set(CMAKE_CXX_EXTENSIONS OFF) + + get_directory_property(Compadre_HAS_PARENT PARENT_DIRECTORY) + + if (NOT Compadre_HAS_PARENT) + include(GNUInstallDirs) + endif() + + bob_begin_package() + + # Set to OFF for significantly faster performance and ON for error tracking + bob_option(Compadre_EXTREME_DEBUG "Run Compadre Toolkit in EXTREME DEBUG mode" OFF) + bob_option(Compadre_DEBUG "Run Compadre Toolkit in DEBUG mode" ON) + if (Compadre_EXTREME_DEBUG) + set(Compadre_DEBUG ON) + message(STATUS "Compadre_DEBUG: ON (because Compadre_EXTREME_DEBUG is ON)") + endif() + + # RPATH related settings + # https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling + SET(CMAKE_SKIP_BUILD_RPATH FALSE) + SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + SET(CMAKE_INSTALL_RPATH "../${CMAKE_INSTALL_LIBDIR}") + + # RPATH should always include the folder it is called from + bob_option(PYTHON_CALLING_BUILD "Python setuptools calling build" OFF) + bob_option(Compadre_USE_PYTHON "Use PYTHON" OFF) + bob_option(Compadre_USE_MATLAB "Use MATLAB interface for PYTHON" OFF) + bob_option(Compadre_USE_MPI "Use MPI (not needed for Compadre toolkit)" OFF) + set(PYTHON_LIBRARY_PREFIX "..") # relative to examples folder + bob_input(Python3_EXECUTABLE "" PATH "Python executable location") + IF(NOT(Python3_EXECUTABLE)) + MESSAGE(STATUS "Python executable location Python3_EXECUTABLE not given. Search made using 'which python'") + EXECUTE_PROCESS( + COMMAND which "python" + OUTPUT_VARIABLE Python3_EXECUTABLE + OUTPUT_STRIP_TRAILING_WHITESPACE ) + ENDIF() + MESSAGE(STATUS "Python3_EXECUTABLE: ${Python3_EXECUTABLE}") + if (Compadre_USE_PYTHON) + # change RPATH for a flat directory structure + # when installing pycompadre as Python package + if (PYTHON_CALLING_BUILD) + if (APPLE) + SET(CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} "@loader_path/") + SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} "@loader_path/") + else() + SET(CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} "$ORIGIN/") + SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} "$ORIGIN/") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,origin") + endif() + endif() + endif() + + + + ########## + # + # + # TPLS + # + # Three choices for providing TPLs: + # + # a.) None + # - Trilinos_PREFIX, KokkosCore_PREFIX, and KokkosKernels_PREFIX + # not specified + # b.) Trilinos installation with Kokkos AND KokkosKernels + # - Trilinos_PREFIX specified + # c.) Kokkos AND KokkosKernels standalone installations + # - KokkosCore_PREFIX and KokkosKernels_PREFIX specified + # + # For option a, vendored Kokkos and KokkosKernels built for user + # + ########## + + + + #TRILINOS + bob_input(Trilinos_PREFIX "" PATH "Path to Trilinos install") + if (Trilinos_PREFIX) + if(NOT IS_ABSOLUTE ${Trilinos_PREFIX}) + set(Trilinos_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/${Trilinos_PREFIX}") + endif() + set(CMAKE_PREFIX_PATH ${Trilinos_PREFIX} ${CMAKE_PREFIX_PATH}) + endif() + + #KOKKOS + bob_input(KokkosCore_PREFIX "" PATH "Path to KokkosCore install") + if (KokkosCore_PREFIX) + if(NOT IS_ABSOLUTE ${KokkosCore_PREFIX}) + set(KokkosCore_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/${KokkosCore_PREFIX}") + endif() + set(CMAKE_PREFIX_PATH ${KokkosCore_PREFIX} ${CMAKE_PREFIX_PATH}) + endif() + + #KOKKOS-KERNELS + bob_input(KokkosKernels_PREFIX "" PATH "Path to KokkosKernels install") + if (KokkosKernels_PREFIX) + if(NOT IS_ABSOLUTE ${KokkosKernels_PREFIX}) + set(KokkosKernels_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/${KokkosKernels_PREFIX}") + endif() + set(CMAKE_PREFIX_PATH ${KokkosKernels_PREFIX} ${CMAKE_PREFIX_PATH}) + endif() + set(KOKKOS_IN_TRILINOS OFF) + set(KOKKOS_EXISTING_ELSEWHERE OFF) + set(KOKKOS_BUILT_FOR_USER OFF) + set(KOKKOSKERNELS_IN_TRILINOS OFF) + set(KOKKOSKERNELS_EXISTING_ELSEWHERE OFF) + set(KOKKOSKERNELS_BUILT_FOR_USER OFF) + set(KOKKOS_MIN "3.3.01") + + if (Trilinos_PREFIX) + FIND_PACKAGE(Trilinos COMPONENTS Kokkos KokkosKernels OPTIONAL_COMPONENTS Gtest) + + LIST(REVERSE Trilinos_INCLUDE_DIRS) + LIST(REMOVE_DUPLICATES Trilinos_INCLUDE_DIRS) + LIST(REVERSE Trilinos_INCLUDE_DIRS) + + LIST(REVERSE Trilinos_LIBRARIES) + LIST(REMOVE_DUPLICATES Trilinos_LIBRARIES) + LIST(REVERSE Trilinos_LIBRARIES) + + LIST(REVERSE Trilinos_TPL_LIBRARIES) + LIST(REMOVE_DUPLICATES Trilinos_TPL_LIBRARIES) + LIST(REVERSE Trilinos_TPL_LIBRARIES) + + MESSAGE("\nFound Trilinos! Here are the details: ") + MESSAGE(" Trilinos_DIR = ${Trilinos_DIR}") + MESSAGE(" Trilinos_VERSION = ${Trilinos_VERSION}") + MESSAGE(" Trilinos_PACKAGE_LIST = ${Trilinos_PACKAGE_LIST}") + MESSAGE(" Trilinos_LIBRARIES = ${Trilinos_LIBRARIES}") + MESSAGE(" Trilinos_BIN_DIRS = ${Trilinos_BIN_DIRS}") + MESSAGE(" Trilinos_INCLUDE_DIRS = ${Trilinos_INCLUDE_DIRS}") + MESSAGE(" Trilinos_LIBRARY_DIRS = ${Trilinos_LIBRARY_DIRS}") + MESSAGE(" Trilinos_TPL_LIST = ${Trilinos_TPL_LIST}") + MESSAGE(" Trilinos_TPL_INCLUDE_DIRS = ${Trilinos_TPL_INCLUDE_DIRS}") + MESSAGE(" Trilinos_TPL_LIBRARIES = ${Trilinos_TPL_LIBRARIES}") + MESSAGE(" Trilinos_TPL_LIBRARY_DIRS = ${Trilinos_TPL_LIBRARY_DIRS}") + MESSAGE(" Trilinos_BUILD_SHARED_LIBS = ${Trilinos_BUILD_SHARED_LIBS}") + MESSAGE(" Trilinos_CXX_COMPILER_FLAGS = ${Trilinos_CXX_COMPILER_FLAGS}") + MESSAGE("End of Trilinos details\n") + + LIST(REVERSE Trilinos_INCLUDE_DIRS) + LIST(REMOVE_DUPLICATES Trilinos_INCLUDE_DIRS) + LIST(REVERSE Trilinos_INCLUDE_DIRS) + MESSAGE(" Trilinos_INCLUDE_DIRS = ${Trilinos_INCLUDE_DIRS}") + MESSAGE(" Trilinos_CXX_FLAGS = ${Trilinos_CXX_COMPILER_FLAGS}") + + IF (Trilinos_VERSION VERSION_GREATER_EQUAL "14.1") + set(CompadreKokkosPackageName "Kokkos") + ELSE () + set(CompadreKokkosPackageName "KokkosCore") + ENDIF() + LIST(FIND Trilinos_PACKAGE_LIST ${CompadreKokkosPackageName} ${CompadreKokkosPackageName}ID) + IF (${CompadreKokkosPackageName}ID GREATER -1 ) + MESSAGE(STATUS "Found ${CompadreKokkosPackageName} inside Trilinos!") + set(KOKKOS_IN_TRILINOS ON) + ELSE() + MESSAGE(FATAL_ERROR "Found Trilinos but could not find ${CompadreKokkosPackageName}.") + ENDIF() + + LIST(FIND Trilinos_PACKAGE_LIST KokkosKernels KokkosKernelsID) + IF (KokkosKernelsID GREATER -1 ) + MESSAGE(STATUS "Found KokkosKernels inside Trilinos!") + set(KOKKOSKERNELS_IN_TRILINOS ON) + set(KokkosKernels_FOUND ON) + ELSE() + MESSAGE(FATAL_ERROR "Found Trilinos but could not find KokkosKernels.") + ENDIF() + + LIST(FIND Trilinos_PACKAGE_LIST Gtest GtestID) + + if(KOKKOS_IN_TRILINOS AND NOT(KOKKOSKERNELS_IN_TRILINOS)) + MESSAGE(FATAL_ERROR "Kokkos found in Trilinos, but not KokkosKernels") + endif() + + # Check that CUDA_LAMBDA is enabled if using CUDA in Kokkos + list(FIND Kokkos_DEVICES CUDA cuda_index) + if (NOT cuda_index EQUAL -1) + list(FIND Kokkos_OPTIONS CUDA_LAMBDA cuda_lambda_index) + if (cuda_lambda_index EQUAL -1) + message(FATAL_ERROR "Please reconfigure Trilinos with -DKokkos_ENABLE_CUDA_LAMBDA:BOOL=ON") + endif() + set(Compadre_USE_CUDA ON) + endif() + + FIND_PACKAGE(Kokkos) + message(STATUS "Kokkos Version: ${Kokkos_VERSION}") + if (Kokkos_VERSION VERSION_LESS "${KOKKOS_MIN}") + message(FATAL_ERROR "${Kokkos_VERSION}: Requires Trilinos with Kokkos version ${KOKKOS_MIN} or greater") + endif() + + ENDIF() + + if (NOT KOKKOS_IN_TRILINOS) + if (KokkosCore_PREFIX STREQUAL "") + SET(KOKKOS_BUILT_FOR_USER ON) + if (APPLE) + bob_option(Kokkos_ENABLE_CUDA "Whether to use CUDA" OFF) + bob_option(Kokkos_ENABLE_OPENMP "Whether to use OPENMP" OFF) + bob_option(Kokkos_ENABLE_THREADS "Whether to use THREADS" ON) + else() + bob_option(Kokkos_ENABLE_CUDA "Whether to use CUDA" OFF) + bob_option(Kokkos_ENABLE_OPENMP "Whether to use OPENMP" ON) + bob_option(Kokkos_ENABLE_THREADS "Whether to use THREADS" OFF) + endif() + option(Kokkos_ENABLE_DEBUG "" "${Compadre_DEBUG}") + option(Kokkos_ENABLE_CUDA_UVM "" OFF) + option(Kokkos_ENABLE_DEBUG_BOUNDS_CHECK "" "${Compadre_EXTREME_DEBUG}") + option(Kokkos_ENABLE_CUDA_LAMBDA "" "${Kokkos_ENABLE_CUDA}") + option(Kokkos_ENABLE_TESTS "" OFF) + option(Kokkos_ENABLE_EXAMPLES "" OFF) + if (NOT(KokkosKernels_PREFIX STREQUAL "")) + MESSAGE(FATAL_ERROR "KokkosKernels_PREFIX specified but KokkosCore_PREFIX not specified. \ + Either provide KokkosCore_PREFIX as well, or remove KokkosKernels_PREFIX specification.") + endif() + # older version of Kokkos shipped with Compadre still uses PTHREAD naming + set(Kokkos_ENABLE_PTHREAD ${Kokkos_ENABLE_THREADS}) + # set Compadre_USE_ to use whatever Kokkos_ENABLE_ specified, since user is building Kokkos + set(Compadre_USE_CUDA ${Kokkos_ENABLE_CUDA}) + set(Kokkos_PREFIX ${CMAKE_INSTALL_PREFIX}) + else() + # Existing KokkosCore indicated by user by setting KokkosCore_PREFIX, so we look for it + # where specified (only) + find_package(Kokkos PATHS "${KokkosCore_PREFIX}" NO_DEFAULT_PATH REQUIRED) + message(STATUS "Kokkos Version: ${Kokkos_VERSION}") + if (Kokkos_VERSION VERSION_LESS "${KOKKOS_MIN}") + message(FATAL_ERROR "${Kokkos_VERSION}: Requires Kokkos version ${KOKKOS_MIN} or greater") + endif() + set(KOKKOS_EXISTING_ELSEWHERE ON) + # set Compadre_USE_ to whatever is enabled in Kokkos build + if (TARGET Kokkos::CUDA) + set(Compadre_USE_CUDA ON) + endif() + set(Kokkos_PREFIX "${KokkosCore_PREFIX}") + endif() + endif() + message(STATUS "Compadre_USE_CUDA: ${Compadre_USE_CUDA}") + + option(Kokkos_CXX_STANDARD "" "${CMAKE_CXX_STANDARD}") + + if (NOT(KOKKOS_IN_TRILINOS) AND (KokkosCore_PREFIX STREQUAL "")) + add_subdirectory(kokkos) + get_directory_property(Kokkos_VERSION DIRECTORY kokkos DEFINITION Kokkos_VERSION) + message(STATUS "Kokkos Version: ${Kokkos_VERSION}") + endif() + if(Kokkos_VERSION VERSION_LESS "3.7") + set(KOKKOS_THREADS_ARG "--kokkos-threads") + else() + set(KOKKOS_THREADS_ARG "--kokkos-num-threads") + endif() + + if (KOKKOSKERNELS_IN_TRILINOS) + if (Compadre_USE_CUDA) + list(FIND Trilinos_TPL_LIST "CUDA" CUDAID) + if (NOT(CUDAID GREATER -1)) + MESSAGE(FATAL_ERROR "Compadre_USE_CUDA set to ON, but CUDA not defined in Trilinos") + endif() + endif() + # register Trilinos so that it shows up in CompadreConfig.cmake + set(Compadre_EXT_DEPS Trilinos) + else() + if (KokkosKernels_PREFIX STREQUAL "") + SET(KOKKOSKERNELS_BUILT_FOR_USER ON) + # both are required to be sure it finds it + SET(KokkosKernels_ENABLE_EXAMPLES OFF) + SET(KokkosKernels_ENABLE_TESTS OFF) + OPTION(KokkosKernels_ETI_ONLY "" OFF) + SET(KokkosKernels_ETI_ONLY OFF) + OPTION(KokkosKernels_INST_OFFSET_SIZE_T "" OFF) + SET(KokkosKernels_INST_OFFSET_SIZE_T OFF) + OPTION(KokkosKernels_INST_OFFSET_INT "" OFF) + SET(KokkosKernels_INST_OFFSET_INT OFF) + OPTION(KokkosKernels_INST_LAYOUTLEFT "" OFF) + SET(KokkosKernels_INST_LAYOUTLEFT OFF) + OPTION(KokkosKernels_INST_LAYOUTRIGHT "" OFF) + SET(KokkosKernels_INST_LAYOUTRIGHT OFF) + OPTION(KokkosKernels_INST_DOUBLE "" OFF) + SET(KokkosKernels_INST_DOUBLE OFF) + OPTION(KokkosKernels_INST_ORDINAL_INT "" OFF) + SET(KokkosKernels_INST_ORDINAL_INT OFF) + OPTION(KokkosKernels_ENABLE_TPL_CUBLAS "" OFF) + SET(KokkosKernels_ENABLE_TPL_CUBLAS OFF) + OPTION(KokkosKernels_ENABLE_TPL_CUSPARSE "" OFF) + SET(KokkosKernels_ENABLE_TPL_CUSPARSE OFF) + OPTION(KokkosKernels_INST_MEMSPACE_CUDAUVMSPACE "" OFF) + SET(KokkosKernels_INST_MEMSPACE_CUDAUVMSPACE OFF) + OPTION(KokkosKernels_INST_EXECSPACE_THREADS "" ${Kokkos_ENABLE_THREADS}) + SET(KokkosKernels_INST_EXECSPACE_THREADS ${Kokkos_ENABLE_THREADS}) + OPTION(KokkosKernels_INST_EXECSPACE_OPENMP "" ${Kokkos_ENABLE_OPENMP}) + SET(KokkosKernels_INST_EXECSPACE_OPENMP ${Kokkos_ENABLE_OPENMP}) + add_subdirectory(kokkos-kernels) + if (NOT(KokkosCore_PREFIX STREQUAL "")) + MESSAGE(FATAL_ERROR "KokkosCore_PREFIX specified but KokkosKernels_PREFIX not specified. \ + Either provide KokkosKernels_PREFIX as well, or remove KokkosCore_PREFIX specification.") + endif() + set(KokkosKernels_PREFIX ${CMAKE_INSTALL_PREFIX}) + else() + # Existing KokkosCore indicated by user by setting KokkosCore_PREFIX, so we look for it + # where specified (only) + find_package(KokkosKernels PATHS "${KokkosKernels_PREFIX}" NO_DEFAULT_PATH REQUIRED) + if(Compadre_USE_CUDA AND NOT(TARGET Kokkos::CUDA)) + MESSAGE(FATAL_ERROR "Compadre_USE_CUDA set to ON, but Kokkos::CUDA not defined") + endif() + set(KOKKOSKERNELS_EXISTING_ELSEWHERE ON) + endif() + # register Kokkos and KokkosKernels so that they show up in CompadreConfig.cmake + set(Compadre_EXT_DEPS Kokkos KokkosKernels) + endif() + + + + #MPI (Not really needed, only used so that if a kokkos-tool was built with MPI, it won't segfault) + if (Compadre_USE_MPI) + FIND_PACKAGE(MPI QUIET) + bob_option(Compadre_USE_MPI "Use MPI for parallelism" ${MPI_CXX_FOUND}) + message(STATUS "MPI Enabled: ${MPI_CXX_FOUND}") + if (MPI_CXX_FOUND) + MESSAGE(STATUS "MPI_CXX_INCLUDE_PATH: ${MPI_CXX_INCLUDE_PATH}") + MESSAGE(STATUS "MPI_CXX_LIBRARIES: ${MPI_CXX_LIBRARIES}") + endif() + endif (Compadre_USE_MPI) + + + + ########## + # + # + # OPTIONS + # + # + ########## + + + + bob_option(Compadre_TESTS "Compile Compadre tests" ON) + bob_option(Compadre_EXAMPLES "Compile Compadre examples" "${Compadre_TESTS}") + bob_option(Compadre_COVERAGE "Use code coverage" OFF) + + +endif() + +########## +# +# +# PREPROCESSOR DEFINES FOR USE WHEN BUILDING CODE +# +# +########## + + +set(Compadre_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +set(Compadre_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +set(Compadre_KEY_BOOLS + Compadre_DEBUG + Compadre_EXTREME_DEBUG + Compadre_USE_CUDA + Compadre_USE_MPI + Compadre_USE_PYTHON + PYTHON_CALLING_BUILD + ) + +set(Compadre_KEY_INTS + Compadre_VERSION_MAJOR + Compadre_VERSION_MINOR + Compadre_VERSION_PATCH + ) + +set(Compadre_KEY_STRINGS + Compadre_SEMVER + Compadre_COMMIT + Compadre_CXX_FLAGS + Compadre_CMAKE_ARGS + Compadre_INSTALL_PREFIX +) + +if (${PROJECT_NAME}_TRIBITS_DIR) # TriBITS CMake Project + + # + # C) Add the libraries, tests, and examples + # + + add_subdirectory(src) + tribits_add_test_directories(examples) + + # + # D) Do standard postprocessing + # + + tribits_package_postprocess() + +else() # Raw CMake Project + + if (NOT(PYTHON_CALLING_BUILD)) + bob_get_commit() + bob_get_semver() + endif() + + ########## + # + # + # COMPADRE LIBRARIES + # + # + ########## + + if (Compadre_COVERAGE) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") + include(CodeCoverage) + append_coverage_compiler_flags() + setup_target_for_coverage_lcov( + NAME coverage + EXECUTABLE ctest + EXCLUDE "/Library/*" "${PROJECT_SOURCE_DIR}/kokkos/*" + "${PROJECT_SOURCE_DIR}/kokkos-kernels/*" + "${PROJECT_SOURCE_DIR}/pycompadre/*") + endif() + + + # compadre library + add_subdirectory(src) + + if (Compadre_EXAMPLES AND Compadre_TESTS) + if (NOT Trilinos_PREFIX) + if (NOT TARGET gtest) + # gtest from kokkos + add_library(gtest + kokkos/tpls/gtest/gtest/gtest-all.cc + ) + target_include_directories(gtest PUBLIC kokkos/tpls/gtest) + endif() + endif() + endif() + + if(Compadre_EXAMPLES) + add_subdirectory(examples) + endif() + + if(Compadre_USE_PYTHON) + set(CMAKE_POLICY_DEFAULT_CMP0127 OLD) + if (CMAKE_CXX_COMPILER_ID STREQUAL "XL") + MESSAGE(FATAL_ERROR " + IBM XL compiler not supported for pybind11. + Set Compadre_USE_PYTHON:BOOL=OFF or switch compilers. + ") + endif() + add_subdirectory(pycompadre/pybind11) + if (${PYTHON_VERSION} VERSION_LESS "3.6") + MESSAGE(FATAL_ERROR " + Compadre_USE_PYTHON:BOOL=ON but Python version <3.6 is not supported. + ") + endif() + pybind11_add_module(_pycompadre pycompadre/pycompadre.cpp) + target_link_libraries(_pycompadre PUBLIC compadre) + if (PYTHON_CALLING_BUILD) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pycompadre/__init__.py.in" "${CMAKE_CURRENT_BINARY_DIR}/__init__.py" COPYONLY) + else() + set_target_properties(_pycompadre PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/pycompadre") + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/pycompadre/__init__.py.in" "${CMAKE_CURRENT_BINARY_DIR}/pycompadre/__init__.py" COPYONLY) + endif() + set(CMAKE_POLICY_DEFAULT_CMP0127 NEW) + endif() + + + if (Trilinos_PREFIX) + bob_end_package_no_recurse("${Trilinos_LIBRARIES}") + else() + bob_end_package() + endif() +endif() + +## print variables beginning with some string +#function (getListOfVarsStartingWith _prefix _varResult) +# get_cmake_property(_vars VARIABLES) +# string (REGEX MATCHALL "(^|;)${_prefix}[A-Za-z0-9_]*" _matchedVars "${_vars}") +# set (${_varResult} ${_matchedVars} PARENT_SCOPE) +#endfunction() +#getListOfVarsStartingWith("SomeString" matchedVars) +#foreach (_var IN LISTS matchedVars) +# message("${_var}=${${_var}}") +#endforeach() diff --git a/packages/compadre/examples/CMakeLists.tribits.cmake b/packages/compadre/examples/CMakeLists.tribits.cmake index 523f31cae25d..3542e6a08425 100644 --- a/packages/compadre/examples/CMakeLists.tribits.cmake +++ b/packages/compadre/examples/CMakeLists.tribits.cmake @@ -518,7 +518,7 @@ if (NOT(Compadre_DEBUG OR Compadre_EXTREME_DEBUG)) # This test is too slow in DEBUG (3x longer than all other tests # combined) - if (PYTHON_EXECUTABLE) + if (Python3_EXECUTABLE) # Python driven test of a C++ executable (Python changes command line # arguments given to executable) configure_file( @@ -529,7 +529,7 @@ if (NOT(Compadre_DEBUG OR Compadre_EXTREME_DEBUG)) set(testName GMLS_Manifold_Multiple_Evaluation_Sites) TRIBITS_ADD_ADVANCED_TEST( ${testName} - TEST_0 CMND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold_Multiple_Evaluation_Sites.py --porder=3 --grids=3 --in-trilinos=True + TEST_0 CMND ${Python3_EXECUTABLE} ARGS ${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold_Multiple_Evaluation_Sites.py --porder=3 --grids=3 --in-trilinos=True PASS_REGULAR_EXPRESSION "Passed." COMM mpi serial ADDED_TEST_NAME_OUT ${testName}_CREATED @@ -546,7 +546,7 @@ if (NOT(Compadre_DEBUG OR Compadre_EXTREME_DEBUG)) $ ) endif() # test created - endif() # PYTHON_EXECUTABLE + endif() # Python3_EXECUTABLE # Divergence-free basis test for GMLS on non-manifold # Note: QR is needed to be used here due to the null space introduced @@ -634,7 +634,7 @@ if (NOT(Compadre_DEBUG OR Compadre_EXTREME_DEBUG)) #endif() # test created endif() # not debug -if (PYTHON_EXECUTABLE) +if (Python3_EXECUTABLE) # Python driven test of a C++ executable (Python changes command line # arguments given to executable) - calling QR solver configure_file( @@ -645,7 +645,7 @@ if (PYTHON_EXECUTABLE) set(testName GMLS_Manifold_Refinement_Study_QR) TRIBITS_ADD_ADVANCED_TEST( ${testName} - TEST_0 CMND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold.py --porder=3 --grids=4 --solver-type=QR --in-trilinos=True + TEST_0 CMND ${Python3_EXECUTABLE} ARGS ${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold.py --porder=3 --grids=4 --solver-type=QR --in-trilinos=True PASS_REGULAR_EXPRESSION "Passed." COMM mpi serial ADDED_TEST_NAME_OUT ${testName}_CREATED @@ -668,7 +668,7 @@ if (PYTHON_EXECUTABLE) set(testName GMLS_Manifold_Refinement_Study_LU) TRIBITS_ADD_ADVANCED_TEST( ${testName} - TEST_0 CMND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold.py --porder=3 --grids=4 --solver-type=LU --in-trilinos=True + TEST_0 CMND ${Python3_EXECUTABLE} ARGS ${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold.py --porder=3 --grids=4 --solver-type=LU --in-trilinos=True PASS_REGULAR_EXPRESSION "Passed." COMM mpi serial ADDED_TEST_NAME_OUT ${testName}_CREATED @@ -698,7 +698,7 @@ if (PYTHON_EXECUTABLE) set(testName GMLS_Staggered_Manifold_Refinement_Study) TRIBITS_ADD_ADVANCED_TEST( ${testName} - TEST_0 CMND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_BINARY_DIR}/GMLS_Staggered_Manifold.py --porder=3 --grids=4 --in-trilinos=True + TEST_0 CMND ${Python3_EXECUTABLE} ARGS ${CMAKE_CURRENT_BINARY_DIR}/GMLS_Staggered_Manifold.py --porder=3 --grids=4 --in-trilinos=True PASS_REGULAR_EXPRESSION "Passed." COMM mpi serial ADDED_TEST_NAME_OUT ${testName}_CREATED @@ -715,7 +715,7 @@ if (PYTHON_EXECUTABLE) $ ) endif() # test created -endif() # PYTHON_EXECUTABLE +endif() # Python3_EXECUTABLE # Utility test - Filter By ID set(testName Test_Utilities) diff --git a/packages/compadre/examples/CMakeLists.txt b/packages/compadre/examples/CMakeLists.txt index a7d73faca892..f2f080d5d31d 100644 --- a/packages/compadre/examples/CMakeLists.txt +++ b/packages/compadre/examples/CMakeLists.txt @@ -125,10 +125,10 @@ if (Compadre_EXAMPLES) # Multisite manifold test for GMLS #ADD_TEST(NAME GMLS_Manifold_MultiSite COMMAND ${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold_MultiSite_Test "3" "4" "${KOKKOS_THREADS_ARG}=2") #SET_TESTS_PROPERTIES(GMLS_Manifold_MultiSite PROPERTIES LABELS "IntegrationTest;integration;kokkos;multi;manifold" TIMEOUT 10) - if (PYTHON_EXECUTABLE) + if (Python3_EXECUTABLE) # Python driven test of a C++ executable (Python changes command line arguments given to executable) CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/GMLS_Manifold_Multiple_Evaluation_Sites.py.in" "${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold_Multiple_Evaluation_Sites.py" @ONLY) - ADD_TEST(NAME GMLS_Manifold_MultiSite_Refinement_Study COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold_Multiple_Evaluation_Sites.py" "--porder=3" "--grids=3") + ADD_TEST(NAME GMLS_Manifold_MultiSite_Refinement_Study COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold_Multiple_Evaluation_Sites.py" "--porder=3" "--grids=3") SET_TESTS_PROPERTIES(GMLS_Manifold_MultiSite_Refinement_Study PROPERTIES LABELS "ConvergenceTest;convergence;manifold" @@ -136,7 +136,7 @@ if (Compadre_EXAMPLES) REQUIRED_FILES $ ) - endif() # PYTHON_EXECUTABLE + endif() # Python3_EXECUTABLE # Divergence-free basis test for GMLS on non-manifold ADD_TEST(NAME GMLS_DivergenceFree_Dim3_P3_QR COMMAND ${CMAKE_CURRENT_BINARY_DIR}/GMLS_Divergence_Test "--p" "3" "--nt" "200" "--d" "3" "${KOKKOS_THREADS_ARG}=2") @@ -154,10 +154,10 @@ if (Compadre_EXAMPLES) # ADD_TEST(NAME GMLS_Manifold_Dim3 COMMAND ${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold_Test "4" "200" "3" "1" "0" "0" "${KOKKOS_THREADS_ARG}=2") # SET_TESTS_PROPERTIES(GMLS_Manifold_Dim3 PROPERTIES LABELS "IntegrationTest;integration;kokkos" TIMEOUT 10) - if (PYTHON_EXECUTABLE) + if (Python3_EXECUTABLE) # Python driven test of a C++ executable (Python changes command line arguments given to executable) - calling QR solver CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/GMLS_Manifold.py.in" "${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold.py" @ONLY) - ADD_TEST(NAME GMLS_Manifold_Refinement_Study_QR COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold.py" "--porder=3" "--grids=4" "--solver-type=QR") + ADD_TEST(NAME GMLS_Manifold_Refinement_Study_QR COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold.py" "--porder=3" "--grids=4" "--solver-type=QR") SET_TESTS_PROPERTIES(GMLS_Manifold_Refinement_Study_QR PROPERTIES LABELS "ConvergenceTest;convergence;manifold" @@ -167,7 +167,7 @@ if (Compadre_EXAMPLES) ) # Python driven test of a C++ executable (Python changes command line arguments given to executable) - calling LU solver - ADD_TEST(NAME GMLS_Manifold_Refinement_Study_LU COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold.py" "--porder=3" "--grids=4" "--solver-type=LU") + ADD_TEST(NAME GMLS_Manifold_Refinement_Study_LU COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/GMLS_Manifold.py" "--porder=3" "--grids=4" "--solver-type=LU") SET_TESTS_PROPERTIES(GMLS_Manifold_Refinement_Study_LU PROPERTIES LABELS "ConvergenceTest;convergence;manifold" @@ -178,7 +178,7 @@ if (Compadre_EXAMPLES) # Python driven test of a C++ executable (Python changes command line arguments given to executable) CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/GMLS_Staggered_Manifold.py.in" "${CMAKE_CURRENT_BINARY_DIR}/GMLS_Staggered_Manifold.py" @ONLY) - ADD_TEST(NAME GMLS_Staggered_Manifold_Refinement_Study COMMAND ${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/GMLS_Staggered_Manifold.py" "--porder=3" "--grids=4") + ADD_TEST(NAME GMLS_Staggered_Manifold_Refinement_Study COMMAND ${Python3_EXECUTABLE} "${CMAKE_CURRENT_BINARY_DIR}/GMLS_Staggered_Manifold.py" "--porder=3" "--grids=4") SET_TESTS_PROPERTIES(GMLS_Staggered_Manifold_Refinement_Study PROPERTIES LABELS "ConvergenceTest;convergence;manifold;staggered" @@ -186,7 +186,7 @@ if (Compadre_EXAMPLES) REQUIRED_FILES $ ) - endif() # PYTHON_EXECUTABLE + endif() # Python3_EXECUTABLE # Utility test - Filter By ID ADD_TEST(NAME Test_Utilities COMMAND ${CMAKE_CURRENT_BINARY_DIR}/TestUtility "200" "${KOKKOS_THREADS_ARG}=2") @@ -225,13 +225,13 @@ if (Compadre_EXAMPLES) #SET_TESTS_PROPERTIES(NeighborKNNSearch3DTest_3 PROPERTIES LABELS "kdtree;nanoflann;" TIMEOUT 5) # WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} ) - if (Compadre_USE_PYTHON AND PYTHON_EXECUTABLE) + if (Compadre_USE_PYTHON AND Python3_EXECUTABLE) FILE(COPY "${CMAKE_CURRENT_SOURCE_DIR}/../pycompadre/examples/test_pycompadre.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/../pycompadre/examples") FILE(COPY "${CMAKE_CURRENT_SOURCE_DIR}/../pycompadre/examples/test_pycompadre_manifold.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/../pycompadre/examples") FILE(COPY "${CMAKE_CURRENT_SOURCE_DIR}/../pycompadre/examples/test_tangent_planes_manifold.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/../pycompadre/examples") FILE(COPY "${CMAKE_CURRENT_SOURCE_DIR}/../pycompadre/examples/kokkos_test_case.py" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/../pycompadre/examples") CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Python_3D_Convergence.py.in" "${CMAKE_CURRENT_BINARY_DIR}/Python_3D_Convergence.py" @ONLY) - ADD_TEST(NAME GMLS_Python_Convergence_Test_3d_Point_Reconstruction COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_BINARY_DIR}/Python_3D_Convergence.py" "${KOKKOS_THREADS_ARG}=4") + ADD_TEST(NAME GMLS_Python_Convergence_Test_3d_Point_Reconstruction COMMAND "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_BINARY_DIR}/Python_3D_Convergence.py" "${KOKKOS_THREADS_ARG}=4") SET_TESTS_PROPERTIES(GMLS_Python_Convergence_Test_3d_Point_Reconstruction PROPERTIES LABELS "IntegrationTest;integration;python;kokkos" TIMEOUT 10) if (Compadre_USE_MATLAB) @@ -239,7 +239,7 @@ if (Compadre_EXAMPLES) SET_TESTS_PROPERTIES(GMLS_Matlab_Python_Interface_1d_Point_Reconstruction PROPERTIES LABELS "IntegrationTest;integration;python;kokkos;matlab" TIMEOUT 10) endif() - ADD_TEST(NAME PyCOMPADRE_Tests COMMAND "${PYTHON_EXECUTABLE}" "-m" "unittest" "discover" "-s" "${PYTHON_LIBRARY_PREFIX}/pycompadre/examples") + ADD_TEST(NAME PyCOMPADRE_Tests COMMAND "${Python3_EXECUTABLE}" "-m" "unittest" "discover" "-s" "${PYTHON_LIBRARY_PREFIX}/pycompadre/examples") SET_TESTS_PROPERTIES(PyCOMPADRE_Tests PROPERTIES ENVIRONMENT PYTHONPATH=${PYTHON_LIBRARY_PREFIX}) SET_TESTS_PROPERTIES(PyCOMPADRE_Tests PROPERTIES LABELS "pycompadre" TIMEOUT 30) diff --git a/packages/epetraext/cmake/FindPythonInclude.cmake b/packages/epetraext/cmake/FindPythonInclude.cmake index ba795196cf76..8634919cae73 100644 --- a/packages/epetraext/cmake/FindPythonInclude.cmake +++ b/packages/epetraext/cmake/FindPythonInclude.cmake @@ -1,16 +1,16 @@ # - Find the python include path # This module determines where the python include file Python.h is, -# based on the current value of PYTHON_EXECUTABLE. This code sets the +# based on the current value of Python3_EXECUTABLE. This code sets the # following variable: # # PYTHON_INCLUDE_PATH = path to where Python.h is found # -IF(PYTHON_EXECUTABLE) +IF(Python3_EXECUTABLE) # Obtain the candidate path for python include EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c + ${Python3_EXECUTABLE} -c "import sys; print(sys.prefix + '/include/python' + sys.version[:3])" OUTPUT_VARIABLE CANDIDATE OUTPUT_STRIP_TRAILING_WHITESPACE @@ -24,13 +24,13 @@ IF(PYTHON_EXECUTABLE) ENDIF(EXISTS "${CANDIDATE}") # Obtain the candidate path for python library EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c + ${Python3_EXECUTABLE} -c "import sys; print('python' + sys.version[:3])" OUTPUT_VARIABLE PYVERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c + ${Python3_EXECUTABLE} -c "import sys; print(sys.prefix + '/lib/python' + sys.version[:3] + '/config')" OUTPUT_VARIABLE CANDIDATE OUTPUT_STRIP_TRAILING_WHITESPACE @@ -46,7 +46,7 @@ IF(PYTHON_EXECUTABLE) ENDIF(EXISTS ${LIB_CANDIDATE}) ENDFOREACH(SUFFIX) ENDIF(EXISTS "${CANDIDATE}") -ENDIF(PYTHON_EXECUTABLE) +ENDIF(Python3_EXECUTABLE) # Set any python variables that did not get set by the above logic IF(PYTHON_INCLUDE_FOUND AND PYTHON_LIB_FOUND) diff --git a/packages/ifpack/src/CMakeLists.txt b/packages/ifpack/src/CMakeLists.txt index 0d0f320f675b..b5d2da5d1347 100644 --- a/packages/ifpack/src/CMakeLists.txt +++ b/packages/ifpack/src/CMakeLists.txt @@ -16,9 +16,9 @@ TRIBITS_CONFIGURE_FILE(${PACKAGE_NAME}_config.h) # Parse the Hypre headers IF (${PACKAGE_NAME}_ENABLE_HYPRE) - IF (PYTHON_EXECUTABLE) + IF (Python3_EXECUTABLE) EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../utils/parseHypre.py ${HYPRE_INCLUDE_DIRS} Ifpack_HypreParameterMap.h + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../utils/parseHypre.py ${HYPRE_INCLUDE_DIRS} Ifpack_HypreParameterMap.h WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" RESULT_VARIABLE RETURN_VALUE OUTPUT_STRIP_TRAILING_WHITESPACE diff --git a/packages/ifpack2/src/CMakeLists.txt b/packages/ifpack2/src/CMakeLists.txt index 283a027ca150..ef185ddce833 100644 --- a/packages/ifpack2/src/CMakeLists.txt +++ b/packages/ifpack2/src/CMakeLists.txt @@ -2,9 +2,9 @@ INCLUDE(TrilinosCreateClientTemplateHeaders) # Parse the Hypre headers IF (${PACKAGE_NAME}_ENABLE_HYPRE) - IF (PYTHON_EXECUTABLE) + IF (Python3_EXECUTABLE) EXECUTE_PROCESS( - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../utils/parseHypre.py ${HYPRE_INCLUDE_DIRS} Ifpack2_HypreParameterMap.hpp + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/../utils/parseHypre.py ${HYPRE_INCLUDE_DIRS} Ifpack2_HypreParameterMap.hpp WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" RESULT_VARIABLE RETURN_VALUE OUTPUT_STRIP_TRAILING_WHITESPACE diff --git a/packages/ml/test/ValidateParams/CMakeLists.txt b/packages/ml/test/ValidateParams/CMakeLists.txt index 41a2529966d4..97ad98f9cbd6 100644 --- a/packages/ml/test/ValidateParams/CMakeLists.txt +++ b/packages/ml/test/ValidateParams/CMakeLists.txt @@ -17,7 +17,7 @@ IF(ML_ENABLE_AztecOO AND ML_ENABLE_Amesos) OVERALL_NUM_MPI_PROCS 1 # Should be 1,4,9 TEST_0 EXEC ml_Validate ARGS input1.xml OUTPUT_FILE ValidateParameters_compareTestOutput.out - TEST_1 CMND ${PYTHON_EXECUTABLE} + TEST_1 CMND ${Python3_EXECUTABLE} ARGS ${PROJECT_SOURCE_DIR}/commonTools/test/utilities/compareTestOutput evaluateCriteria baseline1.txt ValidateParameters_compareTestOutput.out PASS_REGULAR_EXPRESSION "Test passed." diff --git a/packages/muelu/research/regionMG/test/structured/CMakeLists.txt b/packages/muelu/research/regionMG/test/structured/CMakeLists.txt index 2c898f97272a..ca74dd9845a4 100644 --- a/packages/muelu/research/regionMG/test/structured/CMakeLists.txt +++ b/packages/muelu/research/regionMG/test/structured/CMakeLists.txt @@ -287,7 +287,7 @@ IF (${PACKAGE_NAME}_ENABLE_Amesos2) ARGS --linAlgebra=Tpetra --xml=structured_1dof.xml --matrixType=Star2D --nx=10 --ny=10 --smootherIts=2 --convergence-log=Star2D_GS_4.log --smootherType=Gauss NUM_MPI_PROCS 4 TEST_1 - CMND ${PYTHON_EXECUTABLE} + CMND ${Python3_EXECUTABLE} ARGS compare_residual_history.py gold_files/Star2D_GS_4.log.gold Star2D_GS_4.log 1.0e-12 STANDARD_PASS_OUTPUT FAIL_FAST @@ -302,7 +302,7 @@ IF (${PACKAGE_NAME}_ENABLE_Amesos2) ARGS --linAlgebra=Tpetra --xml=structured_linear_1dof.xml --matrixType=Brick3D --nx=10 --ny=10 --nz=10 --smootherIts=2 --convergence-log=Brick3D_linear_4.log NUM_MPI_PROCS 4 TEST_1 - CMND ${PYTHON_EXECUTABLE} + CMND ${Python3_EXECUTABLE} ARGS compare_residual_history.py gold_files/Brick3D_linear_4.log.gold Brick3D_linear_4.log 1.0e-12 STANDARD_PASS_OUTPUT FAIL_FAST @@ -317,7 +317,7 @@ IF (${PACKAGE_NAME}_ENABLE_Amesos2) ARGS --linAlgebra=Tpetra --xml=structured_linear_3dof.xml --matrixType=Elasticity3D --nx=10 --ny=10 --nz=10 --smootherIts=2 --convergence-log=Elasticity3D_linear_4.log --solverType=region NUM_MPI_PROCS 4 TEST_1 - CMND ${PYTHON_EXECUTABLE} + CMND ${Python3_EXECUTABLE} ARGS compare_residual_history.py gold_files/Elasticity3D_linear_4.log.gold Elasticity3D_linear_4.log 1.0e-12 STANDARD_PASS_OUTPUT FAIL_FAST @@ -332,7 +332,7 @@ IF (${PACKAGE_NAME}_ENABLE_Amesos2) ARGS --linAlgebra=Tpetra --xml=structured_linear_3dof.xml --matrixType=Elasticity3D --nx=10 --ny=10 --nz=10 --smootherIts=2 --convergence-log=Elasticity3D_CG_linear_4.log --solverType=CG NUM_MPI_PROCS 4 TEST_1 - CMND ${PYTHON_EXECUTABLE} + CMND ${Python3_EXECUTABLE} ARGS compare_residual_history.py gold_files/Elasticity3D_CG_linear_4.log.gold Elasticity3D_CG_linear_4.log 1.0e-12 STANDARD_PASS_OUTPUT FAIL_FAST @@ -347,7 +347,7 @@ IF (${PACKAGE_NAME}_ENABLE_Amesos2) ARGS --linAlgebra=Tpetra --xml=structured_linear_3dof.xml --matrixType=Elasticity3D --nx=10 --ny=10 --nz=10 --smootherIts=2 --convergence-log=Elasticity3D_Richardson_linear_4.log --solverType=Richardson NUM_MPI_PROCS 4 TEST_1 - CMND ${PYTHON_EXECUTABLE} + CMND ${Python3_EXECUTABLE} ARGS compare_residual_history.py gold_files/Elasticity3D_Richardson_linear_4.log.gold Elasticity3D_Richardson_linear_4.log 1.0e-12 STANDARD_PASS_OUTPUT FAIL_FAST @@ -366,7 +366,7 @@ IF (${PACKAGE_NAME}_ENABLE_Amesos2) ARGS --linAlgebra=Tpetra --xml=structured_linear_R_1dof.xml --matrixType=Brick3D --nx=19 --ny=19 --nz=10 --smootherIts=2 --convergence-log=Brick3D_linear_R_4_comp.log NUM_MPI_PROCS 4 TEST_2 - CMND ${PYTHON_EXECUTABLE} + CMND ${Python3_EXECUTABLE} ARGS compare_residual_history.py Brick3D_linear_4_comp.log Brick3D_linear_R_4_comp.log 1.0e-12 STANDARD_PASS_OUTPUT FAIL_FAST @@ -385,7 +385,7 @@ IF (${PACKAGE_NAME}_ENABLE_Amesos2) ARGS --linAlgebra=Tpetra --xml=structured_linear_3dof.xml --matrixType=Elasticity3D --nx=10 --ny=10 --nz=10 --smootherIts=2 --convergence-log=Elasticity3D_Richardson_linear_4.log --solverType=Richardson NUM_MPI_PROCS 4 TEST_2 - CMND ${PYTHON_EXECUTABLE} + CMND ${Python3_EXECUTABLE} ARGS compare_residual_history.py Elasticity3D_Region_linear_4.log Elasticity3D_Richardson_linear_4.log 1.0e-12 STANDARD_PASS_OUTPUT FAIL_FAST @@ -401,7 +401,7 @@ IF (${PACKAGE_NAME}_ENABLE_Amesos2) ARGS --linAlgebra=Tpetra --xml=structured_1dof.xml --matrixType=Star2D --nx=10 --ny=10 --smootherIts=2 --cycleType=W --convergence-log=Star2D_W.log NUM_MPI_PROCS 4 TEST_1 - CMND ${PYTHON_EXECUTABLE} + CMND ${Python3_EXECUTABLE} ARGS compare_residual_history.py gold_files/Star2D_W.log.gold Star2D_W.log 1.0e-12 STANDARD_PASS_OUTPUT FAIL_FAST diff --git a/packages/rol/cmake/PythonTest.cmake b/packages/rol/cmake/PythonTest.cmake index 2568fa4b6377..f5fbf4c94b22 100644 --- a/packages/rol/cmake/PythonTest.cmake +++ b/packages/rol/cmake/PythonTest.cmake @@ -1,7 +1,7 @@ MACRO(PYTHON_ADD_TEST TEST_NAME) TRIBITS_ADD_TEST( - ${PYTHON_EXECUTABLE} + ${Python3_EXECUTABLE} NOEXEPREFIX NOEXESUFFIX NAME PYTHON_${TEST_NAME} diff --git a/packages/rol/pyrol/CMakeLists.txt b/packages/rol/pyrol/CMakeLists.txt index 2fe54e059c57..9857e19eec0a 100644 --- a/packages/rol/pyrol/CMakeLists.txt +++ b/packages/rol/pyrol/CMakeLists.txt @@ -37,14 +37,14 @@ TRIBITS_ADD_OPTION_AND_DEFINE(PYROL_ENABLE_BINDER_UPDATE "Enable the update of the generated source files with Binder." OFF ) -MESSAGE("-- PYTHON_EXECUTABLE:") -IF(NOT DEFINED ${PYTHON_EXECUTABLE}) - find_program(PYTHON_EXECUTABLE +MESSAGE("-- Python3_EXECUTABLE:") +IF(NOT DEFINED ${Python3_EXECUTABLE}) + find_program(Python3_EXECUTABLE NAMES python3 python ) - MESSAGE(" -- CMake has set: PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}") + MESSAGE(" -- CMake has set: Python3_EXECUTABLE = ${Python3_EXECUTABLE}") ELSE() - MESSAGE(" -- User has set: PYTHON_EXECUTABLE = ${PYTHON_EXECUTABLE}") + MESSAGE(" -- User has set: Python3_EXECUTABLE = ${Python3_EXECUTABLE}") ENDIF() @@ -257,7 +257,7 @@ IF (PYROL_GENERATE_SRC) list (APPEND PyROLPyFiles ${PyROLPyFiles2}) EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/gather_includes.py ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${all_header_with_dir_list} ${all_header_without_dir_list} ${binder_include_name} + ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/scripts/gather_includes.py ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${all_header_with_dir_list} ${all_header_without_dir_list} ${binder_include_name} ) set(BINDER_OPTIONS "") @@ -322,12 +322,12 @@ ELSE() ENDIF() # Get the python version -EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c +EXECUTE_PROCESS(COMMAND ${Python3_EXECUTABLE} -c "import sys; print(sys.version_info.major)" OUTPUT_VARIABLE PYTHON_MAJOR_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE ) -EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c +EXECUTE_PROCESS(COMMAND ${Python3_EXECUTABLE} -c "import sys; print(sys.version_info.minor)" OUTPUT_VARIABLE PYTHON_MINOR_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE @@ -385,7 +385,7 @@ ENDFOREACH() # Find the pybind11 CMake module EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c "import pybind11; print(pybind11.get_cmake_dir())" + ${Python3_EXECUTABLE} -c "import pybind11; print(pybind11.get_cmake_dir())" OUTPUT_VARIABLE pybind11_DIR ERROR_VARIABLE pybind11_CMAKE_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE @@ -395,7 +395,7 @@ MESSAGE(STATUS "pybind11 CMake path: ${pybind11_DIR}") find_package(pybind11 REQUIRED) EXECUTE_PROCESS(COMMAND - ${PYTHON_EXECUTABLE} -c "import mpi4py; print(mpi4py.get_include())" + ${Python3_EXECUTABLE} -c "import mpi4py; print(mpi4py.get_include())" OUTPUT_VARIABLE Mpi4Py_INCLUDE_DIR ERROR_VARIABLE Mpi4Py_INCLUDE_ERROR OUTPUT_STRIP_TRAILING_WHITESPACE diff --git a/packages/sacado/test/GTestSuite/googletest/googletest/cmake/internal_utils.cmake b/packages/sacado/test/GTestSuite/googletest/googletest/cmake/internal_utils.cmake index b3e8b8190ea0..f135e5eb1435 100644 --- a/packages/sacado/test/GTestSuite/googletest/googletest/cmake/internal_utils.cmake +++ b/packages/sacado/test/GTestSuite/googletest/googletest/cmake/internal_utils.cmake @@ -243,7 +243,7 @@ function(cxx_executable name dir libs) ${name} "${cxx_default}" "${libs}" "${dir}/${name}.cc" ${ARGN}) endfunction() -# Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE. +# Sets PYTHONINTERP_FOUND and Python3_EXECUTABLE. find_package(PythonInterp) # cxx_test_with_flags(name cxx_flags libs srcs...) @@ -285,11 +285,11 @@ function(py_test name) if (WIN32 OR MINGW) add_test(NAME ${name} COMMAND powershell -Command ${CMAKE_CURRENT_BINARY_DIR}/$/RunTest.ps1 - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$ ${ARGN}) else() add_test(NAME ${name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$ ${ARGN}) endif() else (CMAKE_CONFIGURATION_TYPES) @@ -298,11 +298,11 @@ function(py_test name) if (WIN32 OR MINGW) add_test(NAME ${name} COMMAND powershell -Command ${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1 - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py --build_dir=${CMAKE_CURRENT_BINARY_DIR} ${ARGN}) else() add_test(NAME ${name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py --build_dir=${CMAKE_CURRENT_BINARY_DIR} ${ARGN}) endif() endif (CMAKE_CONFIGURATION_TYPES) @@ -314,11 +314,11 @@ function(py_test name) if (WIN32 OR MINGW) add_test(NAME ${name} COMMAND powershell -Command ${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1 - ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE} ${ARGN}) else() add_test(NAME ${name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE} ${ARGN}) endif() endif() diff --git a/packages/shylu/shylu_node/tacho/unit-test/googletest/cmake/internal_utils.cmake b/packages/shylu/shylu_node/tacho/unit-test/googletest/cmake/internal_utils.cmake index 5a34c07a1b99..1280e85acb11 100644 --- a/packages/shylu/shylu_node/tacho/unit-test/googletest/cmake/internal_utils.cmake +++ b/packages/shylu/shylu_node/tacho/unit-test/googletest/cmake/internal_utils.cmake @@ -242,13 +242,13 @@ function(cxx_executable name dir libs) ${name} "${cxx_default}" "${libs}" "${dir}/${name}.cc" ${ARGN}) endfunction() -# Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE. +# Sets PYTHONINTERP_FOUND and Python3_EXECUTABLE. if ("${CMAKE_VERSION}" VERSION_LESS "3.12.0") find_package(PythonInterp) else() find_package(Python COMPONENTS Interpreter) set(PYTHONINTERP_FOUND ${Python_Interpreter_FOUND}) - set(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) + set(Python3_EXECUTABLE ${Python_EXECUTABLE}) endif() # cxx_test_with_flags(name cxx_flags libs srcs...) @@ -282,13 +282,13 @@ function(py_test name) # output in a subdirectory of CMAKE_CURRENT_BINARY_DIR (Debug, # Release etc.), so we have to provide it here. add_test(NAME ${name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$ ${ARGN}) else (CMAKE_CONFIGURATION_TYPES) # Single-configuration build generators like Makefile generators # don't have subdirs below CMAKE_CURRENT_BINARY_DIR. add_test(NAME ${name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py --build_dir=${CMAKE_CURRENT_BINARY_DIR} ${ARGN}) endif (CMAKE_CONFIGURATION_TYPES) else() @@ -297,7 +297,7 @@ function(py_test name) # only at ctest runtime (by calling ctest -c ), so # we have to escape $ to delay variable substitution here. add_test(NAME ${name} - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py + COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE} ${ARGN}) endif() # Make the Python import path consistent between Bazel and CMake.