From 032606e5b54f0dfd36c796dab14197d259209a49 Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 5 Jul 2020 11:05:49 +0800 Subject: rename to gfortran toolchains --- xmake/languages/fortran/xmake.lua | 1 - xmake/modules/detect/tools/find_gfortran.lua | 5 +++- xmake/platforms/cygwin/xmake.lua | 2 +- xmake/platforms/linux/xmake.lua | 2 +- xmake/platforms/macosx/xmake.lua | 2 +- xmake/platforms/msys/xmake.lua | 2 +- xmake/platforms/windows/xmake.lua | 2 +- xmake/toolchains/fortran/xmake.lua | 39 ---------------------------- xmake/toolchains/gfortran/xmake.lua | 39 ++++++++++++++++++++++++++++ 9 files changed, 48 insertions(+), 46 deletions(-) delete mode 100644 xmake/toolchains/fortran/xmake.lua create mode 100644 xmake/toolchains/gfortran/xmake.lua diff --git a/xmake/languages/fortran/xmake.lua b/xmake/languages/fortran/xmake.lua index 3520a3621..fb17f6f6b 100644 --- a/xmake/languages/fortran/xmake.lua +++ b/xmake/languages/fortran/xmake.lua @@ -114,7 +114,6 @@ language("fortran") , {category = "Cross Complation Configuration/Linker Configuration" } , {nil, "fcld", "kv", nil, "The Fortran Linker" } - , {nil, "fcar", "kv", nil, "The Fortran Static Library Archiver"} , {nil, "fcsh", "kv", nil, "The Fortran Shared Library Linker" } , {category = "Cross Complation Configuration/Builtin Flags Configuration" } diff --git a/xmake/modules/detect/tools/find_gfortran.lua b/xmake/modules/detect/tools/find_gfortran.lua index 1d5bec7b6..12122abdf 100644 --- a/xmake/modules/detect/tools/find_gfortran.lua +++ b/xmake/modules/detect/tools/find_gfortran.lua @@ -31,7 +31,7 @@ import("lib.detect.find_programver") -- @code -- -- local gfortran = find_gfortran() --- local gfortran, version = find_gfortran({program = "gfortran9", version = true}) +-- local gfortran, version = find_gfortran({program = "g95", version = true}) -- -- @endcode -- @@ -42,6 +42,9 @@ function main(opt) -- find program local program = find_program(opt.program or "gfortran", opt) + if not program then + program = find_program("g95", opt) + end -- find program version local version = nil diff --git a/xmake/platforms/cygwin/xmake.lua b/xmake/platforms/cygwin/xmake.lua index deca581bc..76f841a33 100644 --- a/xmake/platforms/cygwin/xmake.lua +++ b/xmake/platforms/cygwin/xmake.lua @@ -51,5 +51,5 @@ platform("cygwin") end) -- set toolchains - set_toolchains("envs", "cross", "gcc", "clang", "yasm") + set_toolchains("envs", "cross", "gcc", "clang", "yasm", "gfortran") diff --git a/xmake/platforms/linux/xmake.lua b/xmake/platforms/linux/xmake.lua index 3c98f79ce..874bcac7c 100644 --- a/xmake/platforms/linux/xmake.lua +++ b/xmake/platforms/linux/xmake.lua @@ -50,7 +50,7 @@ platform("linux") end) -- set toolchains - set_toolchains("envs", "cross", "gcc", "clang", "yasm", "nasm", "fasm", "cuda", "dlang", "go", "rust", "fortran") + set_toolchains("envs", "cross", "gcc", "clang", "yasm", "nasm", "fasm", "cuda", "dlang", "go", "rust", "gfortran") -- set menu set_menu { diff --git a/xmake/platforms/macosx/xmake.lua b/xmake/platforms/macosx/xmake.lua index 6ca50bea7..9df9aaab2 100644 --- a/xmake/platforms/macosx/xmake.lua +++ b/xmake/platforms/macosx/xmake.lua @@ -50,7 +50,7 @@ platform("macosx") end) -- set toolchains - set_toolchains("envs", "xcode", "clang", "gcc", "yasm", "nasm", "cuda", "dlang", "rust", "go", "fortran") + set_toolchains("envs", "xcode", "clang", "gcc", "yasm", "nasm", "cuda", "dlang", "rust", "go", "gfortran") -- set menu set_menu { diff --git a/xmake/platforms/msys/xmake.lua b/xmake/platforms/msys/xmake.lua index ec73a87ee..12162d064 100644 --- a/xmake/platforms/msys/xmake.lua +++ b/xmake/platforms/msys/xmake.lua @@ -51,5 +51,5 @@ platform("msys") end) -- set toolchains - set_toolchains("envs", "cross", "gcc", "clang", "yasm") + set_toolchains("envs", "cross", "gcc", "clang", "yasm", "gfortran") diff --git a/xmake/platforms/windows/xmake.lua b/xmake/platforms/windows/xmake.lua index bc5a03ea1..c53613d71 100644 --- a/xmake/platforms/windows/xmake.lua +++ b/xmake/platforms/windows/xmake.lua @@ -48,7 +48,7 @@ platform("windows") end) -- set toolchains - set_toolchains("msvc", "clang", "yasm", "nasm", "cuda", "dlang", "rust", "go", "fortran") + set_toolchains("msvc", "clang", "yasm", "nasm", "cuda", "dlang", "rust", "go", "gfortran") -- set menu set_menu { diff --git a/xmake/toolchains/fortran/xmake.lua b/xmake/toolchains/fortran/xmake.lua deleted file mode 100644 index d00d6ce24..000000000 --- a/xmake/toolchains/fortran/xmake.lua +++ /dev/null @@ -1,39 +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 xmake.lua --- - --- define toolchain -toolchain("fortran") - - -- set homepage - set_homepage("https://fortran.com/") - set_description("Fortran Programming Language Compiler") - - -- set toolset - set_toolset("fc", "$(env FC)", "gfortran") - set_toolset("fcld", "$(env FC)", "gfortran") - set_toolset("fcsh", "$(env FC)", "gfortran") - - -- on load - on_load(function (toolchain) - local march = toolchain:is_arch("x86_64", "x64") and "-m64" or "-m32" - toolchain:add("fcflags", march) - toolchain:add("fcshflags", march) - toolchain:add("fcldflags", march) - end) diff --git a/xmake/toolchains/gfortran/xmake.lua b/xmake/toolchains/gfortran/xmake.lua new file mode 100644 index 000000000..e2bb0e0eb --- /dev/null +++ b/xmake/toolchains/gfortran/xmake.lua @@ -0,0 +1,39 @@ +--!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 xmake.lua +-- + +-- define toolchain +toolchain("gfortran") + + -- set homepage + set_homepage("https://fortran.com/") + set_description("Fortran Programming Language Compiler") + + -- set toolset + set_toolset("fc", "$(env FC)", "gfortran") + set_toolset("fcld", "$(env FC)", "gfortran") + set_toolset("fcsh", "$(env FC)", "gfortran") + + -- on load + on_load(function (toolchain) + local march = toolchain:is_arch("x86_64", "x64") and "-m64" or "-m32" + toolchain:add("fcflags", march) + toolchain:add("fcshflags", march) + toolchain:add("fcldflags", march) + end) -- cgit v1.3.1