From d4bb47a3a73430259ff7d108bb7238b3c695ba57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Tue, 21 Jul 2015 11:25:44 +0200 Subject: [PATCH 1/7] Edits to make make install work for juci --- CMakeLists.txt | 3 ++- src/CMakeLists.txt | 6 ++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99ac894..8ad95fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,8 @@ cmake_minimum_required (VERSION 2.8.4) set(project_name clangmm) project(${project_name}) -set(library_installation_path "/usr/local/lib/libclangmm/") +set(library_path "/usr/local/lib/") +set(include_path "/usr/local/include/") if(APPLE) set(Boost_USE_STATIC_LIBS "YES") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 478c921..3879c84 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -48,7 +48,5 @@ add_library(${project_name} SHARED ${header_files} ${cc_files}) include_directories(${LIBCLANG_INCLUDE_DIRS}) target_link_libraries(${project_name} ${LIBCLANG_LIBRARIES}) -install(TARGETS ${project_name} - LIBRARY DESTINATION ${library_installation_path}) -install(FILES ${header_files} - DESTINATION ${library_installation_path}/include) +install(TARGETS ${project_name} LIBRARY DESTINATION ${library_path}) +install(FILES ${header_files} DESTINATION ${include_path}/libclangmm) From f8641dc2a6244d9391eba43404fb3065fa1baa96 Mon Sep 17 00:00:00 2001 From: Geir Morten Larsen Date: Wed, 22 Jul 2015 17:27:58 +0200 Subject: [PATCH 2/7] Adding installation guide in a own folder --- docs/install.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 docs/install.md diff --git a/docs/install.md b/docs/install.md new file mode 100644 index 0000000..37e529e --- /dev/null +++ b/docs/install.md @@ -0,0 +1,25 @@ +# juCi++ +## Installation guide ## +## Linux +```sh +# Libraries +$ sudo apt-get install libboost-log-dev libclang-dev +# Programs +$sudo apt-get install make cmake gcc + +``` +Compile +```sh +# When git clone +$ cd path-to-cloned-from-folder/jucipp/juci +# When download zipped file, extraxt it to a folder of your choice +$ cd path-to-folder-extraxted-into/jucipp-master/juci +# In both cases above you can choose remove the jucipp folder, but remeber to apply changes to cd command as well. +$ cmake . +$ make +``` + +## Run +```sh +$ ./bin/juci +``` From ee4f02a1b5e13f07ebae7c74e15d1019aaf3fcfb Mon Sep 17 00:00:00 2001 From: Geir Morten Larsen Date: Wed, 22 Jul 2015 17:36:49 +0200 Subject: [PATCH 3/7] Fixing link to installation guide --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 960bb25..1d735b6 100644 --- a/README.md +++ b/README.md @@ -29,10 +29,8 @@ $ git clone https://github.com/cppit/libclangmm.git ## Installation ## -```sh -$ cmake . -$ make install -``` +See [installation guide](https://github.com/cppit/libclangmm/blob/master/docs/install.md) + **Notice:** *make install* needs root privileges # Usage # From 79d71fa2c314f30d68ea6066a27053116c5d2a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Thu, 30 Jul 2015 14:22:36 +0200 Subject: [PATCH 4/7] Move docs to correct folder --- {src/docs => docs}/windows-install.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {src/docs => docs}/windows-install.md (100%) diff --git a/src/docs/windows-install.md b/docs/windows-install.md similarity index 100% rename from src/docs/windows-install.md rename to docs/windows-install.md From b88a21ff54f93b193c178fd29af03109118eb220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Thu, 30 Jul 2015 14:25:14 +0200 Subject: [PATCH 5/7] Delete windows install guide --- docs/windows-install.md | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 docs/windows-install.md diff --git a/docs/windows-install.md b/docs/windows-install.md deleted file mode 100644 index 156f22e..0000000 --- a/docs/windows-install.md +++ /dev/null @@ -1,13 +0,0 @@ -# Windows Install Guide # -## Requirements ## - -```bash -* chocolatey [website](http://chocolatey.org) -``` - -##Preperation ## -First you install some dependencies - -```bash -PS: choco install cmake make nmake -``` From 14a107dd4e04b3d5df28ae36e7a9b9c151db1b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Thu, 30 Jul 2015 15:23:27 +0200 Subject: [PATCH 6/7] Update readmes and compilation --- CMakeLists.txt | 5 +-- README.md | 94 ++++++++----------------------------------------- docs/install.md | 26 ++++---------- 3 files changed, 25 insertions(+), 100 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ad95fd..dab3e5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ if(APPLE) set(CMAKE_MACOSX_RPATH 1) endif() -enable_testing() add_subdirectory(src) -add_subdirectory(tests) + +# enable_testing() +# add_subdirectory(tests) diff --git a/README.md b/README.md index 1d735b6..9851154 100644 --- a/README.md +++ b/README.md @@ -1,94 +1,30 @@ # libclangmm - An easy to use C++-wrapper for libclang # ## About ## -This project is written by *cppit* as part of an bachelor thesis +This is a highlevel wrapper for [libclang](http://www.llvm.com). It +provides highlevel C++11 access to complicated C code. -# Install # -This section describes how to install this library on your system. The section below is tested in on unix based systems and in windows. If there are any problems please create an issue and we will look into it. ## Dependencies ## -Please install these dependencies on your system. - * libclang -* cmake -* make -* clang or gcc (compiler) - -## Download the source ## -There are two ways of downloading the source - -### Download the zip ### -You can download the zip [here](https://github.com/cppit/libclangmm/archive/master.zip). - -### Cloning the repository ### - -```sh -$ git clone https://github.com/cppit/libclangmm.git - -``` - ## Installation ## - See [installation guide](https://github.com/cppit/libclangmm/blob/master/docs/install.md) -**Notice:** *make install* needs root privileges - -# Usage # -One quick start: - -```cpp - // lets say it is empty - std::string path("your file here"); - - clang::Index index(0, 0); - clang::TranslationUnit tu(&index, path); - - // ReparseTranslationUnit takes a map with filepath as key - // and buffer as value - std::map buffers; - - // create buffer (this would normally be a gtk/qt-buffer or something) - std::string file; - file.append("#include "); - file.append("int main(int argc, char *argv[]) {\n"); - file.append("std::cout << \"Hello World!\" << std::endl;\n"); - file.append("return 0\n"); - file.append("}"); - - buffers[path] = file; - - // after you can use various methods to get locations - // for tokens for syntax highlighting of refactoring - - // the buffer map should contain all open files. I.e in an text editor - // you could have more than one file open at the same time. Putting the - // files in this std::map will make the translationunit be reparsed - // from memory instead of from file. - tu.ReparseTranslationUnit(path, buffers); - - // zero is the start of the buffer - clang::SourceLocation start(&tu, path, 0); - - // the 129 value is arbitrary, you must set it to the size of your - // buffer (the number of chars in the buffer) - clang::SourceLocation end(&tu, path, 129); - - clang::SourceRange range(&start, &end); - clang::Tokens tokens(&tu, &range); - - // now tokens are stored in "tokens" we can extract ranges that are - // comments for instance - std::vector ranges; - for (auto &t : tokens.tokens()) { - if (t.kind() == clang::Token_Comment) { - ranges.emplace_back(&tu, &t); - } - } +### Quickstart ### +```sh +$ git clone https://github.com/cppit/libclangmm.git clangmm +$ cd clangmm +$ make +$ sudo make install ``` -For more examples see tests/ - # Tests # -To run tests simply do the following: +The compilation of the tests are disabled due to ease of installation. Simply enter CMakeList.txt and uncomment the last two lines in the file to enable testing. + +```sh +# enable_testing() +# add_subdirectory(tests) +``` +Then simply: ```sh $ cmake . $ make diff --git a/docs/install.md b/docs/install.md index 37e529e..d88931f 100644 --- a/docs/install.md +++ b/docs/install.md @@ -1,25 +1,13 @@ -# juCi++ -## Installation guide ## -## Linux -```sh -# Libraries -$ sudo apt-get install libboost-log-dev libclang-dev -# Programs -$sudo apt-get install make cmake gcc +# Installation guide # -``` -Compile +## Debian/Ubuntu ```sh -# When git clone -$ cd path-to-cloned-from-folder/jucipp/juci -# When download zipped file, extraxt it to a folder of your choice -$ cd path-to-folder-extraxted-into/jucipp-master/juci -# In both cases above you can choose remove the jucipp folder, but remeber to apply changes to cd command as well. -$ cmake . -$ make +$ sudo apt-get install libclang-dev make cmake gcc ``` -## Run ```sh -$ ./bin/juci +$ git clone https://github.com/cppit/libclangmm.git clangmm +$ cd clangmm +$ make +$ sudo make install ``` From c03d5fad198255d41eeb0a8b5e10c0ab815f014a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lien=20Sell=C3=A6g?= Date: Thu, 30 Jul 2015 15:27:21 +0200 Subject: [PATCH 7/7] Update broken link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9851154..538864e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # libclangmm - An easy to use C++-wrapper for libclang # ## About ## -This is a highlevel wrapper for [libclang](http://www.llvm.com). It +This is a highlevel wrapper for [libclang](http://www.llvm.org). It provides highlevel C++11 access to complicated C code. ## Dependencies ##