cmake_minimum_required(VERSION 3.17.0) # Start Project project(runtime) # Headers add_library(trampoline-headers INTERFACE) target_include_directories(trampoline-headers INTERFACE include) # Check Architecture include(CheckSymbolExists) check_symbol_exists("__arm__" "" NO_RUNTIME_NEEDED) if(NO_RUNTIME_NEEDED) return() endif() # Only Headers option(TRAMPOLINE_HEADERS_ONLY "Skip Building Runtime" FALSE) if(TRAMPOLINE_HEADERS_ONLY) return() endif() target_compile_definitions(trampoline-headers INTERFACE MCPI_BUILD_RUNTIME) # Build add_executable(runtime src/main.cpp src/trampoline.cpp src/pipe/loop.cpp src/pipe/main.cpp src/pipe/memory.cpp ) # QEMU check_symbol_exists("__x86_64__" "" USE_QEMU) if(USE_QEMU) add_subdirectory(qemu) target_sources(runtime PRIVATE src/syscall/main.cpp src/syscall/handler.cpp src/qemu/qemu.cpp ) endif() # Warnings target_compile_options(runtime PRIVATE -Wall -Wextra -Werror -Wpointer-arith -Wshadow -Wnull-dereference) # Link target_link_libraries(runtime dl rt trampoline-headers) # Install if(DEFINED MCPI_BIN_DIR) install(TARGETS runtime DESTINATION "${MCPI_BIN_DIR}") endif()