Luna/CMakeLists.txt
apio 73ddd0b0c5
All checks were successful
continuous-integration/drone/push Build is passing
tools: Be more arch-agnostic
2023-01-11 19:14:35 +01:00

35 lines
867 B
CMake

cmake_minimum_required(VERSION 3.8..3.22)
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)
set(CMAKE_CROSSCOMPILING true)
project(Luna LANGUAGES C CXX ASM ASM_NASM VERSION 0.1.0)
set(LUNA_ROOT ${CMAKE_CURRENT_LIST_DIR})
set(LUNA_BASE ${CMAKE_CURRENT_LIST_DIR}/base)
set(ARCH $ENV{ARCH})
if(NOT DEFINED ARCH)
set(ARCH "x86_64")
endif()
set(CMAKE_C_COMPILER ${ARCH}-luna-gcc)
set(CMAKE_CXX_COMPILER ${ARCH}-luna-g++)
set(CMAKE_ASM_COMPILER ${ARCH}-luna-gcc)
set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
set(CMAKE_ASM_NASM_LINK_EXECUTABLE "${ARCH}-luna-ld <FLAGS> <CMAKE_ASM_NASM_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_FIND_ROOT_PATH ${LUNA_ROOT}/toolchain/${ARCH}-luna)
message(STATUS "Configuring Luna for ${ARCH}")
add_subdirectory(luna)
add_subdirectory(libc)
add_subdirectory(kernel)
add_subdirectory(apps)