2022-09-27 00:59:46 +00:00
|
|
|
project(qemu)
|
|
|
|
|
|
|
|
## QEMU
|
|
|
|
|
2023-11-24 08:07:06 +00:00
|
|
|
# Version
|
2024-02-07 23:04:53 +00:00
|
|
|
set(QEMU_VERSION "8.2.1")
|
2023-11-24 08:07:06 +00:00
|
|
|
|
2023-11-24 08:28:17 +00:00
|
|
|
# Flatpak Support
|
2024-05-10 22:58:39 +00:00
|
|
|
set(QEMU_FLATPAK_PATCH "")
|
2023-11-24 08:28:17 +00:00
|
|
|
if(MCPI_IS_FLATPAK_BUILD)
|
2024-05-10 22:58:39 +00:00
|
|
|
set(QEMU_FLATPAK_PATCH "sed" "-i" "s/libdrm/libdrm-dis/g" "<SOURCE_DIR>/meson.build")
|
2023-11-24 08:28:17 +00:00
|
|
|
endif()
|
|
|
|
|
2022-09-27 00:59:46 +00:00
|
|
|
# Build
|
|
|
|
include(ExternalProject)
|
2024-01-20 07:10:18 +00:00
|
|
|
set(PKGCONFIG_ENV "")
|
2024-01-16 08:08:34 +00:00
|
|
|
if(DEFINED ENV{PKG_CONFIG_LIBDIR})
|
2024-01-20 07:10:18 +00:00
|
|
|
set(PKGCONFIG_ENV "PKG_CONFIG_LIBDIR=$ENV{PKG_CONFIG_LIBDIR}")
|
2024-01-16 08:08:34 +00:00
|
|
|
endif()
|
2022-09-27 00:59:46 +00:00
|
|
|
ExternalProject_Add(qemu
|
2024-01-16 06:45:52 +00:00
|
|
|
URL "${CMAKE_CURRENT_SOURCE_DIR}/../../archives/qemu-${QEMU_VERSION}.tar.xz"
|
2024-05-10 22:58:39 +00:00
|
|
|
# Configure Build
|
2022-09-27 00:59:46 +00:00
|
|
|
CONFIGURE_COMMAND
|
2022-09-27 02:19:27 +00:00
|
|
|
"${CMAKE_COMMAND}" "-E" "env"
|
2024-01-20 07:10:18 +00:00
|
|
|
${PKGCONFIG_ENV}
|
2022-09-27 02:19:27 +00:00
|
|
|
"CFLAGS=-s"
|
|
|
|
"CXXFLAGS=-s"
|
2022-09-27 00:59:46 +00:00
|
|
|
"<SOURCE_DIR>/configure"
|
|
|
|
"--prefix=${CMAKE_INSTALL_PREFIX}"
|
|
|
|
"--cross-prefix="
|
|
|
|
"--cc=${CMAKE_C_COMPILER}"
|
|
|
|
"--cxx=${CMAKE_CXX_COMPILER}"
|
2022-09-27 02:19:27 +00:00
|
|
|
"--disable-debug-info"
|
2022-09-27 00:59:46 +00:00
|
|
|
"--target-list=arm-linux-user"
|
|
|
|
"--without-default-features"
|
|
|
|
USES_TERMINAL_CONFIGURE TRUE
|
2024-05-10 22:58:39 +00:00
|
|
|
# Build Command
|
|
|
|
BUILD_COMMAND "ninja" "qemu-arm"
|
|
|
|
BUILD_BYPRODUCTS "<BINARY_DIR>/qemu-arm"
|
2022-09-27 00:59:46 +00:00
|
|
|
USES_TERMINAL_BUILD TRUE
|
2024-05-10 22:58:39 +00:00
|
|
|
# Disable Install/Test Commands
|
2022-09-27 00:59:46 +00:00
|
|
|
INSTALL_COMMAND ""
|
|
|
|
TEST_COMMAND ""
|
2024-05-10 22:58:39 +00:00
|
|
|
# Patch Command
|
|
|
|
PATCH_COMMAND "patch" "-p1" "<" "${CMAKE_CURRENT_SOURCE_DIR}/trampoline.patch"
|
|
|
|
COMMAND ${QEMU_FLATPAK_PATCH}
|
2022-09-27 00:59:46 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# Install
|
|
|
|
ExternalProject_Get_property(qemu BINARY_DIR)
|
|
|
|
install(PROGRAMS "${BINARY_DIR}/qemu-arm" DESTINATION "${MCPI_BIN_DIR}")
|
|
|
|
|
|
|
|
# License
|
2023-11-24 08:07:06 +00:00
|
|
|
ExternalProject_Get_property(qemu SOURCE_DIR)
|
|
|
|
install(FILES "${SOURCE_DIR}/COPYING" DESTINATION "${MCPI_LEGAL_DIR}/qemu")
|