runtime/CMakeLists.txt

33 lines
1000 B
CMake
Raw 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 09:28:22 +00:00
check_symbol_exists("__aarch64__" "" USE_NATIVE_RUNTIME)
check_symbol_exists("__x86_64__" "" USE_QEMU_RUNTIME)
2024-06-04 22:26:45 +00:00
# Include Correct Sub-Project
2024-06-08 09:28:22 +00:00
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)
2024-06-04 22:26:45 +00:00
add_subdirectory(native)
2024-06-08 09:28:22 +00:00
elseif(USE_QEMU_RUNTIME)
2024-06-04 22:26:45 +00:00
add_subdirectory(qemu)
2024-06-08 09:28:22 +00:00
target_compile_definitions(trampoline-headers INTERFACE MCPI_RUNTIME_IS_QEMU)
2024-06-04 22:26:45 +00:00
else()
message(FATAL_ERROR "Unsupported Architecture")
endif()
2024-06-04 21:50:17 +00:00
else()
2024-06-04 22:26:45 +00:00
# No-Op Install Function
2024-06-08 09:28:22 +00:00
function(install_runtime)
2024-06-04 22:26:45 +00:00
endfunction()
2024-06-04 21:50:17 +00:00
endif()