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

相关文章

python中的flask_sqlalchemy的使用及示例详解

《python中的flask_sqlalchemy的使用及示例详解》文章主要介绍了在使用SQLAlchemy创建模型实例时,通过元类动态创建实例的方式,并说明了如何在实例化时执行__init__方法,... 目录@orm.reconstructorSQLAlchemy的回滚关联其他模型数据库基本操作将数据添

Spring配置扩展之JavaConfig的使用小结

《Spring配置扩展之JavaConfig的使用小结》JavaConfig是Spring框架中基于纯Java代码的配置方式,用于替代传统的XML配置,通过注解(如@Bean)定义Spring容器的组... 目录JavaConfig 的概念什么是JavaConfig?为什么使用 JavaConfig?Jav

Java使用Spire.Doc for Java实现Word自动化插入图片

《Java使用Spire.DocforJava实现Word自动化插入图片》在日常工作中,Word文档是不可或缺的工具,而图片作为信息传达的重要载体,其在文档中的插入与布局显得尤为关键,下面我们就来... 目录1. Spire.Doc for Java库介绍与安装2. 使用特定的环绕方式插入图片3. 在指定位

Springboot3 ResponseEntity 完全使用案例

《Springboot3ResponseEntity完全使用案例》ResponseEntity是SpringBoot中控制HTTP响应的核心工具——它能让你精准定义响应状态码、响应头、响应体,相比... 目录Spring Boot 3 ResponseEntity 完全使用教程前置准备1. 项目基础依赖(M

Java使用Spire.Barcode for Java实现条形码生成与识别

《Java使用Spire.BarcodeforJava实现条形码生成与识别》在现代商业和技术领域,条形码无处不在,本教程将引导您深入了解如何在您的Java项目中利用Spire.Barcodefor... 目录1. Spire.Barcode for Java 简介与环境配置2. 使用 Spire.Barco

Android使用java实现网络连通性检查详解

《Android使用java实现网络连通性检查详解》这篇文章主要为大家详细介绍了Android使用java实现网络连通性检查的相关知识,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录NetCheck.Java(可直接拷贝)使用示例(Activity/Fragment 内)权限要求

C# 预处理指令(# 指令)的具体使用

《C#预处理指令(#指令)的具体使用》本文主要介绍了C#预处理指令(#指令)的具体使用,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学... 目录1、预处理指令的本质2、条件编译指令2.1 #define 和 #undef2.2 #if, #el

C#中Trace.Assert的使用小结

《C#中Trace.Assert的使用小结》Trace.Assert是.NET中的运行时断言检查工具,用于验证代码中的关键条件,下面就来详细的介绍一下Trace.Assert的使用,具有一定的参考价值... 目录1、 什么是 Trace.Assert?1.1 最简单的比喻1.2 基本语法2、⚡ 工作原理3

C# IPAddress 和 IPEndPoint 类的使用小结

《C#IPAddress和IPEndPoint类的使用小结》本文主要介绍了C#IPAddress和IPEndPoint类的使用小结,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定... 目录一、核心作用网络编程基础类二、IPAddress 类详解三种初始化方式1. byte 数组初始化2. l

C语言逗号运算符和逗号表达式的使用小结

《C语言逗号运算符和逗号表达式的使用小结》本文详细介绍了C语言中的逗号运算符和逗号表达式,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习... 在C语言中逗号“,”也是一种运算符,称为逗号运算符。 其功能是把两个表达式连接其一般形式为:表达