diff --git a/CMakeLists.txt b/CMakeLists.txt index 5fa5fc9a..674c40f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,13 @@ else() # check python find_program(PYTHON_CMD python) if (NOT PYTHON_CMD) - message(FATAL_ERROR "Please install python.") + find_program(PYTHON_CMD python3) + if (NOT PYTHON_CMD) + find_program(PYTHON_CMD python2) + if (NOT PYTHON_CMD) + message(FATAL_ERROR "Please install python.") + endif() + endif() endif() set(EXTRA_CFLAGS "--extra-cflags=") @@ -132,6 +138,7 @@ else() # GEN dynamic source files execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/configure + --python=${PYTHON_CMD} ${EXTRA_CFLAGS} ${TARGET_LIST} ) @@ -199,16 +206,16 @@ else() OUTPUT_FILE ${CMAKE_BINARY_DIR}/sparc64-softmmu/config-target.h ) endif() - execute_process(COMMAND python -B ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/qapi-types.py + execute_process(COMMAND ${PYTHON_CMD} -B ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/qapi-types.py -h -o ${CMAKE_BINARY_DIR} -b -i ${CMAKE_CURRENT_SOURCE_DIR}/qemu/qapi-schema.json ) - execute_process(COMMAND python -B ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/qapi-types.py + execute_process(COMMAND ${PYTHON_CMD} -B ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/qapi-types.py -c -o ${CMAKE_BINARY_DIR} -b -i ${CMAKE_CURRENT_SOURCE_DIR}/qemu/qapi-schema.json ) - execute_process(COMMAND python -B ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/qapi-visit.py + execute_process(COMMAND ${PYTHON_CMD} -B ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/qapi-visit.py -h -o ${CMAKE_BINARY_DIR} -b -i ${CMAKE_CURRENT_SOURCE_DIR}/qemu/qapi-schema.json ) - execute_process(COMMAND python -B ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/qapi-visit.py + execute_process(COMMAND ${PYTHON_CMD} -B ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/qapi-visit.py -c -o ${CMAKE_BINARY_DIR} -b -i ${CMAKE_CURRENT_SOURCE_DIR}/qemu/qapi-schema.json ) add_compile_options( diff --git a/Makefile b/Makefile index 571456ac..8f7b17f2 100644 --- a/Makefile +++ b/Makefile @@ -172,7 +172,7 @@ LIBRARY_SYMLINK = lib$(LIBNAME).$(EXT) endif endif -UNICORN_QEMU_FLAGS += --python=$(shell which /usr/bin/python || which python || which python2) +UNICORN_QEMU_FLAGS += --python=$(shell which /usr/bin/python || which python || which python2 || which python3) ifeq ($(UNICORN_STATIC),yes) ifneq ($(filter MINGW%,$(UNAME_S)),)