2023-07-13 18:07:53 -07:00
|
|
|
cmake_minimum_required(VERSION 3.13.4)
|
2023-10-26 23:28:06 -07:00
|
|
|
project(ClassicOS VERSION 0.0.1 LANGUAGES C CXX ASM_NASM)
|
2023-10-24 16:36:11 -07:00
|
|
|
|
|
|
|
set(IS_OS_WINDOWS FALSE)
|
|
|
|
set(IS_OS_LINUX FALSE)
|
|
|
|
set(IS_OS_MAC FALSE)
|
|
|
|
|
|
|
|
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
|
|
|
set(IS_OS_WINDOWS TRUE)
|
2023-10-26 23:38:54 -07:00
|
|
|
message("Building on the Windows operating system.")
|
2023-10-24 16:36:11 -07:00
|
|
|
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux")
|
|
|
|
set(IS_OS_LINUX TRUE)
|
2023-10-26 23:38:54 -07:00
|
|
|
message("Building on the Linux operating system.")
|
2023-10-24 16:36:11 -07:00
|
|
|
elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
|
|
|
|
set(IS_OS_MAC TRUE)
|
2023-10-26 23:38:54 -07:00
|
|
|
message("Building on the Mac operating system.")
|
2023-10-24 16:36:11 -07:00
|
|
|
endif ()
|
2023-07-13 18:07:53 -07:00
|
|
|
|
2023-09-17 12:37:26 -07:00
|
|
|
# Source files
|
|
|
|
set(BOOT_SOURCE_FILES
|
|
|
|
src/boot/boot.asm
|
|
|
|
src/boot/linker.ld
|
|
|
|
)
|
2023-10-18 19:15:44 -07:00
|
|
|
|
2023-10-24 16:36:11 -07:00
|
|
|
#[[
|
2023-09-17 12:37:26 -07:00
|
|
|
set(GRUB_SOURCE_FILES
|
|
|
|
src/boot/grub/grub.cfg
|
|
|
|
src/boot/grub/menu.lst
|
|
|
|
)
|
2023-10-24 16:36:11 -07:00
|
|
|
]]
|
2023-10-18 19:15:44 -07:00
|
|
|
|
2023-09-17 12:37:26 -07:00
|
|
|
set(DRIVERS_SOURCE_FILES
|
|
|
|
src/drivers/audio/audio.c
|
|
|
|
src/drivers/audio/audio.h
|
2023-09-18 15:18:13 -07:00
|
|
|
src/drivers/bus/eisa.c
|
|
|
|
src/drivers/bus/eisa.h
|
|
|
|
src/drivers/bus/isa.c
|
|
|
|
src/drivers/bus/isa.h
|
|
|
|
src/drivers/bus/mca.c
|
|
|
|
src/drivers/bus/mca.h
|
2023-10-26 23:28:06 -07:00
|
|
|
#src/drivers/bus/pci.asm
|
2023-09-18 15:18:13 -07:00
|
|
|
src/drivers/bus/pci.c
|
|
|
|
src/drivers/bus/pci.h
|
|
|
|
src/drivers/bus/vesa.c
|
|
|
|
src/drivers/bus/vesa.h
|
2023-09-17 12:37:26 -07:00
|
|
|
src/drivers/display/display.c
|
|
|
|
src/drivers/display/display.h
|
|
|
|
src/drivers/io/io.c
|
2023-10-31 04:32:41 -07:00
|
|
|
src/drivers/io/io.asm
|
2023-09-17 12:37:26 -07:00
|
|
|
src/drivers/io/io.h
|
|
|
|
src/drivers/keyboard/keyboard.c
|
|
|
|
src/drivers/keyboard/keyboard.h
|
|
|
|
src/drivers/screen/screen.c
|
|
|
|
src/drivers/screen/screen.h
|
|
|
|
src/drivers/tty/tty.c
|
|
|
|
src/drivers/tty/tty.h
|
|
|
|
)
|
|
|
|
set(KERNEL_SOURCE_FILES
|
2023-09-18 15:18:13 -07:00
|
|
|
src/kernel/arch/x86/include/memory.h
|
|
|
|
src/kernel/arch/x86/include/types.h
|
|
|
|
src/kernel/arch/x86/include/types.h
|
|
|
|
src/kernel/arch/x86/memory/memory.c
|
|
|
|
src/kernel/arch/x86/gdt.c
|
|
|
|
src/kernel/arch/x86/gdt.c
|
|
|
|
src/kernel/arch/x86/idt.c
|
2023-10-31 04:32:41 -07:00
|
|
|
src/kernel/arch/x86/idt.asm
|
2023-09-18 15:18:13 -07:00
|
|
|
src/kernel/arch/x86/idt.h
|
2023-10-31 04:32:41 -07:00
|
|
|
src/kernel/arch/x86/isr/isr.c
|
|
|
|
src/kernel/arch/x86/isr/isr.h
|
|
|
|
src/kernel/arch/x86/isr/exceptions.c
|
|
|
|
src/kernel/arch/x86/isr/exceptions.h
|
2023-09-17 12:37:26 -07:00
|
|
|
src/kernel/kernel.c
|
|
|
|
src/kernel/kernel.h
|
|
|
|
src/kernel/linker.ld
|
|
|
|
src/kernel/print.c
|
2023-07-13 19:20:28 -07:00
|
|
|
)
|
2023-07-13 18:07:53 -07:00
|
|
|
|
2023-10-26 23:28:06 -07:00
|
|
|
set(UTIL_SOURCE_FILES
|
|
|
|
src/EHS.h
|
2023-10-26 23:38:54 -07:00
|
|
|
src/sys/CPU.h src/sys/CPU.cpp src/sys/CPU_GCC_AMD64.asm
|
2023-10-26 23:28:06 -07:00
|
|
|
src/Util.h src/Util.cpp
|
|
|
|
src/Version.h src/Version.cpp
|
|
|
|
src/Serializer.h
|
|
|
|
src/Array.h
|
|
|
|
src/Vector.h
|
|
|
|
src/SArray.h
|
|
|
|
src/Str.h
|
|
|
|
src/PRNG.h
|
|
|
|
src/HRNG.h src/HRNG_GCC.s
|
|
|
|
src/Math.h src/Math.cpp src/Math_GCC_AMD64.s
|
|
|
|
src/Rect.h
|
|
|
|
src/Range.h src/Range.cpp
|
|
|
|
src/Color4.h src/Color4.cpp
|
|
|
|
src/Color3.h src/Color3.cpp
|
|
|
|
src/Quat.h
|
|
|
|
src/Vec4.h
|
|
|
|
src/Vec3.h
|
|
|
|
src/Vec2.h
|
|
|
|
src/Mat4.h
|
|
|
|
src/Mat3.h
|
|
|
|
src/Mat2.h
|
|
|
|
)
|
|
|
|
|
2023-09-17 12:37:26 -07:00
|
|
|
add_executable(ClassicOS
|
2023-10-24 16:36:11 -07:00
|
|
|
${GRUB_SOURCE_FILES}
|
2023-09-17 12:37:26 -07:00
|
|
|
${DRIVERS_SOURCE_FILES}
|
|
|
|
${KERNEL_SOURCE_FILES}
|
2023-07-13 19:20:28 -07:00
|
|
|
)
|
2023-07-13 18:07:53 -07:00
|
|
|
|
2023-09-18 15:18:13 -07:00
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
|
|
|
|
# Enable testing
|
|
|
|
enable_testing()
|
|
|
|
|
2023-09-17 12:37:26 -07:00
|
|
|
target_link_libraries(ClassicOS PRIVATE)
|
|
|
|
|
2023-10-24 16:36:11 -07:00
|
|
|
|
2023-07-13 19:20:28 -07:00
|
|
|
set(CMAKE_SYSTEM_PROCESSOR i386)
|
2023-10-05 14:40:15 -07:00
|
|
|
set(CMAKE_SYSTEM_NAME None)
|
2023-07-13 19:20:28 -07:00
|
|
|
set(CMAKE_C_STANDARD 17)
|
2023-10-26 23:38:54 -07:00
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
2023-10-24 16:36:11 -07:00
|
|
|
set(CMAKE_BUILD_TYPE Debug)
|
2023-07-13 19:20:28 -07:00
|
|
|
set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
|
|
|
set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build)
|
2023-10-24 16:36:11 -07:00
|
|
|
|
|
|
|
if (IS_OS_LINUX)
|
|
|
|
set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -f elf")
|
|
|
|
set(CMAKE_C_COMPILER gcc)
|
|
|
|
set(CMAKE_LINKER ld)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "-g -s")
|
|
|
|
set(CMAKE_LINK_FLAGS "${CMAKE_LINK_FLAGS} -e kernel_main")
|
|
|
|
set(CMAKE_CXX_FLAGS "-g -Wall")
|
|
|
|
set(CMAKE_C_FLAGS "-g -Wall -m32")
|
|
|
|
set(CMAKE_C_FLAGS_DEBUG "-g")
|
|
|
|
set(CMAKE_GDB_COMMAND gdb)
|
|
|
|
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
|
|
|
|
set_target_properties(ClassicOS PROPERTIES LINK_FLAGS "-T ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld")
|
|
|
|
elseif (IS_OS_WINDOWS)
|
|
|
|
set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -f win32")
|
|
|
|
endif ()
|