cmake

CMake 用法总结(转载)

左心房为你撑大大i 提交于 2020-02-22 23:44:54
原文地址 什么是 CMake All problems in computer science can be solved by another level of indirection. David Wheeler 你或许听过好几种 Make 工具,例如 GNU Make ,QT 的 qmake ,微软的 MS nmake ,BSD Make( pmake ), Makepp ,等等。这些 Make 工具遵循着不同的规范和标准,所执行的 Makefile 格式也千差万别。这样就带来了一个严峻的问题:如果软件想跨平台,必须要保证能够在不同平台编译。而如果使用上面的 Make 工具,就得为每一种标准写一次 Makefile ,这将是一件让人抓狂的工作。 CMake 就是针对上面问题所设计的工具:它首先允许开发者编写一种平台无关的 CMakeList.txt 文件来定制整个编译流程,然后再根据目标用户的平台进一步生成所需的本地化 Makefile 和工程文件,如 Unix 的 Makefile 或 Windows 的 Visual Studio 工程。从而做到“Write once, run everywhere”。显然,CMake 是一个比上述几种 make 更高级的编译配置工具。一些使用 CMake 作为项目架构系统的知名开源项目有 VTK 、 ITK 、 KDE 、 OpenCV

Cartographer安装

≯℡__Kan透↙ 提交于 2020-02-22 23:09:47
请注意本文的安装日期2017/12/20,如果距离该时间很遥远,请仅作为参考,毕竟cartographer的代码在不断更新,可能会存在很大的变动。 参考文档: https://google-cartographer.readthedocs.io/en/latest/ https://google-cartographer-ros.readthedocs.io/en/latest/ http://www.cnblogs.com/liangyf0312/p/8028441.html 1. 先装好 wstool 、 rosdep 、ninja 2. 建工作空间 3. 下载cartographer、cartographer_ros、ceres源码。这里也下载了rplidar的代码(略)。 https: / / github.com / ceres - solver / ceres - solver https: / / github.com / googlecartographer / cartographer https: / / github.com / googlecartographer / cartographer_ros yhexie@ubuntu:~$ sudo apt-get install -y python-wstool python-rosdep ninja

Cmake 模板

与世无争的帅哥 提交于 2020-02-21 17:42:01
CMakeLists.txt #指定 cmake 的最低版本 cmake_minimum_required(VERSION 3.5.1) #项目名 project(whistle_capture) #加入 c++11标准 set(CMAKE_CXX_STANDARD 11) add_definitions(-D __LINUX__) #指定头文件地址 include_directories("${PROJECT_SOURCE_DIR}") include_directories(${PROJECT_SOURCE_DIR}/3library/include) #加载源文件 set(SOURCE_FILES src/main.cpp src/HardwareDriver.cpp src/audio.cpp src/video.cpp src/whistleprocessing.cpp src/SoundLocalization.cpp src/profile.cpp src/Server.cpp src/confile.cpp src/WaveFile.cpp src/x264_encoder.cpp src/rtsp_msg.c src/rtsp_demo.c src/rtp_enc.c src/stream_queue.c src/utils.c src/dir_list.cpp

win10 opencv3.4.6+CMake3.15.3+qt5.11(MSVC)+hdf5环境配置

早过忘川 提交于 2020-02-21 11:21:58
1 安装软件 安装QT 可以在这里下载 http://download.qt.io/archive/qt/5.14/ 组件根据个人电脑安装情况选MinGW、msvc的对应版本; 然后添加C:\Qt\Qt5.11.1\5.11.1\msvc2017_64\bin到系统环境变量path中; 安装cmake 下载后,安装点下一步即可,然后把路径加到path中(不加也可以) 安装hdf5 下载源码安装没成功. 下载cmake版本的源码,解压; 源码目录下有相应的bat文件,选择合适的bat文件,(我直接运行bat文件,失败了),复制里面的文本; 管理员模式打开cmd或者powershell,进入解压的文件夹下,执行刚才复制的文本; 生成hdf5的压缩包,exe文件(一些情况下)把其中名字类似HDF5-1.10.5-win64.zip的压缩包解压,就是库、包文件; 把bin所在的路径添加到系统环境变量中 visual studio 2017 微软官网下载 sdk工具 还需要安装windows的sdk工具,用于debug, sdk下载 否则可能导致错误: debug时显示the selected debugger may be inappropriate for the inferior… imshow 无法解析的外部命令未找到,但在安装了上面的sdk后,解决问题 2 编译opencv4.1

