diff options
| author | ruki <[email protected]> | 2020-05-21 23:11:51 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-05-21 13:11:06 +0800 |
| commit | 36e30f47020e0c4399eb5f7b7a8739d55489f499 (patch) | |
| tree | 2835479e2089ec80189e43d472668724dcd7be10 | |
| parent | f248bb4ffe4a980eebd31a9ae12ddf8a03237d29 (diff) | |
improve to check arch for platform
23 files changed, 95 insertions, 376 deletions
diff --git a/xmake/modules/private/platform/check_arch.lua b/xmake/modules/private/platform/check_arch.lua deleted file mode 100644 index 4e67f8ae9..000000000 --- a/xmake/modules/private/platform/check_arch.lua +++ /dev/null @@ -1,38 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-2020, TBOOX Open Source Group. --- --- @author ruki --- @file check_arch.lua --- - --- imports -import("core.base.option") - --- check the architecture -function main(config, default) - - -- get the architecture - local arch = config.get("arch") - if not arch then - - -- init the default architecture - config.set("arch", default or os.arch()) - - -- trace - cprint("checking for the architecture ... ${color.success}%s", config.get("arch")) - end -end - diff --git a/xmake/platforms/android/check.lua b/xmake/platforms/android/check.lua deleted file mode 100644 index 5db47502a..000000000 --- a/xmake/platforms/android/check.lua +++ /dev/null @@ -1,29 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-2020, TBOOX Open Source Group. --- --- @author ruki --- @file check.lua --- - --- imports -import("core.project.config") -import("private.platform.check_arch") - --- check it -function main(platform) - check_arch(config, "armeabi-v7a") -end - diff --git a/xmake/platforms/android/xmake.lua b/xmake/platforms/android/xmake.lua index 48177245e..27bea1645 100644 --- a/xmake/platforms/android/xmake.lua +++ b/xmake/platforms/android/xmake.lua @@ -42,8 +42,15 @@ platform("android") set_formats("shared", "lib$(name).so") set_formats("symbol", "$(name).sym") - -- on check - on_check("check") + -- on check + on_check(function (platform) + import("core.project.config") + local arch = config.get("arch") + if not arch then + config.set("arch", "armeabi-v7a") + cprint("checking for the architecture ... ${color.success}%s", config.get("arch")) + end + end) -- set toolchains set_toolchains("envs", "ndk", "rust") diff --git a/xmake/platforms/bsd/check.lua b/xmake/platforms/bsd/check.lua deleted file mode 100644 index 50c933cba..000000000 --- a/xmake/platforms/bsd/check.lua +++ /dev/null @@ -1,29 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-2020, TBOOX Open Source Group. --- --- @author ruki --- @file check.lua --- - --- imports -import("core.project.config") -import("private.platform.check_arch") - --- check it -function main(platform) - check_arch(config, os.arch()) -end - diff --git a/xmake/platforms/bsd/xmake.lua b/xmake/platforms/bsd/xmake.lua index 7bc9c03b8..35f063eb7 100644 --- a/xmake/platforms/bsd/xmake.lua +++ b/xmake/platforms/bsd/xmake.lua @@ -39,8 +39,15 @@ platform("bsd") -- set install directory set_installdir("/usr/local") - -- on check - on_check("check") + -- on check + on_check(function (platform) + import("core.project.config") + local arch = config.get("arch") + if not arch then + config.set("arch", os.arch()) + cprint("checking for the architecture ... ${color.success}%s", config.get("arch")) + end + end) -- set toolchains set_toolchains("envs", "gcc", "clang", "yasm", "nasm", "fasm", "cuda", "dlang", "go", "rust") diff --git a/xmake/platforms/cross/check.lua b/xmake/platforms/cross/check.lua deleted file mode 100644 index 6c02f12b5..000000000 --- a/xmake/platforms/cross/check.lua +++ /dev/null @@ -1,38 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-2020, TBOOX Open Source Group. --- --- @author ruki --- @file check.lua --- - --- imports -import("core.project.config") - --- check the architecture -function _check_arch() - - -- get the architecture - local arch = config.get("arch") - if not arch then - config.set("arch", "none") - end -end - --- check it -function main(platform) - _check_arch() -end - diff --git a/xmake/platforms/cross/xmake.lua b/xmake/platforms/cross/xmake.lua index 4e6b2dcc2..c5b12eda5 100644 --- a/xmake/platforms/cross/xmake.lua +++ b/xmake/platforms/cross/xmake.lua @@ -34,7 +34,14 @@ platform("cross") set_formats("symbol", "$(name).sym") -- on check - on_check("check") + on_check(function (platform) + import("core.project.config") + local arch = config.get("arch") + if not arch then + config.set("arch", "none") + cprint("checking for the architecture ... ${color.success}%s", config.get("arch")) + end + end) -- set toolchains set_toolchains("envs", "cross") diff --git a/xmake/platforms/cygwin/check.lua b/xmake/platforms/cygwin/check.lua deleted file mode 100644 index 5c5902225..000000000 --- a/xmake/platforms/cygwin/check.lua +++ /dev/null @@ -1,28 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-2020, TBOOX Open Source Group. --- --- @author ruki --- @file check.lua --- - --- imports -import("core.project.config") -import("private.platform.check_arch") - --- check it -function main(platform) - check_arch(config, config.get("cross") and "none" or os.subarch()) -end diff --git a/xmake/platforms/cygwin/xmake.lua b/xmake/platforms/cygwin/xmake.lua index c7f16f8d2..deca581bc 100644 --- a/xmake/platforms/cygwin/xmake.lua +++ b/xmake/platforms/cygwin/xmake.lua @@ -41,7 +41,14 @@ platform("cygwin") set_installdir("/usr/local") -- on check - on_check("check") + on_check(function (platform) + import("core.project.config") + local arch = config.get("arch") + if not arch then + config.set("arch", os.subarch()) + cprint("checking for the architecture ... ${color.success}%s", config.get("arch")) + end + end) -- set toolchains set_toolchains("envs", "cross", "gcc", "clang", "yasm") diff --git a/xmake/platforms/iphoneos/check.lua b/xmake/platforms/iphoneos/check.lua deleted file mode 100644 index 520420f84..000000000 --- a/xmake/platforms/iphoneos/check.lua +++ /dev/null @@ -1,28 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-2020, TBOOX Open Source Group. --- --- @author ruki --- @file check.lua --- - --- imports -import("core.project.config") -import("private.platform.check_arch") - --- check it -function main(platform) - check_arch(config, "arm64") -end diff --git a/xmake/platforms/iphoneos/xmake.lua b/xmake/platforms/iphoneos/xmake.lua index bf7612c2c..7118846b7 100644 --- a/xmake/platforms/iphoneos/xmake.lua +++ b/xmake/platforms/iphoneos/xmake.lua @@ -36,8 +36,15 @@ platform("iphoneos") set_formats("shared", "lib$(name).dylib") set_formats("symbol", "$(name).dSYM") - -- on check - on_check("check") + -- on check + on_check(function (platform) + import("core.project.config") + local arch = config.get("arch") + if not arch then + config.set("arch", "arm64") + cprint("checking for the architecture ... ${color.success}%s", config.get("arch")) + end + end) -- set toolchains set_toolchains("envs", "xcode") diff --git a/xmake/platforms/linux/check.lua b/xmake/platforms/linux/check.lua deleted file mode 100644 index 2d3a4a063..000000000 --- a/xmake/platforms/linux/check.lua +++ /dev/null @@ -1,28 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-2020, TBOOX Open Source Group. --- --- @author ruki --- @file check.lua --- - --- imports -import("core.project.config") -import("private.platform.check_arch") - --- check it -function main(platform) - check_arch(config, os.arch()) -end diff --git a/xmake/platforms/linux/xmake.lua b/xmake/platforms/linux/xmake.lua index 62cc1e3e8..a1097565b 100644 --- a/xmake/platforms/linux/xmake.lua +++ b/xmake/platforms/linux/xmake.lua @@ -39,8 +39,15 @@ platform("linux") -- set install directory set_installdir("/usr/local") - -- on check - on_check("check") + -- on check + on_check(function (platform) + import("core.project.config") + local arch = config.get("arch") + if not arch then + config.set("arch", os.arch()) + cprint("checking for the architecture ... ${color.success}%s", config.get("arch")) + end + end) -- set toolchains set_toolchains("envs", "cross", "gcc", "clang", "yasm", "nasm", "fasm", "cuda", "dlang", "go", "rust") diff --git a/xmake/platforms/macosx/check.lua b/xmake/platforms/macosx/check.lua deleted file mode 100644 index 0885534cc..000000000 --- a/xmake/platforms/macosx/check.lua +++ /dev/null @@ -1,28 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-2020, TBOOX Open Source Group. --- --- @author ruki --- @file check.lua --- - --- imports -import("core.project.config") -import("private.platform.check_arch") - --- check it -function main(platform) - check_arch(config) -end diff --git a/xmake/platforms/macosx/xmake.lua b/xmake/platforms/macosx/xmake.lua index 0dc0ece52..f643d2c80 100644 --- a/xmake/platforms/macosx/xmake.lua +++ b/xmake/platforms/macosx/xmake.lua @@ -40,7 +40,14 @@ platform("macosx") set_installdir("/usr/local") -- on check - on_check("check") + on_check(function (platform) + import("core.project.config") + local arch = config.get("arch") + if not arch then + config.set("arch", os.arch()) + cprint("checking for the architecture ... ${color.success}%s", config.get("arch")) + end + end) -- set toolchains set_toolchains("envs", "xcode", "clang", "gcc", "yasm", "nasm", "cuda", "dlang", "rust", "go") diff --git a/xmake/platforms/mingw/check.lua b/xmake/platforms/mingw/check.lua deleted file mode 100644 index 6b81b5d92..000000000 --- a/xmake/platforms/mingw/check.lua +++ /dev/null @@ -1,28 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-2020, TBOOX Open Source Group. --- --- @author ruki --- @file check.lua --- - --- imports -import("core.project.config") -import("private.platform.check_arch") - --- check it -function main(platform) - check_arch(config, "x86_64") -end diff --git a/xmake/platforms/mingw/xmake.lua b/xmake/platforms/mingw/xmake.lua index 6a29e39d5..82c2ae07e 100644 --- a/xmake/platforms/mingw/xmake.lua +++ b/xmake/platforms/mingw/xmake.lua @@ -37,8 +37,15 @@ platform("mingw") set_formats("binary", "$(name).exe") set_formats("symbol", "$(name).pdb") - -- on check - on_check("check") + -- on check + on_check(function (platform) + import("core.project.config") + local arch = config.get("arch") + if not arch then + config.set("arch", "x86_64") + cprint("checking for the architecture ... ${color.success}%s", config.get("arch")) + end + end) -- set toolchains set_toolchains("envs", "mingw") diff --git a/xmake/platforms/msys/check.lua b/xmake/platforms/msys/check.lua deleted file mode 100644 index 5c5902225..000000000 --- a/xmake/platforms/msys/check.lua +++ /dev/null @@ -1,28 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-2020, TBOOX Open Source Group. --- --- @author ruki --- @file check.lua --- - --- imports -import("core.project.config") -import("private.platform.check_arch") - --- check it -function main(platform) - check_arch(config, config.get("cross") and "none" or os.subarch()) -end diff --git a/xmake/platforms/msys/xmake.lua b/xmake/platforms/msys/xmake.lua index 7fa199b76..ec73a87ee 100644 --- a/xmake/platforms/msys/xmake.lua +++ b/xmake/platforms/msys/xmake.lua @@ -40,8 +40,15 @@ platform("msys") -- set install directory set_installdir("/usr/local") - -- on check - on_check("check") + -- on check + on_check(function (platform) + import("core.project.config") + local arch = config.get("arch") + if not arch then + config.set("arch", os.subarch()) + cprint("checking for the architecture ... ${color.success}%s", config.get("arch")) + end + end) -- set toolchains set_toolchains("envs", "cross", "gcc", "clang", "yasm") diff --git a/xmake/platforms/watchos/check.lua b/xmake/platforms/watchos/check.lua deleted file mode 100644 index bd8852db3..000000000 --- a/xmake/platforms/watchos/check.lua +++ /dev/null @@ -1,28 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-2020, TBOOX Open Source Group. --- --- @author ruki --- @file check.lua --- - --- imports -import("core.project.config") -import("private.platform.check_arch") - --- check it -function main(platform) - check_arch(config, "armv7k") -end diff --git a/xmake/platforms/watchos/xmake.lua b/xmake/platforms/watchos/xmake.lua index 8be929977..b6d864d0b 100644 --- a/xmake/platforms/watchos/xmake.lua +++ b/xmake/platforms/watchos/xmake.lua @@ -37,7 +37,14 @@ platform("watchos") set_formats("symbol", "$(name).dSYM") -- on check - on_check("check") + on_check(function (platform) + import("core.project.config") + local arch = config.get("arch") + if not arch then + config.set("arch", "armv7k") + cprint("checking for the architecture ... ${color.success}%s", config.get("arch")) + end + end) -- set toolchains set_toolchains("envs", "xcode") diff --git a/xmake/platforms/windows/check.lua b/xmake/platforms/windows/check.lua deleted file mode 100644 index 0885534cc..000000000 --- a/xmake/platforms/windows/check.lua +++ /dev/null @@ -1,28 +0,0 @@ ---!A cross-platform build utility based on Lua --- --- Licensed under the Apache License, Version 2.0 (the "License"); --- you may not use this file except in compliance with the License. --- You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015-2020, TBOOX Open Source Group. --- --- @author ruki --- @file check.lua --- - --- imports -import("core.project.config") -import("private.platform.check_arch") - --- check it -function main(platform) - check_arch(config) -end diff --git a/xmake/platforms/windows/xmake.lua b/xmake/platforms/windows/xmake.lua index f43d7179c..5c29b0e0b 100644 --- a/xmake/platforms/windows/xmake.lua +++ b/xmake/platforms/windows/xmake.lua @@ -37,8 +37,15 @@ platform("windows") set_formats("binary", "$(name).exe") set_formats("symbol", "$(name).pdb") - -- on check - on_check("check") + -- on check + on_check(function (platform) + import("core.project.config") + local arch = config.get("arch") + if not arch then + config.set("arch", os.arch()) + cprint("checking for the architecture ... ${color.success}%s", config.get("arch")) + end + end) -- set toolchains set_toolchains("vs", "clang", "yasm", "nasm", "cuda", "dlang", "rust", "go") |
