BuildSystem: Cleanup cmake code
The buildsystem is kind of a mess. I will be writingn build instructions soon.
This commit is contained in:
parent
8a8793fd2d
commit
2a8dc58b6a
|
@ -1,18 +1,20 @@
|
||||||
cmake_minimum_required(VERSION 3.26)
|
cmake_minimum_required(VERSION 3.26)
|
||||||
|
|
||||||
set(BANAN_ARCH x86_64)
|
|
||||||
|
|
||||||
if(DEFINED ENV{BANAN_ARCH})
|
if(DEFINED ENV{BANAN_ARCH})
|
||||||
set(BANAN_ARCH $ENV{BANAN_ARCH})
|
set(BANAN_ARCH $ENV{BANAN_ARCH})
|
||||||
|
else()
|
||||||
|
set(BANAN_ARCH x86_64)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(TOOLCHAIN_PREFIX ${CMAKE_SOURCE_DIR}/toolchain/local)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
set(CMAKE_CXX_COMPILER ${BANAN_ARCH}-elf-g++)
|
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_PREFIX}/bin/${BANAN_ARCH}-banan_os-g++)
|
||||||
set(CMAKE_CXX_COMPILER_WORKS True)
|
set(CMAKE_CXX_COMPILER_WORKS True)
|
||||||
|
|
||||||
if("${BANAN_ARCH}" STREQUAL "i386")
|
if(NOT EXISTS ${CMAKE_CXX_COMPILER})
|
||||||
set(CMAKE_CXX_COMPILER i686-elf-g++)
|
set(CMAKE_CXX_COMPILER g++)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
project(banan-os CXX)
|
project(banan-os CXX)
|
||||||
|
@ -21,7 +23,6 @@ set(BANAN_SYSROOT ${CMAKE_BINARY_DIR}/sysroot)
|
||||||
set(BANAN_INCLUDE ${BANAN_SYSROOT}/usr/include)
|
set(BANAN_INCLUDE ${BANAN_SYSROOT}/usr/include)
|
||||||
set(BANAN_BOOT ${BANAN_SYSROOT}/boot)
|
set(BANAN_BOOT ${BANAN_SYSROOT}/boot)
|
||||||
set(DISK_IMAGE_PATH ${CMAKE_BINARY_DIR}/banan-os.img)
|
set(DISK_IMAGE_PATH ${CMAKE_BINARY_DIR}/banan-os.img)
|
||||||
set(TOOLCHAIN_PREFIX ${CMAKE_SOURCE_DIR}/toolchain/local)
|
|
||||||
|
|
||||||
add_subdirectory(kernel)
|
add_subdirectory(kernel)
|
||||||
add_subdirectory(BAN)
|
add_subdirectory(BAN)
|
||||||
|
|
|
@ -150,3 +150,4 @@ add_custom_command(
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_COMPILER} <CMAKE_CXX_LINK_FLAGS> <FLAGS> <LINK_FLAGS> -o <TARGET> ${CMAKE_CURRENT_BINARY_DIR}/crti.o ${CMAKE_CURRENT_BINARY_DIR}/crtbegin.o <OBJECTS> ${CMAKE_CURRENT_BINARY_DIR}/crtend.o ${CMAKE_CURRENT_BINARY_DIR}/crtn.o -lgcc ")
|
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_COMPILER} <CMAKE_CXX_LINK_FLAGS> <FLAGS> <LINK_FLAGS> -o <TARGET> ${CMAKE_CURRENT_BINARY_DIR}/crti.o ${CMAKE_CURRENT_BINARY_DIR}/crtbegin.o <OBJECTS> ${CMAKE_CURRENT_BINARY_DIR}/crtend.o ${CMAKE_CURRENT_BINARY_DIR}/crtn.o -lgcc ")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue