Commit 7c5aa160 authored by wooway777's avatar wooway777
Browse files

issue/985 - adjust cxflags and cxxflags for lua scripts

parent 81e5fe94
...@@ -19,7 +19,7 @@ end ...@@ -19,7 +19,7 @@ end
if is_plat("windows") then if is_plat("windows") then
set_runtimes("MD") set_runtimes("MD")
add_ldflags("/utf-8", {force = true}) add_ldflags("/utf-8", {force = true})
add_cxflags("/utf-8", {force = true}) add_cxxflags("/utf-8", {force = true})
end end
-- CPU -- CPU
...@@ -224,14 +224,15 @@ target("infini-utils") ...@@ -224,14 +224,15 @@ target("infini-utils")
set_warnings("all", "error") set_warnings("all", "error")
if is_plat("windows") then if is_plat("windows") then
add_cxflags("/wd4068") add_cxxflags("/wd4068")
if has_config("omp") then if has_config("omp") then
add_cxflags("/openmp") add_cxxflags("/openmp")
end end
else else
add_cxflags("-fPIC", "-Wno-unknown-pragmas") add_cxflags("-fPIC", "-Wno-unknown-pragmas")
add_cxxflags("-fPIC", "-Wno-unknown-pragmas")
if has_config("omp") then if has_config("omp") then
add_cxflags("-fopenmp") add_cxxflags("-fopenmp")
add_ldflags("-fopenmp", {force = true}) add_ldflags("-fopenmp", {force = true})
end end
end end
...@@ -276,6 +277,7 @@ target("infinirt") ...@@ -276,6 +277,7 @@ target("infinirt")
set_languages("cxx17") set_languages("cxx17")
if not is_plat("windows") then if not is_plat("windows") then
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
end end
set_installdir(os.getenv("INFINI_ROOT") or (os.getenv(is_host("windows") and "HOMEPATH" or "HOME") .. "/.infini")) set_installdir(os.getenv("INFINI_ROOT") or (os.getenv(is_host("windows") and "HOMEPATH" or "HOME") .. "/.infini"))
add_files("src/infinirt/*.cc") add_files("src/infinirt/*.cc")
......
...@@ -44,6 +44,7 @@ target("infiniop-ascend") ...@@ -44,6 +44,7 @@ target("infiniop-ascend")
on_install(function (target) end) on_install(function (target) end)
add_cxflags("-lstdc++ -fPIC") add_cxflags("-lstdc++ -fPIC")
add_cxxflags("-lstdc++ -fPIC")
set_warnings("all", "error") set_warnings("all", "error")
set_languages("cxx17") set_languages("cxx17")
...@@ -62,6 +63,7 @@ target("infinirt-ascend") ...@@ -62,6 +63,7 @@ target("infinirt-ascend")
-- Add files -- Add files
add_files("$(projectdir)/src/infinirt/ascend/*.cc") add_files("$(projectdir)/src/infinirt/ascend/*.cc")
add_cxflags("-lstdc++ -Wall -Werror -fPIC") add_cxflags("-lstdc++ -Wall -Werror -fPIC")
add_cxxflags("-lstdc++ -Wall -Werror -fPIC")
target_end() target_end()
target("infiniccl-ascend") target("infiniccl-ascend")
...@@ -76,5 +78,6 @@ target("infiniccl-ascend") ...@@ -76,5 +78,6 @@ target("infiniccl-ascend")
add_links("libhccl.so") add_links("libhccl.so")
add_files("../src/infiniccl/ascend/*.cc") add_files("../src/infiniccl/ascend/*.cc")
add_cxflags("-lstdc++ -fPIC") add_cxflags("-lstdc++ -fPIC")
add_cxxflags("-lstdc++ -fPIC")
end end
target_end() target_end()
...@@ -41,6 +41,7 @@ target("infiniop-cambricon") ...@@ -41,6 +41,7 @@ target("infiniop-cambricon")
on_install(function (target) end) on_install(function (target) end)
add_cxflags("-lstdc++ -fPIC") add_cxflags("-lstdc++ -fPIC")
add_cxxflags("-lstdc++ -fPIC")
set_warnings("all", "error") set_warnings("all", "error")
set_languages("cxx17") set_languages("cxx17")
...@@ -59,6 +60,7 @@ target("infinirt-cambricon") ...@@ -59,6 +60,7 @@ target("infinirt-cambricon")
-- Add include dirs -- Add include dirs
add_files("../src/infinirt/bang/*.cc") add_files("../src/infinirt/bang/*.cc")
add_cxflags("-lstdc++ -Wall -Werror -fPIC") add_cxflags("-lstdc++ -Wall -Werror -fPIC")
add_cxxflags("-lstdc++ -Wall -Werror -fPIC")
target_end() target_end()
target("infiniccl-cambricon") target("infiniccl-cambricon")
...@@ -89,6 +91,7 @@ target("infiniccl-cambricon") ...@@ -89,6 +91,7 @@ target("infiniccl-cambricon")
add_files("../src/infiniccl/cambricon/*.cc") add_files("../src/infiniccl/cambricon/*.cc")
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
add_ldflags("-fPIC") add_ldflags("-fPIC")
else else
print("[Warning] CNCL is currently only supported on Linux") print("[Warning] CNCL is currently only supported on Linux")
......
...@@ -6,14 +6,15 @@ target("infiniop-cpu") ...@@ -6,14 +6,15 @@ target("infiniop-cpu")
set_warnings("all", "error") set_warnings("all", "error")
if is_plat("windows") then if is_plat("windows") then
add_cxflags("/wd4068") add_cxxflags("/wd4068")
if has_config("omp") then if has_config("omp") then
add_cxflags("/openmp") add_cxxflags("/openmp")
end end
else else
add_cxflags("-fPIC", "-Wno-unknown-pragmas") add_cxflags("-fPIC", "-Wno-unknown-pragmas")
add_cxxflags("-fPIC", "-Wno-unknown-pragmas")
if has_config("omp") then if has_config("omp") then
add_cxflags("-fopenmp") add_cxxflags("-fopenmp")
add_ldflags("-fopenmp") add_ldflags("-fopenmp")
end end
end end
...@@ -32,6 +33,7 @@ target("infinirt-cpu") ...@@ -32,6 +33,7 @@ target("infinirt-cpu")
if not is_plat("windows") then if not is_plat("windows") then
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
end end
set_languages("cxx17") set_languages("cxx17")
......
...@@ -60,6 +60,7 @@ target("infiniop-hygon") ...@@ -60,6 +60,7 @@ target("infiniop-hygon")
add_cuflags("-fPIC", "-std=c++17", {force = true}) add_cuflags("-fPIC", "-std=c++17", {force = true})
add_culdflags("-fPIC") add_culdflags("-fPIC")
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
-- 添加海光DCU特定的编译标志 -- 添加海光DCU特定的编译标志
add_cuflags("-arch=gfx906", "-arch=gfx926", "-arch=gfx928", "-arch=gfx936") add_cuflags("-arch=gfx906", "-arch=gfx926", "-arch=gfx928", "-arch=gfx936")
...@@ -76,7 +77,7 @@ target("infiniop-hygon") ...@@ -76,7 +77,7 @@ target("infiniop-hygon")
add_files("../src/infiniop/ops/swiglu/nvidia/*.cu") add_files("../src/infiniop/ops/swiglu/nvidia/*.cu")
if has_config("ninetoothed") then if has_config("ninetoothed") then
add_files("../build/ninetoothed/*.c", {cxflags = {"-Wno-return-type"}}) add_files("../build/ninetoothed/*.c", {cxxflags = {"-Wno-return-type"}})
end end
target_end() target_end()
...@@ -105,6 +106,7 @@ target("infinirt-hygon") ...@@ -105,6 +106,7 @@ target("infinirt-hygon")
add_cuflags("-fPIC", "-std=c++17", {force = true}) add_cuflags("-fPIC", "-std=c++17", {force = true})
add_culdflags("-fPIC") add_culdflags("-fPIC")
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
-- 添加海光DCU特定的编译标志 -- 添加海光DCU特定的编译标志
add_cuflags("-arch=gfx906", "-arch=gfx926", "-arch=gfx928", "-arch=gfx936") add_cuflags("-arch=gfx906", "-arch=gfx926", "-arch=gfx928", "-arch=gfx936")
...@@ -138,6 +140,7 @@ target("infiniccl-hygon") ...@@ -138,6 +140,7 @@ target("infiniccl-hygon")
add_cuflags("-fPIC", "-std=c++17", {force = true}) add_cuflags("-fPIC", "-std=c++17", {force = true})
add_culdflags("-fPIC") add_culdflags("-fPIC")
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
-- 添加海光DCU特定的编译标志 -- 添加海光DCU特定的编译标志
add_cuflags("-arch=gfx906", "-arch=gfx926", "-arch=gfx928", "-arch=gfx936") add_cuflags("-arch=gfx906", "-arch=gfx926", "-arch=gfx928", "-arch=gfx936")
......
...@@ -49,6 +49,7 @@ target("infiniop-iluvatar") ...@@ -49,6 +49,7 @@ target("infiniop-iluvatar")
end end
add_culdflags("-fPIC") add_culdflags("-fPIC")
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
-- set_languages("cxx17") 天数似乎不能用这个配置 -- set_languages("cxx17") 天数似乎不能用这个配置
add_files("../src/infiniop/devices/nvidia/*.cu", "../src/infiniop/ops/*/nvidia/*.cu") add_files("../src/infiniop/devices/nvidia/*.cu", "../src/infiniop/ops/*/nvidia/*.cu")
...@@ -57,7 +58,7 @@ target("infiniop-iluvatar") ...@@ -57,7 +58,7 @@ target("infiniop-iluvatar")
add_files("../src/infiniop/ops/dequantize_awq/iluvatar/*.cu") add_files("../src/infiniop/ops/dequantize_awq/iluvatar/*.cu")
if has_config("ninetoothed") then if has_config("ninetoothed") then
add_files("../build/ninetoothed/*.c", {cxflags = {"-Wno-return-type"}}) add_files("../build/ninetoothed/*.c", {cxxflags = {"-Wno-return-type"}})
end end
target_end() target_end()
...@@ -76,6 +77,7 @@ target("infinirt-iluvatar") ...@@ -76,6 +77,7 @@ target("infinirt-iluvatar")
add_cuflags("-fPIC", "-x", "ivcore", "-std=c++17", {force = true}) add_cuflags("-fPIC", "-x", "ivcore", "-std=c++17", {force = true})
add_culdflags("-fPIC") add_culdflags("-fPIC")
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
-- set_languages("cxx17") 天数似乎不能用这个配置 -- set_languages("cxx17") 天数似乎不能用这个配置
add_files("../src/infinirt/cuda/*.cu") add_files("../src/infinirt/cuda/*.cu")
...@@ -97,6 +99,7 @@ target("infiniccl-iluvatar") ...@@ -97,6 +99,7 @@ target("infiniccl-iluvatar")
add_cuflags("-fPIC", "-x", "ivcore", "-std=c++17", {force = true}) add_cuflags("-fPIC", "-x", "ivcore", "-std=c++17", {force = true})
add_culdflags("-fPIC") add_culdflags("-fPIC")
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
local nccl_root = os.getenv("NCCL_ROOT") local nccl_root = os.getenv("NCCL_ROOT")
if nccl_root then if nccl_root then
......
...@@ -75,6 +75,7 @@ target("infiniop-kunlun") ...@@ -75,6 +75,7 @@ target("infiniop-kunlun")
on_install(function (target) end) on_install(function (target) end)
add_cxflags("-lstdc++ -fPIC -Wno-error=unused-function") add_cxflags("-lstdc++ -fPIC -Wno-error=unused-function")
add_cxxflags("-lstdc++ -fPIC -Wno-error=unused-function")
set_warnings("all", "error") set_warnings("all", "error")
set_languages("cxx17") set_languages("cxx17")
...@@ -102,6 +103,7 @@ target("infinirt-kunlun") ...@@ -102,6 +103,7 @@ target("infinirt-kunlun")
-- Add include dirs -- Add include dirs
add_files("$(projectdir)/src/infinirt/kunlun/*.cc") add_files("$(projectdir)/src/infinirt/kunlun/*.cc")
add_cxflags("-lstdc++ -Wall -Werror -fPIC") add_cxflags("-lstdc++ -Wall -Werror -fPIC")
add_cxxflags("-lstdc++ -Wall -Werror -fPIC")
target_end() target_end()
target("infiniccl-kunlun") target("infiniccl-kunlun")
...@@ -117,5 +119,6 @@ target("infiniccl-kunlun") ...@@ -117,5 +119,6 @@ target("infiniccl-kunlun")
add_links("bkcl") add_links("bkcl")
add_files("$(projectdir)/src/infiniccl/kunlun/*.cc") add_files("$(projectdir)/src/infiniccl/kunlun/*.cc")
add_cxflags("-lstdc++ -fPIC") add_cxflags("-lstdc++ -fPIC")
add_cxxflags("-lstdc++ -fPIC")
end end
target_end() target_end()
...@@ -48,11 +48,19 @@ target("infiniop-metax") ...@@ -48,11 +48,19 @@ target("infiniop-metax")
set_languages("cxx17") set_languages("cxx17")
set_warnings("all", "error") set_warnings("all", "error")
add_cxflags("-lstdc++", "-fPIC", "-Wno-defaulted-function-deleted", "-Wno-strict-aliasing", {force = true}) add_cxflags("-lstdc++", "-fPIC", "-Wno-defaulted-function-deleted", "-Wno-strict-aliasing", {force = true})
add_cxxflags("-lstdc++", "-fPIC", "-Wno-defaulted-function-deleted", "-Wno-strict-aliasing", {force = true})
add_files("../src/infiniop/devices/metax/*.cc", "../src/infiniop/ops/*/metax/*.cc") add_files("../src/infiniop/devices/metax/*.cc", "../src/infiniop/ops/*/metax/*.cc")
add_files("../src/infiniop/ops/*/metax/*.maca", {rule = "maca"}) add_files("../src/infiniop/ops/*/metax/*.maca", {rule = "maca"})
if has_config("ninetoothed") then if has_config("ninetoothed") then
add_files("../build/ninetoothed/*.c", {cxflags = {"-include stdlib.h", "-Wno-return-type"}}) add_files("../build/ninetoothed/*.c", {
cxflags = {
"-include stdlib.h",
"-Wno-return-type",
"-Wno-implicit-function-declaration",
"-Wno-builtin-declaration-mismatch"
}
})
end end
target_end() target_end()
...@@ -63,6 +71,7 @@ target("infinirt-metax") ...@@ -63,6 +71,7 @@ target("infinirt-metax")
add_deps("infini-utils") add_deps("infini-utils")
set_warnings("all", "error") set_warnings("all", "error")
add_cxflags("-lstdc++ -fPIC") add_cxflags("-lstdc++ -fPIC")
add_cxxflags("-lstdc++ -fPIC")
add_files("../src/infinirt/metax/*.cc") add_files("../src/infinirt/metax/*.cc")
target_end() target_end()
...@@ -73,6 +82,7 @@ target("infiniccl-metax") ...@@ -73,6 +82,7 @@ target("infiniccl-metax")
set_warnings("all", "error") set_warnings("all", "error")
if not is_plat("windows") then if not is_plat("windows") then
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
end end
if has_config("ccl") then if has_config("ccl") then
if has_config("use-mc") then if has_config("use-mc") then
......
...@@ -42,6 +42,7 @@ target("infiniop-moore") ...@@ -42,6 +42,7 @@ target("infiniop-moore")
set_languages("cxx17") set_languages("cxx17")
set_warnings("all", "error") set_warnings("all", "error")
add_cxflags("-lstdc++", "-fPIC", "-Wno-comment") add_cxflags("-lstdc++", "-fPIC", "-Wno-comment")
add_cxxflags("-lstdc++", "-fPIC", "-Wno-comment")
add_files("../src/infiniop/devices/moore/*.cc") add_files("../src/infiniop/devices/moore/*.cc")
add_files("../src/infiniop/ops/*/moore/*.mu", {rule = "mu"}) add_files("../src/infiniop/ops/*/moore/*.mu", {rule = "mu"})
...@@ -56,6 +57,7 @@ target("infinirt-moore") ...@@ -56,6 +57,7 @@ target("infinirt-moore")
add_deps("infini-utils") add_deps("infini-utils")
set_warnings("all", "error") set_warnings("all", "error")
add_cxflags("-lstdc++", "-fPIC") add_cxflags("-lstdc++", "-fPIC")
add_cxxflags("-lstdc++", "-fPIC")
add_files("../src/infinirt/moore/*.cc") add_files("../src/infinirt/moore/*.cc")
target_end() target_end()
...@@ -66,6 +68,7 @@ target("infiniccl-moore") ...@@ -66,6 +68,7 @@ target("infiniccl-moore")
set_warnings("all", "error") set_warnings("all", "error")
if not is_plat("windows") then if not is_plat("windows") then
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
end end
if has_config("ccl") then if has_config("ccl") then
add_links("libmccl.so") add_links("libmccl.so")
......
...@@ -48,6 +48,7 @@ target("infiniop-nvidia") ...@@ -48,6 +48,7 @@ target("infiniop-nvidia")
add_cuflags("-Xcompiler=-fPIC") add_cuflags("-Xcompiler=-fPIC")
add_cuflags("--extended-lambda") add_cuflags("--extended-lambda")
add_culdflags("-Xcompiler=-fPIC") add_culdflags("-Xcompiler=-fPIC")
add_cxflags("-fPIC")
add_cxxflags("-fPIC") add_cxxflags("-fPIC")
add_cflags("-fPIC") add_cflags("-fPIC")
add_cuflags("--expt-relaxed-constexpr") add_cuflags("--expt-relaxed-constexpr")
...@@ -93,6 +94,7 @@ target("infinirt-nvidia") ...@@ -93,6 +94,7 @@ target("infinirt-nvidia")
add_cuflags("-Xcompiler=-fPIC") add_cuflags("-Xcompiler=-fPIC")
add_culdflags("-Xcompiler=-fPIC") add_culdflags("-Xcompiler=-fPIC")
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
end end
set_languages("cxx17") set_languages("cxx17")
...@@ -112,6 +114,7 @@ target("infiniccl-nvidia") ...@@ -112,6 +114,7 @@ target("infiniccl-nvidia")
add_cuflags("-Xcompiler=-fPIC") add_cuflags("-Xcompiler=-fPIC")
add_culdflags("-Xcompiler=-fPIC") add_culdflags("-Xcompiler=-fPIC")
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
local nccl_root = os.getenv("NCCL_ROOT") local nccl_root = os.getenv("NCCL_ROOT")
if nccl_root then if nccl_root then
......
...@@ -88,6 +88,7 @@ target("infiniop-qy") ...@@ -88,6 +88,7 @@ target("infiniop-qy")
add_cuflags("-Xcompiler=-fPIC") add_cuflags("-Xcompiler=-fPIC")
add_cuflags("--extended-lambda") add_cuflags("--extended-lambda")
add_culdflags("-Xcompiler=-fPIC") add_culdflags("-Xcompiler=-fPIC")
add_cxflags("-fPIC")
add_cxxflags("-fPIC") add_cxxflags("-fPIC")
add_cuflags("--expt-relaxed-constexpr") add_cuflags("--expt-relaxed-constexpr")
if CUDNN_ROOT ~= nil then if CUDNN_ROOT ~= nil then
...@@ -117,6 +118,7 @@ target("infinirt-qy") ...@@ -117,6 +118,7 @@ target("infinirt-qy")
add_cuflags("-Xcompiler=-fPIC") add_cuflags("-Xcompiler=-fPIC")
add_culdflags("-Xcompiler=-fPIC") add_culdflags("-Xcompiler=-fPIC")
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
end end
set_languages("cxx17") set_languages("cxx17")
...@@ -133,6 +135,7 @@ target("infiniccl-qy") ...@@ -133,6 +135,7 @@ target("infiniccl-qy")
add_cuflags("-Xcompiler=-fPIC") add_cuflags("-Xcompiler=-fPIC")
add_culdflags("-Xcompiler=-fPIC") add_culdflags("-Xcompiler=-fPIC")
add_cxflags("-fPIC") add_cxflags("-fPIC")
add_cxxflags("-fPIC")
local nccl_root = os.getenv("NCCL_ROOT") local nccl_root = os.getenv("NCCL_ROOT")
if nccl_root then if nccl_root then
......
...@@ -24,7 +24,7 @@ target("infiniop-test") ...@@ -24,7 +24,7 @@ target("infiniop-test")
add_links("infiniop", "infinirt") add_links("infiniop", "infinirt")
if has_config("omp") then if has_config("omp") then
add_cxflags("-fopenmp") add_cxxflags("-fopenmp")
add_ldflags("-fopenmp") add_ldflags("-fopenmp")
end end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment