refactor: xmake in use, compiles and tests fine
This commit is contained in:
94
xmake.lua
Normal file
94
xmake.lua
Normal file
@@ -0,0 +1,94 @@
|
||||
set_project("lae_arraylist")
|
||||
set_version("1.0.0")
|
||||
|
||||
set_languages("c11")
|
||||
|
||||
add_rules("mode.debug", "mode.release")
|
||||
|
||||
-- clang compile commands
|
||||
add_rules("plugin.compile_commands.autoupdate")
|
||||
|
||||
-- =========================================================
|
||||
-- Options
|
||||
-- =========================================================
|
||||
|
||||
option("tests")
|
||||
set_default(false)
|
||||
set_showmenu(true)
|
||||
option_end()
|
||||
|
||||
option("example")
|
||||
set_default(false)
|
||||
set_showmenu(true)
|
||||
option_end()
|
||||
|
||||
option("asan")
|
||||
set_default(false)
|
||||
set_showmenu(true)
|
||||
option_end()
|
||||
|
||||
-- =========================================================
|
||||
-- Packages
|
||||
-- =========================================================
|
||||
|
||||
-- Run xmake repo --add lae-repo https://laentropia-homelab.tail7368da.ts.net/laentropia/xmake-repo.git
|
||||
-- to add my repo :)
|
||||
|
||||
add_requires("cmocka", { optional = true }) -- For tests
|
||||
add_requires("lae_allocator")
|
||||
|
||||
-- =========================================================
|
||||
-- Library
|
||||
-- =========================================================
|
||||
|
||||
target("lae_arraylist")
|
||||
set_kind("static")
|
||||
|
||||
add_packages("lae_allocator", { public = true })
|
||||
|
||||
add_files("src/lae_arraylist.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_deps("lae_arraylist")
|
||||
add_packages("lae_allocator")
|
||||
|
||||
add_files("src/main.c")
|
||||
end
|
||||
|
||||
-- =========================================================
|
||||
-- Tests
|
||||
-- =========================================================
|
||||
|
||||
if has_config("tests") then
|
||||
target("test_arena")
|
||||
set_kind("binary")
|
||||
|
||||
add_files("test/test_arraylist.c")
|
||||
|
||||
add_deps("lae_arraylist")
|
||||
|
||||
add_packages("cmocka")
|
||||
|
||||
add_tests("default")
|
||||
|
||||
if has_config("asan") then
|
||||
add_cflags("-fsanitize=address", "-fno-omit-frame-pointer", { force = true })
|
||||
|
||||
add_ldflags("-fsanitize=address", { force = true })
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user