2024-06-04 21:22:15 +00:00
|
|
|
cmake_minimum_required(VERSION 3.17.0)
|
|
|
|
|
|
|
|
# Start Project
|
2024-06-04 21:50:17 +00:00
|
|
|
project(trampoline)
|
2024-06-04 21:22:15 +00:00
|
|
|
|
2024-06-04 21:50:17 +00:00
|
|
|
# Headers
|
|
|
|
add_library(trampoline-headers INTERFACE)
|
|
|
|
target_include_directories(trampoline-headers INTERFACE include)
|
2024-06-04 21:22:15 +00:00
|
|
|
|
2024-06-04 21:50:17 +00:00
|
|
|
# Check Architecture
|
|
|
|
include(CheckSymbolExists)
|
|
|
|
check_symbol_exists("__aarch64__" "" USE_NATIVE_TRAMPOLINE)
|
|
|
|
check_symbol_exists("__x86_64__" "" USE_QEMU_TRAMPOLINE)
|
2024-06-04 21:22:15 +00:00
|
|
|
|
2024-06-04 21:50:17 +00:00
|
|
|
# Build
|
|
|
|
if(USE_NATIVE_TRAMPOLINE)
|
|
|
|
add_subdirectory(native)
|
|
|
|
elseif(USE_QEMU_TRAMPOLINE)
|
|
|
|
add_subdirectory(qemu)
|
|
|
|
target_compile_definitions(trampoline-headers INTERFACE MCPI_USE_QEMU)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Unsupported Architecture")
|
|
|
|
endif()
|