@@ -125,7 +125,7 @@ if has_config("cambricon-mlu") then
125125 table.insert (target :objectfiles (), objectfile )
126126 end )
127127
128- rule_end ()
128+ rule_end ()
129129
130130
131131 target (" cambricon-mlu" )
@@ -179,7 +179,7 @@ if has_config("ascend-npu") then
179179 os .rm (builddir .. " /libascend_kernels.a" )
180180
181181 end )
182- rule_end ()
182+ rule_end ()
183183
184184 target (" ascend-npu" )
185185 -- Other configs
@@ -226,9 +226,6 @@ target("infiniop")
226226 get_config (" mode" )
227227 )
228228
229- os .exec (" mkdir -p $(projectdir)/lib/" )
230- os .exec (" cp " .. builddir .. " /libinfiniop.so $(projectdir)/lib/" )
231- os .exec (" cp -r $(projectdir)/include $(projectdir)/lib/" )
232229 -- Define color codes
233230 local GREEN = ' \27 [0;32m'
234231 local YELLOW = ' \27 [1;33m'
@@ -244,23 +241,35 @@ target("infiniop")
244241
245242 on_install (function (target )
246243 print (" Installing libraries..." )
247- if os.getenv (" INFINI_ROOT" ) == nil then
244+
245+ local GREEN = ' \27 [0;32m'
246+ local YELLOW = ' \27 [1;33m'
247+ local NC = ' \27 [0m' -- No Color
248+
249+ local infini_dir = os.getenv (" INFINI_ROOT" )
250+ if infini_dir == nil then
248251 print (YELLOW .. " INFINI_ROOT not set, installation path default to ~/.infini" .. NC )
249252 print (YELLOW .. " It is recommended to set INFINI_ROOT as an environment variable." .. NC )
250- os . setenv ( " INFINI_ROOT " , os.getenv (" HOME" ) .. " /.infini" )
253+ infini_dir = os.getenv (" HOME" ) .. " /.infini"
251254 end
252- local infini_dir = os.getenv (" INFINI_ROOT" )
253255
254256 if os.isdir (infini_dir ) then
255257 print (" INFINI_ROOT already exists, duplicated contents will be overwritten." )
256258 else
257259 os .mkdir (infini_dir )
258260 end
259- os .exec (" cp -r " .. " $(projectdir)/lib " .. infini_dir )
260261
261- local GREEN = ' \27 [0;32m'
262- local YELLOW = ' \27 [1;33m'
263- local NC = ' \27 [0m' -- No Color
262+ local builddir = string.format (
263+ " %s/build/%s/%s/%s" ,
264+ os.projectdir (),
265+ get_config (" plat" ),
266+ get_config (" arch" ),
267+ get_config (" mode" )
268+ )
269+ os .exec (" mkdir -p " .. infini_dir .. " /lib" )
270+ os .exec (" cp " .. builddir .. " /libinfiniop.so " .. infini_dir .. " /lib/" )
271+ os .exec (" cp -r $(projectdir)/include " .. infini_dir .. " /include" )
272+
264273 os .exec (" echo -e '" .. GREEN .. " Installation completed successfully at " .. infini_dir .. NC .. " '" )
265274 os .exec (" echo -e '" .. YELLOW .. " To set the environment variables, you can run the following command:" .. NC .. " '" )
266275 os .exec (" echo -e '" .. YELLOW .. " export INFINI_ROOT=" .. infini_dir .. NC .. " '" )
0 commit comments