20 lines
648 B
CMake
20 lines
648 B
CMake
# Copyright (c) 2026 Dominic Masters
|
|
#
|
|
# This software is released under the MIT License.
|
|
# https://opensource.org/licenses/MIT
|
|
|
|
function(dusk_run_python CMAKE_TARGET_NAME PYTHON_MODULE)
|
|
cmake_parse_arguments(DUSK_RUN_PYTHON "" "OUTPUT" "DEPENDS;ARGS" ${ARGN})
|
|
find_package(Python3 COMPONENTS Interpreter REQUIRED)
|
|
|
|
add_custom_command(
|
|
OUTPUT ${DUSK_RUN_PYTHON_OUTPUT}
|
|
WORKING_DIRECTORY ${DUSK_ROOT_DIR}
|
|
COMMAND
|
|
${Python3_EXECUTABLE} -m ${PYTHON_MODULE} ${DUSK_RUN_PYTHON_ARGS}
|
|
DEPENDS ${DUSK_RUN_PYTHON_DEPENDS}
|
|
VERBATIM
|
|
)
|
|
add_custom_target(${CMAKE_TARGET_NAME} DEPENDS ${DUSK_RUN_PYTHON_OUTPUT})
|
|
endfunction()
|