11--- @meta
2- --- [conditions](https://xmake.io/#/manual /conditions)
2+ --- [conditions](https://xmake.io/api/description /conditions)
33
44---
55--- Is the current compilation target system
66---
7- --- [Open in browser](https://xmake.io/#/manual/conditions?id=is_os)
7+ --- [Open in browser](https://xmake.io/api/description/conditions#is_os)
8+ --- Example:
9+ --- ```lua
10+ --- if is_os("ios") then add_files("src/*.m") end
11+ --- ```
812---
913--- @param os OperationSystem Checked operation system
1014--- @return boolean
@@ -13,7 +17,11 @@ function is_os(os) end
1317---
1418--- Is the current compilation architecture
1519---
16- --- [Open in browser](https://xmake.io/#/manual/conditions?id=is_arch)
20+ --- [Open in browser](https://xmake.io/api/description/conditions#is_arch)
21+ --- Example:
22+ --- ```lua
23+ --- if is_arch("x86_64", "i386") then add_files("src/*.c") end
24+ --- ```
1725---
1826--- @param arch Architecture Checked architecture
1927--- @param ... Architecture Checked architectures
@@ -23,7 +31,13 @@ function is_arch(arch, ...) end
2331---
2432--- Is the current compilation platform
2533---
26- --- [Open in browser](https://xmake.io/#/manual/conditions?id=is_plat)
34+ --- [Open in browser](https://xmake.io/api/description/conditions#is_plat)
35+ --- Example:
36+ --- ```lua
37+ --- if is_plat("windows", "linux") then
38+ --- add_defines("PLATFORM_OK")
39+ --- end
40+ --- ```
2741---
2842--- @param platform Platform Checked platform
2943--- @param ... Platform Checked platforms
@@ -33,7 +47,13 @@ function is_plat(platform, ...) end
3347---
3448--- Is the current compilation host system
3549---
36- --- [Open in browser](https://xmake.io/#/manual/conditions?id=is_host)
50+ --- [Open in browser](https://xmake.io/api/description/conditions#is_host)
51+ --- Example:
52+ --- ```lua
53+ --- if is_host("macosx") then
54+ --- add_defines("HOST_MAC")
55+ --- end
56+ --- ```
3757---
3858--- @param host Host Checked host
3959--- @return boolean
@@ -42,7 +62,13 @@ function is_host(host) end
4262---
4363--- Determine the subsystem environment of the current host
4464---
45- --- [Open in browser](https://xmake.io/#/manual/conditions?id=is_subhost)
65+ --- [Open in browser](https://xmake.io/api/description/conditions#is_subhost)
66+ --- Example:
67+ --- ```lua
68+ --- if is_subhost("msys", "cygwin") then
69+ --- add_defines("HOST_SUBSYSTEM")
70+ --- end
71+ --- ```
4672---
4773--- @param subhost Subhost Checked subhost
4874--- @param ... Subhost Checked subhosts
@@ -52,7 +78,13 @@ function is_subhost(subhost, ...) end
5278---
5379--- Determine the architecture of the current host subsystem environment
5480---
55- --- [Open in browser](https://xmake.io/#/manual/conditions?id=is_subarch)
81+ --- [Open in browser](https://xmake.io/api/description/conditions#is_subarch)
82+ --- Example:
83+ --- ```lua
84+ --- if is_subarch("x86", "x64") then
85+ --- add_defines("HOST_SUBARCH")
86+ --- end
87+ --- ```
5688---
5789--- @param subarch Subarchitecture Checked subarch
5890--- @param ... Subarchitecture Checked architectures of current host subsystem environment
@@ -62,7 +94,13 @@ function is_subarch(subarch, ...) end
6294---
6395--- Is the current compilation mode
6496---
65- --- [Open in browser](https://xmake.io/#/manual/conditions?id=is_mode)
97+ --- [Open in browser](https://xmake.io/api/description/conditions#is_mode)
98+ --- Example:
99+ --- ```lua
100+ --- if is_mode("debug") then
101+ --- add_defines("DEBUG")
102+ --- end
103+ --- ```
66104---
67105--- @param mode CompilationMode Checked compilation mode
68106--- @return boolean
@@ -71,7 +109,13 @@ function is_mode(mode) end
71109---
72110--- Is the current target kind
73111---
74- --- [Open in browser](https://xmake.io/#/manual/conditions?id=is_kind)
112+ --- [Open in browser](https://xmake.io/api/description/conditions#is_kind)
113+ --- Example:
114+ --- ```lua
115+ --- if is_kind("binary") then
116+ --- add_defines("APP_BIN")
117+ --- end
118+ --- ```
75119---
76120--- @param kind TargetKind Checked target kind
77121--- @return boolean
@@ -80,7 +124,13 @@ function is_kind(kind) end
80124---
81125--- Is the given config values?
82126---
83- --- [Open in browser](https://xmake.io/#/manual/conditions?id=is_config)
127+ --- [Open in browser](https://xmake.io/api/description/conditions#is_config)
128+ --- Example:
129+ --- ```lua
130+ --- if is_config("runtime", "MD", "MDd") then
131+ --- add_defines("USE_MSVC_MD")
132+ --- end
133+ --- ```
84134---
85135--- @param key string Checked config key
86136--- @param value string Checked config value
@@ -91,17 +141,29 @@ function is_config(key, value, ...) end
91141---
92142--- Is the given configs enabled?
93143---
94- --- [Open in browser](https://xmake.io/#/manual/conditions?id=has_config)
144+ --- [Open in browser](https://xmake.io/api/description/conditions#has_config)
145+ --- Example:
146+ --- ```lua
147+ --- if has_config("unitybuild") then
148+ --- add_defines("UNITY_BUILD")
149+ --- end
150+ --- ```
95151---
96- --- @pram key string Checked config key
152+ --- @param key string Checked config key
97153--- @param ... string Checked config keys
98154--- @return boolean
99155function has_config (key , ...) end
100156
101157---
102158--- Is the given dependent package enabled?
103159---
104- --- [Open in browser](https://xmake.io/#/manual/conditions?id=has_package)
160+ --- [Open in browser](https://xmake.io/api/description/conditions#has_package)
161+ --- Example:
162+ --- ```lua
163+ --- if has_package("openssl") then
164+ --- add_defines("HAS_OPENSSL")
165+ --- end
166+ --- ```
105167---
106168--- @param package string Checked package name
107169--- @return boolean
0 commit comments