2023-10-31 16:21:54 -07:00
|
|
|
# x86-baremetal-toolchain.cmake
|
|
|
|
|
|
|
|
# Specify the cross-compiler (If you need one; otherwise, your native GCC should work)
|
|
|
|
set(CMAKE_ASM_COMPILER nasm)
|
|
|
|
set(CMAKE_C_COMPILER gcc)
|
|
|
|
set(CMAKE_CXX_COMPILER g++)
|
|
|
|
|
2024-02-07 23:55:04 -08:00
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
2023-10-31 16:21:54 -07:00
|
|
|
|
|
|
|
# Add compiler and linker flags for x86 bare metal
|
|
|
|
set(CMAKE_ASM_NASM_FLAGS "-f elf32")
|
|
|
|
set(CMAKE_C_FLAGS "-m32 -ffreestanding -nostdlib")
|
|
|
|
set(CMAKE_CXX_FLAGS "-m32 -ffreestanding -nostdlib")
|
2023-11-01 00:38:16 -07:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "-e kernel_main -T${CMAKE_CURRENT_LIST_DIR}/linker.ld -m32 -z noexecstack")
|