summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2015-06-09 10:14:56 +0800
committerruki <[email protected]>2015-06-09 10:14:56 +0800
commitd9051004d0b3b24f804e0bfffc5050e260018084 (patch)
treed65e74ba1caf4041e1ecaf2038f23196cedf4aab
parent387b3666c4d952e01b96bce7e9bc51ed86fe986f (diff)
rename xmake.xproj to xmake.lua
-rw-r--r--tests/console/plat/demo_cpp.xswf8
-rw-r--r--tests/console/xmake.lua84
-rw-r--r--tests/console/xmake.xproj129
-rw-r--r--xmake/scripts/base/main.lua18
4 files changed, 93 insertions, 146 deletions
diff --git a/tests/console/plat/demo_cpp.xswf b/tests/console/plat/demo_cpp.xswf
deleted file mode 100644
index 747cd54e6..000000000
--- a/tests/console/plat/demo_cpp.xswf
+++ /dev/null
@@ -1,8 +0,0 @@
-switches:
-{
- defines: DDD_ENABLE
- defines: WWW_ENABLE
-# defines: ZZZ_ENABLE
- defines: TTT_ENABLE, YYY_ENABLE
- defines: XXX_ENABLE
-}
diff --git a/tests/console/xmake.lua b/tests/console/xmake.lua
new file mode 100644
index 000000000..8762021fe
--- /dev/null
+++ b/tests/console/xmake.lua
@@ -0,0 +1,84 @@
+project("console")
+
+if modes("debug") then
+ symbols("debug")
+ warnings("all")
+ optimize("none")
+ cxflags("-fsanitize=address", "-ftrapv")
+end
+
+if modes("release") then
+ strip("all")
+ symbols("hidden")
+ cflags("-Wno-error=deprecated-declarations")
+ warnings("all")
+ optimize("smallest")
+ vectorexts("sse2", "ssse3", "mmx")
+end
+
+if modes("profile") then
+ symbols("debug")
+ warnings("none")
+ optimize("fastest")
+end
+
+target("hello1")
+ kind("static")
+ files("src/hello1/*.c")
+
+target("hello2")
+ kind("shared")
+ files("$(projectdir)/src/hello2/*.c")
+
+target("hello3")
+ kind("static")
+ files("src/hello3/*.c")
+ headers("src/hello3/*.h")
+ headerdir("$(buildir)/inc")
+ targetdir("$(buildir)/lib")
+ objectdir("$(buildir)/obj")
+
+target("demo_c")
+ kind("binary")
+ deps("hello1")
+ files("src/demo/*.c")
+ links("hello1")
+ linkdirs("$(buildir)")
+ includedirs("$(buildir)")
+ cflags("-DHELLO1")
+
+ if modes("release") then defines("NDEBUG") end
+
+target("demo_cpp")
+ kind("binary")
+ deps("hello2")
+ files("src/demo/*.cpp")
+ version("1.0.1")
+ configfile("$(buildir)/demo_cpp.h")
+ linkdirs("$(buildir)")
+ includedirs("$(buildir)")
+ undefines("HELLO2")
+ cxxflags("-DHELLO1")
+
+ if platforms("macosx", "ios") then
+
+ target("demo_objc")
+ kind("binary")
+ deps("hello3")
+ files("src/demo/*.m")
+ links("hello3")
+ linkdirs("$(buildir)/lib")
+ includedirs("$(buildir)/inc")
+ mflags("-DHELLO3", "-DPLAT=\"macosx\"", "-DARCH='armv7, arm64'")
+
+ target("demo_objcpp")
+ kind("binary")
+ deps("hello3")
+ files("src/demo/*.mm")
+ mxflags("-DHELLO3")
+ ldflags("-L$(buildir)/lib", "-lhello3", "-lhello3")
+
+ if platforms("ios") then
+ ldflags("-framework Cocoa", "-framework IOKit", "-framework CoreFoundation")
+ end
+ end
diff --git a/tests/console/xmake.xproj b/tests/console/xmake.xproj
deleted file mode 100644
index 5a6a94377..000000000
--- a/tests/console/xmake.xproj
+++ /dev/null
@@ -1,129 +0,0 @@
-[
- -- get configs
- local configs = import("configs")
- assert(configs)
-
- -- the custom script
- function add(a, b)
- return a + b
- end
-]
-project: console
-{
- # the modes
- modes: debug
- {
- symbols: debug
- warnings: all
- optimize: none
- cxflags: -fsanitize=address -ftrapv
- }
-
- modes: release
- {
- strip: all
- symbols: hidden
- cflags: -Wno-error=deprecated-declarations
- warnings: all
- optimize: smallest
- vectorexts: sse2, ssse3, mmx
- }
-
- modes: profile
- {
- symbols: debug
- warnings: none
- optimize: fastest
- }
-
- target: hello1
- {
- kind: static
- files: src/hello1/*.c
- }
-
- target: hello2
- {
- kind: shared
- files: $(projectdir)/src/hello2/*.c
- }
-
- target: hello3
- {
- kind: static
- files: src/hello3/*.c
- headers: src/hello3/*.h
- headerdir: $(buildir)/inc
- targetdir: $(buildir)/lib
- objectdir: $(buildir)/obj
- }
-
- target: demo_c
- {
- kind: binary
- deps: hello1
- files: src/demo/*.c
- links: hello1
- linkdirs: $(buildir)
- includedirs: $(buildir)
- cflags: -DHELLO1
-
- # the modes
- modes: release
- {
- defines: NDEBUG
- }
- }
-
- target: demo_cpp
- {
- kind: binary
- deps: hello2
- files: src/demo/*.cpp
- version: 1.0.1
- configfile: $(buildir)/demo_cpp.h
- linkdirs: $(buildir)
- includedirs: $(buildir)
- switches: AAA_ENABLE
- switches: CCC_ENABLE
- switches: FFF_ENABLE, KKK_ENABLE
- switchfiles: plat/demo_cpp.xswf
- undefines: HELLO2
- cxxflags: -DHELLO1
- , [_if (AAA_ENABLE, "-DAAA")]
- , [_if (BBB_ENABLE, "-DBBB")]
- , [_if (CCC_ENABLE, "-DCCC")]
- , [_ifelse (DDD_ENABLE, "-DDDD", "-DEEE")]
- , [_ifelse (KKK_ENABLE, "-DKKK", "-DFFF")]
- }
-
- platforms: macosx, ios
- {
- target: demo_objc
- {
- kind: binary
- deps: hello3
- files: src/demo/*.m
- links: hello3
- linkdirs: $(buildir)/lib
- includedirs: $(buildir)/inc
- mflags: -DHELLO3, -DPLAT="macosx", -DARCH='armv7, arm64', -DVERSION=[add(1, 2)]
- }
-
- target: demo_objcpp
- {
- kind: binary
- deps: hello3
- files: src/demo/*.mm
- mxflags: -DHELLO3
- ldflags: -L$(buildir)/lib, -lhello3, -lhello3
-
- platforms: ios
- {
- ldflags: -framework Cocoa, "-framework IOKit"
- , -framework CoreFoundation
- }
- }
- }
-}
-
diff --git a/xmake/scripts/base/main.lua b/xmake/scripts/base/main.lua
index 7f8087180..544a15005 100644
--- a/xmake/scripts/base/main.lua
+++ b/xmake/scripts/base/main.lua
@@ -64,7 +64,7 @@ local menu =
, {'r', "rebuild", "k", nil, "Rebuild the project." }
, {}
- , {'f', "file", "kv", "xmake.xproj","Read a given xmake.xproj file." }
+ , {'f', "file", "kv", "xmake.lua", "Read a given xmake.lua file." }
, {'P', "project", "kv", nil, "Change to the given project directory."
, "Search priority:"
, " 1. The Given Command Argument"
@@ -98,7 +98,7 @@ local menu =
, options =
{
{'n', "name", "kv", nil, "The project name." }
- , {'f', "file", "kv", "xmake.xproj","Create a given xmake.xproj file." }
+ , {'f', "file", "kv", "xmake.lua", "Create a given xmake.lua file." }
, {'P', "project", "kv", nil, "Create from the given project directory."
, "Search priority:"
, " 1. The Given Command Argument"
@@ -223,7 +223,7 @@ local menu =
, function () return platform.menu("config") end
, {}
- , {'f', "file", "kv", "xmake.xproj","Read a given xmake.xproj file." }
+ , {'f', "file", "kv", "xmake.lua", "Read a given xmake.lua file." }
, {'P', "project", "kv", nil, "Change to the given project directory."
, "Search priority:"
, " 1. The Given Command Argument"
@@ -286,7 +286,7 @@ local menu =
-- options
, options =
{
- {'f', "file", "kv", "xmake.xproj","Read a given xmake.xproj file." }
+ {'f', "file", "kv", "xmake.lua", "Read a given xmake.lua file." }
, {'P', "project", "kv", nil, "Change to the given project directory."
, "Search priority:"
, " 1. The Given Command Argument"
@@ -318,7 +318,7 @@ local menu =
-- options
, options =
{
- {'f', "file", "kv", "xmake.xproj","Read a given xmake.xproj file." }
+ {'f', "file", "kv", "xmake.lua", "Read a given xmake.lua file." }
, {'P', "project", "kv", nil, "Change to the given project directory."
, "Search priority:"
, " 1. The Given Command Argument"
@@ -353,7 +353,7 @@ local menu =
, {nil, "debugger", "kv", "auto", "Set the debugger path." }
, {}
- , {'f', "file", "kv", "xmake.xproj","Read a given xmake.xproj file." }
+ , {'f', "file", "kv", "xmake.lua", "Read a given xmake.lua file." }
, {'P', "project", "kv", nil, "Change to the given project directory."
, "Search priority:"
, " 1. The Given Command Argument"
@@ -453,8 +453,8 @@ function main._prepare_project()
-- save the project directory
xmake._PROJECT_DIR = options.project
- -- init the xmake.xproj file path
- options.file = options.file or options._DEFAULTS.file or "xmake.xproj"
+ -- init the xmake.lua file path
+ options.file = options.file or options._DEFAULTS.file or "xmake.lua"
if not path.is_absolute(options.file) then
options.file = path.absolute(options.file, options.project)
end
@@ -497,7 +497,7 @@ function main._prepare_project()
if not options[k] then options[k] = v end
end
- -- load xmake.xproj file
+ -- load xmake.lua file
return project.loadxproj(options.file)
end