From 55221f1536a1f21c3f0b0b4dbb28344185ec655c Mon Sep 17 00:00:00 2001 From: Mike Lloyd Date: Tue, 9 Apr 2019 03:15:48 -0600 Subject: [PATCH] Add documentation for Windows --- README.md | 21 +++++++++++++++++++++ include/cppast/cpp_entity.hpp | 3 +-- include/cppast/cpp_member_variable.hpp | 3 +-- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8b7920c0..b488b464 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/include/cppast/cpp_entity.hpp b/include/cppast/cpp_entity.hpp index c7c4d750..0997c83f 100644 --- a/include/cppast/cpp_entity.hpp +++ b/include/cppast/cpp_entity.hpp @@ -157,8 +157,7 @@ class cpp_entity : detail::intrusive_list_node { user_data_ = data; } - -protected: + /// \effects Creates it giving it the the name. cpp_entity(std::string name) : name_(std::move(name)), user_data_(nullptr) {} diff --git a/include/cppast/cpp_member_variable.hpp b/include/cppast/cpp_member_variable.hpp index 63b2f116..13c7abe4 100644 --- a/include/cppast/cpp_member_variable.hpp +++ b/include/cppast/cpp_member_variable.hpp @@ -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 type, std::unique_ptr def, bool is_mutable) : cpp_entity(std::move(name)), cpp_variable_base(std::move(type), std::move(def)),