Commit c99d0bd8 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

Adding Docker Theia development image

parent 6bf59c1f
Loading
Loading
Loading
Loading

docker/dev/Dockerfile

0 → 100644
+31 −0
Original line number Diff line number Diff line
from theiaide/theia-full:next
user root
run apt-get -y update \ 
    && unlink /usr/bin/clangd \
    && wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
    && echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial main" > \ 
                 /etc/apt/sources.list.d/llvm.list \
    && apt-get -y update && apt-get install -y clang-tools-8 cmake libssl-dev \
              python3 libpython3-dev python3-pip vim gdb gfortran libblas-dev \
              liblapack-dev pkg-config \ 
    && ln -s /usr/bin/clangd-8 /usr/bin/clangd \
    && ln -s /usr/bin/clang++-8 /usr/bin/clang++ \
    && ln -s /usr/bin/clang-8 /usr/bin/clang \
    && git clone --recursive https://github.com/eclipse/xacc \
    && cd xacc && mkdir build && cd build \
    && CC=clang CXX=clang++ cmake .. -DPYTHON_INCLUDE_DIR=/usr/include/python3.5 -DCMAKE_EXPORT_COMPILE_COMMANDS=TRUE \
    && make -j4 install && cd ../.. \
    && git clone --recursive https://github.com/ornl-qci/xacc-ibm \
    && cd xacc-ibm && mkdir build && cd build \
    && cmake .. -DXACC_DIR=~/.xacc && make -j4 install && cd ../.. \
    && git clone https://github.com/ornl-qci/tnqvm && cd tnqvm \
    && mkdir build && cd build \
    && cmake .. -DXACC_DIR=~/.xacc && make -j4 install && cd ../.. \
    && git clone --recursive https://github.com/ornl-qci/xacc-vqe \ 
    && cd xacc-vqe && mkdir build && cd build \
    && cmake .. -DXACC_DIR=~/.xacc -DPYTHON_INCLUDE_DIR=/usr/include/python3.5 \
    && make -j4 install && cd ../..
add settings.json /home/.theia/
user xacc-theia

docker/dev/README.md

0 → 100644
+20 −0
Original line number Diff line number Diff line
# Develop with Theia

To develop XACC using the Eclipse Theia IDE and Docker

```bash
$ git clone --recursive https://github.com/eclipse/xacc
$ cd xacc/docker/dev/theia
$ docker-compose up -d
```

Navigate to `http://localhost:3000` in your web browser. For an application look and feel in Google Chrome, you can run 
```bash
$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app=http://localhost:3000 (On a Mac)
$ google-chrome --app=http://localhost:3000 (On Linux)
```

To delete this development workspace
```bash
$ docker-compose down
```
+9 −0
Original line number Diff line number Diff line
version: '2'

services:
  qcor-dev:
    image: qcor/dev-ide
    volumes:
      - ../../..:/home/project
    ports:
      - 3000:3000
+11 −0
Original line number Diff line number Diff line
{
    "cpp.buildConfigurations": [{
        "name": "xacc",
        "directory": "/home/project/xacc/build"
    },
    {
	"name": "qcor",
	"directory": "/home/project/qcor/build"
    }
    ]
}
+0 −62
Original line number Diff line number Diff line
//------------------------------------------------------------------------------
// Tooling sample. Demonstrates:
//
// * How to write a simple source tool using libTooling.
// * How to use RecursiveASTVisitor to find interesting AST nodes.
// * How to use the Rewriter API to rewrite the source code.
//
// Eli Bendersky (eliben@gmail.com)
// This code is in the public domain
//------------------------------------------------------------------------------
#include <iostream>
#include <sstream>
#include <string>
@@ -78,55 +68,6 @@ class MyASTVisitor : public RecursiveASTVisitor<MyASTVisitor> {
public:
  MyASTVisitor(Rewriter &R, CompilerInstance &c)
      : TheRewriter(R), TheCompInst(c) {}

  bool VisitStmt(Stmt *s) {
    // Only care about If statements.
    if (isa<IfStmt>(s)) {
      IfStmt *IfStatement = cast<IfStmt>(s);
      Stmt *Then = IfStatement->getThen();

      TheRewriter.InsertText(Then->getBeginLoc(), "// the 'if' part\n", true,
                             true);

      Stmt *Else = IfStatement->getElse();
      if (Else)
        TheRewriter.InsertText(Else->getBeginLoc(), "// the 'else' part\n",
                               true, true);
    }

    return true;
  }

  bool VisitFunctionDecl(FunctionDecl *f) {

    // Only function definitions (with bodies), not declarations.
    if (f->hasBody()) {
      Stmt *FuncBody = f->getBody();

      // Type name as string
      QualType QT = f->getReturnType();
      std::string TypeStr = QT.getAsString();

      // Function name
      DeclarationName DeclName = f->getNameInfo().getName();
      std::string FuncName = DeclName.getAsString();

      // Add comment before
      std::stringstream SSBefore;
      SSBefore << "// Begin function " << FuncName << " returning " << TypeStr
               << "\n";
      SourceLocation ST = f->getSourceRange().getBegin();
      TheRewriter.InsertText(ST, SSBefore.str(), true, true);

      // And after
      std::stringstream SSAfter;
      SSAfter << "\n// End function " << FuncName;
      ST = FuncBody->getEndLoc().getLocWithOffset(1);
      TheRewriter.InsertText(ST, SSAfter.str(), true, true);
    }

    return true;
  }
  bool TraverseLambdaBody(LambdaExpr *LE) {
    SourceManager &SM = TheRewriter.getSourceMgr();
    LangOptions &lo = TheCompInst.getLangOpts();
@@ -203,14 +144,12 @@ private:
class MyASTConsumer : public ASTConsumer {
public:
  MyASTConsumer(Rewriter &R, CompilerInstance &c) : Visitor(R, c) {}

  // Override the method that gets called for each parsed top-level
  // declaration.
  bool HandleTopLevelDecl(DeclGroupRef DR) override {
    for (DeclGroupRef::iterator b = DR.begin(), e = DR.end(); b != e; ++b) {
      // Traverse the declaration using our AST visitor.
      Visitor.TraverseDecl(*b);
    //   (*b)->dump();
    }
    return true;
  }
@@ -227,7 +166,6 @@ public:
    SourceManager &SM = TheRewriter.getSourceMgr();
    llvm::errs() << "** EndSourceFileAction for: "
                 << SM.getFileEntryForID(SM.getMainFileID())->getName() << "\n";

    // Now emit the rewritten buffer.
    TheRewriter.getEditBuffer(SM.getMainFileID()).write(llvm::outs());
  }