我正在尝试向LLVM编译器基础设施中添加新的pass。 我已经能够使用make构建LLVM-2.9。但是我想使用Eclipse进行构建,以便我可以跟踪代码。 我使用LinuxGcc工具链和CDT内部构建器(带有CDT-7.0的Eclipse)将LLVM源文件导入到C++项目中。但是它会出现一些错误。 这是否是使用Eclipse构建LLVM的正确方法? 请告诉我使用Eclipse构建LLVM源码的步骤。 注意:平台为ubuntu。
Tools/versions used by me:
Create a folder for CDT project files in your workspace. I.e. workspace/llvm
.
Generate CDT project files with cmake (being in workspace/llvm
):
cmake -G "Eclipse CDT4 - Unix Makefiles" -D_ECLIPSE_VERSION=4.3 ../../src/llvm
If eclipse version is not set the generator will assume 3.7 and inform you that it can be changed by CMAKE_ECLIPSE_VERSION
option, what turns out to be the wrong name for that option.
Increase eclipse heap allocation size. The default setting is too small and C++ Indexer would hang the whole IDE. Replace default settings with
-Xms512m
-Xmx1024m
in eclipse.ini
file.
Import the project into your workspace. File → Import... → General → Existing Projects into Workspace.
llvm
can be built as one (option Build Project). There are also separated targets created for every lib and executable, placed in [Targets]
folder. Individual target can be built with option Make Targets → Build...cmake -G"Eclipse CDT4 - Unix Makefiles"
来生成本地Eclipse项目集。这可能需要调整你的CMakeLists.txt
,以删除源内构建的检查(因为Eclipse只支持在同一目录中的项目文件和源代码,但由于某种原因,当前的CMakeLists仅允许MSVS)- 只需按照错误消息操作即可。