summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-22 00:48:39 +0800
committerruki <[email protected]>2020-04-21 22:51:59 +0800
commit93517f4cdc94a028399db7d642d7332338cc8363 (patch)
tree36415a1c67860f82e2a5df38ef42bd0f4df331cf /core
parent4dbc3cce61a2d848e92d7d9327fb0f2b81d36d57 (diff)
improve core/xmake.lua
Diffstat (limited to 'core')
-rw-r--r--core/src/lcurses/xmake.lua10
-rw-r--r--core/src/pdcurses/xmake.lua5
-rw-r--r--core/src/xmake/xmake.lua11
-rw-r--r--core/xmake.lua9
4 files changed, 26 insertions, 9 deletions
diff --git a/core/src/lcurses/xmake.lua b/core/src/lcurses/xmake.lua
index c4714c316..771bf8111 100644
--- a/core/src/lcurses/xmake.lua
+++ b/core/src/lcurses/xmake.lua
@@ -1,12 +1,17 @@
-- add target
target("lcurses")
+ -- enable this target?
+ if not has_config("curses") and not has_config("pdcurses") then
+ set_default(false)
+ end
+
-- make as a static library
set_kind("static")
-- add deps
add_deps("luajit")
- if is_plat("windows") then
+ if is_plat("windows") and has_config("pdcurses") then
add_deps("pdcurses")
end
@@ -15,8 +20,7 @@ target("lcurses")
-- add options
if is_plat("windows") then
- add_defines("PDCURSES", "XM_CONFIG_API_HAVE_CURSES")
- add_includedirs("../pdcurses")
+ add_options("pdcurses")
else
add_options("curses")
end
diff --git a/core/src/pdcurses/xmake.lua b/core/src/pdcurses/xmake.lua
index ecbeb62e0..4fd2bb96d 100644
--- a/core/src/pdcurses/xmake.lua
+++ b/core/src/pdcurses/xmake.lua
@@ -1,6 +1,11 @@
-- add target
target("pdcurses")
+ -- enable this target
+ if not has_config("pdcurses") then
+ set_default(false)
+ end
+
-- make as a static library
set_kind("static")
diff --git a/core/src/xmake/xmake.lua b/core/src/xmake/xmake.lua
index df9bbe11d..d85b2802f 100644
--- a/core/src/xmake/xmake.lua
+++ b/core/src/xmake/xmake.lua
@@ -5,7 +5,10 @@ target("xmake")
set_kind("static")
-- add deps
- add_deps("lcurses", "sv", "luajit", "tbox")
+ if has_config("curses") or has_config("pdcurses") then
+ add_deps("lcurses")
+ end
+ add_deps("sv", "luajit", "tbox")
-- add defines
add_defines("__tb_prefix__=\"xmake\"")
@@ -32,12 +35,8 @@ target("xmake")
add_files("winos/*.c")
end
- -- add readline
+ -- add options
add_options("readline")
-
- if is_plat("windows") or has_config("curses") then
- add_defines("XM_CONFIG_API_HAVE_CURSES")
- end
if is_plat("windows") then
add_defines("UNICODE", "_UNICODE")
end
diff --git a/core/xmake.lua b/core/xmake.lua
index 87e9bdc1f..e8625612e 100644
--- a/core/xmake.lua
+++ b/core/xmake.lua
@@ -53,6 +53,15 @@ option("curses")
add_defines("XM_CONFIG_API_HAVE_CURSES")
option_end()
+-- the pdcurses option
+option("pdcurses")
+ set_default(true)
+ set_showmenu(true)
+ set_description("Enable or disable pdcurses library")
+ add_defines("PDCURSES")
+ add_defines("XM_CONFIG_API_HAVE_CURSES")
+option_end()
+
-- only build xmake libraries for development?
option("onlylib")
set_default(false)