31 lines
1.0 KiB
CMake
31 lines
1.0 KiB
CMake
cmake_minimum_required(VERSION 3.17.0)
|
|
|
|
# Start Project
|
|
project(runtime)
|
|
|
|
# Headers
|
|
add_library(trampoline-headers INTERFACE)
|
|
target_include_directories(trampoline-headers INTERFACE include)
|
|
|
|
# Build
|
|
if(NOT TRAMPOLINE_HEADERS_ONLY)
|
|
# Check Architecture
|
|
include(CheckSymbolExists)
|
|
check_symbol_exists("__arm__" "" NO_RUNTIME_NEEDED)
|
|
if(NOT NO_RUNTIME_NEEDED)
|
|
check_symbol_exists("__aarch64__" "" USE_NATIVE_RUNTIME)
|
|
check_symbol_exists("__x86_64__" "" USE_QEMU_RUNTIME)
|
|
# Include Correct Sub-Project
|
|
set(RUNTIME_RPATH "$ORIGIN/../lib/native")
|
|
set(RUNTIME_EXTRA_LINK_FLAG "--disable-new-dtags")
|
|
target_compile_definitions(trampoline-headers INTERFACE MCPI_BUILD_RUNTIME)
|
|
if(USE_NATIVE_RUNTIME)
|
|
add_subdirectory(native)
|
|
elseif(USE_QEMU_RUNTIME)
|
|
add_subdirectory(qemu)
|
|
target_compile_definitions(trampoline-headers INTERFACE MCPI_RUNTIME_IS_QEMU)
|
|
else()
|
|
message(FATAL_ERROR "Unsupported Architecture")
|
|
endif()
|
|
endif()
|
|
endif() |