3D进阶之CloudCompare:使用脚本添加git子项目依赖(.gitmodules)并用VS2019编译

本文主要是介绍3D进阶之CloudCompare:使用脚本添加git子项目依赖(.gitmodules)并用VS2019编译,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

(一)如何添加子依赖项目

从github上下载下来的文件,例如,

https://github.com/CloudCompare/CloudCompare/archive/refs/tags/v2.12.0.tar.gz

里面明明是有一个在.gitmodules文件的,内容如下,

[submodule "plugins/core/IO/qE57IO/extern/libE57Format"]path = plugins/core/IO/qE57IO/extern/libE57Formaturl = https://github.com/asmaloney/libE57Format
[submodule "extern/CCCoreLib"]path = libs/qCC_db/extern/CCCoreLiburl = https://github.com/CloudCompare/CCCoreLib
[submodule "plugins/core/Standard/qPoissonRecon/extern/PoissonRecon"]path = plugins/core/Standard/qPoissonRecon/extern/PoissonReconurl = https://github.com/cloudcompare/PoissonRecon
[submodule "plugins/core/Standard/qMPlane"]path = plugins/core/Standard/qMPlaneurl = https://github.com/hvs-ait/mplane-plugin
[submodule "plugins/core/Standard/qColorimetricSegmenter"]path = plugins/core/Standard/qColorimetricSegmenterurl = https://gitlab.univ-nantes.fr/E164955Z/ptrans
[submodule "plugins/core/Standard/qMasonry"]path = plugins/core/Standard/qMasonryurl = https://github.com/CyberbuildLab/masonry-cc
[submodule "plugins/core/Standard/qJSonRPCPlugin"]path = plugins/core/Standard/qJSonRPCPluginurl = https://gitlab.com/theadib/JSonRPCPlugin.git
[submodule "plugins/core/Standard/qCanupo/contrib/dlib"]path = plugins/core/Standard/qCanupo/contrib/dliburl = https://github.com/davisking/dlib.git

可是,当你希望通过下面的指令克隆这些子项目依赖项时,会发现根本就没有反应【1】。

办法(1)当然你可以手动一个个去添加,不过这会非常麻烦。

办法(2)使用分支,

> git clone -b v2.12.0 --recursive https://github.com/CloudCompare/CloudCompare.git CC2120b

这里命名CC2120b是拷贝下来后重新命名的文件夹名称。

但这有个问题,有些项目是没有子分支的,或者,某些项目已经被删除了,git命令没办法找到github上的origin项目。

办法(3)使用脚本(具体可参考资料【1】)

假设你的项目解压后在CC2120b文件夹内,那就在这个文件夹内建一个脚本script.sh,然后在git bash中运行这些脚本就好了(使用命令:sh  script.sh),

如果需要逐个克隆并回复y:

#!/bin/bashset -e
rm -rf .git
git initgit config -f .gitmodules --get-regexp '^submodule\..*\.path$' > tempfilewhile read -u 3 path_key path
dourl_key=$(echo $path_key | sed 's/\.path/.url/')url=$(git config -f .gitmodules --get "$url_key")read -p "Are you sure you want to delete $path and re-initialize as a new submodule? " yncase $yn in[Yy]* ) rm -rf $path; git submodule add $url $path; echo "$path has been initialized";;[Nn]* ) exit;;* ) echo "Please answer yes or no.";;esacdone 3<tempfilerm tempfile

如果想一次性更新,就使用下面的脚本

#!/bin/shset -egit config -f .gitmodules --get-regexp '^submodule\..*\.path$' |while read path_key pathdoname=$(echo $path_key | sed 's/\submodule\.\(.*\)\.path/\1/')url_key=$(echo $path_key | sed 's/\.path/.url/')branch_key=$(echo $path_key | sed 's/\.path/.branch/')url=$(git config -f .gitmodules --get "$url_key")branch=$(git config -f .gitmodules --get "$branch_key" || echo "master")git submodule add -b $branch --name $name $url $path || continuedone

(二)编译cloudcompare

 不得不说cloudcompare在编译方面做得非常棒,我按默认的配置(如下图所示)整个过程中没有碰到任何错误,一气编译完成后,就可以愉快地使用cloudcompare了。

