This commit is contained in:
TheBrokenRail 2024-06-04 18:26:45 -04:00
parent a17817a57b
commit 2a1ee6a91b
2 changed files with 24 additions and 12 deletions

View File

@ -7,17 +7,24 @@ project(trampoline)
add_library(trampoline-headers INTERFACE)
target_include_directories(trampoline-headers INTERFACE include)
# Check Architecture
include(CheckSymbolExists)
check_symbol_exists("__aarch64__" "" USE_NATIVE_TRAMPOLINE)
check_symbol_exists("__x86_64__" "" USE_QEMU_TRAMPOLINE)
# Build
if(USE_NATIVE_TRAMPOLINE)
if(NOT TRAMPOLINE_HEADERS_ONLY)
# Check Architecture
include(CheckSymbolExists)
check_symbol_exists("__aarch64__" "" USE_NATIVE_TRAMPOLINE)
check_symbol_exists("__x86_64__" "" USE_QEMU_TRAMPOLINE)
# Include Correct Sub-Project
if(USE_NATIVE_TRAMPOLINE)
add_subdirectory(native)
elseif(USE_QEMU_TRAMPOLINE)
elseif(USE_QEMU_TRAMPOLINE)
add_subdirectory(qemu)
target_compile_definitions(trampoline-headers INTERFACE MCPI_USE_QEMU)
else()
else()
message(FATAL_ERROR "Unsupported Architecture")
endif()
else()
# No-Op Install Function
function(install_trampoline)
endfunction()
endif()

View File

@ -1,5 +1,10 @@
project(qemu)
# Avoid Warning About DOWNLOAD_EXTRACT_TIMESTAMP
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24.0)
cmake_policy(SET CMP0135 NEW)
endif()
# Archive
if(NOT DEFINED TRAMPOLINE_QEMU_ARCHIVE)
message(FATAL_ERROR "Missing QEMU Archive")
@ -51,7 +56,7 @@ ExternalProject_Add(qemu
# Install
function(install_trampoline bin_dir legal_dir)
ExternalProject_Get_property(qemu BINARY_DIR)
install(PROGRAMS "${BINARY_DIR}/qemu-arm" DESTINATION "${bin_dir}/trampoline")
install(PROGRAMS "${BINARY_DIR}/qemu-arm" DESTINATION "${bin_dir}" RENAME "trampoline")
# License
ExternalProject_Get_property(qemu SOURCE_DIR)
install(FILES "${SOURCE_DIR}/COPYING" DESTINATION "${legal_dir}/qemu")