由于github环境不稳定,建立该仓库直接存储代码环境的源码,提供快速下载。

LiuZe 73b6a436cb 添加protobuf3.17版本源码及opencv源码 1 year ago
ceres-solver 3b51f35e80 base commit 1 year ago
cmake 3b51f35e80 base commit 1 year ago
gflags 3b51f35e80 base commit 1 year ago
glog 3b51f35e80 base commit 1 year ago
googletest 3b51f35e80 base commit 1 year ago
gtsam-4.1.1 3b51f35e80 base commit 1 year ago
nanomsg 3b51f35e80 base commit 1 year ago
nanomsgxx 3b51f35e80 base commit 1 year ago
opencv-4.8.0 73b6a436cb 添加protobuf3.17版本源码及opencv源码 1 year ago
paho 3b51f35e80 base commit 1 year ago
protobuf 3b51f35e80 base commit 1 year ago
protobuf-3.17.0 73b6a436cb 添加protobuf3.17版本源码及opencv源码 1 year ago
rabbitmq-c 3b51f35e80 base commit 1 year ago
snap7-full-1.4.2 3b51f35e80 base commit 1 year ago
yaml-cpp 3b51f35e80 base commit 1 year ago
.gitignore 3b51f35e80 base commit 1 year ago
README.md 3b51f35e80 base commit 1 year ago
config.txt 3b51f35e80 base commit 1 year ago
install.sh 3b51f35e80 base commit 1 year ago
ltmain.sh 3b51f35e80 base commit 1 year ago
test.sh 3b51f35e80 base commit 1 year ago

README.md

​ 由于github环境不稳定,建立该仓库直接存储代码环境的源码,提供快速下载。

一、工程规范

  • 每个源码必须保证可以正常编译通过,如果源码开源方有部分代码出现问题,请修改后上传。
  • 每个源码目录下提供相应的安装说明和一般情况下的自动安装脚本。

二、bash脚本函数功能提供

1、git 克隆代码,指定源码网站和下载目录,将代码克隆下来,会尝试三次。

# 克隆代码
function git_clone {
    local repo_url=$1
    local target_dir=$2
    local max_attempts=3

    echo "Cloning $repo_url to $target_dir..."

    # 初始化计数器
    attempt=1

    # 循环尝试克隆
    while [ $attempt -le $max_attempts ]; do
        # 如果目标目录存在,则删除它
        if [ -d "$target_dir" ]; then
            echo "Clone successful!"
            return
        fi

        # 克隆代码
        git clone "$repo_url" "$target_dir"

        # 检查克隆是否成功
        if [ $? -eq 0 ]; then
            echo "Clone successful!"
            # 如果克隆成功,则退出循环
            break
        else
            rm -rf "$target_dir"
            echo "Clone attempt $attempt failed."
            attempt=$((attempt+1))
            if [ $attempt -gt $max_attempts ]; then
                echo "Max attempts reached. Continue..."
            else
                echo "Retrying in 5 seconds..."
                sleep 5
            fi
        fi
    done
}

2、进入某个目录,如果目录不存在则新建并进入

function cd_dir {
    local dir_path=$1

    # 检查目录是否存在
    if [ ! -d "$dir_path" ]; then
        echo "Directory $dir_path does not exist. Creating..."
        mkdir -p "$dir_path"
    fi
    cd "$dir_path" || exit
}

3、软件检测,如果软件没有安装就通过apt安装

# 安装包检测
function check_and_install {
    for package_name in "$@"
    do
        if ! command -v $package_name &> /dev/null
        then
            echo "$package_name not found. Installing..."
            sudo apt-get update
            sudo apt-get install $package_name -y
        else
            echo "$package_name already installed."
        fi
    done
}