Skip to content

Commit 765cc56

Browse files
Merge pull request #125 from PanZezhong1725/xmake_fix
fix: 修改xmake build和install的提示信息
2 parents eb3546b + 74a52b6 commit 765cc56

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

xmake.lua

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

265270
target_end()

0 commit comments

Comments
 (0)