本文结束

参考资料:

【1】Restore git submodules from .gitmodules - Stack Overflow

这篇关于3D进阶之CloudCompare:使用脚本添加git子项目依赖(.gitmodules)并用VS2019编译的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/813432

相关文章

使用Dify访问mysql数据库详细代码示例

《使用Dify访问mysql数据库详细代码示例》:本文主要介绍使用Dify访问mysql数据库的相关资料,并详细讲解了如何在本地搭建数据库访问服务,使用ngrok暴露到公网,并创建知识库、数据库访... 1、在本地搭建数据库访问的服务,并使用ngrok暴露到公网。#sql_tools.pyfrom

使用mvn deploy命令上传jar包的实现

《使用mvndeploy命令上传jar包的实现》本文介绍了使用mvndeploy:deploy-file命令将本地仓库中的JAR包重新发布到Maven私服,文中通过示例代码介绍的非常详细,对大家的学... 目录一、背景二、环境三、配置nexus上传账号四、执行deploy命令上传包1. 首先需要把本地仓中要

Java进阶学习之如何开启远程调式

《Java进阶学习之如何开启远程调式》Java开发中的远程调试是一项至关重要的技能,特别是在处理生产环境的问题或者协作开发时,:本文主要介绍Java进阶学习之如何开启远程调式的相关资料,需要的朋友... 目录概述Java远程调试的开启与底层原理开启Java远程调试底层原理JVM参数总结&nbsMbKKXJx

Spring Cloud之注册中心Nacos的使用详解

《SpringCloud之注册中心Nacos的使用详解》本文介绍SpringCloudAlibaba中的Nacos组件,对比了Nacos与Eureka的区别,展示了如何在项目中引入SpringClo... 目录Naacos服务注册/服务发现引⼊Spring Cloud Alibaba依赖引入Naco编程s依

Java springBoot初步使用websocket的代码示例

《JavaspringBoot初步使用websocket的代码示例》:本文主要介绍JavaspringBoot初步使用websocket的相关资料,WebSocket是一种实现实时双向通信的协... 目录一、什么是websocket二、依赖坐标地址1.springBoot父级依赖2.springBoot依赖

Java使用Mail构建邮件功能的完整指南

《Java使用Mail构建邮件功能的完整指南》JavaMailAPI是一个功能强大的工具,它可以帮助开发者轻松实现邮件的发送与接收功能,本文将介绍如何使用JavaMail发送和接收邮件,希望对大家有所... 目录1、简述2、主要特点3、发送样例3.1 发送纯文本邮件3.2 发送 html 邮件3.3 发送带

使用DeepSeek搭建个人知识库(在笔记本电脑上)

《使用DeepSeek搭建个人知识库(在笔记本电脑上)》本文介绍了如何在笔记本电脑上使用DeepSeek和开源工具搭建个人知识库,通过安装DeepSeek和RAGFlow,并使用CherryStudi... 目录部署环境软件清单安装DeepSeek安装Cherry Studio安装RAGFlow设置知识库总

Python FastAPI入门安装使用

《PythonFastAPI入门安装使用》FastAPI是一个现代、快速的PythonWeb框架,用于构建API,它基于Python3.6+的类型提示特性,使得代码更加简洁且易于绶护,这篇文章主要介... 目录第一节:FastAPI入门一、FastAPI框架介绍什么是ASGI服务(WSGI)二、FastAP

Spring-AOP-ProceedingJoinPoint的使用详解

《Spring-AOP-ProceedingJoinPoint的使用详解》:本文主要介绍Spring-AOP-ProceedingJoinPoint的使用方式,具有很好的参考价值,希望对大家有所帮... 目录ProceedingJoinPoijsnt简介获取环绕通知方法的相关信息1.proceed()2.g

Maven pom.xml文件中build,plugin标签的使用小结

《Mavenpom.xml文件中build,plugin标签的使用小结》本文主要介绍了Mavenpom.xml文件中build,plugin标签的使用小结,文中通过示例代码介绍的非常详细,对大家的学... 目录<build> 标签Plugins插件<build> 标签<build> 标签是 pom.XML