summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-06-16 17:36:47 +0800
committerruki <[email protected]>2016-06-16 17:36:47 +0800
commit83c4da5def52fcc0d825d20f16df77792378a3f7 (patch)
tree0488b374037c7af41df38a9953ab895a31ba3e06
parent7d0892a6d0d5246beb110043c635a432f7cd7cab (diff)
merge iphoneos and iphonesimulator and watchos ..
-rw-r--r--xmake/platforms/iphoneos/checker.lua48
-rwxr-xr-xxmake/platforms/iphoneos/xmake.lua73
-rw-r--r--xmake/platforms/iphonesimulator/checker.lua76
-rwxr-xr-xxmake/platforms/iphonesimulator/xmake.lua130
-rw-r--r--xmake/platforms/watchos/checker.lua48
-rwxr-xr-xxmake/platforms/watchos/xmake.lua73
-rw-r--r--xmake/platforms/watchsimulator/checker.lua76
-rwxr-xr-xxmake/platforms/watchsimulator/xmake.lua130
8 files changed, 168 insertions, 486 deletions
diff --git a/xmake/platforms/iphoneos/checker.lua b/xmake/platforms/iphoneos/checker.lua
index 02a1ac97a..6c2c42c73 100644
--- a/xmake/platforms/iphoneos/checker.lua
+++ b/xmake/platforms/iphoneos/checker.lua
@@ -41,21 +41,39 @@ end
-- check the toolchains
function _check_toolchains(config)
- -- done
- checker.check_toolchain(config, "cc", "xcrun -sdk iphoneos ", "clang", "the c compiler")
- checker.check_toolchain(config, "cxx", "xcrun -sdk iphoneos ", "clang", "the c++ compiler")
- checker.check_toolchain(config, "cxx", "xcrun -sdk iphoneos ", "clang++", "the c++ compiler")
- checker.check_toolchain(config, "mm", "xcrun -sdk iphoneos ", "clang", "the objc compiler")
- checker.check_toolchain(config, "mxx", "xcrun -sdk iphoneos ", "clang++", "the objc++ compiler")
- checker.check_toolchain(config, "mxx", "xcrun -sdk iphoneos ", "clang", "the objc++ compiler")
- checker.check_toolchain(config, "as", path.join(os.toolsdir(), "utils/gas-preprocessor.pl xcrun -sdk iphoneos "), "clang", "the assember", _check_as)
- checker.check_toolchain(config, "ld", "xcrun -sdk iphoneos ", "clang++", "the linker")
- checker.check_toolchain(config, "ld", "xcrun -sdk iphoneos ", "clang", "the linker")
- checker.check_toolchain(config, "ar", "xcrun -sdk iphoneos ", "ar", "the static library linker")
- checker.check_toolchain(config, "sh", "xcrun -sdk iphoneos ", "clang++", "the shared library linker")
- checker.check_toolchain(config, "sh", "xcrun -sdk iphoneos ", "clang", "the shared library linker")
- checker.check_toolchain(config, "sc", "xcrun -sdk iphoneos ", "swiftc", "the swift compiler")
- checker.check_toolchain(config, "lipo", "xcrun -sdk iphoneos ", "lipo", "the universal files creater")
+ -- iphoneos or iphonesimulator?
+ local arch = config.get("arch")
+ if arch == "i386" or arch == "x86_64" then
+ checker.check_toolchain(config, "cc", "xcrun -sdk iphonesimulator ", "clang", "the c compiler")
+ checker.check_toolchain(config, "cxx", "xcrun -sdk iphonesimulator ", "clang", "the c++ compiler")
+ checker.check_toolchain(config, "cxx", "xcrun -sdk iphonesimulator ", "clang++", "the c++ compiler")
+ checker.check_toolchain(config, "mm", "xcrun -sdk iphonesimulator ", "clang", "the objc compiler")
+ checker.check_toolchain(config, "mxx", "xcrun -sdk iphonesimulator ", "clang++", "the objc++ compiler")
+ checker.check_toolchain(config, "mxx", "xcrun -sdk iphonesimulator ", "clang", "the objc++ compiler")
+ checker.check_toolchain(config, "as", "xcrun -sdk iphonesimulator ", "clang", "the assember")
+ checker.check_toolchain(config, "ld", "xcrun -sdk iphonesimulator ", "clang++", "the linker")
+ checker.check_toolchain(config, "ld", "xcrun -sdk iphonesimulator ", "clang", "the linker")
+ checker.check_toolchain(config, "ar", "xcrun -sdk iphonesimulator ", "ar", "the static library linker")
+ checker.check_toolchain(config, "sh", "xcrun -sdk iphonesimulator ", "clang++", "the shared library linker")
+ checker.check_toolchain(config, "sh", "xcrun -sdk iphonesimulator ", "clang", "the shared library linker")
+ checker.check_toolchain(config, "sc", "xcrun -sdk iphonesimulator ", "swiftc", "the swift compiler")
+ checker.check_toolchain(config, "lipo", "xcrun -sdk iphonesimulator ", "lipo", "the universal files creater")
+ else
+ checker.check_toolchain(config, "cc", "xcrun -sdk iphoneos ", "clang", "the c compiler")
+ checker.check_toolchain(config, "cxx", "xcrun -sdk iphoneos ", "clang", "the c++ compiler")
+ checker.check_toolchain(config, "cxx", "xcrun -sdk iphoneos ", "clang++", "the c++ compiler")
+ checker.check_toolchain(config, "mm", "xcrun -sdk iphoneos ", "clang", "the objc compiler")
+ checker.check_toolchain(config, "mxx", "xcrun -sdk iphoneos ", "clang++", "the objc++ compiler")
+ checker.check_toolchain(config, "mxx", "xcrun -sdk iphoneos ", "clang", "the objc++ compiler")
+ checker.check_toolchain(config, "as", path.join(os.toolsdir(), "utils/gas-preprocessor.pl xcrun -sdk iphoneos "), "clang", "the assember", _check_as)
+ checker.check_toolchain(config, "ld", "xcrun -sdk iphoneos ", "clang++", "the linker")
+ checker.check_toolchain(config, "ld", "xcrun -sdk iphoneos ", "clang", "the linker")
+ checker.check_toolchain(config, "ar", "xcrun -sdk iphoneos ", "ar", "the static library linker")
+ checker.check_toolchain(config, "sh", "xcrun -sdk iphoneos ", "clang++", "the shared library linker")
+ checker.check_toolchain(config, "sh", "xcrun -sdk iphoneos ", "clang", "the shared library linker")
+ checker.check_toolchain(config, "sc", "xcrun -sdk iphoneos ", "swiftc", "the swift compiler")
+ checker.check_toolchain(config, "lipo", "xcrun -sdk iphoneos ", "lipo", "the universal files creater")
+ end
end
-- init it
diff --git a/xmake/platforms/iphoneos/xmake.lua b/xmake/platforms/iphoneos/xmake.lua
index 1ec9659b7..26a88678c 100755
--- a/xmake/platforms/iphoneos/xmake.lua
+++ b/xmake/platforms/iphoneos/xmake.lua
@@ -30,7 +30,7 @@ platform("iphoneos")
set_hosts("macosx")
-- set archs
- set_archs("armv7", "armv7s", "arm64")
+ set_archs("armv7", "armv7s", "arm64", "i386", "x86_64")
-- set checker
set_checker("checker")
@@ -64,30 +64,59 @@ platform("iphoneos")
_g.tools.ex = config.get("ar")
_g.tools.sc = config.get("sc")
- -- init flags for architecture
- local arch = config.get("arch")
- local target_minver = config.get("target_minver")
- _g.cxflags = { "-arch " .. arch, "-miphoneos-version-min=" .. target_minver }
- _g.mxflags = { "-arch " .. arch, "-miphoneos-version-min=" .. target_minver }
- _g.asflags = { "-arch " .. arch, "-miphoneos-version-min=" .. target_minver }
- _g.ldflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-miphoneos-version-min=" .. target_minver }
- _g.shflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-miphoneos-version-min=" .. target_minver }
- _g.scflags = { format("-target %s-apple-ios%s", arch, target_minver) }
+ -- iphoneos or iphonesimulator?
+ local arch = config.get("arch")
+ if arch == "i386" or arch == "x86_64" then
- -- init flags for the xcode sdk directory
- local xcode_dir = config.get("xcode_dir")
- local xcode_sdkver = config.get("xcode_sdkver")
- local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" .. xcode_sdkver .. ".sdk"
- insert(_g.cxflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.asflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.mxflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.ldflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.shflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.scflags, "-sdk " .. xcode_sdkdir)
+ -- init flags for architecture
+ local target_minver = config.get("target_minver")
+ _g.cxflags = { "-arch " .. arch, "-mios-simulator-version-min=" .. target_minver }
+ _g.mxflags = { "-arch " .. arch, "-mios-simulator-version-min=" .. target_minver }
+ _g.asflags = { "-arch " .. arch, "-mios-simulator-version-min=" .. target_minver }
+ _g.ldflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mios-simulator-version-min=" .. target_minver }
+ _g.shflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mios-simulator-version-min=" .. target_minver }
+ _g.ldflags = { "-arch " .. arch, "-Xlinker -objc_abi_version", "-Xlinker 2 -stdlib=libc++", "-Xlinker -no_implicit_dylibs", "-fobjc-link-runtime", "-mios-simulator-version-min=" .. target_minver }
+ _g.shflags = { "-arch " .. arch, "-Xlinker -objc_abi_version", "-Xlinker 2 -stdlib=libc++", "-Xlinker -no_implicit_dylibs", "-fobjc-link-runtime", "-mios-simulator-version-min=" .. target_minver }
+ _g.scflags = { format("-target %s-apple-ios%s", arch, target_minver) }
- -- save swift link directory for tools
- config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos")
+ -- init flags for the xcode sdk directory
+ local xcode_dir = config.get("xcode_dir")
+ local xcode_sdkver = config.get("xcode_sdkver")
+ local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" .. xcode_sdkver .. ".sdk"
+ insert(_g.cxflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.asflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.mxflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.ldflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.shflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.scflags, "-sdk " .. xcode_sdkdir)
+ -- save swift link directory for tools
+ config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator")
+ else
+
+ -- init flags for architecture
+ local target_minver = config.get("target_minver")
+ _g.cxflags = { "-arch " .. arch, "-miphoneos-version-min=" .. target_minver }
+ _g.mxflags = { "-arch " .. arch, "-miphoneos-version-min=" .. target_minver }
+ _g.asflags = { "-arch " .. arch, "-miphoneos-version-min=" .. target_minver }
+ _g.ldflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-miphoneos-version-min=" .. target_minver }
+ _g.shflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-miphoneos-version-min=" .. target_minver }
+ _g.scflags = { format("-target %s-apple-ios%s", arch, target_minver) }
+
+ -- init flags for the xcode sdk directory
+ local xcode_dir = config.get("xcode_dir")
+ local xcode_sdkver = config.get("xcode_sdkver")
+ local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" .. xcode_sdkver .. ".sdk"
+ insert(_g.cxflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.asflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.mxflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.ldflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.shflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.scflags, "-sdk " .. xcode_sdkdir)
+
+ -- save swift link directory for tools
+ config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos")
+ end
end)
-- set menu
diff --git a/xmake/platforms/iphonesimulator/checker.lua b/xmake/platforms/iphonesimulator/checker.lua
deleted file mode 100644
index 3daf1a64f..000000000
--- a/xmake/platforms/iphonesimulator/checker.lua
+++ /dev/null
@@ -1,76 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file checker.lua
---
-
--- imports
-import("core.tool.tool")
-import("platforms.checker", {rootdir = os.programdir()})
-
--- check the toolchains
-function _check_toolchains(config)
-
- -- done
- checker.check_toolchain(config, "cc", "xcrun -sdk iphonesimulator ", "clang", "the c compiler")
- checker.check_toolchain(config, "cxx", "xcrun -sdk iphonesimulator ", "clang", "the c++ compiler")
- checker.check_toolchain(config, "cxx", "xcrun -sdk iphonesimulator ", "clang++", "the c++ compiler")
- checker.check_toolchain(config, "mm", "xcrun -sdk iphonesimulator ", "clang", "the objc compiler")
- checker.check_toolchain(config, "mxx", "xcrun -sdk iphonesimulator ", "clang++", "the objc++ compiler")
- checker.check_toolchain(config, "mxx", "xcrun -sdk iphonesimulator ", "clang", "the objc++ compiler")
- checker.check_toolchain(config, "as", "xcrun -sdk iphonesimulator ", "clang", "the assember")
- checker.check_toolchain(config, "ld", "xcrun -sdk iphonesimulator ", "clang++", "the linker")
- checker.check_toolchain(config, "ld", "xcrun -sdk iphonesimulator ", "clang", "the linker")
- checker.check_toolchain(config, "ar", "xcrun -sdk iphonesimulator ", "ar", "the static library linker")
- checker.check_toolchain(config, "sh", "xcrun -sdk iphonesimulator ", "clang++", "the shared library linker")
- checker.check_toolchain(config, "sh", "xcrun -sdk iphonesimulator ", "clang", "the shared library linker")
- checker.check_toolchain(config, "sc", "xcrun -sdk iphonesimulator ", "swiftc", "the swift compiler")
- checker.check_toolchain(config, "lipo", "xcrun -sdk iphonesimulator ", "lipo", "the universal files creater")
-end
-
--- init it
-function init()
-
- -- init the check list of config
- _g.config =
- {
- { checker.check_arch, "x86_64" }
- , checker.check_xcode
- , checker.check_xcode_sdkver
- , checker.check_target_minver
- , checker.check_ccache
- , _check_toolchains
- }
-
- -- init the check list of global
- _g.global =
- {
- checker.check_xcode
- , checker.check_ccache
- }
-
-end
-
--- get the property
-function get(name)
-
- -- get it
- return _g[name]
-end
-
diff --git a/xmake/platforms/iphonesimulator/xmake.lua b/xmake/platforms/iphonesimulator/xmake.lua
deleted file mode 100755
index b1cd4c3f1..000000000
--- a/xmake/platforms/iphonesimulator/xmake.lua
+++ /dev/null
@@ -1,130 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file xmake.lua
---
-
--- define platform
-platform("iphonesimulator")
-
- -- set os
- set_os("ios")
-
- -- set hosts
- set_hosts("macosx")
-
- -- set archs
- set_archs("i386", "x86_64")
-
- -- set checker
- set_checker("checker")
-
- -- set tooldirs
- set_tooldirs("/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin")
-
- -- on load
- on_load(function ()
-
- -- imports
- import("core.project.config")
-
- -- init the file formats
- _g.formats = {}
- _g.formats.static = {"lib", ".a"}
- _g.formats.object = {"", ".o"}
- _g.formats.shared = {"lib", ".dylib"}
-
- -- init the tools
- _g.tools = {}
- _g.tools.ccache = config.get("__ccache")
- _g.tools.cc = config.get("cc")
- _g.tools.cxx = config.get("cxx")
- _g.tools.mm = config.get("mm")
- _g.tools.mxx = config.get("mxx")
- _g.tools.as = config.get("as")
- _g.tools.ld = config.get("ld")
- _g.tools.ar = config.get("ar")
- _g.tools.sh = config.get("sh")
- _g.tools.ex = config.get("ar")
- _g.tools.sc = config.get("sc")
-
- -- init flags for architecture
- local arch = config.get("arch")
- local target_minver = config.get("target_minver")
- _g.cxflags = { "-arch " .. arch, "-mios-simulator-version-min=" .. target_minver }
- _g.mxflags = { "-arch " .. arch, "-mios-simulator-version-min=" .. target_minver }
- _g.asflags = { "-arch " .. arch, "-mios-simulator-version-min=" .. target_minver }
- _g.ldflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mios-simulator-version-min=" .. target_minver }
- _g.shflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mios-simulator-version-min=" .. target_minver }
- _g.ldflags = { "-arch " .. arch, "-Xlinker -objc_abi_version", "-Xlinker 2 -stdlib=libc++", "-Xlinker -no_implicit_dylibs", "-fobjc-link-runtime", "-mios-simulator-version-min=" .. target_minver }
- _g.shflags = { "-arch " .. arch, "-Xlinker -objc_abi_version", "-Xlinker 2 -stdlib=libc++", "-Xlinker -no_implicit_dylibs", "-fobjc-link-runtime", "-mios-simulator-version-min=" .. target_minver }
- _g.scflags = { format("-target %s-apple-ios%s", arch, target_minver) }
-
- -- init flags for the xcode sdk directory
- local xcode_dir = config.get("xcode_dir")
- local xcode_sdkver = config.get("xcode_sdkver")
- local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" .. xcode_sdkver .. ".sdk"
- insert(_g.cxflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.asflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.mxflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.ldflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.shflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.scflags, "-sdk " .. xcode_sdkdir)
-
- -- save swift link directory for tools
- config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator")
-
- end)
-
- -- set menu
- set_menu({
- config =
- {
- {}
- , {nil, "mm", "kv", nil, "the objc compiler" }
- , {nil, "mxx", "kv", nil, "the objc++ compiler" }
- , {nil, "mflags", "kv", nil, "the objc compiler flags" }
- , {nil, "mxflags", "kv", nil, "the objc/c++ compiler flags" }
- , {nil, "mxxflags", "kv", nil, "the objc++ compiler flags" }
- , {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- , {nil, "xcode_sdkver", "kv", "auto", "the sdk version for xcode" }
- , {nil, "target_minver", "kv", "auto", "the target minimal version" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- }
-
- , global =
- {
- {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- }
- })
-
-
-
-
-
-
diff --git a/xmake/platforms/watchos/checker.lua b/xmake/platforms/watchos/checker.lua
index 8eac8546f..89ab5f1ee 100644
--- a/xmake/platforms/watchos/checker.lua
+++ b/xmake/platforms/watchos/checker.lua
@@ -41,21 +41,39 @@ end
-- check the toolchains
function _check_toolchains(config)
- -- done
- checker.check_toolchain(config, "cc", "xcrun -sdk watchos ", "clang", "the c compiler")
- checker.check_toolchain(config, "cxx", "xcrun -sdk watchos ", "clang", "the c++ compiler")
- checker.check_toolchain(config, "cxx", "xcrun -sdk watchos ", "clang++", "the c++ compiler")
- checker.check_toolchain(config, "mm", "xcrun -sdk watchos ", "clang", "the objc compiler")
- checker.check_toolchain(config, "mxx", "xcrun -sdk watchos ", "clang++", "the objc++ compiler")
- checker.check_toolchain(config, "mxx", "xcrun -sdk watchos ", "clang", "the objc++ compiler")
- checker.check_toolchain(config, "as", path.join(os.toolsdir(), "utils/gas-preprocessor.pl xcrun -sdk watchos "), "clang", "the assember", _check_as)
- checker.check_toolchain(config, "ld", "xcrun -sdk watchos ", "clang++", "the linker")
- checker.check_toolchain(config, "ld", "xcrun -sdk watchos ", "clang", "the linker")
- checker.check_toolchain(config, "ar", "xcrun -sdk watchos ", "ar", "the static library linker")
- checker.check_toolchain(config, "sh", "xcrun -sdk watchos ", "clang++", "the shared library linker")
- checker.check_toolchain(config, "sh", "xcrun -sdk watchos ", "clang", "the shared library linker")
- checker.check_toolchain(config, "sc", "xcrun -sdk watchos ", "swiftc", "the swift compiler")
- checker.check_toolchain(config, "lipo", "xcrun -sdk watchos ", "lipo", "the universal files creater")
+ -- watchos or watchsimulator?
+ local arch = config.get("arch")
+ if arch == "i386" then
+ checker.check_toolchain(config, "cc", "xcrun -sdk watchsimulator ", "clang", "the c compiler")
+ checker.check_toolchain(config, "cxx", "xcrun -sdk watchsimulator ", "clang", "the c++ compiler")
+ checker.check_toolchain(config, "cxx", "xcrun -sdk watchsimulator ", "clang++", "the c++ compiler")
+ checker.check_toolchain(config, "mm", "xcrun -sdk watchsimulator ", "clang", "the objc compiler")
+ checker.check_toolchain(config, "mxx", "xcrun -sdk watchsimulator ", "clang++", "the objc++ compiler")
+ checker.check_toolchain(config, "mxx", "xcrun -sdk watchsimulator ", "clang", "the objc++ compiler")
+ checker.check_toolchain(config, "as", "xcrun -sdk watchsimulator ", "clang", "the assember")
+ checker.check_toolchain(config, "ld", "xcrun -sdk watchsimulator ", "clang++", "the linker")
+ checker.check_toolchain(config, "ld", "xcrun -sdk watchsimulator ", "clang", "the linker")
+ checker.check_toolchain(config, "ar", "xcrun -sdk watchsimulator ", "ar", "the static library linker")
+ checker.check_toolchain(config, "sh", "xcrun -sdk watchsimulator ", "clang++", "the shared library linker")
+ checker.check_toolchain(config, "sh", "xcrun -sdk watchsimulator ", "clang", "the shared library linker")
+ checker.check_toolchain(config, "sc", "xcrun -sdk watchsimulator ", "swiftc", "the swift compiler")
+ checker.check_toolchain(config, "lipo", "xcrun -sdk watchsimulator ", "lipo", "the universal files creater")
+ else
+ checker.check_toolchain(config, "cc", "xcrun -sdk watchos ", "clang", "the c compiler")
+ checker.check_toolchain(config, "cxx", "xcrun -sdk watchos ", "clang", "the c++ compiler")
+ checker.check_toolchain(config, "cxx", "xcrun -sdk watchos ", "clang++", "the c++ compiler")
+ checker.check_toolchain(config, "mm", "xcrun -sdk watchos ", "clang", "the objc compiler")
+ checker.check_toolchain(config, "mxx", "xcrun -sdk watchos ", "clang++", "the objc++ compiler")
+ checker.check_toolchain(config, "mxx", "xcrun -sdk watchos ", "clang", "the objc++ compiler")
+ checker.check_toolchain(config, "as", path.join(os.toolsdir(), "utils/gas-preprocessor.pl xcrun -sdk watchos "), "clang", "the assember", _check_as)
+ checker.check_toolchain(config, "ld", "xcrun -sdk watchos ", "clang++", "the linker")
+ checker.check_toolchain(config, "ld", "xcrun -sdk watchos ", "clang", "the linker")
+ checker.check_toolchain(config, "ar", "xcrun -sdk watchos ", "ar", "the static library linker")
+ checker.check_toolchain(config, "sh", "xcrun -sdk watchos ", "clang++", "the shared library linker")
+ checker.check_toolchain(config, "sh", "xcrun -sdk watchos ", "clang", "the shared library linker")
+ checker.check_toolchain(config, "sc", "xcrun -sdk watchos ", "swiftc", "the swift compiler")
+ checker.check_toolchain(config, "lipo", "xcrun -sdk watchos ", "lipo", "the universal files creater")
+ end
end
-- init it
diff --git a/xmake/platforms/watchos/xmake.lua b/xmake/platforms/watchos/xmake.lua
index 899919c89..1296ec712 100755
--- a/xmake/platforms/watchos/xmake.lua
+++ b/xmake/platforms/watchos/xmake.lua
@@ -30,7 +30,7 @@ platform("watchos")
set_hosts("macosx")
-- set archs
- set_archs("armv7k")
+ set_archs("armv7k", "i386")
-- set checker
set_checker("checker")
@@ -64,30 +64,59 @@ platform("watchos")
_g.tools.ex = config.get("ar")
_g.tools.sc = config.get("sc")
- -- init flags for architecture
- local arch = config.get("arch")
- local target_minver = config.get("target_minver")
- _g.cxflags = { "-arch " .. arch, "-mwatchos-version-min=" .. target_minver }
- _g.mxflags = { "-arch " .. arch, "-mwatchos-version-min=" .. target_minver }
- _g.asflags = { "-arch " .. arch, "-mwatchos-version-min=" .. target_minver }
- _g.ldflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mwatchos-version-min=" .. target_minver }
- _g.shflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mwatchos-version-min=" .. target_minver }
- _g.scflags = { format("-target %s-apple-ios%s", arch, target_minver) }
+ -- watchos or watchsimulator?
+ local arch = config.get("arch")
+ if arch == "i386" then
- -- init flags for the xcode sdk directory
- local xcode_dir = config.get("xcode_dir")
- local xcode_sdkver = config.get("xcode_sdkver")
- local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS" .. xcode_sdkver .. ".sdk"
- insert(_g.cxflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.asflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.mxflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.ldflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.shflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.scflags, "-sdk " .. xcode_sdkdir)
+ -- init flags for architecture
+ local target_minver = config.get("target_minver")
+ _g.cxflags = { "-arch " .. arch, "-mwatchos-simulator-version-min=" .. target_minver }
+ _g.mxflags = { "-arch " .. arch, "-mwatchos-simulator-version-min=" .. target_minver }
+ _g.asflags = { "-arch " .. arch, "-mwatchos-simulator-version-min=" .. target_minver }
+ _g.ldflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mwatchos-simulator-version-min=" .. target_minver }
+ _g.shflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mwatchos-simulator-version-min=" .. target_minver }
+ _g.ldflags = { "-arch " .. arch, "-Xlinker -objc_abi_version", "-Xlinker 2 -stdlib=libc++", "-Xlinker -no_implicit_dylibs", "-fobjc-link-runtime", "-mwatchos-simulator-version-min=" .. target_minver }
+ _g.shflags = { "-arch " .. arch, "-Xlinker -objc_abi_version", "-Xlinker 2 -stdlib=libc++", "-Xlinker -no_implicit_dylibs", "-fobjc-link-runtime", "-mwatchos-simulator-version-min=" .. target_minver }
+ _g.scflags = { format("-target %s-apple-ios%s", arch, target_minver) }
- -- save swift link directory for tools
- config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/watchos")
+ -- init flags for the xcode sdk directory
+ local xcode_dir = config.get("xcode_dir")
+ local xcode_sdkver = config.get("xcode_sdkver")
+ local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator" .. xcode_sdkver .. ".sdk"
+ insert(_g.cxflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.asflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.mxflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.ldflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.shflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.scflags, "-sdk " .. xcode_sdkdir)
+ -- save swift link directory for tools
+ config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/watchsimulator")
+ else
+
+ -- init flags for architecture
+ local target_minver = config.get("target_minver")
+ _g.cxflags = { "-arch " .. arch, "-mwatchos-version-min=" .. target_minver }
+ _g.mxflags = { "-arch " .. arch, "-mwatchos-version-min=" .. target_minver }
+ _g.asflags = { "-arch " .. arch, "-mwatchos-version-min=" .. target_minver }
+ _g.ldflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mwatchos-version-min=" .. target_minver }
+ _g.shflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mwatchos-version-min=" .. target_minver }
+ _g.scflags = { format("-target %s-apple-ios%s", arch, target_minver) }
+
+ -- init flags for the xcode sdk directory
+ local xcode_dir = config.get("xcode_dir")
+ local xcode_sdkver = config.get("xcode_sdkver")
+ local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS" .. xcode_sdkver .. ".sdk"
+ insert(_g.cxflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.asflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.mxflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.ldflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.shflags, "-isysroot " .. xcode_sdkdir)
+ insert(_g.scflags, "-sdk " .. xcode_sdkdir)
+
+ -- save swift link directory for tools
+ config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/watchos")
+ end
end)
-- set menu
diff --git a/xmake/platforms/watchsimulator/checker.lua b/xmake/platforms/watchsimulator/checker.lua
deleted file mode 100644
index e5cc31443..000000000
--- a/xmake/platforms/watchsimulator/checker.lua
+++ /dev/null
@@ -1,76 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file checker.lua
---
-
--- imports
-import("core.tool.tool")
-import("platforms.checker", {rootdir = os.programdir()})
-
--- check the toolchains
-function _check_toolchains(config)
-
- -- done
- checker.check_toolchain(config, "cc", "xcrun -sdk watchsimulator ", "clang", "the c compiler")
- checker.check_toolchain(config, "cxx", "xcrun -sdk watchsimulator ", "clang", "the c++ compiler")
- checker.check_toolchain(config, "cxx", "xcrun -sdk watchsimulator ", "clang++", "the c++ compiler")
- checker.check_toolchain(config, "mm", "xcrun -sdk watchsimulator ", "clang", "the objc compiler")
- checker.check_toolchain(config, "mxx", "xcrun -sdk watchsimulator ", "clang++", "the objc++ compiler")
- checker.check_toolchain(config, "mxx", "xcrun -sdk watchsimulator ", "clang", "the objc++ compiler")
- checker.check_toolchain(config, "as", "xcrun -sdk watchsimulator ", "clang", "the assember")
- checker.check_toolchain(config, "ld", "xcrun -sdk watchsimulator ", "clang++", "the linker")
- checker.check_toolchain(config, "ld", "xcrun -sdk watchsimulator ", "clang", "the linker")
- checker.check_toolchain(config, "ar", "xcrun -sdk watchsimulator ", "ar", "the static library linker")
- checker.check_toolchain(config, "sh", "xcrun -sdk watchsimulator ", "clang++", "the shared library linker")
- checker.check_toolchain(config, "sh", "xcrun -sdk watchsimulator ", "clang", "the shared library linker")
- checker.check_toolchain(config, "sc", "xcrun -sdk watchsimulator ", "swiftc", "the swift compiler")
- checker.check_toolchain(config, "lipo", "xcrun -sdk watchsimulator ", "lipo", "the universal files creater")
-end
-
--- init it
-function init()
-
- -- init the check list of config
- _g.config =
- {
- { checker.check_arch, "i386" }
- , checker.check_xcode
- , checker.check_xcode_sdkver
- , checker.check_target_minver
- , checker.check_ccache
- , _check_toolchains
- }
-
- -- init the check list of global
- _g.global =
- {
- checker.check_xcode
- , checker.check_ccache
- }
-
-end
-
--- get the property
-function get(name)
-
- -- get it
- return _g[name]
-end
-
diff --git a/xmake/platforms/watchsimulator/xmake.lua b/xmake/platforms/watchsimulator/xmake.lua
deleted file mode 100755
index b2c2fa1e6..000000000
--- a/xmake/platforms/watchsimulator/xmake.lua
+++ /dev/null
@@ -1,130 +0,0 @@
---!The Automatic Cross-platform Build Tool
---
--- XMake is free software; you can redistribute it and/or modify
--- it under the terms of the GNU Lesser General Public License as published by
--- the Free Software Foundation; either version 2.1 of the License, or
--- (at your option) any later version.
---
--- XMake is distributed in the hope that it will be useful,
--- but WITHOUT ANY WARRANTY; without even the implied warranty of
--- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--- GNU Lesser General Public License for more details.
---
--- You should have received a copy of the GNU Lesser General Public License
--- along with XMake;
--- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
---
--- Copyright (C) 2015 - 2016, ruki All rights reserved.
---
--- @author ruki
--- @file xmake.lua
---
-
--- define platform
-platform("watchsimulator")
-
- -- set os
- set_os("ios")
-
- -- set hosts
- set_hosts("macosx")
-
- -- set archs
- set_archs("i386")
-
- -- set checker
- set_checker("checker")
-
- -- set tooldirs
- set_tooldirs("/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin")
-
- -- on load
- on_load(function ()
-
- -- imports
- import("core.project.config")
-
- -- init the file formats
- _g.formats = {}
- _g.formats.static = {"lib", ".a"}
- _g.formats.object = {"", ".o"}
- _g.formats.shared = {"lib", ".dylib"}
-
- -- init the tools
- _g.tools = {}
- _g.tools.ccache = config.get("__ccache")
- _g.tools.cc = config.get("cc")
- _g.tools.cxx = config.get("cxx")
- _g.tools.mm = config.get("mm")
- _g.tools.mxx = config.get("mxx")
- _g.tools.as = config.get("as")
- _g.tools.ld = config.get("ld")
- _g.tools.ar = config.get("ar")
- _g.tools.sh = config.get("sh")
- _g.tools.ex = config.get("ar")
- _g.tools.sc = config.get("sc")
-
- -- init flags for architecture
- local arch = config.get("arch")
- local target_minver = config.get("target_minver")
- _g.cxflags = { "-arch " .. arch, "-mwatchos-simulator-version-min=" .. target_minver }
- _g.mxflags = { "-arch " .. arch, "-mwatchos-simulator-version-min=" .. target_minver }
- _g.asflags = { "-arch " .. arch, "-mwatchos-simulator-version-min=" .. target_minver }
- _g.ldflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mwatchos-simulator-version-min=" .. target_minver }
- _g.shflags = { "-arch " .. arch, "-ObjC", "-lstdc++", "-fobjc-link-runtime", "-mwatchos-simulator-version-min=" .. target_minver }
- _g.ldflags = { "-arch " .. arch, "-Xlinker -objc_abi_version", "-Xlinker 2 -stdlib=libc++", "-Xlinker -no_implicit_dylibs", "-fobjc-link-runtime", "-mwatchos-simulator-version-min=" .. target_minver }
- _g.shflags = { "-arch " .. arch, "-Xlinker -objc_abi_version", "-Xlinker 2 -stdlib=libc++", "-Xlinker -no_implicit_dylibs", "-fobjc-link-runtime", "-mwatchos-simulator-version-min=" .. target_minver }
- _g.scflags = { format("-target %s-apple-ios%s", arch, target_minver) }
-
- -- init flags for the xcode sdk directory
- local xcode_dir = config.get("xcode_dir")
- local xcode_sdkver = config.get("xcode_sdkver")
- local xcode_sdkdir = xcode_dir .. "/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator" .. xcode_sdkver .. ".sdk"
- insert(_g.cxflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.asflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.mxflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.ldflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.shflags, "-isysroot " .. xcode_sdkdir)
- insert(_g.scflags, "-sdk " .. xcode_sdkdir)
-
- -- save swift link directory for tools
- config.set("__swift_linkdirs", xcode_dir .. "/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/watchsimulator")
-
- end)
-
- -- set menu
- set_menu({
- config =
- {
- {}
- , {nil, "mm", "kv", nil, "the objc compiler" }
- , {nil, "mxx", "kv", nil, "the objc++ compiler" }
- , {nil, "mflags", "kv", nil, "the objc compiler flags" }
- , {nil, "mxflags", "kv", nil, "the objc/c++ compiler flags" }
- , {nil, "mxxflags", "kv", nil, "the objc++ compiler flags" }
- , {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- , {nil, "xcode_sdkver", "kv", "auto", "the sdk version for xcode" }
- , {nil, "target_minver", "kv", "auto", "the target minimal version" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- }
-
- , global =
- {
- {}
- , {nil, "xcode_dir", "kv", "auto", "the xcode application directory" }
- , {}
- , {nil, "mobileprovision","kv", "auto", "The Provisioning Profile File" }
- , {nil, "codesign", "kv", "auto", "The Code Signing Indentity" }
- , {nil, "entitlements", "kv", "auto", "The Code Signing Entitlements" }
- }
- })
-
-
-
-
-
-