-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxmake.lua
More file actions
127 lines (104 loc) · 2.48 KB
/
xmake.lua
File metadata and controls
127 lines (104 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
add_rules("mode.debug", "mode.release")
set_policy("check.auto_ignore_flags", false)
set_targetdir("build")
set_objectdir("build/objs")
set_languages("cxx20")
local flags = {
general = {
cxx = {
"-ffreestanding",
"-fno-threadsafe-statics",
"-fno-exceptions",
"-fno-rtti",
"-fno-stack-protector",
"-fno-use-cxa-atexit",
"-fno-pic",
"-fno-omit-frame-pointer",
"-nostdlib",
"-nostdinc",
"-Wno-constant-conversion",
"-Wno-c++11-narrowing",
},
asm = {
"-w-label-orphan",
"-w-implicit-abs-deprecated",
"-w-other",
},
ld = {
"-T Config/linker.ld",
"-nostdlib",
"-z max-page-size=0x1000",
},
},
x86_64 = {
cxx = {
"--target=x86_64-unknown-none-elf",
"-mcmodel=kernel",
"-mno-sse",
"-mno-avx",
},
asm = {
"-f elf64",
},
},
}
local kernel_non_architecture_related = {
"Src/Kernel/Block/**.cpp",
"Src/Kernel/Driver/**.cpp",
"Src/Kernel/FileSystem/**.cpp",
"Src/Kernel/Hardware/**.cpp",
"Src/Kernel/Init/**.cpp",
"Src/Kernel/MemoryManager/**.cpp",
"Src/Kernel/Posix/**.cpp",
}
toolchain("FKernel_Compiling")
set_kind("standalone")
set_toolset("cc", "clang", "tcc", "cl", "gcc")
set_toolset("cxx", "clang++", "cl", "g++")
set_toolset("ld", "ld.lld", "gold", "link", "ld")
set_toolset("as", "nasm", "yasm", "ml")
toolchain_end()
target("FKernel")
set_kind("binary")
set_default(true)
set_filename("FKernel.bin")
set_license("BSD-3-Clause")
set_warnings("allextra", "error")
if is_mode("debug") then
set_symbols("debug")
set_optimize("fast")
add_defines("FKERNEL_DEBUG")
--TODO: add tests load on the kernel if this mode is setted
end
if is_mode("release") then
set_symbols("hidden")
set_optimize("faster")
set_strip("all")
end
add_includedirs("Include")
add_cxflags(flags.general.cxx, { force = true })
add_asflags(flags.general.asm, { force = true })
add_ldflags(flags.general.ld, { force = true })
add_files("Src/LibC/**.c")
add_files("Src/LibC/**.cpp")
add_files("Src/LibFK/**.cpp")
if is_arch("x86_64", "x64") then
add_cxflags(flags.x86_64.cxx)
add_asflags(flags.x86_64.asm)
add_files("Src/Kernel/Arch/x86_64/**.asm")
add_files("Src/Kernel/Arch/x86_64/**.cpp")
end
add_files(kernel_non_architecture_related)
if is_arch("x86_64", "x64") then
after_link(function(target)
os.execv("lua Meta/x86_64-tools/mount_mockos.lua")
end)
on_run(function(target)
os.execv("lua Meta/x86_64-tools/run_mockos.lua")
end)
end
on_clean(function(target)
os.execv("rm -rf Build")
os.execv("rm -rf build")
end)
target_end()