GithubHelp home page GithubHelp logo

ak239 / cmake-kythe Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aslushnikov/cmake-kythe

1.0 1.0 0.0 36 KB

helpers to get kythe working with webkit on linux

Shell 1.65% C++ 1.28% JavaScript 97.07%

cmake-kythe's Introduction

CMake-Kythe

This script helps running Kythe pipeline for cmake-compiled projects. Main goal is to run Kythe against WebKit source.

Example

Let's build index for a sample cmake project: bast/cmake-example.

  1. First things first - clone cmake-kythe and install dependencies.
user:~$ git clone https://github.com/aslushnikov/cmake-kythe
user:~$ cd cmake-kythe
user:~/cmake-kythe$ npm i
user:~/cmake-kythe$ cd ..
user:~$

cmake-kythe has a few NPM dependencies so it should be pretty quick.

  1. Second - let's clone our sample cmake project bast/cmake-example.
user:~$ git clone https://github.com/bast/cmake-example
user:~$ cd cmake-example
user:~/cmake-example$
  1. CMake-Kythe relies on compilation database to produce its indexes. Thus a cmake project has to be configured first to export CMake compilation database. This is done with a -DCMAKE_EXPORT_COMPILE_COMMANDS flag.

Build cmake-example, generating compilation database:

user:~/cmake-example$ cmake -H. -Bbuild -DCMAKE_EXPORT_COMPILE_COMMANDS=1

This command should produce a ~/cmake-example/build directory, with a compilation database under ~/cmake-example/build/compile_commands.json.

NOTE: if this steps throw an error for you, make sure that there's C++ compiler available on your system. Also, cmake-example wants to have Fortran available on your system. This can be avoided by removing "Fortran" from the list of supported langauges in //CMakeLists.txt.

  1. Let's actually compile the cmake-example so that it produces all the intermediate generated files.
user:~/cmake-example$ cd build
user:~/cmake-example/build$ cmake --build .

This should succeed.

  1. Now, we need to install Kythe separately to the system. cmake-kythe is tested to work well with Kythe v0.0.30, so I'd recommend downloading Kythe v0.0.30 and extracting it into /opt/kythe on your system.

You should end up with /opt/kythe directory that has various subdirectories, e.g. /opt/kythe/tools, /opt/kythe/indexers and so on.

  1. cmake-kythe requires a small config for it to deal with the project.

Save the following to the ~/cmake-example/config.json:

{
  // Path to Kythe installation.
  "kythe_path": "/opt/kythe",
  // This is the port to serve Kythe basic UI. Drop "localhost" if you want server to be reachable
  // from outside.
  "kythe_web_ui_port": "localhost:8080",
  // Parallelization level.
  "parallel": 1,
  // Project directory. Relative paths are resolved wrt config's location.
  "project_directory": ".",
  // Path to cmake's compilation database.
  "cmake_compilation_database": "./build/compile_commands.json",
  // Where to put index.
  "output_directory": "/tmp/cmake-example"
}
  1. Last step - run indexing!
user:~/cmake-example$ node ../cmake-kythe/index.js config.js

This step takes ~5 minutes for me. Please, give it some time. Once it's done, basic Kythe UI will be served at localhost:8080.

cmake-kythe's People

Contributors

aslushnikov avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.