diff --git a/command/scripts/lcompile.sh b/command/scripts/lcompile.sh old mode 100644 new mode 100755 index b530bcd..bb146aa --- a/command/scripts/lcompile.sh +++ b/command/scripts/lcompile.sh @@ -1,23 +1,23 @@ -#!/bin/bash -currentDirectory=$(pwd) -cmakeListsPath="${currentDirectory}/CMakeLists.txt" - -if [ ! -f "$cmakeListsPath" ]; then - echo "No CMakeLists.txt in current directory, please check." - exit 1 -fi - -echo "Start generating and compiling..." - -buildFolderPath="./build" - -if [ ! -d "$buildFolderPath" ]; then - mkdir -p "$buildFolderPath" - echo "build folder created." -fi - -cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ -S . -B ./build/ - -if [ $? -eq 0 ]; then - cmake --build ./build/ --config DEBUG -fi +#!/bin/bash +currentDirectory=$(pwd) +cmakeListsPath="${currentDirectory}/CMakeLists.txt" + +if [ ! -f "$cmakeListsPath" ]; then + echo "No CMakeLists.txt in current directory, please check." + exit 1 +fi + +echo "Start generating and compiling..." + +buildFolderPath="./build" + +if [ ! -d "$buildFolderPath" ]; then + mkdir -p "$buildFolderPath" + echo "build folder created." +fi + +cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ -S . -B ./build/ + +if [ $? -eq 0 ]; then + cmake --build ./build/ --config DEBUG +fi diff --git a/command/scripts/llaunch.sh b/command/scripts/llaunch.sh old mode 100644 new mode 100755 index 49e549a..4518c0b --- a/command/scripts/llaunch.sh +++ b/command/scripts/llaunch.sh @@ -1,45 +1,45 @@ -#!/bin/bash -currentDirectory=$(pwd) -cmakeListsPath="${currentDirectory}/CMakeLists.txt" - -if [ ! -f "$cmakeListsPath" ]; then - echo "No CMakeLists.txt in current directory, please check." - exit 1 -fi - -echo "Start generating and compiling..." - -buildFolderPath="./build" - -if [ ! -d "$buildFolderPath" ]; then - mkdir -p "$buildFolderPath" - echo "build folder created." -fi - -cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ -S . -B ./build/ - -if [ $? -eq 0 ]; then - cmake --build ./build/ --config DEBUG - if [ $? -eq 0 ]; then - content=$(<"./CMakeLists.txt") - exePath="" - while IFS= read -r line; do - if [[ $line == "set(MY_EXECUTABLE_NAME"* ]]; then - pattern="\"([^\"]+)\"" - if [[ $line =~ $pattern ]]; then - contentInParentheses="${BASH_REMATCH[1]}" - result=($contentInParentheses) - exePath="./build/bin/${result[0]}" - echo "start running as follows..." - echo "==================================================" - fi - fi - done <<<"$content" - # execute the binary file - if [ -n "$exePath" ]; then - $exePath - else - echo "cannot find executable file path" - fi - fi -fi +#!/bin/bash +currentDirectory=$(pwd) +cmakeListsPath="${currentDirectory}/CMakeLists.txt" + +if [ ! -f "$cmakeListsPath" ]; then + echo "No CMakeLists.txt in current directory, please check." + exit 1 +fi + +echo "Start generating and compiling..." + +buildFolderPath="./build" + +if [ ! -d "$buildFolderPath" ]; then + mkdir -p "$buildFolderPath" + echo "build folder created." +fi + +cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ -S . -B ./build/ + +if [ $? -eq 0 ]; then + cmake --build ./build/ --config DEBUG + if [ $? -eq 0 ]; then + content=$(<"./CMakeLists.txt") + exePath="" + while IFS= read -r line; do + if [[ $line == "set(MY_EXECUTABLE_NAME"* ]]; then + pattern="\"([^\"]+)\"" + if [[ $line =~ $pattern ]]; then + contentInParentheses="${BASH_REMATCH[1]}" + result=($contentInParentheses) + exePath="./build/bin/${result[0]}" + echo "start running as follows..." + echo "==================================================" + fi + fi + done <<<"$content" + # execute the binary file + if [ -n "$exePath" ]; then + $exePath + else + echo "cannot find executable file path" + fi + fi +fi diff --git a/command/scripts/lrun.sh b/command/scripts/lrun.sh old mode 100644 new mode 100755 index 8dec0c3..0c6264e --- a/command/scripts/lrun.sh +++ b/command/scripts/lrun.sh @@ -1,18 +1,18 @@ -content=$(<"./CMakeLists.txt") -exePath="" -while IFS= read -r line; do - if [[ $line == "set(MY_EXECUTABLE_NAME"* ]]; then - pattern="\"([^\"]+)\"" - if [[ $line =~ $pattern ]]; then - contentInParentheses="${BASH_REMATCH[1]}" - result=($contentInParentheses) - exePath="./build/bin/${result[0]}" - fi - fi -done <<<"$content" - -if [ -n "$exePath" ]; then - $exePath -else - echo "cannot find executable file path" -fi +content=$(<"./CMakeLists.txt") +exePath="" +while IFS= read -r line; do + if [[ $line == "set(MY_EXECUTABLE_NAME"* ]]; then + pattern="\"([^\"]+)\"" + if [[ $line =~ $pattern ]]; then + contentInParentheses="${BASH_REMATCH[1]}" + result=($contentInParentheses) + exePath="./build/bin/${result[0]}" + fi + fi +done <<<"$content" + +if [ -n "$exePath" ]; then + $exePath +else + echo "cannot find executable file path" +fi diff --git a/scripts/lcompile.sh b/scripts/lcompile.sh old mode 100644 new mode 100755 index b530bcd..bb146aa --- a/scripts/lcompile.sh +++ b/scripts/lcompile.sh @@ -1,23 +1,23 @@ -#!/bin/bash -currentDirectory=$(pwd) -cmakeListsPath="${currentDirectory}/CMakeLists.txt" - -if [ ! -f "$cmakeListsPath" ]; then - echo "No CMakeLists.txt in current directory, please check." - exit 1 -fi - -echo "Start generating and compiling..." - -buildFolderPath="./build" - -if [ ! -d "$buildFolderPath" ]; then - mkdir -p "$buildFolderPath" - echo "build folder created." -fi - -cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ -S . -B ./build/ - -if [ $? -eq 0 ]; then - cmake --build ./build/ --config DEBUG -fi +#!/bin/bash +currentDirectory=$(pwd) +cmakeListsPath="${currentDirectory}/CMakeLists.txt" + +if [ ! -f "$cmakeListsPath" ]; then + echo "No CMakeLists.txt in current directory, please check." + exit 1 +fi + +echo "Start generating and compiling..." + +buildFolderPath="./build" + +if [ ! -d "$buildFolderPath" ]; then + mkdir -p "$buildFolderPath" + echo "build folder created." +fi + +cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ -S . -B ./build/ + +if [ $? -eq 0 ]; then + cmake --build ./build/ --config DEBUG +fi diff --git a/scripts/llaunch.sh b/scripts/llaunch.sh old mode 100644 new mode 100755 index 49e549a..4518c0b --- a/scripts/llaunch.sh +++ b/scripts/llaunch.sh @@ -1,45 +1,45 @@ -#!/bin/bash -currentDirectory=$(pwd) -cmakeListsPath="${currentDirectory}/CMakeLists.txt" - -if [ ! -f "$cmakeListsPath" ]; then - echo "No CMakeLists.txt in current directory, please check." - exit 1 -fi - -echo "Start generating and compiling..." - -buildFolderPath="./build" - -if [ ! -d "$buildFolderPath" ]; then - mkdir -p "$buildFolderPath" - echo "build folder created." -fi - -cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ -S . -B ./build/ - -if [ $? -eq 0 ]; then - cmake --build ./build/ --config DEBUG - if [ $? -eq 0 ]; then - content=$(<"./CMakeLists.txt") - exePath="" - while IFS= read -r line; do - if [[ $line == "set(MY_EXECUTABLE_NAME"* ]]; then - pattern="\"([^\"]+)\"" - if [[ $line =~ $pattern ]]; then - contentInParentheses="${BASH_REMATCH[1]}" - result=($contentInParentheses) - exePath="./build/bin/${result[0]}" - echo "start running as follows..." - echo "==================================================" - fi - fi - done <<<"$content" - # execute the binary file - if [ -n "$exePath" ]; then - $exePath - else - echo "cannot find executable file path" - fi - fi -fi +#!/bin/bash +currentDirectory=$(pwd) +cmakeListsPath="${currentDirectory}/CMakeLists.txt" + +if [ ! -f "$cmakeListsPath" ]; then + echo "No CMakeLists.txt in current directory, please check." + exit 1 +fi + +echo "Start generating and compiling..." + +buildFolderPath="./build" + +if [ ! -d "$buildFolderPath" ]; then + mkdir -p "$buildFolderPath" + echo "build folder created." +fi + +cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ -S . -B ./build/ + +if [ $? -eq 0 ]; then + cmake --build ./build/ --config DEBUG + if [ $? -eq 0 ]; then + content=$(<"./CMakeLists.txt") + exePath="" + while IFS= read -r line; do + if [[ $line == "set(MY_EXECUTABLE_NAME"* ]]; then + pattern="\"([^\"]+)\"" + if [[ $line =~ $pattern ]]; then + contentInParentheses="${BASH_REMATCH[1]}" + result=($contentInParentheses) + exePath="./build/bin/${result[0]}" + echo "start running as follows..." + echo "==================================================" + fi + fi + done <<<"$content" + # execute the binary file + if [ -n "$exePath" ]; then + $exePath + else + echo "cannot find executable file path" + fi + fi +fi diff --git a/scripts/lrun.sh b/scripts/lrun.sh old mode 100644 new mode 100755 index 8dec0c3..0c6264e --- a/scripts/lrun.sh +++ b/scripts/lrun.sh @@ -1,18 +1,18 @@ -content=$(<"./CMakeLists.txt") -exePath="" -while IFS= read -r line; do - if [[ $line == "set(MY_EXECUTABLE_NAME"* ]]; then - pattern="\"([^\"]+)\"" - if [[ $line =~ $pattern ]]; then - contentInParentheses="${BASH_REMATCH[1]}" - result=($contentInParentheses) - exePath="./build/bin/${result[0]}" - fi - fi -done <<<"$content" - -if [ -n "$exePath" ]; then - $exePath -else - echo "cannot find executable file path" -fi +content=$(<"./CMakeLists.txt") +exePath="" +while IFS= read -r line; do + if [[ $line == "set(MY_EXECUTABLE_NAME"* ]]; then + pattern="\"([^\"]+)\"" + if [[ $line =~ $pattern ]]; then + contentInParentheses="${BASH_REMATCH[1]}" + result=($contentInParentheses) + exePath="./build/bin/${result[0]}" + fi + fi +done <<<"$content" + +if [ -n "$exePath" ]; then + $exePath +else + echo "cannot find executable file path" +fi