cmake

CMake实践(3)

喜你入骨 提交于 2020-02-05 14:05:43
一,本期目标 [sun@localhost t3]$ cat README t3:静态库(.a)与动态库(.so)构建 任务:1,建立一个静态库和动态库,提供HelloFunc函数供其他程序编程使用 HelloFunc向终端输出Hello World字符串 2,安装头文件与共享库 使用方法 到<path_to>/t3/build,执行: cmake -DCMAKE_INSTALL_PREFIX=/home/TOM/tmp .. make make instal 二,目录结构: [sun@localhost t3]$ tree ../t3/ ../t3 ├── build ├── CMakeLists.txt ├── lib │ ├── CMakeLists.txt │ ├── hello.cpp │ └── hello.h └── README 三,CMakeList.txt [sun@localhost t3]$ cat CMakeLists.txt PROJECT(HELLOLIB) cmake_minimum_required(VERSION 2.6) ADD_SUBDIRECTORY(lib) [sun@localhost t3]$ cat lib/CMakeLists.txt SET(LIBHELLO_SRC hello.cpp) #1)注意: 下面2句不能同时出现

CMake, RPATH, $ORIGIN and @loader_path

本小妞迷上赌 提交于 2020-02-05 07:37:25
问题 In my CMake project I build a bunch of libraries that are loaded at runtime as plugins. I therefore need to set various RPATHs so that these libraries can be found by the dynamic loading mechanism. I also need the whole thing to be relocatable, because it is part of a Python extension module and so gets copied around by various tools during the build process. It seems that the proper way to do this is to set the RPATH in a relative fashion by using the special $ORIGIN variable on Linux, and

CUDA: Why does compute_20 code fail on compute_35 device?

老子叫甜甜 提交于 2020-02-05 03:54:12
问题 For a computer with Titan GPU ( compute_35,sm_35 ), I compiled some code using this line in CMakeLists.txt : set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_35,code=sm_35) The code compiles and also runs fine. I wanted to check what compilation problems this code would cause for a friend who uses a GTS 450 ( compute_20,sm_21 ). So, I changed the above line to: set(CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS};-gencode arch=compute_20,code=sm_21) The code compiles without any errors on my

CMake with gRPC cannot find gRPCTargets.cmake

假如想象 提交于 2020-02-05 03:48:09
问题 I am having issues building the grpc cpp helloworld example with cmake . I built and installed grpc with cmake initially, and then with make directly. I have found this issue raised by someone else in the past, which was closed as resolved. It does not appear to be resolved and I opened a new issue for it, but I feel it will be some time until I get some help, so here I am. The OP of the original issue offers a workaround with his FindGRPC cmake module, but I am not sure how is this suppose

Linux下gcc/g++、make和cmake的区别

邮差的信 提交于 2020-02-05 00:36:37
首先介绍一下GCC :GNU Compiler Collection(GNU 编译器集合),在为Linux开发应用程序时,绝大多数情况下使用的都是C语言,因此几乎每一位Linux程序员面临的首要问题都是如何灵活运用C编译器。目前 Linux下最常用的C语言编译器是GCC(GNU Compiler Collection),它是GNU项目中符合ANSI C标准的编译系统,能够编译用C、C++和Object C等语言编写的程序。GCC不仅功能非常强大,结构也异常灵活。最值得称道的一点就是它可以通过不同的前端模块来支持各种语言,如Java、 Fortran、Pascal、Modula-3和Ada等。 gcc与g++区别: gcc 是GCC 中的GUNC Compiler(C 编译器) g++ 是GCC 中的GUN C++ Compiler(C++编译器) 更准确的说法是:gcc 调用了Ccompiler,而g++调用了C++ compiler gcc 和g++ 的主要区别 1. 对于 *.c 和*.cpp文件,gcc分别当做c和cpp文件编译(c和cpp的语法强度是不一样的); g++则统一当做cpp文件编译 2. 使用g++ 编译文件时, g++ 会自动链接标准库STL ,而gcc不会自动链接STL, 在用gcc 编译c++文件时,为了能够使用STL,需要加参数 –lstdc++

How do I manipulate CMake lists as sets?

