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