47 lines
937 B
CMake
47 lines
937 B
CMake
cmake_minimum_required(VERSION 3.17.0)
|
|
|
|
# Start Project
|
|
project(runtime)
|
|
|
|
# Headers
|
|
add_subdirectory(lib)
|
|
if(TARGET trampoline)
|
|
return()
|
|
endif()
|
|
|
|
# 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}")
|
|
# License
|
|
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" DESTINATION "${MCPI_LEGAL_DIR}/${PROJECT_NAME}")
|
|
endif() |