summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2020-10-17 00:37:54 +0800
committerruki <[email protected]>2020-10-17 00:37:54 +0800
commitdae7f831925340293a418056703d0f5ed1abb97d (patch)
tree59152adf146485ee1feecb75e1286c2f32bb9f29
parentd482b1f6dc82ed80161600f2697ca33183dd02a2 (diff)
improve openmp
-rw-r--r--xmake/core/project/target.lua4
-rw-r--r--xmake/rules/c++/openmp/load.lua9
-rw-r--r--xmake/rules/c++/openmp/xmake.lua2
3 files changed, 4 insertions, 11 deletions
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index 7f93eeb94..8ab8894a6 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -554,11 +554,7 @@ function _instance:linker()
if not instance then
os.raise(errors)
end
-
- -- cache it
self._LINKER = instance
-
- -- get it
return instance
end
diff --git a/xmake/rules/c++/openmp/load.lua b/xmake/rules/c++/openmp/load.lua
index 6678e46e3..b217c377d 100644
--- a/xmake/rules/c++/openmp/load.lua
+++ b/xmake/rules/c++/openmp/load.lua
@@ -18,13 +18,10 @@
-- @file load.lua
--
--- imports
-import("core.tool.compiler")
-
-- main entry
-function main(target, langkind)
- local compiler_name = compiler.name(langkind)
- local flag_name = langkind .. "flags"
+function main(target, sourcekind)
+ local _, compiler_name = target:tool(sourcekind)
+ local flag_name = sourcekind == "cxx" and "cxxflags" or "cflags"
if compiler_name == "cl" then
target:add(flag_name, "/openmp")
elseif compiler_name == "clang" or compiler_name == "clangxx" then
diff --git a/xmake/rules/c++/openmp/xmake.lua b/xmake/rules/c++/openmp/xmake.lua
index 6a43810ad..66e93a72e 100644
--- a/xmake/rules/c++/openmp/xmake.lua
+++ b/xmake/rules/c++/openmp/xmake.lua
@@ -21,7 +21,7 @@
-- define rule: c.openmp
rule("c.openmp")
on_load(function (target)
- import("load")(target, "c")
+ import("load")(target, "cc")
end)
-- define rule: c++.openmp