build(mk): added auto cmake detect
This commit is contained in:
82
mk
82
mk
@@ -122,7 +122,7 @@ if ! command -v meson &> /dev/null; then
|
||||
# Check if the user would like to try to install meson by getting input
|
||||
installMeson=0
|
||||
while true; do
|
||||
read -p "Would you like to try to install Meson? [y/n]: " yn
|
||||
read -p "${YELLOW}[Query] Would you like to try to install Meson? [y/n]: ${NC}" yn
|
||||
case $yn in
|
||||
[Yy]* ) installMeson=1; break;;
|
||||
[Nn]* ) break;;
|
||||
@@ -136,7 +136,7 @@ if ! command -v meson &> /dev/null; then
|
||||
log "${YELLOW}[Info] Please install pip and try again.${NC}"
|
||||
exit 1
|
||||
else
|
||||
log "${MAGENTA}[Success] pip is installed. Continuing...${NC}"
|
||||
log "${MAGENTA}[Succsess] pip is installed. Continuing...${NC}"
|
||||
fi
|
||||
|
||||
# check if python3 is installed
|
||||
@@ -146,7 +146,7 @@ if ! command -v meson &> /dev/null; then
|
||||
log "${YELLOW}[INFO] If you have python3 installed, please add it to your PATH.${NC}"
|
||||
exit 1
|
||||
else
|
||||
log "${MAGENTA}[Success] python3 is installed. Continuing...${NC}"
|
||||
log "${MAGENTA}[Succsess] python3 is installed. Continuing...${NC}"
|
||||
fi
|
||||
|
||||
# Check if the venv ~/.4DSSE_env exists
|
||||
@@ -154,7 +154,7 @@ if ! command -v meson &> /dev/null; then
|
||||
log "${BLUE}[Info] Creating virtual environment...${NC}"
|
||||
python3 -m venv "$HOME/.4DSSE_env"
|
||||
source "$HOME/.4DSSE_env/bin/activate"
|
||||
log "${GREEN}[Success] Virtual environment created.${NC}"
|
||||
log "${GREEN}[Succsess] Virtual environment created.${NC}"
|
||||
else
|
||||
log "${MAGENTA}[Succsess] Virtual environment already exists. Skipping...${NC}"
|
||||
fi
|
||||
@@ -169,14 +169,14 @@ if ! command -v meson &> /dev/null; then
|
||||
log "${YELLOW}[Info] Please manually install Meson and try again.${NC}"
|
||||
exit 1
|
||||
else
|
||||
log "${GREEN}[Success] Meson installed.${NC}"
|
||||
log "${GREEN}[Succsess] Meson installed.${NC}"
|
||||
fi
|
||||
else
|
||||
log "${YELLOW}[Info] Please install Meson and try again.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
log "${MAGENTA}[Success] Meson is installed. Continuing...${NC}"
|
||||
log "${MAGENTA}[Succsess] Meson is installed. Continuing...${NC}"
|
||||
fi
|
||||
|
||||
# --- Check if NINJA is installed ---
|
||||
@@ -187,7 +187,7 @@ if ! command -v ninja &> /dev/null; then
|
||||
# Check if the user would like to try to install ninja by getting input
|
||||
installNinja=0
|
||||
while true; do
|
||||
read -p "Would you like to try to install Ninja? [y/n]: " yn
|
||||
read -p "${YELLOW}[Query] Would you like to try to install Ninja? [y/n]: ${NC}" yn
|
||||
case $yn in
|
||||
[Yy]* ) installNinja=1; break;;
|
||||
[Nn]* ) break;;
|
||||
@@ -201,7 +201,7 @@ if ! command -v ninja &> /dev/null; then
|
||||
log "${YELLOW}[Info] Please install pip and try again.${NC}"
|
||||
exit 1
|
||||
else
|
||||
log "${MAGENTA}[Success] pip is installed. Continuing...${NC}"
|
||||
log "${MAGENTA}[Succsess] pip is installed. Continuing...${NC}"
|
||||
fi
|
||||
|
||||
# check if python3 is installed
|
||||
@@ -211,7 +211,7 @@ if ! command -v ninja &> /dev/null; then
|
||||
log "${YELLOW}[INFO] If you have python3 installed, please add it to your PATH.${NC}"
|
||||
exit 1
|
||||
else
|
||||
log "${MAGENTA}[Success] python3 is installed. Continuing...${NC}"
|
||||
log "${MAGENTA}[Succsess] python3 is installed. Continuing...${NC}"
|
||||
fi
|
||||
|
||||
# Check if the venv ~/.4DSSE_env exists
|
||||
@@ -219,7 +219,7 @@ if ! command -v ninja &> /dev/null; then
|
||||
log "${BLUE}[Info] Creating virtual environment...${NC}"
|
||||
python3 -m venv "$HOME/.4DSSE_env"
|
||||
source "$HOME/.4DSSE_env/bin/activate"
|
||||
log "${GREEN}[Success] Virtual environment created.${NC}"
|
||||
log "${GREEN}[Succsess] Virtual environment created.${NC}"
|
||||
else
|
||||
log "${MAGENTA}[Succsess] Virtual environment already exists. Skipping...${NC}"
|
||||
fi
|
||||
@@ -244,6 +244,68 @@ else
|
||||
log "${MAGENTA}[Success] Ninja is installed. Continuing...${NC}"
|
||||
fi
|
||||
|
||||
# --- Check if CMake is installed ---
|
||||
log "${BLUE}[Info] Checking if CMake is installed...${NC}"
|
||||
if ! command -v cmake &> /dev/null; then
|
||||
log "${RED}[Error] CMake is not installed. Exiting...${NC}"
|
||||
|
||||
# Check if the user would like to try to install cmake by getting input
|
||||
installCMake=0
|
||||
while true; do
|
||||
read -p "${YELLOW}[Query] Would you like to try to install CMake? [y/n]: ${NC}" yn
|
||||
case $yn in
|
||||
[Yy]* ) installCMake=1; break;;
|
||||
[Nn]* ) break;;
|
||||
* ) echo "Please answer yes or no.";;
|
||||
esac
|
||||
done
|
||||
if [[ $installCMake -eq 1 ]]; then
|
||||
# check if pip is installed
|
||||
if ! command -v pip &> /dev/null; then
|
||||
log "${RED}[Error] pip is not installed. Exiting...${NC}"
|
||||
log "${YELLOW}[Info] Please install pip and try again.${NC}"
|
||||
exit 1
|
||||
else
|
||||
log "${MAGENTA}[Succsess] pip is installed. Continuing...${NC}"
|
||||
fi
|
||||
|
||||
# check if python3 is installed
|
||||
if ! command -v python3 &> /dev/null; then
|
||||
log "${RED}[Error] python3 is not installed. Exiting...${NC}"
|
||||
log "${YELLOW}[Info] Please install python3 and try again.${NC}"
|
||||
log "${YELLOW}[INFO] If you have python3 installed, please add it to your PATH.${NC}"
|
||||
exit 1
|
||||
else
|
||||
log "${MAGENTA}[Succsess] python3 is installed. Continuing...${NC}"
|
||||
fi
|
||||
|
||||
# Check if the venv ~/.4DSSE_env exists
|
||||
if [[ ! -d "$HOME/.4DSSE_env" ]]; then
|
||||
log "${BLUE}[Info] Creating virtual environment...${NC}"
|
||||
python3 -m venv "$HOME/.4DSSE_env"
|
||||
source "$HOME/.4DSSE_env/bin/activate"
|
||||
log "${GREEN}[Succsess] Virtual environment created.${NC}"
|
||||
else
|
||||
log "${MAGENTA}[Succsess] Virtual environment already exists. Skipping...${NC}"
|
||||
fi
|
||||
|
||||
# install cmake
|
||||
log "${BLUE}[Info] Installing CMake...${NC}"
|
||||
pip install cmake
|
||||
|
||||
# confirm cmake is installed
|
||||
if ! command -v cmake &> /dev/null; then
|
||||
log "${RED}[Error] CMake did not install properly. Exiting...${NC}"
|
||||
log "${YELLOW}[Info] Please manually install CMake and try again.${NC}"
|
||||
exit 1
|
||||
else
|
||||
log "${GREEN}[Success] CMake installed.${NC}"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
log "${MAGENTA}[Success] CMake is installed. Continuing...${NC}"
|
||||
fi
|
||||
|
||||
# --- Build 4DSSE ---
|
||||
log "${BLUE}[Info] Building 4DSSE...${NC}"
|
||||
if [[ $userFlag -eq 1 ]]; then
|
||||
|
||||
Reference in New Issue
Block a user