Skip to content

Commit 33d4eca

Browse files
authored
i#3544 RV64: Replace usage of FindPythonInterp with FindPython3 in CMake (DynamoRIO#7488)
A Python 3 interpreter is required to generate instruction codecs for RV64. Previously we make use of CMake's FindPythonInterp to search for one, but the module has been deprecated in CMake since 3.12. This patch replaces its usage with FindPython3 introduced in CMake 3.12, which is fine since the minimum required CMake version of DynamoRIO has been raised to 3.14. This fixes warnings about CMP0148 introduced since CMake 3.27. Issue: DynamoRIO#3544
1 parent d746e04 commit 33d4eca

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

make/CMake_riscv64_gen_codec.cmake

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,7 @@
3030

3131
# Commands to automatically create the codec files from
3232
# core/arch/riscv64/isl/*.txt.
33-
find_package(PythonInterp)
34-
35-
if (NOT PYTHONINTERP_FOUND)
36-
message(FATAL_ERROR "Python interpreter not found")
37-
endif ()
33+
find_package(Python3 REQUIRED Interpreter)
3834

3935
set(RISCV64_CODEC_GEN_SRCS
4036
${PROJECT_BINARY_DIR}/opcode_api.h
@@ -80,7 +76,7 @@ add_custom_command(
8076
${PROJECT_SOURCE_DIR}/core/ir/${ARCH_NAME}/isl/zicboz.txt
8177
${PROJECT_SOURCE_DIR}/core/ir/${ARCH_NAME}/isl/zicsr.txt
8278
${PROJECT_SOURCE_DIR}/core/ir/${ARCH_NAME}/isl/zifencei.txt
83-
COMMAND ${PYTHON_EXECUTABLE}
79+
COMMAND ${Python3_EXECUTABLE}
8480
ARGS ${PROJECT_SOURCE_DIR}/core/ir/${ARCH_NAME}/codec.py
8581
${PROJECT_SOURCE_DIR}/core/ir/${ARCH_NAME}/isl
8682
${PROJECT_SOURCE_DIR}/core/ir/${ARCH_NAME}

0 commit comments

Comments
 (0)