2021-02-24 13:30:19 +03:00
|
|
|
add_compile_options(-Os)
|
|
|
|
|
2021-03-04 19:50:05 +03:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "i686")
|
|
|
|
set(KERNEL_ARCH i386)
|
|
|
|
elseif("${SERENITY_ARCH}" STREQUAL "x86_64")
|
|
|
|
set(KERNEL_ARCH x86_64)
|
|
|
|
endif()
|
|
|
|
|
2020-08-10 18:44:35 +03:00
|
|
|
set(KERNEL_HEAP_SOURCES
|
|
|
|
Heap/SlabAllocator.cpp
|
|
|
|
Heap/kmalloc.cpp
|
|
|
|
)
|
|
|
|
|
2020-10-17 14:39:36 +03:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_STATIC}")
|
|
|
|
|
2020-05-06 18:40:06 +03:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
ACPI/DynamicParser.cpp
|
|
|
|
ACPI/Initialize.cpp
|
|
|
|
ACPI/MultiProcessorParser.cpp
|
|
|
|
ACPI/Parser.cpp
|
2021-02-14 23:47:10 +03:00
|
|
|
AddressSanitizer.cpp
|
2021-02-25 19:25:34 +03:00
|
|
|
Arch/PC/BIOS.cpp
|
|
|
|
Arch/x86/SmapDisabler.h
|
2020-05-06 18:40:06 +03:00
|
|
|
CMOS.cpp
|
|
|
|
CommandLine.cpp
|
2021-04-24 17:50:35 +03:00
|
|
|
ConsoleDevice.cpp
|
2020-11-06 11:09:51 +03:00
|
|
|
CoreDump.cpp
|
2021-01-29 14:10:18 +03:00
|
|
|
DMI.cpp
|
2020-11-02 21:16:01 +03:00
|
|
|
Devices/AsyncDeviceRequest.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
Devices/BlockDevice.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Devices/CharacterDevice.cpp
|
2021-01-01 13:20:55 +03:00
|
|
|
Devices/Device.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Devices/FullDevice.cpp
|
2021-01-29 15:03:25 +03:00
|
|
|
Devices/MemoryDevice.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Devices/NullDevice.cpp
|
|
|
|
Devices/PCSpeaker.cpp
|
|
|
|
Devices/RandomDevice.cpp
|
|
|
|
Devices/SB16.cpp
|
|
|
|
Devices/SerialDevice.cpp
|
2020-11-10 08:52:13 +03:00
|
|
|
Devices/USB/UHCIController.cpp
|
2021-01-02 20:53:05 +03:00
|
|
|
VirtIO/VirtIO.cpp
|
|
|
|
VirtIO/VirtIOQueue.cpp
|
2021-01-02 20:56:36 +03:00
|
|
|
VirtIO/VirtIOConsole.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Devices/VMWareBackdoor.cpp
|
|
|
|
Devices/ZeroDevice.cpp
|
2021-04-02 23:21:35 +03:00
|
|
|
Devices/HID/I8042Controller.cpp
|
|
|
|
Devices/HID/HIDManagement.cpp
|
|
|
|
Devices/HID/KeyboardDevice.cpp
|
|
|
|
Devices/HID/MouseDevice.cpp
|
|
|
|
Devices/HID/PS2KeyboardDevice.cpp
|
|
|
|
Devices/HID/PS2MouseDevice.cpp
|
|
|
|
Devices/HID/VMWareMouseDevice.cpp
|
2021-04-16 22:58:51 +03:00
|
|
|
Graphics/Console/FramebufferConsole.cpp
|
|
|
|
Graphics/Console/TextModeConsole.cpp
|
|
|
|
Graphics/Console/VGAConsole.cpp
|
2021-03-05 15:23:08 +03:00
|
|
|
Graphics/BochsFramebufferDevice.cpp
|
|
|
|
Graphics/BochsGraphicsAdapter.cpp
|
|
|
|
Graphics/FramebufferDevice.cpp
|
|
|
|
Graphics/GraphicsManagement.cpp
|
2021-04-12 22:07:30 +03:00
|
|
|
Graphics/IntelNativeGraphicsAdapter.cpp
|
2021-03-05 15:23:08 +03:00
|
|
|
Graphics/RawFramebufferDevice.cpp
|
|
|
|
Graphics/VGACompatibleAdapter.cpp
|
2020-12-25 21:23:35 +03:00
|
|
|
Storage/Partition/DiskPartition.cpp
|
2020-12-25 23:48:29 +03:00
|
|
|
Storage/Partition/DiskPartitionMetadata.cpp
|
2020-12-25 21:23:35 +03:00
|
|
|
Storage/Partition/EBRPartitionTable.cpp
|
2020-12-26 17:53:30 +03:00
|
|
|
Storage/Partition/GUIDPartitionTable.cpp
|
2020-12-25 21:23:35 +03:00
|
|
|
Storage/Partition/MBRPartitionTable.cpp
|
2020-12-26 17:53:30 +03:00
|
|
|
Storage/Partition/PartitionTable.cpp
|
2020-12-19 13:50:57 +03:00
|
|
|
Storage/StorageDevice.cpp
|
2021-02-26 07:25:45 +03:00
|
|
|
Storage/AHCIController.cpp
|
|
|
|
Storage/AHCIPort.cpp
|
|
|
|
Storage/AHCIPortHandler.cpp
|
|
|
|
Storage/SATADiskDevice.cpp
|
2021-03-27 09:01:00 +03:00
|
|
|
Storage/BMIDEChannel.cpp
|
2020-12-19 13:50:57 +03:00
|
|
|
Storage/IDEController.cpp
|
|
|
|
Storage/IDEChannel.cpp
|
|
|
|
Storage/PATADiskDevice.cpp
|
2021-01-20 00:33:00 +03:00
|
|
|
Storage/RamdiskController.cpp
|
|
|
|
Storage/RamdiskDevice.cpp
|
2020-12-19 16:25:06 +03:00
|
|
|
Storage/StorageManagement.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
DoubleBuffer.cpp
|
2021-01-15 13:28:07 +03:00
|
|
|
FileSystem/AnonymousFile.cpp
|
2020-07-02 12:48:08 +03:00
|
|
|
FileSystem/BlockBasedFileSystem.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
FileSystem/Custody.cpp
|
2020-12-25 20:26:38 +03:00
|
|
|
FileSystem/DevFS.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
FileSystem/DevPtsFS.cpp
|
|
|
|
FileSystem/Ext2FileSystem.cpp
|
|
|
|
FileSystem/FIFO.cpp
|
|
|
|
FileSystem/File.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
FileSystem/FileBackedFileSystem.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
FileSystem/FileDescription.cpp
|
|
|
|
FileSystem/FileSystem.cpp
|
|
|
|
FileSystem/Inode.cpp
|
|
|
|
FileSystem/InodeFile.cpp
|
|
|
|
FileSystem/InodeWatcher.cpp
|
2020-07-02 13:05:56 +03:00
|
|
|
FileSystem/Plan9FileSystem.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
FileSystem/ProcFS.cpp
|
|
|
|
FileSystem/TmpFS.cpp
|
|
|
|
FileSystem/VirtualFileSystem.cpp
|
2020-12-22 09:21:58 +03:00
|
|
|
FutexQueue.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Interrupts/APIC.cpp
|
|
|
|
Interrupts/GenericInterruptHandler.cpp
|
|
|
|
Interrupts/IOAPIC.cpp
|
|
|
|
Interrupts/IRQHandler.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
Interrupts/InterruptManagement.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Interrupts/PIC.cpp
|
|
|
|
Interrupts/SharedIRQHandler.cpp
|
|
|
|
Interrupts/SpuriousInterruptHandler.cpp
|
|
|
|
Interrupts/UnhandledInterruptHandler.cpp
|
|
|
|
KBufferBuilder.cpp
|
|
|
|
KSyms.cpp
|
|
|
|
Lock.cpp
|
|
|
|
Net/E1000NetworkAdapter.cpp
|
|
|
|
Net/IPv4Socket.cpp
|
|
|
|
Net/LocalSocket.cpp
|
|
|
|
Net/LoopbackAdapter.cpp
|
2021-01-30 18:00:57 +03:00
|
|
|
Net/NE2000NetworkAdapter.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Net/NetworkAdapter.cpp
|
|
|
|
Net/NetworkTask.cpp
|
|
|
|
Net/RTL8139NetworkAdapter.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
Net/Routing.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Net/Socket.cpp
|
|
|
|
Net/TCPSocket.cpp
|
|
|
|
Net/UDPSocket.cpp
|
|
|
|
PCI/Access.cpp
|
|
|
|
PCI/Device.cpp
|
2020-12-18 11:52:52 +03:00
|
|
|
PCI/DeviceController.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
PCI/IOAccess.cpp
|
|
|
|
PCI/MMIOAccess.cpp
|
2021-04-03 16:46:04 +03:00
|
|
|
PCI/Initializer.cpp
|
|
|
|
PCI/WindowedMMIOAccess.cpp
|
2021-02-14 11:01:52 +03:00
|
|
|
Panic.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
PerformanceEventBuffer.cpp
|
|
|
|
Process.cpp
|
2020-08-15 22:13:19 +03:00
|
|
|
ProcessGroup.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
RTC.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
Random.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Scheduler.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
StdLib.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Syscall.cpp
|
2021-01-15 13:28:07 +03:00
|
|
|
Syscalls/anon_create.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/access.cpp
|
|
|
|
Syscalls/alarm.cpp
|
|
|
|
Syscalls/beep.cpp
|
|
|
|
Syscalls/chdir.cpp
|
|
|
|
Syscalls/chmod.cpp
|
|
|
|
Syscalls/chown.cpp
|
|
|
|
Syscalls/chroot.cpp
|
|
|
|
Syscalls/clock.cpp
|
|
|
|
Syscalls/debug.cpp
|
2020-08-04 14:51:11 +03:00
|
|
|
Syscalls/disown.cpp
|
2020-08-15 11:54:00 +03:00
|
|
|
Syscalls/dup2.cpp
|
2021-03-09 10:16:00 +03:00
|
|
|
Syscalls/emuctl.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/execve.cpp
|
|
|
|
Syscalls/exit.cpp
|
|
|
|
Syscalls/fcntl.cpp
|
|
|
|
Syscalls/fork.cpp
|
|
|
|
Syscalls/ftruncate.cpp
|
|
|
|
Syscalls/futex.cpp
|
|
|
|
Syscalls/get_dir_entries.cpp
|
|
|
|
Syscalls/get_stack_bounds.cpp
|
|
|
|
Syscalls/getrandom.cpp
|
|
|
|
Syscalls/getuid.cpp
|
|
|
|
Syscalls/hostname.cpp
|
|
|
|
Syscalls/ioctl.cpp
|
2021-01-30 23:35:54 +03:00
|
|
|
Syscalls/keymap.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/kill.cpp
|
|
|
|
Syscalls/link.cpp
|
|
|
|
Syscalls/lseek.cpp
|
|
|
|
Syscalls/mkdir.cpp
|
|
|
|
Syscalls/mknod.cpp
|
|
|
|
Syscalls/mmap.cpp
|
|
|
|
Syscalls/module.cpp
|
|
|
|
Syscalls/mount.cpp
|
|
|
|
Syscalls/open.cpp
|
|
|
|
Syscalls/perf_event.cpp
|
|
|
|
Syscalls/pipe.cpp
|
|
|
|
Syscalls/pledge.cpp
|
2020-12-25 20:27:42 +03:00
|
|
|
Syscalls/prctl.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/process.cpp
|
|
|
|
Syscalls/profiling.cpp
|
|
|
|
Syscalls/ptrace.cpp
|
|
|
|
Syscalls/purge.cpp
|
|
|
|
Syscalls/read.cpp
|
|
|
|
Syscalls/readlink.cpp
|
|
|
|
Syscalls/realpath.cpp
|
|
|
|
Syscalls/rename.cpp
|
|
|
|
Syscalls/rmdir.cpp
|
|
|
|
Syscalls/sched.cpp
|
|
|
|
Syscalls/select.cpp
|
|
|
|
Syscalls/sendfd.cpp
|
|
|
|
Syscalls/setpgid.cpp
|
|
|
|
Syscalls/setuid.cpp
|
|
|
|
Syscalls/shutdown.cpp
|
|
|
|
Syscalls/sigaction.cpp
|
|
|
|
Syscalls/socket.cpp
|
|
|
|
Syscalls/stat.cpp
|
|
|
|
Syscalls/sync.cpp
|
|
|
|
Syscalls/sysconf.cpp
|
|
|
|
Syscalls/thread.cpp
|
|
|
|
Syscalls/times.cpp
|
|
|
|
Syscalls/ttyname.cpp
|
|
|
|
Syscalls/umask.cpp
|
|
|
|
Syscalls/uname.cpp
|
|
|
|
Syscalls/unlink.cpp
|
|
|
|
Syscalls/unveil.cpp
|
|
|
|
Syscalls/utime.cpp
|
|
|
|
Syscalls/waitid.cpp
|
2021-05-12 22:17:51 +03:00
|
|
|
Syscalls/inode_watcher.cpp
|
2020-07-31 00:38:15 +03:00
|
|
|
Syscalls/write.cpp
|
2021-04-16 22:58:51 +03:00
|
|
|
TTY/ConsoleManagement.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
TTY/MasterPTY.cpp
|
|
|
|
TTY/PTYMultiplexer.cpp
|
|
|
|
TTY/SlavePTY.cpp
|
|
|
|
TTY/TTY.cpp
|
|
|
|
TTY/VirtualConsole.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Tasks/FinalizerTask.cpp
|
|
|
|
Tasks/SyncTask.cpp
|
|
|
|
Thread.cpp
|
2020-11-30 02:05:27 +03:00
|
|
|
ThreadBlockers.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
ThreadTracer.cpp
|
2020-10-25 18:13:47 +03:00
|
|
|
Time/APICTimer.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Time/HPET.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
Time/HPETComparator.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
Time/PIT.cpp
|
|
|
|
Time/RTC.cpp
|
|
|
|
Time/TimeManagement.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
TimerQueue.cpp
|
2021-02-05 21:44:26 +03:00
|
|
|
UBSanitizer.cpp
|
2020-09-12 06:11:07 +03:00
|
|
|
UserOrKernelBuffer.cpp
|
2021-04-15 12:22:02 +03:00
|
|
|
VirtIO/VirtIO.cpp
|
|
|
|
VirtIO/VirtIOConsole.cpp
|
|
|
|
VirtIO/VirtIOQueue.cpp
|
2021-01-22 19:56:19 +03:00
|
|
|
VirtIO/VirtIORNG.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
VM/AnonymousVMObject.cpp
|
|
|
|
VM/ContiguousVMObject.cpp
|
|
|
|
VM/InodeVMObject.cpp
|
|
|
|
VM/MemoryManager.cpp
|
|
|
|
VM/PageDirectory.cpp
|
|
|
|
VM/PhysicalPage.cpp
|
|
|
|
VM/PhysicalRegion.cpp
|
|
|
|
VM/PrivateInodeVMObject.cpp
|
|
|
|
VM/ProcessPagingScope.cpp
|
2020-09-06 00:52:14 +03:00
|
|
|
VM/PurgeablePageRanges.cpp
|
2021-02-25 13:42:49 +03:00
|
|
|
VM/Range.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
VM/RangeAllocator.cpp
|
|
|
|
VM/Region.cpp
|
2021-05-12 17:58:05 +03:00
|
|
|
VM/RingBuffer.cpp
|
2021-01-20 19:34:16 +03:00
|
|
|
VM/ScatterGatherList.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
VM/SharedInodeVMObject.cpp
|
2021-02-08 17:45:40 +03:00
|
|
|
VM/Space.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
VM/VMObject.cpp
|
|
|
|
WaitQueue.cpp
|
2021-02-06 09:36:38 +03:00
|
|
|
WorkQueue.cpp
|
2020-05-16 13:00:04 +03:00
|
|
|
init.cpp
|
|
|
|
kprintf.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
)
|
|
|
|
|
2021-03-07 23:28:28 +03:00
|
|
|
set(KERNEL_SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/${KERNEL_ARCH}/CPU.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/${KERNEL_ARCH}/InterruptEntry.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/${KERNEL_ARCH}/ProcessorInfo.cpp
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Arch/${KERNEL_ARCH}/SafeMem.cpp
|
|
|
|
)
|
|
|
|
|
2020-05-06 18:40:06 +03:00
|
|
|
set(AK_SOURCES
|
|
|
|
../AK/FlyString.cpp
|
2020-08-09 12:34:26 +03:00
|
|
|
../AK/GenericLexer.cpp
|
2020-12-31 14:17:03 +03:00
|
|
|
../AK/Hex.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
../AK/JsonParser.cpp
|
|
|
|
../AK/JsonValue.cpp
|
2020-05-26 14:52:44 +03:00
|
|
|
../AK/LexicalPath.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
../AK/String.cpp
|
|
|
|
../AK/StringBuilder.cpp
|
|
|
|
../AK/StringImpl.cpp
|
|
|
|
../AK/StringUtils.cpp
|
|
|
|
../AK/StringView.cpp
|
2020-08-26 02:19:16 +03:00
|
|
|
../AK/Time.cpp
|
2020-09-22 14:05:40 +03:00
|
|
|
../AK/Format.cpp
|
2020-12-31 14:17:03 +03:00
|
|
|
../AK/UUID.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
set(ELF_SOURCES
|
2021-01-12 14:17:30 +03:00
|
|
|
../Userland/Libraries/LibELF/Image.cpp
|
|
|
|
../Userland/Libraries/LibELF/Validation.cpp
|
2020-05-06 18:40:06 +03:00
|
|
|
)
|
|
|
|
|
2021-05-08 21:37:43 +03:00
|
|
|
generate_state_machine(../Userland/Libraries/LibVT/StateMachine.txt ../Userland/Libraries/LibVT/EscapeSequenceStateMachine.h)
|
|
|
|
|
2020-05-27 00:35:14 +03:00
|
|
|
set(VT_SOURCES
|
2021-01-12 14:17:30 +03:00
|
|
|
../Userland/Libraries/LibVT/Terminal.cpp
|
|
|
|
../Userland/Libraries/LibVT/Line.cpp
|
2021-05-08 21:37:43 +03:00
|
|
|
../Userland/Libraries/LibVT/EscapeSequenceStateMachine.h
|
|
|
|
../Userland/Libraries/LibVT/EscapeSequenceParser.cpp
|
2020-05-27 00:35:14 +03:00
|
|
|
)
|
|
|
|
|
2020-06-10 11:22:31 +03:00
|
|
|
set(KEYBOARD_SOURCES
|
2021-01-12 14:17:30 +03:00
|
|
|
../Userland/Libraries/LibKeyboard/CharacterMap.cpp
|
2020-06-10 11:22:31 +03:00
|
|
|
)
|
|
|
|
|
2020-06-23 05:23:35 +03:00
|
|
|
set(CRYPTO_SOURCES
|
2021-01-12 14:17:30 +03:00
|
|
|
../Userland/Libraries/LibCrypto/Cipher/AES.cpp
|
|
|
|
../Userland/Libraries/LibCrypto/Hash/SHA2.cpp
|
2020-06-23 05:23:35 +03:00
|
|
|
)
|
|
|
|
|
2020-09-27 13:44:03 +03:00
|
|
|
set(C_SOURCES
|
2021-01-12 14:17:30 +03:00
|
|
|
../Userland/Libraries/LibC/ctype.cpp
|
2020-09-27 13:44:03 +03:00
|
|
|
)
|
|
|
|
|
2020-05-06 18:40:06 +03:00
|
|
|
set(SOURCES
|
|
|
|
${KERNEL_SOURCES}
|
|
|
|
${AK_SOURCES}
|
|
|
|
${ELF_SOURCES}
|
2020-05-27 00:35:14 +03:00
|
|
|
${VT_SOURCES}
|
2020-06-10 11:22:31 +03:00
|
|
|
${KEYBOARD_SOURCES}
|
2020-06-23 05:23:35 +03:00
|
|
|
${CRYPTO_SOURCES}
|
2020-09-27 13:44:03 +03:00
|
|
|
${C_SOURCES}
|
2020-05-06 18:40:06 +03:00
|
|
|
)
|
|
|
|
|
2021-04-17 01:37:24 +03:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option -Wvla -Wnull-dereference")
|
2021-01-01 16:12:20 +03:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pie -fPIE -fno-rtti -ffreestanding -fbuiltin")
|
2020-05-06 18:40:06 +03:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-80387 -mno-mmx -mno-sse -mno-sse2")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-asynchronous-unwind-tables")
|
2021-01-02 14:02:42 +03:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong")
|
2021-02-15 00:49:25 +03:00
|
|
|
if (NOT ${CMAKE_HOST_SYSTEM_NAME} MATCHES SerenityOS)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdlib -nostdinc -nostdinc++")
|
|
|
|
endif()
|
2020-05-06 18:40:06 +03:00
|
|
|
|
2021-03-04 19:50:05 +03:00
|
|
|
if ("${SERENITY_ARCH}" STREQUAL "x86_64")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcmodel=large -mno-red-zone")
|
|
|
|
endif()
|
|
|
|
|
2021-02-24 22:47:56 +03:00
|
|
|
# Kernel Undefined Behavior Sanitizer (KUBSAN)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
|
|
|
|
|
2021-02-14 23:47:10 +03:00
|
|
|
# Kernel Address Sanitize (KASAN) implementation is still a work in progress, this option
|
|
|
|
# is not currently meant to be used, besides when developing Kernel ASAN support.
|
|
|
|
#
|
|
|
|
if (ENABLE_KERNEL_ADDRESS_SANITIZER)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=kernel-address")
|
|
|
|
endif()
|
|
|
|
|
2021-02-11 23:20:10 +03:00
|
|
|
add_compile_definitions(KERNEL)
|
|
|
|
|
|
|
|
# HACK: This is a workaround for CLion to grok the kernel sources.
|
|
|
|
# It's needed because CLion doesn't understand the way we switch compilers mid-build.
|
|
|
|
add_compile_definitions(__serenity__)
|
|
|
|
|
2020-05-06 18:40:06 +03:00
|
|
|
add_link_options(LINKER:-T ${CMAKE_CURRENT_BINARY_DIR}/linker.ld -nostdlib)
|
|
|
|
|
2021-02-24 08:08:21 +03:00
|
|
|
# HACK: This is to work around a bug in CMake dependency resolution, the
|
|
|
|
# kernel won't re-link when boot.S changes without this.
|
|
|
|
set_source_files_properties(init.cpp
|
|
|
|
PROPERTIES
|
2021-03-04 19:50:05 +03:00
|
|
|
OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/Arch/${KERNEL_ARCH}/Boot/boot.S
|
2021-02-24 08:08:21 +03:00
|
|
|
)
|
2021-03-07 23:28:28 +03:00
|
|
|
|
2021-03-04 19:50:05 +03:00
|
|
|
add_library(boot OBJECT Arch/${KERNEL_ARCH}/Boot/boot.S)
|
2021-02-24 08:08:21 +03:00
|
|
|
|
2020-08-10 18:44:35 +03:00
|
|
|
add_library(kernel_heap STATIC ${KERNEL_HEAP_SOURCES})
|
2020-05-06 18:40:06 +03:00
|
|
|
file(GENERATE OUTPUT linker.ld INPUT linker.ld)
|
|
|
|
|
|
|
|
if (${CMAKE_HOST_SYSTEM_NAME} MATCHES SerenityOS)
|
2021-04-27 10:25:02 +03:00
|
|
|
include_directories(/usr/local/include/c++/${GCC_VERSION}/)
|
2020-05-06 18:40:06 +03:00
|
|
|
else()
|
2021-04-27 10:30:33 +03:00
|
|
|
if (NOT EXISTS ${TOOLCHAIN_ROOT}/Kernel/${SERENITY_ARCH}-pc-serenity/include/c++/${GCC_VERSION}/)
|
2021-05-13 14:15:35 +03:00
|
|
|
message(FATAL_ERROR "Toolchain version ${GCC_VERSION} appears to be missing! Please run: Meta/serenity.sh rebuild-toolchain")
|
2021-04-27 10:30:33 +03:00
|
|
|
endif()
|
2021-04-27 10:25:02 +03:00
|
|
|
include_directories(${TOOLCHAIN_ROOT}/Kernel/${SERENITY_ARCH}-pc-serenity/include/c++/${GCC_VERSION}/)
|
|
|
|
include_directories(${TOOLCHAIN_ROOT}/Kernel/${SERENITY_ARCH}-pc-serenity/include/c++/${GCC_VERSION}/${SERENITY_ARCH}-pc-serenity/)
|
|
|
|
link_directories(${TOOLCHAIN_ROOT}/Kernel/${SERENITY_ARCH}-pc-serenity/lib)
|
|
|
|
link_directories(${TOOLCHAIN_ROOT}/Kernel/lib/gcc/${SERENITY_ARCH}-pc-serenity/${GCC_VERSION}/)
|
2020-05-06 18:40:06 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(Kernel ${SOURCES})
|
2021-04-29 16:25:31 +03:00
|
|
|
if (ENABLE_KERNEL_LTO)
|
|
|
|
include(CheckIPOSupported)
|
|
|
|
check_ipo_supported()
|
|
|
|
set_property(TARGET Kernel PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
|
|
|
|
endif()
|
2020-08-10 18:44:35 +03:00
|
|
|
target_link_libraries(Kernel kernel_heap gcc stdc++)
|
|
|
|
add_dependencies(Kernel boot kernel_heap)
|
2020-05-06 18:40:06 +03:00
|
|
|
install(TARGETS Kernel RUNTIME DESTINATION boot)
|
2021-04-21 14:15:52 +03:00
|
|
|
serenity_add_ak_precompiled_headers_to_target(Kernel)
|
2020-05-06 18:40:06 +03:00
|
|
|
|
|
|
|
add_custom_command(
|
|
|
|
TARGET Kernel
|
|
|
|
COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/mkmap.sh
|
|
|
|
)
|
|
|
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/kernel.map DESTINATION res)
|
|
|
|
|
2020-05-26 21:20:24 +03:00
|
|
|
serenity_install_headers(Kernel)
|
2020-08-15 15:11:10 +03:00
|
|
|
serenity_install_sources(Kernel)
|
2020-05-26 21:20:24 +03:00
|
|
|
|
2020-05-06 18:40:06 +03:00
|
|
|
add_subdirectory(Modules)
|