2022-02-20 22:12:44 +08:00
|
|
|
target("libthread")
|
2026-11-19 21:56:04 +08:00
|
|
|
set_version("1.0.0")
|
2022-02-20 22:12:44 +08:00
|
|
|
set_kind("$(kind)")
|
2022-02-03 14:26:20 +08:00
|
|
|
add_files("src/*.c")
|
2023-04-29 23:38:26 +08:00
|
|
|
set_configdir("include")
|
|
|
|
|
add_configfiles("src/thread.h.in")
|
|
|
|
|
add_headerfiles("include/thread.h")
|
2022-02-03 14:26:20 +08:00
|
|
|
if not is_plat("windows") then
|
2021-07-31 21:11:20 +08:00
|
|
|
add_syslinks("pthread", "dl")
|
|
|
|
|
end
|
2022-02-20 22:12:44 +08:00
|
|
|
add_deps("yutil")
|
2023-04-29 23:38:26 +08:00
|
|
|
if is_kind("static") then
|
|
|
|
|
set_configvar("LIBTHREAD_STATIC_BUILD", 1)
|
|
|
|
|
elseif is_plat("windows") then
|
|
|
|
|
add_defines("LIBTHREAD_DLL_EXPORT")
|
|
|
|
|
end
|
2026-05-23 18:46:07 +08:00
|
|
|
|
|
|
|
|
target("libthread-tests")
|
|
|
|
|
set_default(false)
|
|
|
|
|
set_kind("binary")
|
|
|
|
|
set_group("tests")
|
|
|
|
|
set_rundir("tests")
|
|
|
|
|
add_files("tests/main.c", "tests/test_thread.c")
|
|
|
|
|
add_deps("ctest", "libthread")
|
|
|
|
|
add_rules("tests.runnable")
|
|
|
|
|
add_tests("default", {group = "tests"})
|
|
|
|
|
|