使用库设置 emacs EDE 项目
我已经搜索了 emacs 文档、cedet 网站和此处,但没有成功。如果我的问题已经得到解答,请随意(指出现有答案并)关闭它。
我正在尝试熟悉 emacs 中的 EDE 项目。到目前为止,我可以使用一个或多个文件建立一个简单的项目。
现在我想分离出一部分代码并将其打包到一个库中。基本上,我试图通过以下手写的朴素 Makefile 实现相同的目标:
matrix:
g++ -c -o lib/libmatrix.o lib/matrix.cpp -std=c++0x
ar crf lib/libmatrix.a lib/libmatrix.o
num:
g++ num.cpp -Llib -Ilib -std=c++0x -o num -g
这里我有一个由“lib/matrix.h”和“lib/matrix.cpp”组成的库(它是一个玩具实现矩阵类型)和使用矩阵的文件“num.cpp”。
我不知道如何告诉 emacs 正确编译矩阵。到目前为止,我得到了以下 EDE 项目,但它当然无法编译。
;; Object Numbers
;; EDE project file.
(ede-proj-project "Numbers"
:name "Numbers"
:file "Project.ede"
:targets (list
(ede-proj-target-makefile-program "num"
:name "num"
:path ""
:source '("num.cpp")
:compiler 'ede-g++-compiler
:linker 'ede-g++-linker
:configuration-variables 'nil
:ldflags '("-std=c++0x" "-Llib" "-Ilib")
:ldlibs '("matrix")
)
(ede-proj-target-makefile-archive "matrix"
:name "matrix"
:path "/lib"
:source '("matrix.cpp")
:compiler 'ede-g++-compiler
:linker 'ede-archive-linker
:configuration-variables 'nil
)
)
:configuration-variables 'nil
)
I already searched the emacs documentation, the cedet website and here on SO in vain. If my question is already been answered, fell free to (point out to an existing answer and) close it.
I'm trying to familiarize myself with EDE-projects in emacs. So far I can set up a simple project with one or more files.
Now I'd like to separate a part of my code and pack it into a library. Basically I'm trying to achieve the same thing I get with the following hand-written naive Makefile:
matrix:
g++ -c -o lib/libmatrix.o lib/matrix.cpp -std=c++0x
ar crf lib/libmatrix.a lib/libmatrix.o
num:
g++ num.cpp -Llib -Ilib -std=c++0x -o num -g
Here I have a library consisting of "lib/matrix.h" and "lib/matrix.cpp" (it's a toy implementation of a matrix type) and a file "num.cpp" that uses matrix.
I don't know how to tell emacs to compile matrix properly. So far I got the following EDE-project, but of course it doesn't compile.
;; Object Numbers
;; EDE project file.
(ede-proj-project "Numbers"
:name "Numbers"
:file "Project.ede"
:targets (list
(ede-proj-target-makefile-program "num"
:name "num"
:path ""
:source '("num.cpp")
:compiler 'ede-g++-compiler
:linker 'ede-g++-linker
:configuration-variables 'nil
:ldflags '("-std=c++0x" "-Llib" "-Ilib")
:ldlibs '("matrix")
)
(ede-proj-target-makefile-archive "matrix"
:name "matrix"
:path "/lib"
:source '("matrix.cpp")
:compiler 'ede-g++-compiler
:linker 'ede-archive-linker
:configuration-variables 'nil
)
)
:configuration-variables 'nil
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以,
我想我解决了。我自己回答这个问题,以防有人遇到同样的困难。
基本上我需要在目录“lib/”中定义一个子项目来编译和归档库。
我现在有以下文件,
配置文件 lib/Project.ede 是负责该库的子项目,它看起来像这样:
主文件 ./Project.ede 看起来像这样:
So,
i think I solved it. I'm answering the question myself, in case someone stumbles on the same difficulties.
Basically I needed to define a subproject in the directory "lib/" which compiles and archives the library.
I now have the following files
the config-file lib/Project.ede is the subproject responsible for the library and it looks like this:
The main file ./Project.ede looks like this: