cppast | Library to parse and work with the C++ AST | Parser library
kandi X-RAY | cppast Summary
kandi X-RAY | cppast Summary
There are three class hierarchies that represent the AST:.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of cppast
cppast Key Features
cppast Examples and Code Snippets
Community Discussions
Trending Discussions on cppast
QUESTION
I have the following directory structure:
...ANSWER
Answered 2017-May-08 at 09:31The problem comes from the fact that you are generating the file generated.cpp
in one directory and then trying to add it to a target defined in a different directory. CMake only supports adding generated files to targets defined in the same directory scope. The add_custom_command()
documentation explicitly mentions this restriction.
You probably want to move the generation of generated.cpp
into the src
directory. You should also use just the gen
target name to refer to the executable to run, not ${CMAKE_BINARY_DIR}/gen
which is not going to be correct with all CMake generator types. It would also be better style to use the current binary directory rather than the top level binary directory as the output dir. Your src/CMakeLists.txt
should look something like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install cppast
Similar to the above instructions for cppast, there are a couple extra requirements for Windows. The LLVM team does not currently distribute llvm-config.exe as part of the release binaries, so the only way to get it is through manual compilation or from 3rd parties. To prevent version mismatches, it's best to compile LLVM, libclang, and llvm-config.exe from source to ensure proper version matching. However, this is a non-trivial task, requiring a lot of time. The easiest way to work with LLVM and llvm-config.exe is to leverage the Chocolatey llvm package, and then compile the llvm-config.exe tool as a standalone binary. In your cppast based project, if you run into issues with cmake not finding libclang, set LIBCLANG_LIBRARY to be C:/Program Files/LLVM/lib in your CMakeLists.txt file.
Install Visual Studio 2017 with the Desktop C++ development feature enabled.
Install llvm and clang with choco install llvm
Check the version with clang.exe --version
Clone the LLVM project: git clone https://github.com/llvm/llvm-project
Checkout a release version matching the version output, such as 7.0.1, with git checkout llvmorg-7.0.1
cd llvm-project && mkdir build && cd build to prep the build environment.
cmake -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_TARGETS_TO_BUILD="X86" -G "Visual Studio 15 2017" -Thost=x64 ..\llvm This will configure clang and LLVM using a 64-bit toolchain. You'll have all the necessary projects configured for building clang, if you need other LLVM tools. See the LLVM documentation and clang documentation if you only need more assistance.
Open the LLVM.sln solution, and set the build type to be "Release".
Build the Tools/llvm-config target.
Copy the release binary to from build\Release\bin\llvm-config.exe to C:\Program Files\LLVM\bin\llvm-config.exe
Open a new Powershell window and test accessiblity of llvm-config.exe, it should return with it's help message.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page