From 74a52b6bb92849bbf9abb8fb99ea65be62945432 Mon Sep 17 00:00:00 2001 From: PanZezhong Date: Wed, 4 Dec 2024 11:34:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9xmake=20build=E5=92=8C?= =?UTF-8?q?install=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- xmake.lua | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/xmake.lua b/xmake.lua index ab83c077..4d83b2b4 100644 --- a/xmake.lua +++ b/xmake.lua @@ -239,15 +239,20 @@ target("infiniop") -- Output messages with colors os.exec("echo -e '" .. GREEN .. "Compilation completed successfully." .. NC .. "'") - os.exec("echo -e '" .. YELLOW .. "Install the libraries with \"xmake install\" or set INFINI_ROOT=" .. current_dir .. NC .. "'") + os.exec("echo -e '" .. YELLOW .. "You can install the libraries with \"xmake install\"" .. NC .. "'") end) - on_install(function (target) - local home_dir = os.getenv("HOME") - local infini_dir = home_dir .. "/.infini/" + on_install(function (target) + print("Installing libraries...") + if os.getenv("INFINI_ROOT") == nil then + print(YELLOW .. "INFINI_ROOT not set, installation path default to ~/.infini".. NC) + print(YELLOW .. "It is recommended to set INFINI_ROOT as an environment variable." .. NC) + os.setenv("INFINI_ROOT", os.getenv("HOME") .. "/.infini") + end + local infini_dir = os.getenv("INFINI_ROOT") if os.isdir(infini_dir) then - print("~/.infini/ detected, duplicated contents will be overwritten.") + print("INFINI_ROOT already exists, duplicated contents will be overwritten.") else os.mkdir(infini_dir) end @@ -256,10 +261,10 @@ target("infiniop") local GREEN = '\27[0;32m' local YELLOW = '\27[1;33m' local NC = '\27[0m' -- No Color - os.exec("echo -e '" .. GREEN .. "Installation completed successfully at ~/.infini/." .. NC .. "'") - os.exec("echo -e '" .. YELLOW .. "To set the environment variables, please run the following command:" .. NC .. "'") - os.exec("echo -e '" .. YELLOW .. "echo \"export INFINI_ROOT=~/.infini/\" >> ~/.bashrc" .. NC .. "'") - os.exec("echo -e '" .. YELLOW .. "echo \"export LD_LIBRARY_PATH=:~/.infini/lib:$LD_LIBRARY_PATH\" >> ~/.bashrc" .. NC .. "'") + os.exec("echo -e '" .. GREEN .. "Installation completed successfully at " .. infini_dir .. NC .. "'") + os.exec("echo -e '" .. YELLOW .. "To set the environment variables, you can run the following command:" .. NC .. "'") + os.exec("echo -e '" .. YELLOW .. "export INFINI_ROOT=" .. infini_dir .. NC .. "'") + os.exec("echo -e '" .. YELLOW .. "export LD_LIBRARY_PATH=:$INFINI_ROOT/lib:$LD_LIBRARY_PATH" .. NC .. "'") end) target_end()