Do something for all targets

这一生的挚爱 提交于 2020-02-21 07:00:27
问题 What is the best way to do additional stuff for all (binary) targets? Examples: I want to check that each library name follows a pattern. I want to sign each executable. I dont what the C/C++ developers to use nonstandard commands (like add_library2 ). I want them to use and learn the official CMake functions, but have them do additonal, project specific, stuff. 回答1: The built-in CMake functions add_library and add_executable can be overidden by defining CMake functions of the same name. E.g.

CMake: build cross-platform distribution

你说的曾经没有我的故事 提交于 2020-02-21 06:02:20
问题 On my MacOSX I've developed an application that makes use of Qt and VTK libraries. I generate the makefile using CMake. Now I want to compile an end-user self-contained package on Windows, and it is supposed to work on end-user machine without needing to pre-install Qt or VTK libraries. I think is possible to do this by modifying the CMakeLists.txt file but a web search hasn't pointed me the right direction. How to make a distributable package for Windows using CMake? 回答1: What I have done in

CMake: build cross-platform distribution

自作多情 提交于 2020-02-21 05:58:08
问题 On my MacOSX I've developed an application that makes use of Qt and VTK libraries. I generate the makefile using CMake. Now I want to compile an end-user self-contained package on Windows, and it is supposed to work on end-user machine without needing to pre-install Qt or VTK libraries. I think is possible to do this by modifying the CMakeLists.txt file but a web search hasn't pointed me the right direction. How to make a distributable package for Windows using CMake? 回答1: What I have done in

CMake: build cross-platform distribution

霸气de小男生 提交于 2020-02-21 05:58:05
问题 On my MacOSX I've developed an application that makes use of Qt and VTK libraries. I generate the makefile using CMake. Now I want to compile an end-user self-contained package on Windows, and it is supposed to work on end-user machine without needing to pre-install Qt or VTK libraries. I think is possible to do this by modifying the CMakeLists.txt file but a web search hasn't pointed me the right direction. How to make a distributable package for Windows using CMake? 回答1: What I have done in

Header files with prefix in CMake project

筅森魡賤 提交于 2020-02-19 11:43:49
问题 I have set up a CMake project whose directory structure looks as follows: src/ --CMakeLists.txt --libA/ ----CMakeLists.txt ----foo.h ----foo.cpp --main/ ----CMakeLists.txt ----main.cpp src/CMakeLists.txt uses add_subdirectory to pull in libA and main . libA/CMakeLists.txt uses add_library to define a library called libA , which exports foo.h via target_include_directories . If I now link against libA in main using target_link_library , I can include foo.h via #include <foo.h> in main.cpp .

使用CMake编译Cocos2d-4.0 (For Visual Studio)

只谈情不闲聊 提交于 2020-02-18 18:55:04
使用CMake编译Cocos2d-4.0 (For Visual Studio) 1. 前往官方下载cocos2d-v4.0版本 2. 满足以下条件 Windows 7+ 虽然我用的win10 VS 2017+ 虽然我用的VS2019 CMake 3.1+ 如果官网( www.cmake.org )上不了,建议去软件管家下载 Python 2.7.5+, P建议 ython 2,7.10, 而不是 Python 3+__ 虽然我用的python3.7 3. 使用CMake构建visual studio 进入下载后解压的cocos2d文件夹:cd cocos2d-x 创建文件夹且进入:mkdir win32-build && cd win32-build 构建:cmake … -G"Visual Studio 16 2019" -Tv142 -A win32 …(如果你是vs2017 那么: cmake … -G"Visual Studio 15 2017" -Tv141 -A win32 …) 如下图 结果: 使用vs打开,F5原先运行,运行后cocos2d-x-4.0\win32-build\bin目录会生成不同的exe文件,如运行\win32-build\bin\cpp-tests\Debug\cpp-tests.exe 来源: CSDN 作者: hunter_wyh 链接: