-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathxmake.lua
65 lines (55 loc) · 2.02 KB
/
xmake.lua
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
add_rules("mode.debug", "mode.release")
set_project("khistory")
set_languages("cxx17")
-- config common third-party libs
add_requires("imgui 1.88", {configs = {glfw_opengl3 = true}})
add_packages("imgui")
-- use dsvisual framework
add_includedirs("third-party/DSVisual")
add_files("third-party/DSVisual/dsvisual-core.cpp")
add_includedirs("third-party/DStruct")
-- config os platform
if is_host("windows") then
add_ldflags("-subsystem:windows")
add_ldflags("-entry:mainCRTStartup", {force = true})
add_files("platform/win_platform_impl.cpp")
elseif is_host("macosx") then
add_files("platform/mac_platform_impl.cpp")
else
add_files("platform/linux_platform_impl.cpp")
add_links("X11")
end
-- config khistory include path
add_includedirs("include")
add_includedirs("kplugin")
add_includedirs("kplugin/auto-register")
target("khistory")
set_kind("binary")
add_files("src/*.cpp")
before_build(
function ()
local files = os.files("kplugin/auto-register" .. "/*.kplugin.hpp")
local pluginFile = io.open("kplugin/plugin-auto-register-info.kplugin", "w")
pluginFile:write('//Note: This file is automatically generated by a script. Please do not modify it.\n');
pluginFile:write('//Date: ' .. os.date("%Y-%m-%d %H:%M:%S") .. '\n');
-- detect head-file
for _, file in ipairs(files) do
local fileName = path.filename(file)
pluginFile:write('#include "' .. fileName .. '"\n')
end
-- register plugin
pluginFile:write('static void loadAutoRegisterPlugin() {')
for _, file in ipairs(files) do
local pluginName = path.filename(file):gsub("%.kplugin%.hpp$", "")
pluginFile:write('\n KPLUGIN_REGISTER(' .. pluginName .. ');')
end
pluginFile:write('\n}')
pluginFile:close()
end
)
--[[
target("khistory-test")
set_kind("binary")
add_files("src/PAL.cpp")
add_files("tests/test.cpp")
--]]