From 16acd89349368628838a46670174dc4438676902 Mon Sep 17 00:00:00 2001 From: Andrii Kurdiumov Date: Fri, 25 Jun 2021 10:20:21 +0600 Subject: [PATCH 1/2] Document how to use local Clang on Linux --- .gitignore | 1 + README.md | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/.gitignore b/.gitignore index 1c33a1f3..37151e7d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ # Build Artifacts ############################################################################### artifacts/ +build/ *.binlog *.dll *.dylib diff --git a/README.md b/README.md index b5c5e5dc..317faf31 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,15 @@ cmake -DPATH_TO_LLVM=../../../../llvm-project/artifacts/install/ -G "Visual Stud You can then open `libClangSharp.sln` in Visual Studio, change the configuration to `Release` and build the `ALL_BUILD` project. +If you building on Linux +``` +git clone https://github.com/microsoft/clangsharp +mkdir artifacts/bin/native +cd artifacts/bin/native +cmake -DPATH_TO_LLVM=/usr/lib/llvm/12/ -G Ninja ../../.. +ninja +``` + ## Generating Bindings This program will take a given set of C or C++ header files and generate C# bindings from them. It is still a work-in-progress and not every declaration can have bindings generated today (contributions are welcome). @@ -232,6 +241,21 @@ Options: traversal issues. ``` +## Using locally built version + +After you build local version, you can use executable from build location. + +``` +artifacts/bin/sources/ClangSharpPInvokeGenerator/Debug/net5.0/ClangSharpPInvokeGenerator +``` + +If you are on Linux + +``` +LD_LIBRARY_PATH=$(pwd)/artifacts/bin/native/lib/ +artifacts/bin/sources/ClangSharpPInvokeGenerator/Debug/net5.0/ClangSharpPInvokeGenerator +``` + ## Spotlight The P/Invoke Generator is currently used by several projects: From 218e9a74c32ee11aff29fc0ff7f444e889a4bc4e Mon Sep 17 00:00:00 2001 From: Andrii Kurdiumov Date: Sat, 26 Jun 2021 00:36:49 +0600 Subject: [PATCH 2/2] Add instructions for make files --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 317faf31..3084574a 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,15 @@ If you building on Linux git clone https://github.com/microsoft/clangsharp mkdir artifacts/bin/native cd artifacts/bin/native +cmake -DPATH_TO_LLVM=/usr/lib/llvm/12/ ../../.. +make +``` + +or if you prefer Ninja +``` +git clone https://github.com/microsoft/clangsharp +mkdir artifacts/bin/native +cd artifacts/bin/native cmake -DPATH_TO_LLVM=/usr/lib/llvm/12/ -G Ninja ../../.. ninja ```