-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxmake.lua
37 lines (30 loc) · 982 Bytes
/
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
set_project("penis")
set_version("2.1.1")
set_xmakever("2.7.0")
set_languages("c++20")
add_rules("mode.debug", "mode.release")
add_includedirs("include")
target("penis-lib")
set_kind("static")
add_files("src/**/*.cpp")
add_headerfiles("include/(**/*.hpp)")
-- Define a function to get all files in a directory
function get_files_in_directory(dir)
local files = os.files(path.join(dir, "*.c"))
for _, f in ipairs(os.files(path.join(dir, "*.cpp"))) do
table.insert(files, f)
end
return files
end
-- Define a target for every file in the example directory
local example_dir = "examples"
for _, file in ipairs(get_files_in_directory(example_dir)) do
local target_name = path.basename(file)
target_name = target_name:gsub("%.[^.]+$", "") -- remove file extension
target("example_" .. target_name)
set_default(false)
set_kind("binary")
add_files(file)
add_deps("penis-lib")
end
add_installfiles("(include/**)", {prefixdir = ""})