runtime/CMakeLists.txt
TheBrokenRail 70fc889ac8
All checks were successful
CI / Test (AMD64) (push) Successful in 2m8s
CI / Test (ARM64) (push) Successful in 5m8s
Add Warnings To lib/
2025-02-15 01:17:12 -05:00

52 lines
1.2 KiB
CMake

cmake_minimum_required(VERSION 3.17.0)
# Start Project
project(runtime)
# Warnings
add_compile_options(-Wall -Wextra -Werror -Wpointer-arith -Wshadow -Wnull-dereference)
# 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
include(CheckSymbolExists)
check_symbol_exists("__ARM_ARCH" "" DONT_USE_QEMU)
if(NOT DONT_USE_QEMU)
add_subdirectory(qemu)
target_sources(runtime PRIVATE
src/syscall/main.cpp
src/syscall/handler.cpp
src/qemu/qemu.cpp
)
endif()
# Link
target_link_libraries(runtime
dl
rt
trampoline-headers
)
# External Library
set(TRAMPOLINE_LIBRARY_NAME "trampoline" CACHE STRING "Trampoline Library That The Runtime Uses")
target_compile_definitions(runtime PRIVATE "TRAMPOLINE_LIBRARY=\"lib${TRAMPOLINE_LIBRARY_NAME}.so\"")
# Install
if(DEFINED MCPI_LIB_DIR)
install(TARGETS runtime DESTINATION "${MCPI_LIB_DIR}")
# License
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" DESTINATION "${MCPI_LEGAL_DIR}/${PROJECT_NAME}")
endif()