前端技术
HTML
CSS
Javascript
前端框架和UI库
VUE
ReactJS
AngularJS
JQuery
NodeJS
JSON
Element-UI
Bootstrap
Material UI
服务端和客户端
Java
Python
PHP
Golang
Scala
Kotlin
Groovy
Ruby
Lua
.net
c#
c++
后端WEB和工程框架
SpringBoot
SpringCloud
Struts2
MyBatis
Hibernate
Tornado
Beego
Go-Spring
Go Gin
Go Iris
Dubbo
HessianRPC
Maven
Gradle
数据库
MySQL
Oracle
Mongo
中间件与web容器
Redis
MemCache
Etcd
Cassandra
Kafka
RabbitMQ
RocketMQ
ActiveMQ
Nacos
Consul
Tomcat
Nginx
Netty
大数据技术
Hive
Impala
ClickHouse
DorisDB
Greenplum
PostgreSQL
HBase
Kylin
Hadoop
Apache Pig
ZooKeeper
SeaTunnel
Sqoop
Datax
Flink
Spark
Mahout
数据搜索与日志
ElasticSearch
Apache Lucene
Apache Solr
Kibana
Logstash
数据可视化与OLAP
Apache Atlas
Superset
Saiku
Tesseract
系统与容器
Linux
Shell
Docker
Kubernetes
[CMake]的搜索结果
这里是文章列表。热门标签的颜色随机变换,标签颜色没有特殊含义。
点击某个标签可搜索标签相关的文章。
点击某个标签可搜索标签相关的文章。
转载文章
...ckf_vio --cmake-args -DCMAKE_BUILD_TYPE=Release激活环境变量很关键source /devel/setup.bashroslaunch msckf_vio msckf_vio_euroc.launch注意文件路径rosrun rviz rviz -d rviz/rviz_euroc_config.rviz (改成你自己的rviz文件)rosbag play ~/data/euroc/MH_04_difficult.bag(改成你自己的rosbag文件) 可以看到,s_msckf的输出是没有轨迹的,可以增加如下脚本,将/odom存为/path,在rviz订阅即可可视化轨迹 脚本来自其issue:https://github.com/KumarRobotics/msckf_vio/issues/13 !/usr/bin/env pythonimport rospyfrom nav_msgs.msg import Odometry, Pathfrom geometry_msgs.msg import PoseStampedclass OdomToPath:def __init__(self):self.path_pub = rospy.Publisher('/slz_path', Path, latch=True, queue_size=10)self.odom_sub = rospy.Subscriber('/firefly_sbx/vio/odom', Odometry, self.odom_cb, queue_size=10)self.path = Path()def odom_cb(self, msg):cur_pose = PoseStamped()cur_pose.header = msg.headercur_pose.pose = msg.pose.poseself.path.header = msg.headerself.path.poses.append(cur_pose)self.path_pub.publish(self.path)if __name__ == '__main__':rospy.init_node('odom_to_path')odom_to_path = OdomToPath()rospy.spin() 或者增加一个draw_path的功能包: cpp为: include <stdio.h>include <stdlib.h>include <unistd.h>include <ros/ros.h>include <ros/console.h>include <nav_msgs/Path.h>include <std_msgs/String.h>include <nav_msgs/Odometry.h>include <geometry_msgs/Quaternion.h>include <geometry_msgs/PoseStamped.h>nav_msgs::Path path;ros::Publisher path_pub;ros::Subscriber odomSub;ros::Subscriber odom_raw_Sub;void odomCallback(const nav_msgs::Odometry::ConstPtr& odom){geometry_msgs::PoseStamped this_pose_stamped;this_pose_stamped.header= odom->header;this_pose_stamped.pose = odom->pose.pose;//this_pose_stamped.pose.position.x = odom->pose.pose.position.x;//this_pose_stamped.pose.position.y = odom->pose.pose.position.y;//this_pose_stamped.pose.orientation = odom->pose.pose.orientation;//this_pose_stamped.header.stamp = ros::Time::now();//this_pose_stamped.header.frame_id = "world";//frame_id 是消息中与数据相关联的参考系id,例如在在激光数据中,frame_id对应激光数据采集的参考系 path.header= this_pose_stamped.header;path.poses.push_back(this_pose_stamped);//path.header.stamp = ros::Time::now();//path.header.frame_id= "world";path_pub.publish(path);//printf("path_pub ");//printf("odom %.3lf %.3lf\n",odom->pose.pose.position.x,odom->pose.pose.position.y);}int main (int argc, char argv){ros::init (argc, argv, "showpath");ros::NodeHandle ph;path_pub = ph.advertise<nav_msgs::Path>("/trajectory",10, true);odomSub = ph.subscribe<nav_msgs::Odometry>("/firefly_sbx/vio/odom", 10, odomCallback);//ros::Rate loop_rate(50);while (ros::ok()){ros::spinOnce(); // check for incoming messages//loop_rate.sleep();}return 0;} cmakelists.txt cmake_minimum_required(VERSION 2.8.3)project(draw) Compile as C++11, supported in ROS Kinetic and newer add_compile_options(-std=c++11) Find catkin macros and libraries if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) is used, also find other catkin packagesfind_package(catkin REQUIRED COMPONENTSgeometry_msgsroscpprospystd_msgsmessage_generation)catkin_package( INCLUDE_DIRS include LIBRARIES learning_communicationCATKIN_DEPENDS geometry_msgs roscpp rospy std_msgs message_runtime DEPENDS system_lib) Build include_directories(include${catkin_INCLUDE_DIRS})add_executable(draw_path draw.cpp)target_link_libraries(draw_path ${catkin_LIBRARIES}) package.xml <?xml version="1.0"?><package><name>draw</name><version>0.0.0</version><description>The learning_communication package</description><!-- One maintainer tag required, multiple allowed, one person per tag --><!-- Example: --><!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> --><maintainer email="hcx@todo.todo">hcx</maintainer><!-- One license tag required, multiple allowed, one license per tag --><!-- Commonly used license strings: --><!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 --><license>TODO</license><!-- Url tags are optional, but multiple are allowed, one per tag --><!-- Optional attribute type can be: website, bugtracker, or repository --><!-- Example: --><!-- <url type="website">http://wiki.ros.org/learning_communication</url> --><!-- Author tags are optional, multiple are allowed, one per tag --><!-- Authors do not have to be maintainers, but could be --><!-- Example: --><!-- <author email="jane.doe@example.com">Jane Doe</author> --><!-- The _depend tags are used to specify dependencies --><!-- Dependencies can be catkin packages or system dependencies --><!-- Examples: --><!-- Use build_depend for packages you need at compile time: --><!-- <build_depend>message_generation</build_depend> --><!-- Use buildtool_depend for build tool packages: --><!-- <buildtool_depend>catkin</buildtool_depend> --><!-- Use run_depend for packages you need at runtime: --><!-- <run_depend>message_runtime</run_depend> --><!-- Use test_depend for packages you need only for testing: --><!-- <test_depend>gtest</test_depend> --><buildtool_depend>catkin</buildtool_depend><build_depend>geometry_msgs</build_depend><build_depend>roscpp</build_depend><build_depend>rospy</build_depend><build_depend>std_msgs</build_depend><run_depend>geometry_msgs</run_depend><run_depend>roscpp</run_depend><run_depend>rospy</run_depend><run_depend>std_msgs</run_depend><build_depend>message_generation</build_depend><run_depend>message_runtime</run_depend><!-- The export tag contains other, unspecified, tags --><export><!-- Other tools can request additional information be placed here --></export></package> vins_fusion: 双目vio等多系统 mkdir -p vins-catkin_ws/srccd vins-catkin_ws/srcgit clone https://github.com/HKUST-Aerial-Robotics/VINS-Fusion.gitcd ..catkin_makesource devel/setup.bash按照readme 3.1 Monocualr camera + IMUroslaunch vins vins_rviz.launchrosrun vins vins_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_mono_imu_config.yaml (optional) rosrun loop_fusion loop_fusion_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_mono_imu_config.yaml rosbag play YOUR_DATASET_FOLDER/MH_01_easy.bag 3.2 Stereo cameras + IMUroslaunch vins vins_rviz.launchrosrun vins vins_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_stereo_imu_config.yaml (optional) rosrun loop_fusion loop_fusion_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_stereo_imu_config.yaml rosbag play YOUR_DATASET_FOLDER/MH_01_easy.bag 3.3 Stereo camerasroslaunch vins vins_rviz.launchrosrun vins vins_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_stereo_config.yaml (optional) rosrun loop_fusion loop_fusion_node ~/catkin_ws/src/VINS-Fusion/config/euroc/euroc_stereo_config.yaml rosbag play YOUR_DATASET_FOLDER/MH_01_easy.bag<img src="https://github.com/HKUST-Aerial-Robotics/VINS-Fusion/blob/master/support_files/image/euroc.gif" width = 430 height = 240 /> 4. KITTI Example 4.1 KITTI Odometry (Stereo)Download [KITTI Odometry dataset](http://www.cvlibs.net/datasets/kitti/eval_odometry.php) to YOUR_DATASET_FOLDER. Take sequences 00 for example,Open two terminals, run vins and rviz respectively. (We evaluated odometry on KITTI benchmark without loop closure funtion)roslaunch vins vins_rviz.launch(optional) rosrun loop_fusion loop_fusion_node ~/catkin_ws/src/VINS-Fusion/config/kitti_odom/kitti_config00-02.yamlrosrun vins kitti_odom_test ~/catkin_ws/src/VINS-Fusion/config/kitti_odom/kitti_config00-02.yaml YOUR_DATASET_FOLDER/sequences/00/ 4.2 KITTI GPS Fusion (Stereo + GPS)Download [KITTI raw dataset](http://www.cvlibs.net/datasets/kitti/raw_data.php) to YOUR_DATASET_FOLDER. Take [2011_10_03_drive_0027_synced](https://s3.eu-central-1.amazonaws.com/avg-kitti/raw_data/2011_10_03_drive_0027/2011_10_03_drive_0027_sync.zip) for example.Open three terminals, run vins, global fusion and rviz respectively. Green path is VIO odometry; blue path is odometry under GPS global fusion.roslaunch vins vins_rviz.launchrosrun vins kitti_gps_test ~/catkin_ws/src/VINS-Fusion/config/kitti_raw/kitti_10_03_config.yaml YOUR_DATASET_FOLDER/2011_10_03_drive_0027_sync/ rosrun global_fusion global_fusion_node<img src="https://github.com/HKUST-Aerial-Robotics/VINS-Fusion/blob/master/support_files/image/kitti.gif" width = 430 height = 240 /> 5. VINS-Fusion on car demonstrationDownload [car bag](https://drive.google.com/open?id=10t9H1u8pMGDOI6Q2w2uezEq5Ib-Z8tLz) to YOUR_DATASET_FOLDER.Open four terminals, run vins odometry, visual loop closure(optional), rviz and play the bag file respectively. Green path is VIO odometry; red path is odometry under visual loop closure.roslaunch vins vins_rviz.launchrosrun vins vins_node ~/catkin_ws/src/VINS-Fusion/config/vi_car/vi_car.yaml (optional) rosrun loop_fusion loop_fusion_node ~/catkin_ws/src/VINS-Fusion/config/vi_car/vi_car.yaml rosbag play YOUR_DATASET_FOLDER/car.bag 本篇文章为转载内容。原文链接:https://blog.csdn.net/slzlincent/article/details/104364909。 该文由互联网用户投稿提供,文中观点代表作者本人意见,并不代表本站的立场。 作为信息平台,本站仅提供文章转载服务,并不拥有其所有权,也不对文章内容的真实性、准确性和合法性承担责任。 如发现本文存在侵权、违法、违规或事实不符的情况,请及时联系我们,我们将第一时间进行核实并删除相应内容。
2023-09-13 20:38:56
310
转载
转载文章
...ntial 安装cmakeapt-get install cmake 在tvm目录下创建build文件夹,并将cmake/config.cmake文件复制到此文件夹中: mkdir buildcp cmake/config.cmake build/ 编辑build/config.cmake进行相关配置: 本次是在cpu上进行测试,因此没有配置cudaset(USE_LLVM ON) line 136set(USE_RELAY_DEBUG ON) line 285(建议先 OFF) 在末尾添加一个cmake的编译宏,确保编译出来的是debug版本set(CMAKE_BUILD_TYPE Debug) 编译tvm,这里开启了16个线程: cd buildcmake ..make -j 16 建议开多个线程,否则编译速度很慢哦 大约5分钟,即可生成我们需要的两个共享链接库:libtvm.so 和 libtvm_runtime.so 1.4 验证安装是否成功 tvm版本验证: import tvmprint(tvm.__version__) pytorch模型验证: from_pytorch.py https://tvm.apache.org/docs/how_to/compile_models/from_pytorch.html ps: TVM supports PyTorch 1.7 and 1.4. Other versions may be unstable.import tvmfrom tvm import relayfrom tvm.contrib.download import download_testdataimport numpy as np PyTorch importsimport torchimport torchvision Load a pretrained PyTorch model -------------------------------model_name = "resnet18"model = getattr(torchvision.models, model_name)(pretrained=True) or model = torchvision.models.resnet18(pretrained=True) or pth_file = 'resnet18-f37072fd.pth' model = torchvision.models.resnet18() ckpt = torch.load(pth_file) model.load_state_dict(ckpt)model = model.eval() We grab the TorchScripted model via tracinginput_shape = [1, 3, 224, 224]input_data = torch.randn(input_shape)scripted_model = torch.jit.trace(model, input_data).eval() Load a test image ----------------- Classic cat example!from PIL import Image img_url = "https://github.com/dmlc/mxnet.js/blob/main/data/cat.png?raw=true" img_path = download_testdata(img_url, "cat.png", module="data")img_path = 'cat.png'img = Image.open(img_path).resize((224, 224)) Preprocess the image and convert to tensorfrom torchvision import transformsmy_preprocess = transforms.Compose([transforms.Resize(256),transforms.CenterCrop(224),transforms.ToTensor(),transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),])img = my_preprocess(img)img = np.expand_dims(img, 0) Import the graph to Relay ------------------------- Convert PyTorch graph to Relay graph. The input name can be arbitrary.input_name = "input0"shape_list = [(input_name, img.shape)]mod, params = relay.frontend.from_pytorch(scripted_model, shape_list) Relay Build ----------- Compile the graph to llvm target with given input specification.target = tvm.target.Target("llvm", host="llvm")dev = tvm.cpu(0)with tvm.transform.PassContext(opt_level=3):lib = relay.build(mod, target=target, params=params) Execute the portable graph on TVM --------------------------------- Now we can try deploying the compiled model on target.from tvm.contrib import graph_executordtype = "float32"m = graph_executor.GraphModule(lib["default"](dev)) Set inputsm.set_input(input_name, tvm.nd.array(img.astype(dtype))) Executem.run() Get outputstvm_output = m.get_output(0) Look up synset name ------------------- Look up prediction top 1 index in 1000 class synset. synset_url = "".join( [ "https://raw.githubusercontent.com/Cadene/", "pretrained-models.pytorch/master/data/", "imagenet_synsets.txt", ] ) synset_name = "imagenet_synsets.txt" synset_path = download_testdata(synset_url, synset_name, module="data") https://raw.githubusercontent.com/Cadene/pretrained-models.pytorch/master/data/imagenet_synsets.txtsynset_path = 'imagenet_synsets.txt'with open(synset_path) as f:synsets = f.readlines()synsets = [x.strip() for x in synsets]splits = [line.split(" ") for line in synsets]key_to_classname = {spl[0]: " ".join(spl[1:]) for spl in splits} class_url = "".join( [ "https://raw.githubusercontent.com/Cadene/", "pretrained-models.pytorch/master/data/", "imagenet_classes.txt", ] ) class_name = "imagenet_classes.txt" class_path = download_testdata(class_url, class_name, module="data") https://raw.githubusercontent.com/Cadene/pretrained-models.pytorch/master/data/imagenet_classes.txtclass_path = 'imagenet_classes.txt'with open(class_path) as f:class_id_to_key = f.readlines()class_id_to_key = [x.strip() for x in class_id_to_key] Get top-1 result for TVMtop1_tvm = np.argmax(tvm_output.numpy()[0])tvm_class_key = class_id_to_key[top1_tvm] Convert input to PyTorch variable and get PyTorch result for comparisonwith torch.no_grad():torch_img = torch.from_numpy(img)output = model(torch_img) Get top-1 result for PyTorchtop1_torch = np.argmax(output.numpy())torch_class_key = class_id_to_key[top1_torch]print("Relay top-1 id: {}, class name: {}".format(top1_tvm, key_to_classname[tvm_class_key]))print("Torch top-1 id: {}, class name: {}".format(top1_torch, key_to_classname[torch_class_key])) 2. 配置vscode 安装两个vscode远程连接所需的两个插件,具体如下图所示: 安装完成之后,在左侧工具栏会出现一个图标,点击图标进行ssh配置: ssh yourname@yourip -A 然后右键选择在当前窗口进行连接: 除此之外,还可以设置免费登录,具体可参考这篇文章。 当然,也可以使用windows本地的WSL2,vscode连接WSL还需要安装WSL和Dev Containers这两个插件。 在服务器端执行code .会自动安装vscode server,安装位置在用户的根目录下: 3. 安装FFI Navigator 由于TVM是由Python和C++混合开发,且大多数的IDE仅支持在同一种语言中查找函数定义,因此对于跨语言的FFI 调用,即Python跳转到C++或者C++跳转到Python,vscode是做不到的。虽然解决这个问题在技术上可能非常具有挑战性,但我们可以通过构建一个与FFI注册码模式匹配并恢复必要信息的项目特定分析器来解决这个问题,FFI Navigator就这样诞生了,作者仍然是陈天奇博士。 安装方式如下: 建议使用源码安装git clone https://github.com/tqchen/ffi-navigator.git 安装python依赖cd ffi-navigator/pythonpython setyp.py install vscode需要安装FFI Navigator插件,直接搜索安装即可(安装到服务器端)。 最后需要在.vscode/setting.json进行配置,内容如下: {"python.analysis.extraPaths": ["${workspaceFolder}/python"], // 添加额外导入路径, 告诉pylance自定义的python库在哪里"ffi_navigator.pythonpath": "/home/liyanpeng/anaconda3/envs/tvmenv/bin/python", // 配置FFI Navigator"python.defaultInterpreterPath": "/home/liyanpeng/anaconda3/envs/tvmenv/bin/python","files.associations": {"type_traits": "cpp","fstream": "cpp","thread": "cpp",".tcc": "cpp"} } 更详细内容可以参考项目链接。 结束语 对于vscode的使用技巧及C/C++相关的配置,这里不再详细的介绍了,感兴趣的小伙伴们可以了解下。 本篇文章为转载内容。原文链接:https://blog.csdn.net/qq_42730750/article/details/126723224。 该文由互联网用户投稿提供,文中观点代表作者本人意见,并不代表本站的立场。 作为信息平台,本站仅提供文章转载服务,并不拥有其所有权,也不对文章内容的真实性、准确性和合法性承担责任。 如发现本文存在侵权、违法、违规或事实不符的情况,请及时联系我们,我们将第一时间进行核实并删除相应内容。
2023-12-12 20:04:26
87
转载
c++
...问题,那就是如何使用CMake来构建我们的C++项目。经过一番深入探索,我发现搞定这个问题的秘诀就在于创建一个叫做CMakeLists.txt的配置文件。这个小玩意儿可重要了,就像解锁难题的金钥匙一样。但是,我对这个文件的作用还不太清楚。于是,我琢磨着得挤点时间,好好探究一下这个神神秘秘的文件,尤其是它到底有啥作用,怎么个用法,我可得摸透彻了。 二、什么是CMakeLists.txt? CMake是一个开源的跨平台自动化构建系统,它可以将C++和其他编程语言的源代码转换成各种不同的编译器和操作系统可以接受的形式。在这个环节里,我们得用一个叫CMakeLists.txt的神奇小文件,它相当于一份详细的说明书,告诉CMake这位幕后大厨应该如何料理咱们的源代码。 三、CMakeLists.txt的作用 那么,CMakeLists.txt到底起到了什么作用呢?我们可以从以下几个方面来了解: 1. 指定构建类型 通过在CMakeLists.txt文件中添加相应的指令,我们可以指定我们的项目是静态链接还是动态链接,是否需要生成库,等等。例如,如果我们想要生成一个静态库,可以在CMakeLists.txt文件中添加以下指令: set(CMAKE_BUILD_TYPE Release) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) file(GLOB_RECURSE SOURCES ".cpp") add_library(mylib STATIC ${SOURCES}) 以上代码会将所有的.cpp文件编译成一个静态库,并将其命名为mylib.a。 2. 指定编译选项 我们还可以通过CMakeLists.txt文件来指定编译选项,如优化级别、警告级别等。例如,如果我们要开启编译器的所有警告,可以在CMakeLists.txt文件中添加以下指令: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") 以上代码会在编译C++代码时开启所有警告。 3. 定义依赖关系 除了上面提到的一些基本功能之外,CMakeLists.txt文件还可以用来定义项目的依赖关系。比方说,假设我们有个库叫A,而恰好有个库B对它特别依赖,就像大树离不开土壤一样。那么,为了让这两个库能够和谐共处,互相明白对方的需求,我们就可以在CMakeLists.txt这个“说明书”里,详细地写清楚它们之间的这种依赖关系,就像是画出一张谁也离不开谁的地图一样。具体做法如下: find_package(A REQUIRED) target_link_libraries(B PRIVATE A::A) 以上代码会查找名为A的库,并确保B的目标链接了该库。 四、总结 总的来说,CMakeLists.txt是一个非常强大的工具,它可以帮助我们更好地管理和构建C++项目。当你真正地钻透它,并且灵活玩转,就能让咱们的C++项目跑得更溜、更稳当、更靠谱。
2024-01-03 23:32:17
429
灵动之光_t
c++
...握一种强大的工具——CMake。这篇东西呢,咱主要会聊聊CMake都有哪些大招儿,特别是当我们把那个至关重要的CMakeList.txt配置文件捯饬妥当之后,它会在哪些环节里施展拳脚,咱们来重点掰扯掰扯。 二、什么是CMake? CMake是一种跨平台的自动化构建系统,它可以生成多个支持不同构建系统的项目文件,如Visual Studio解决方案文件、Xcode项目文件、Unix Makefiles等。它的最大亮点就是能够超级轻松地进行跨平台开发,这样一来,开发者无论在哪个操作系统上,都能轻轻松松构建和部署自己的项目,毫无压力,简直像在各个平台上自由穿梭一样便利。 三、CMakeList.txt的作用 CMakeList.txt是一个文本文件,其中包含了构建项目的指令。当我们动手运行cmake这个命令时,它就像个聪明的小助手,会认真读取咱们在CMakeList.txt文件里写的各种“小纸条”(也就是指令啦),然后根据这些“小纸条”的指示,自动生成对应的构建文件,这样一来,我们就可以更方便地搭建和构建项目了。所以呢,CMakeList.txt这个文件啊,它可是咱们项目里的顶梁柱,相当于一份详细的构建指南,决定了咱们整个项目该走怎样的构建路径。 四、CMakeList.txt在哪些阶段起作用? 首先,我们需要了解的是,当我们在本地开发时,通常会经历以下几个阶段: 1. 编码阶段 在这个阶段,我们编写我们的C++代码,完成我们的项目设计和实现。 2. 构建阶段 在这个阶段,我们需要使用一些工具来构建我们的项目,生成可执行文件或其他类型的输出文件。 3. 测试阶段 在这个阶段,我们需要对我们的项目进行全面的测试,确保其能够正常工作。 4. 发布阶段 在这个阶段,我们需要将我们的项目发布给用户,供他们下载和使用。 那么,在这些阶段中,CMakeList.txt分别会起到什么作用呢? 1. 编码阶段 在编码阶段,我们并不需要直接使用CMakeList.txt。在这个阶段,我们的主要任务是编写高质量的C++代码。嘿,你知道吗?CMakeList.txt这个小玩意儿可厉害了,它就像个项目经理,能帮我们把项目结构整得明明白白的。比如,它可以告诉我们哪些源代码文件之间是“你离不开我、我离不开你”的依赖关系,还能指导编译器用特定的方式去构建项目,真可谓咱们开发过程中的得力小助手! 2. 构建阶段 在构建阶段,CMakeList.txt就显得尤为重要了。当我们动手运行cmake这个命令时,它就像个聪明的小助手,会认真读取咱们在CMakeList.txt文件里写的各种“小纸条”(也就是指令啦),然后根据这些“小纸条”的指示,自动生成对应的构建文件,这样一来,我们就可以更方便地搭建和构建项目了。这些构建文件可以是各种类型的,包括Visual Studio解决方案文件、Xcode项目文件、Unix Makefiles等。用这种方式,咱们就能轻轻松松地在不同的操作系统之间切换,继续我们项目的搭建工作啦! 3. 测试阶段 在测试阶段,我们通常不会直接使用CMakeList.txt。不过,假如我们的项目里头捣鼓了一些个性化的测试框架,那我们可能就得在CMakeList.txt这个文件里头写上一些特别的命令行“暗号”,这样咱们的测试框架才能在构建的过程中乖乖地、准确无误地跑起来。 4. 发布阶段 在发布阶段,我们通常也不会直接使用CMakeList.txt。然而,如果我们希望在发布过程中自动打包我们的项目,那么我们可能需要在CMakeList.txt中定义一些特殊的指令,以便自动打包我们的项目。 五、总结 总的来说,CMakeList.txt在我们的项目开发过程中扮演着非常重要的角色。无论是编码阶段、构建阶段、测试阶段还是发布阶段,我们都离不开它。只要咱们搞明白了CMakeList.txt这个文件的基本操作和用法,那就相当于拿到一把神奇的钥匙,能够轻松玩转我们的项目管理,让工作效率嗖嗖地往上窜,简直不要太爽!所以,无论是刚入门的小白,还是身经百战的老司机,都得好好研究琢磨这个CMakeList.txt文件,把它整明白了才行!
2023-12-09 16:39:31
395
彩虹之上_t
转载文章
...时,自动化构建工具如CMake和Autotools的作用不容忽视。它们能够简化多平台下的编译流程,并有效管理静态库与共享库的生成与链接(参考“Mastering CMake for Effective Project Configuration and Build System”)。 针对预处理和头文件管理,LLVM的Header Include Optimization (HIO) 技术提供了一种新的解决方案,它能够在编译时智能地分析和包含必要的头文件,从而提高编译速度和减少冗余(查阅“LLVM’s Header Include Optimization: Smarter Inclusion of Headers”)。 同时,对于希望深入了解底层机制的开发者,可以阅读《深入理解计算机系统》一书,书中详细介绍了从源码到可执行程序的完整过程,涵盖了预处理、编译、汇编和链接等各阶段原理,有助于读者更好地运用GCC编译选项和相关技术。 总之,在掌握GCC基本用法的基础上,结合最新的编译器技术和构建工具发展动态,以及深入研究编译原理,都能帮助开发者更高效地构建高质量的C语言项目。
2023-06-29 13:05:13
52
转载
转载文章
...但现代项目管理工具如CMake、Meson等因其跨平台性和易用性逐渐受到青睐。了解这些工具的优势和应用场景,结合实际需求选择合适的构建解决方案。 5. Linux进程间通信(IPC)机制详解:在Linux编程实战中,进程间的通信和同步往往是关键环节之一。深入理解管道、消息队列、共享内存、信号量等IPC机制,能够帮助您设计出更为复杂且高效的多进程应用程序。 通过以上延展阅读,读者不仅能够巩固已学知识,还能紧跟技术发展潮流,不断提升自身在Linux环境下的软件开发能力。
2023-12-26 19:04:57
100
转载
转载文章
... gcc make cmake zlib-devel bzip2-devel openssl-devel ncurse-devel libffi-devel -y 2.在线下载Python3.7源码包进入tmp目录 cd /tmp 下载python3.7.3 wget https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz 3.解压并配置解压 tar Jxvf Python-3.7.3.tar.xz 进入python3.7.3目录 cd Python-3.7.3 创建目录 mkdir -p /usr/local/python3 配置(指定安装目录) ./configure --prefix=/usr/local/python3 --enable-optimizations 4. 编译及安装make && make install 5.更换系统默认Python版本 1).备份原系统旧版本pythonmv /usr/bin/python /usr/bin/python.bak mkdir /usr/bin/pip mv /usr/bin/pip /usr/bin/pip.bak 2).配置环境变量:创建新版本Python和pip的软链接ln -s /usr/local/python3/bin/python3.7 /usr/bin/python ln -s /usr/local/python3/bin/pip3 /usr/bin/pip 3).查看Python版本python -V 6.修改yum功能 因为yum的功能依赖Pyhon2,现在更改默认Python版本后会导致yum无法正常工作,所以进行以下3处修复 第1处:vim /usr/bin/yum 把最顶部的 改成:! /usr/bin/python2.7 第2处: vim /usr/libexec/urlgrabber-ext-down 把最顶部的 改成:! /usr/bin/python2.7 /usr/sbin/firewalld /usr/bin/firewall-cmd 这两个也改下 评论一下 赞助站长 赞助站长X 版权申明:此文如未标注转载均为本站原创,自由转载请表明出处《龙行博客》。 本文网址:https://www.liaotaoo.cn/243.html 本篇文章为转载内容。原文链接:https://blog.csdn.net/weixin_39974223/article/details/110081791。 该文由互联网用户投稿提供,文中观点代表作者本人意见,并不代表本站的立场。 作为信息平台,本站仅提供文章转载服务,并不拥有其所有权,也不对文章内容的真实性、准确性和合法性承担责任。 如发现本文存在侵权、违法、违规或事实不符的情况,请及时联系我们,我们将第一时间进行核实并删除相应内容。
2023-03-23 10:44:41
284
转载
转载文章
...讨了与其他构建工具如CMake、Meson等的对比和融合。 通过延伸阅读以上内容,您可以更好地将理论知识应用于实际项目开发,优化构建过程,提高项目的可维护性和迭代速度。
2023-03-28 09:49:23
282
转载
转载文章
...于Makefile或CMake,在本文中被用来编译和安装ndn-cxx和NFD项目。waf可以根据项目需求自动化完成配置、编译、链接等一系列构建步骤,简化软件开发和部署流程。 Interest 报文 , 在NDN体系结构中,Interest报文是用来表达用户对特定数据内容的需求,包含了用户想要获取的数据的名字等信息。当一个节点发送Interest报文时,沿途的转发器会记录这个请求,并试图找到并返回相应的数据内容给请求者。 Consumer/Producer 模型 , 在NDN环境下,consumer是数据的请求者,producer则是数据的提供者。文中提到的示例程序即遵循这一模型,producer程序负责发布数据,consumer程序则发出Interest报文请求这些数据。通过搭建环境并运行这两个程序,可以验证NDN平台的基本功能是否正常运作。
2023-03-30 19:22:59
321
转载
站内搜索
用于搜索本网站内部文章,支持栏目切换。
知识学习
实践的时候请根据实际情况谨慎操作。
随机学习一条linux命令:
chmod +x script.sh
- 给脚本添加执行权限。
推荐内容
推荐本栏目内的其它文章,看看还有哪些文章让你感兴趣。
2023-04-28
2023-08-09
2023-06-18
2023-04-14
2023-02-18
2023-04-17
2024-01-11
2023-10-03
2023-09-09
2023-06-13
2023-08-07
2023-03-11
历史内容
快速导航到对应月份的历史文章列表。
随便看看
拉到页底了吧,随便看看还有哪些文章你可能感兴趣。
时光飞逝
"流光容易把人抛,红了樱桃,绿了芭蕉。"