summaryrefslogtreecommitdiff
path: root/xmake/scripts/platform
diff options
context:
space:
mode:
authorruki <[email protected]>2015-05-28 10:17:32 +0800
committerruki <[email protected]>2015-05-28 10:17:32 +0800
commit6292b0f0938625902da6e3deec4877e409007708 (patch)
tree4f6c7477e3901e0c63acd7a8cc2449d9d51344df /xmake/scripts/platform
parent3aab30fc254ae7e9bd138aff2bb263af0d447017 (diff)
add some compiler options for macosx
Diffstat (limited to 'xmake/scripts/platform')
-rw-r--r--xmake/scripts/platform/android/_android.lua10
-rw-r--r--xmake/scripts/platform/android/_prober.lua4
-rw-r--r--xmake/scripts/platform/iphoneos/_iphoneos.lua11
-rw-r--r--xmake/scripts/platform/iphoneos/_prober.lua8
-rw-r--r--xmake/scripts/platform/iphonesimulator/_iphonesimulator.lua11
-rw-r--r--xmake/scripts/platform/iphonesimulator/_prober.lua8
-rw-r--r--xmake/scripts/platform/linux/_linux.lua12
-rw-r--r--xmake/scripts/platform/linux/_prober.lua4
-rw-r--r--xmake/scripts/platform/macosx/_macosx.lua54
-rw-r--r--xmake/scripts/platform/macosx/_prober.lua8
-rw-r--r--xmake/scripts/platform/platform.lua4
-rw-r--r--xmake/scripts/platform/windows/_prober.lua4
-rw-r--r--xmake/scripts/platform/windows/_windows.lua12
13 files changed, 95 insertions, 55 deletions
diff --git a/xmake/scripts/platform/android/_android.lua b/xmake/scripts/platform/android/_android.lua
index a7e8806df..112d464dd 100644
--- a/xmake/scripts/platform/android/_android.lua
+++ b/xmake/scripts/platform/android/_android.lua
@@ -38,11 +38,11 @@ _android._PROBER = require("platform/android/_prober")
-- make configure
function _android.make(configs)
- -- init the file name formats
- configs.formats = {}
- configs.formats.static = {"lib", ".a"}
- configs.formats.object = {"", ".o"}
- configs.formats.shared = {"", ".so"}
+ -- init the file name format
+ configs.format = {}
+ configs.format.static = {"lib", ".a"}
+ configs.format.object = {"", ".o"}
+ configs.format.shared = {"", ".so"}
end
diff --git a/xmake/scripts/platform/android/_prober.lua b/xmake/scripts/platform/android/_prober.lua
index a1f68de8a..c13b46c01 100644
--- a/xmake/scripts/platform/android/_prober.lua
+++ b/xmake/scripts/platform/android/_prober.lua
@@ -36,7 +36,7 @@ function _prober._probe_arch(configs)
local arch = configs.arch
-- ok?
- if arch and arch ~= "auto" then return true end
+ if arch then return true end
-- init the default architecture
configs.arch = "armv7-a"
@@ -45,7 +45,7 @@ function _prober._probe_arch(configs)
return true
end
--- probe the configure and update the values with "auto"
+-- probe the configure
function _prober.done(configs)
-- probe the architecture
diff --git a/xmake/scripts/platform/iphoneos/_iphoneos.lua b/xmake/scripts/platform/iphoneos/_iphoneos.lua
index 5d7d679e8..5fbea1558 100644
--- a/xmake/scripts/platform/iphoneos/_iphoneos.lua
+++ b/xmake/scripts/platform/iphoneos/_iphoneos.lua
@@ -38,11 +38,11 @@ _iphoneos._PROBER = require("platform/iphoneos/_prober")
-- make configure
function _iphoneos.make(configs)
- -- init the file name formats
- configs.formats = {}
- configs.formats.static = {"lib", ".a"}
- configs.formats.object = {"", ".o"}
- configs.formats.shared = {"", ".dylib"}
+ -- init the file name format
+ configs.format = {}
+ configs.format.static = {"lib", ".a"}
+ configs.format.object = {"", ".o"}
+ configs.format.shared = {"", ".dylib"}
-- init xcode sdk directory
configs.xcode_sdkdir = config.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS" .. config.get("xcode_sdkver") .. ".sdk"
@@ -56,7 +56,6 @@ function _iphoneos.menu(action)
_iphoneos._MENU_CONFIG = _iphoneos._MENU_CONFIG or
{ {}
, {nil, "mm", "kv", nil, "The Objc Compiler" }
- , {nil, "mx", "kv", nil, "The Objc/c++ 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" }
diff --git a/xmake/scripts/platform/iphoneos/_prober.lua b/xmake/scripts/platform/iphoneos/_prober.lua
index 52b0e5df4..f62630583 100644
--- a/xmake/scripts/platform/iphoneos/_prober.lua
+++ b/xmake/scripts/platform/iphoneos/_prober.lua
@@ -36,7 +36,7 @@ function _prober._probe_arch(configs)
local arch = configs.arch
-- ok?
- if arch and arch ~= "auto" then return true end
+ if arch then return true end
-- init the default architecture
configs.arch = "armv7"
@@ -52,7 +52,7 @@ function _prober._probe_xcode(configs)
local xcode_dir = configs.xcode_dir
-- ok?
- if xcode_dir and xcode_dir ~= "auto" then return true end
+ if xcode_dir then return true end
-- clear it first
xcode_dir = nil
@@ -94,7 +94,7 @@ function _prober._probe_xcode_sdkver(configs)
local xcode_sdkver = configs.xcode_sdkver
-- ok?
- if xcode_sdkver and xcode_sdkver ~= "auto" then return true end
+ if xcode_sdkver then return true end
-- clear it first
xcode_sdkver = nil
@@ -125,7 +125,7 @@ function _prober._probe_xcode_sdkver(configs)
return true
end
--- probe the configure and update the values with "auto"
+-- probe the configure
function _prober.done(configs)
-- probe the architecture
diff --git a/xmake/scripts/platform/iphonesimulator/_iphonesimulator.lua b/xmake/scripts/platform/iphonesimulator/_iphonesimulator.lua
index 5df326fd0..5028f8bbb 100644
--- a/xmake/scripts/platform/iphonesimulator/_iphonesimulator.lua
+++ b/xmake/scripts/platform/iphonesimulator/_iphonesimulator.lua
@@ -38,11 +38,11 @@ _iphonesimulator._PROBER = require("platform/iphonesimulator/_prober")
-- make configure
function _iphonesimulator.make(configs)
- -- init the file name formats
- configs.formats = {}
- configs.formats.static = {"lib", ".a"}
- configs.formats.object = {"", ".o"}
- configs.formats.shared = {"", ".dylib"}
+ -- init the file name format
+ configs.format = {}
+ configs.format.static = {"lib", ".a"}
+ configs.format.object = {"", ".o"}
+ configs.format.shared = {"", ".dylib"}
-- init xcode sdk directory
configs.xcode_sdkdir = config.get("xcode_dir") .. "/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" .. config.get("xcode_sdkver") .. ".sdk"
@@ -56,7 +56,6 @@ function _iphonesimulator.menu(action)
_iphonesimulator._MENU_CONFIG = _iphonesimulator._MENU_CONFIG or
{ {}
, {nil, "mm", "kv", nil, "The Objc Compiler" }
- , {nil, "mx", "kv", nil, "The Objc/c++ 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" }
diff --git a/xmake/scripts/platform/iphonesimulator/_prober.lua b/xmake/scripts/platform/iphonesimulator/_prober.lua
index c11d78a03..9e7c85202 100644
--- a/xmake/scripts/platform/iphonesimulator/_prober.lua
+++ b/xmake/scripts/platform/iphonesimulator/_prober.lua
@@ -36,7 +36,7 @@ function _prober._probe_arch(configs)
local arch = configs.arch
-- ok?
- if arch and arch ~= "auto" then return true end
+ if arch then return true end
-- init the default architecture
configs.arch = "x86"
@@ -52,7 +52,7 @@ function _prober._probe_xcode(configs)
local xcode_dir = configs.xcode_dir
-- ok?
- if xcode_dir and xcode_dir ~= "auto" then return true end
+ if xcode_dir then return true end
-- clear it first
xcode_dir = nil
@@ -94,7 +94,7 @@ function _prober._probe_xcode_sdkver(configs)
local xcode_sdkver = configs.xcode_sdkver
-- ok?
- if xcode_sdkver and xcode_sdkver ~= "auto" then return true end
+ if xcode_sdkver then return true end
-- clear it first
xcode_sdkver = nil
@@ -125,7 +125,7 @@ function _prober._probe_xcode_sdkver(configs)
return true
end
--- probe the configure and update the values with "auto"
+-- probe the configure
function _prober.done(configs)
-- probe the architecture
diff --git a/xmake/scripts/platform/linux/_linux.lua b/xmake/scripts/platform/linux/_linux.lua
index b933d563b..391a4d2cd 100644
--- a/xmake/scripts/platform/linux/_linux.lua
+++ b/xmake/scripts/platform/linux/_linux.lua
@@ -38,11 +38,11 @@ _linux._PROBER = require("platform/linux/_prober")
-- make configure
function _linux.make(configs)
- -- init the file name formats
- configs.formats = {}
- configs.formats.static = {"lib", ".a"}
- configs.formats.object = {"", ".o"}
- configs.formats.shared = {"", ".so"}
+ -- init the file name format
+ configs.format = {}
+ configs.format.static = {"lib", ".a"}
+ configs.format.object = {"", ".o"}
+ configs.format.shared = {"", ".so"}
end
-- get the option menu for action: xmake config or global
@@ -51,7 +51,7 @@ function _linux.menu(action)
-- init config option menu
_linux._MENU_CONFIG = _linux._MENU_CONFIG or
{ {}
- , {nil, "ar", "kv", "ar", "The Library Creator" }
+ , {nil, "ar", "kv", nil, "The Library Creator" }
, {nil, "arflags", "kv", nil, "The Library Creator Flags" }
}
diff --git a/xmake/scripts/platform/linux/_prober.lua b/xmake/scripts/platform/linux/_prober.lua
index cbfcc3710..13cb0b52f 100644
--- a/xmake/scripts/platform/linux/_prober.lua
+++ b/xmake/scripts/platform/linux/_prober.lua
@@ -36,7 +36,7 @@ function _prober._probe_arch(configs)
local arch = configs.arch
-- ok?
- if arch and arch ~= "auto" then return true end
+ if arch then return true end
-- init the default architecture
configs.arch = xmake._ARCH
@@ -45,7 +45,7 @@ function _prober._probe_arch(configs)
return true
end
--- probe the configure and update the values with "auto"
+-- probe the configure
function _prober.done(configs)
-- probe the architecture
diff --git a/xmake/scripts/platform/macosx/_macosx.lua b/xmake/scripts/platform/macosx/_macosx.lua
index 67110058f..6a66d12cb 100644
--- a/xmake/scripts/platform/macosx/_macosx.lua
+++ b/xmake/scripts/platform/macosx/_macosx.lua
@@ -38,11 +38,54 @@ _macosx._PROBER = require("platform/macosx/_prober")
-- make configure
function _macosx.make(configs)
- -- init the file name formats
- configs.formats = {}
- configs.formats.static = {"lib", ".a"}
- configs.formats.object = {"", ".o"}
- configs.formats.shared = {"", ".dylib"}
+ -- init the file name format
+ configs.format = {}
+ configs.format.static = {"lib", ".a"}
+ configs.format.object = {"", ".o"}
+ configs.format.shared = {"", ".dylib"}
+
+ -- init the compiler
+ configs.compiler = {}
+ configs.compiler.cc = config.get("cc") or "xcrun -sdk macosx clang"
+ configs.compiler.cxx = config.get("cxx") or "xcrun -sdk macosx clang++"
+ configs.compiler.mm = config.get("mm") or configs.compiler.cc
+ configs.compiler.mxx = config.get("mxx") or configs.compiler.cxx
+
+ -- init the linker
+ configs.linker = {}
+ configs.linker.ld = config.get("ld") or configs.compiler.cxx
+
+ -- init the assembler
+ configs.assembler = {}
+ configs.assembler.as = config.get("as") or configs.compiler.cc
+
+ -- init the cflags
+ configs.compiler.cflags = {}
+ configs.compiler.cflags.opti = {}
+ configs.compiler.cflags.warn = {}
+ configs.compiler.cflags.all = "-c"
+ configs.compiler.cflags.debug = "-g"
+ configs.compiler.cflags.release = "-fomit-frame-pointer -fvisibility=hidden"
+ configs.compiler.cflags.profile = ""
+ configs.compiler.cflags.opti.O0 = "-O0"
+ configs.compiler.cflags.opti.O1 = "-O1"
+ configs.compiler.cflags.opti.O2 = "-O2"
+ configs.compiler.cflags.opti.O3 = "-O3"
+ configs.compiler.cflags.opti.Os = "-Os"
+ configs.compiler.cflags.warn.W0 = "-W0"
+ configs.compiler.cflags.warn.W1 = "-W1"
+ configs.compiler.cflags.warn.W2 = "-W2"
+ configs.compiler.cflags.warn.W3 = "-W3"
+ configs.compiler.cflags.warn.We = "-Werror"
+
+ -- init the cxxflags
+ configs.compiler.cxxflags = {}
+ configs.compiler.cxxflags.opti = configs.compiler.cflags.opti
+ configs.compiler.cxxflags.warn = configs.compiler.cflags.warn
+ configs.compiler.cxxflags.all = ""
+ configs.compiler.cxxflags.debug = "-g"
+ configs.compiler.cxxflags.release = "-fomit-frame-pointer -fvisibility=hidden"
+ configs.compiler.cxxflags.profile = ""
-- init xcode sdk directory
configs.xcode_sdkdir = config.get("xcode_dir") .. "/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX" .. config.get("xcode_sdkver") .. ".sdk"
@@ -55,7 +98,6 @@ function _macosx.menu(action)
_macosx._MENU_CONFIG = _macosx._MENU_CONFIG or
{ {}
, {nil, "mm", "kv", nil, "The Objc Compiler" }
- , {nil, "mx", "kv", nil, "The Objc/c++ 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" }
diff --git a/xmake/scripts/platform/macosx/_prober.lua b/xmake/scripts/platform/macosx/_prober.lua
index 4cb2ef1e3..81625af9e 100644
--- a/xmake/scripts/platform/macosx/_prober.lua
+++ b/xmake/scripts/platform/macosx/_prober.lua
@@ -36,7 +36,7 @@ function _prober._probe_arch(configs)
local arch = configs.arch
-- ok?
- if arch and arch ~= "auto" then return true end
+ if arch then return true end
-- init the default architecture
configs.arch = xmake._ARCH
@@ -52,7 +52,7 @@ function _prober._probe_xcode(configs)
local xcode_dir = configs.xcode_dir
-- ok?
- if xcode_dir and xcode_dir ~= "auto" then return true end
+ if xcode_dir then return true end
-- clear it first
xcode_dir = nil
@@ -94,7 +94,7 @@ function _prober._probe_xcode_sdkver(configs)
local xcode_sdkver = configs.xcode_sdkver
-- ok?
- if xcode_sdkver and xcode_sdkver ~= "auto" then return true end
+ if xcode_sdkver then return true end
-- clear it first
xcode_sdkver = nil
@@ -125,7 +125,7 @@ function _prober._probe_xcode_sdkver(configs)
return true
end
--- probe the configure and update the values with "auto"
+-- probe the configure
function _prober.done(configs)
-- probe the architecture
diff --git a/xmake/scripts/platform/platform.lua b/xmake/scripts/platform/platform.lua
index b47623216..064138d45 100644
--- a/xmake/scripts/platform/platform.lua
+++ b/xmake/scripts/platform/platform.lua
@@ -89,7 +89,7 @@ end
function platform.format(kind)
-- get format
- local format = platform.get("formats")
+ local format = platform.get("format")
-- get it
return format[kind] or {"", ""}
@@ -208,7 +208,7 @@ function platform.menu(action)
return menus
end
--- probe the platform configure and update the values with "auto"
+-- probe the platform configure
function platform.probe(configs, is_global)
-- probe global
diff --git a/xmake/scripts/platform/windows/_prober.lua b/xmake/scripts/platform/windows/_prober.lua
index cbfcc3710..13cb0b52f 100644
--- a/xmake/scripts/platform/windows/_prober.lua
+++ b/xmake/scripts/platform/windows/_prober.lua
@@ -36,7 +36,7 @@ function _prober._probe_arch(configs)
local arch = configs.arch
-- ok?
- if arch and arch ~= "auto" then return true end
+ if arch then return true end
-- init the default architecture
configs.arch = xmake._ARCH
@@ -45,7 +45,7 @@ function _prober._probe_arch(configs)
return true
end
--- probe the configure and update the values with "auto"
+-- probe the configure
function _prober.done(configs)
-- probe the architecture
diff --git a/xmake/scripts/platform/windows/_windows.lua b/xmake/scripts/platform/windows/_windows.lua
index 394846872..576160719 100644
--- a/xmake/scripts/platform/windows/_windows.lua
+++ b/xmake/scripts/platform/windows/_windows.lua
@@ -38,12 +38,12 @@ _windows._PROBER = require("platform/windows/_prober")
-- make configure
function _windows.make(configs)
- -- init the file name formats
- configs.formats = {}
- configs.formats.static = {"", ".lib"}
- configs.formats.object = {"", ".obj"}
- configs.formats.shared = {"", ".dll"}
- configs.formats.console = {"", ".exe"}
+ -- init the file name format
+ configs.format = {}
+ configs.format.static = {"", ".lib"}
+ configs.format.object = {"", ".obj"}
+ configs.format.shared = {"", ".dll"}
+ configs.format.console = {"", ".exe"}
end
-- get the option menu for action: xmake config or global