@@ -239,15 +239,20 @@ target("infiniop")
239239
240240 -- Output messages with colors
241241 os .exec (" echo -e '" .. GREEN .. " Compilation completed successfully." .. NC .. " '" )
242- os .exec (" echo -e '" .. YELLOW .. " Install the libraries with \" xmake install\" or set INFINI_ROOT= " .. current_dir .. NC .. " '" )
242+ os .exec (" echo -e '" .. YELLOW .. " You can install the libraries with \" xmake install\" " .. NC .. " '" )
243243 end )
244244
245- on_install (function (target )
246- local home_dir = os.getenv (" HOME" )
247- local infini_dir = home_dir .. " /.infini/"
245+ on_install (function (target )
246+ print (" Installing libraries..." )
247+ if os.getenv (" INFINI_ROOT" ) == nil then
248+ print (YELLOW .. " INFINI_ROOT not set, installation path default to ~/.infini" .. NC )
249+ print (YELLOW .. " It is recommended to set INFINI_ROOT as an environment variable." .. NC )
250+ os .setenv (" INFINI_ROOT" , os.getenv (" HOME" ) .. " /.infini" )
251+ end
252+ local infini_dir = os.getenv (" INFINI_ROOT" )
248253
249254 if os.isdir (infini_dir ) then
250- print (" ~/.infini/ detected , duplicated contents will be overwritten." )
255+ print (" INFINI_ROOT already exists , duplicated contents will be overwritten." )
251256 else
252257 os .mkdir (infini_dir )
253258 end
@@ -256,10 +261,10 @@ target("infiniop")
256261 local GREEN = ' \27 [0;32m'
257262 local YELLOW = ' \27 [1;33m'
258263 local NC = ' \27 [0m' -- No Color
259- os .exec (" echo -e '" .. GREEN .. " Installation completed successfully at ~/.infini/. " .. NC .. " '" )
260- os .exec (" echo -e '" .. YELLOW .. " To set the environment variables, please run the following command:" .. NC .. " '" )
261- os .exec (" echo -e '" .. YELLOW .. " echo \" export INFINI_ROOT=~/.infini/ \" >> ~/.bashrc " .. NC .. " '" )
262- os .exec (" echo -e '" .. YELLOW .. " echo \" export LD_LIBRARY_PATH=:~/.infini/ lib:$LD_LIBRARY_PATH\" >> ~/.bashrc " .. NC .. " '" )
264+ os .exec (" echo -e '" .. GREEN .. " Installation completed successfully at " .. infini_dir .. NC .. " '" )
265+ os .exec (" echo -e '" .. YELLOW .. " To set the environment variables, you can run the following command:" .. NC .. " '" )
266+ os .exec (" echo -e '" .. YELLOW .. " export INFINI_ROOT=" .. infini_dir .. NC .. " '" )
267+ os .exec (" echo -e '" .. YELLOW .. " export LD_LIBRARY_PATH=:$INFINI_ROOT/ lib:$LD_LIBRARY_PATH" .. NC .. " '" )
263268 end )
264269
265270target_end ()
0 commit comments