runtime/CMakeLists.txt

31 lines
1.0 KiB
CMake
Raw Permalink Normal View History

2024-06-04 21:22:15 +00:00
cmake_minimum_required(VERSION 3.17.0)
# Start Project
2024-06-08 09:28:22 +00:00
project(runtime)
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
# Build
2024-06-04 22:26:45 +00:00
if(NOT TRAMPOLINE_HEADERS_ONLY)
# Check Architecture
include(CheckSymbolExists)
2024-06-08 18:45:39 +00:00
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()
2024-06-04 22:26:45 +00:00
endif()
2024-06-04 21:50:17 +00:00
endif()