Initial commit
This commit is contained in:
81
xmake.lua
Normal file
81
xmake.lua
Normal file
@@ -0,0 +1,81 @@
|
||||
set_project("allocator")
|
||||
set_version("1.0.0")
|
||||
|
||||
set_languages("c11")
|
||||
|
||||
add_rules("mode.debug", "mode.release")
|
||||
|
||||
-- Export compile_commands.json
|
||||
add_rules("plugin.compile_commands.autoupdate")
|
||||
|
||||
-- =========================================================
|
||||
-- Options
|
||||
-- =========================================================
|
||||
|
||||
option("tests")
|
||||
set_default(false)
|
||||
set_showmenu(true)
|
||||
option_end()
|
||||
|
||||
option("example")
|
||||
set_default(true)
|
||||
set_showmenu(true)
|
||||
option_end()
|
||||
|
||||
option("asan")
|
||||
set_default(false)
|
||||
set_showmenu(true)
|
||||
option_end()
|
||||
|
||||
-- =========================================================
|
||||
-- Library
|
||||
-- =========================================================
|
||||
|
||||
target("allocator")
|
||||
set_kind("static")
|
||||
|
||||
add_files("src/allocator.c")
|
||||
|
||||
add_headerfiles("include/*.h")
|
||||
|
||||
add_includedirs("include", { public = true })
|
||||
|
||||
if is_mode("debug") then
|
||||
add_cflags("-Wall", "-Wextra", "-Wpedantic")
|
||||
end
|
||||
|
||||
-- =========================================================
|
||||
-- Example executable
|
||||
-- =========================================================
|
||||
|
||||
if has_config("example") then
|
||||
target("example")
|
||||
set_kind("binary")
|
||||
|
||||
add_files("src/main.c")
|
||||
|
||||
add_deps("allocator")
|
||||
end
|
||||
|
||||
-- =========================================================
|
||||
-- Tests
|
||||
-- =========================================================
|
||||
|
||||
if has_config("tests") then
|
||||
add_requires("cmocka")
|
||||
|
||||
target("test_mylib")
|
||||
set_kind("binary")
|
||||
|
||||
add_files("test/test_allocator.c")
|
||||
|
||||
add_deps("allocator")
|
||||
|
||||
add_packages("cmocka")
|
||||
|
||||
if has_config("asan") then
|
||||
add_cflags("-fsanitize=address", "-fno-omit-frame-pointer")
|
||||
|
||||
add_ldflags("-fsanitize=address")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user