Skip to content

Commit

Permalink
add cosmocc option
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Aug 21, 2024
1 parent 553c324 commit 7db25c5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/tbox/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ target("tbox")
-- add the source files for the hash module
if has_config("hash") then
add_files("hash/*.c")
if not is_plat("windows") and not is_config("toolchain", "cosmocc") then
if not is_plat("windows") and not has_config("cosmocc") then
add_files("hash/arch/crc32.S")
end
end
Expand Down
26 changes: 3 additions & 23 deletions src/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
option("demo", {default = true, category = "option", description = "Enable or disable the demo module."})
option("small", {default = true, category = "option", description = "Enable the small compile mode and disable all modules."})
option("cosmocc", {default = false, category = "option", description = "Use cosmocc toolchain to build once and run anywhere."})

-- option: demo
option("demo")
set_default(true)
set_showmenu(true)
set_category("option")
set_description("Enable or disable the demo module")
option_end()

-- option: micro
option("micro")
set_default(false)
set_showmenu(true)
Expand All @@ -16,21 +10,11 @@ option("micro")
set_configvar("TB_CONFIG_MICRO_ENABLE", 1)
option_end()

-- option: small
option("small")
set_default(true)
set_showmenu(true)
set_category("option")
set_description("Enable the small compile mode and disable all modules.")
option_end()

-- option: wchar
option("wchar")
add_ctypes("wchar_t")
set_configvar("TB_CONFIG_TYPE_HAVE_WCHAR", 1)
option_end()

-- option: float
option("float")
set_default(true)
set_showmenu(true)
Expand All @@ -45,7 +29,6 @@ option("float")
end)
option_end()

-- option: info
option("info")
set_default(true)
set_showmenu(true)
Expand All @@ -61,7 +44,6 @@ option("info")
end)
option_end()

-- option: exception
option("exception")
set_default(false)
set_showmenu(true)
Expand All @@ -70,7 +52,6 @@ option("exception")
set_configvar("TB_CONFIG_EXCEPTION_ENABLE", 1)
option_end()

-- option: deprecated
option("deprecated")
set_default(false)
set_showmenu(true)
Expand All @@ -79,7 +60,6 @@ option("deprecated")
set_configvar("TB_CONFIG_API_HAVE_DEPRECATED", 1)
option_end()

-- option: force-utf8
option("force-utf8")
set_default(false)
set_showmenu(true)
Expand Down
7 changes: 7 additions & 0 deletions xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ if is_plat("wasm") then
set_toolchains("emcc@emscripten")
end

-- set cosmocc toolchain, e.g. xmake f -p linux --cosmocc=y
if has_config("cosmocc") then
add_requires("cosmocc")
set_toolchains("@cosmocc")
set_policy("build.ccache", false)
end

-- add build modes
add_rules("mode.release", "mode.debug", "mode.profile", "mode.coverage", "mode.valgrind", "mode.asan", "mode.tsan", "mode.ubsan")
if is_mode("debug") then
Expand Down

0 comments on commit 7db25c5

Please sign in to comment.