fix finding python path which only has python3. (#1220)

This commit is contained in:
Nguyen Anh Quynh 2020-03-06 01:48:53 +08:00 committed by GitHub
parent 4ca2c7f0b0
commit 8ff326a2a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 6 deletions

View File

@ -84,9 +84,15 @@ if(MSVC)
else()
# check python
find_program(PYTHON_CMD python)
if (NOT PYTHON_CMD)
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=")
if (UNICORN_HAS_X86)
@ -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(

View File

@ -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)),)