做~自己de王妃 提交于 2020-02-04 22:18:16
问题 In CMake, lists are used extensively. Sometimes you have two lists of items (strings, basically), and you want to consider their intersection, difference or union. Like in this case that just came up for me. How do I produce such intersection, difference or union lists? Note: The outputs need to have no duplicates, the inputs not really 回答1: Suppose our lists are in variables S and T . For the union, write: list(APPEND union_list ${S} ${T}) list(REMOVE_DUPLICATES union_list) For set

How do I manipulate CMake lists as sets?

旧城冷巷雨未停 提交于 2020-02-04 22:18:05
问题 In CMake, lists are used extensively. Sometimes you have two lists of items (strings, basically), and you want to consider their intersection, difference or union. Like in this case that just came up for me. How do I produce such intersection, difference or union lists? Note: The outputs need to have no duplicates, the inputs not really 回答1: Suppose our lists are in variables S and T . For the union, write: list(APPEND union_list ${S} ${T}) list(REMOVE_DUPLICATES union_list) For set

postgresql pgagent 的安装及使用

会有一股神秘感。 提交于 2020-02-04 14:54:20
pgagent 作为postgresql的一个任务调度代理,在postgresql 9.0 以前 是附带在pgadmin 包下面的,只是默认不安装,9.0之后作为了一个单独是的安装包。所以要使用 pgagent 定时任务调度的话还得单独安装。 在安装pgagent之前还需要安装另外的2个依赖包, cmake 以及 wxGTK . 这里我选择的软件版本分别是 postgresql 9.5.1 pgagent-3.4.0下载地址:https://www.pgadmin.org/download/pgagent.php cmake-2.8.5 下载地址:http://cmake.org/download/ wxGTK-2.8.12 下载地址:http://www.wxwidgets.org/downloads/ 一、postgresql 的安装 (略) 二、cmake的安装 将安装包上传至服务器并解压,解压后进入解压后生成的cmake-2.8.5目录,执行以下命令。 [root@lsrac97 ~]# tar zxvf pgagent-3.4.0.tar.gz [root@lsrac97 ~]# cd cmake-2.8.5 [root@lsrac97 cmake-2.8.5]# ./bootstrap && make && make install 三、wxGTK-2.8.12 的安装

arm交叉编译opencv-2.4.9的步骤以及出现的问题

[亡魂溺海] 提交于 2020-02-04 03:23:06
linux环境:ubuntu16.04 交叉编译工具 arm-cortexa9-linux-gnueabi (一)下载opencv2.4.9源码 下载地址: opencv (二)配置编译环境 安装cmake cmake-qt-gui (三)配置编译选项 打开cmake-gui 配置编译选项 Compilers选项中的C选择*-gcc C++选择*-g++,要找到交叉编译工具链所在位置。 find program include 编译工具的库函数(lib)的位置 点Advanced 接下来是终极配置!!不按照以下配置必然会报错!! 去掉BUILD_OPENEXR 去掉BUILD_opencv_ocl 去掉WITH_1394 去掉WITH_CUDA 去掉WITH_GSTREAMER(没见到) 去掉WITH_GTK(没见到) 去掉WITH_LIBV4L(后边有v4l这个没用不要选)(没见到) 去掉WITH_OPENCL 去掉WITH_OPENEXR 去掉WITH_TIFF 在cmake-gui中去掉BUILD_opencv_apps这一项的钩钩!!! 勾上BUILD_JASPER 勾上BUILD_JPEG 勾上BUILD_PNG 勾上BUILD_ZLIB CMAKE_C_FLAGS 设置为-O3 -fPIC CMAKE_CXX_FLAGS 设置为-O3 -fPIC CMAKE

Compile C++ with embedded Python using CMake Import error

让人想犯罪 __ 提交于 2020-02-03 10:00:12
问题 I'm trying to include a python file in a C++ project compiled using CMake. First I did this standalone using these two files: #include <Python.h> #include <stdio.h> int main(int argc, char *argv[]) { setenv("PYTHONPATH", ".", 0); char hostname[] = "localhost"; PyObject *pName, *pModule, *pFunc; PyObject *pArgs, *pValue; Py_Initialize(); pName = PyString_FromString("GetHostname"); pModule = PyImport_Import(pName); Py_DECREF(pName); if(pModule != NULL) { pFunc = PyObject_GetAttrString(pModule,