Skip to content

Commit

Permalink
Add documentation for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
siennathesane authored and foonathan committed Apr 9, 2019
1 parent 4ed0678 commit 55221f1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,27 @@ The other dependencies like [type_safe](http://type_safe.foonathan.net) are inst

If you run into any issues with the installation, please report them.

### Installation on Windows

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](https://chocolatey.org/) `llvm` package, and then compile the `llvm-config.exe` tool as a standalone binary.

* 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](https://llvm.org/docs/CMake.html) and [clang documentation](http://clang.llvm.org/get_started.html) 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.

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.

### Quick API Overview

There are three class hierarchies that represent the AST:
Expand Down
3 changes: 1 addition & 2 deletions include/cppast/cpp_entity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ class cpp_entity : detail::intrusive_list_node<cpp_entity>
{
user_data_ = data;
}

protected:

/// \effects Creates it giving it the the name.
cpp_entity(std::string name) : name_(std::move(name)), user_data_(nullptr) {}

Expand Down
3 changes: 1 addition & 2 deletions include/cppast/cpp_member_variable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class cpp_member_variable_base : public cpp_entity, public cpp_variable_base
{
return mutable_;
}

protected:

cpp_member_variable_base(std::string name, std::unique_ptr<cpp_type> type,
std::unique_ptr<cpp_expression> def, bool is_mutable)
: cpp_entity(std::move(name)), cpp_variable_base(std::move(type), std::move(def)),
Expand Down

0 comments on commit 55221f1

Please sign in to comment.