Skip to content

Commit

Permalink
Update build instructions after conda packaging of dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainCorlay committed Jan 30, 2017
1 parent fda8d63 commit 6fd530d
Show file tree
Hide file tree
Showing 10 changed files with 201 additions and 38 deletions.
30 changes: 30 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
build: false

os: Visual Studio 2015

platform:
- x64
- x86

environment:
matrix:
- MINICONDA: C:\xtensor-conda

init:
- "ECHO %MINICONDA%"
- C:\"Program Files (x86)"\"Microsoft Visual Studio 14.0"\VC\vcvarsall.bat %PLATFORM%
- ps: if($env:Platform -eq "x64"){Start-FileDownload 'http://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe' C:\Miniconda.exe; echo "Done"}
- ps: if($env:Platform -eq "x86"){Start-FileDownload 'http://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86.exe' C:\Miniconda.exe; echo "Done"}
- cmd: C:\Miniconda.exe /S /D=C:\xtensor-conda
- "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%MINICONDA%\\Library\\bin;%PATH%"

install:
# Install conda
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
- conda install cmake cppzmq zeromq rapidjson cryptopp -c conda-forge
- mkdir build
- cd build
- cmake -G "NMake Makefiles" -D CMAKE_INSTALL_PREFIX=%MINICONDA%\\LIBRARY -D BUILD_EXAMPLES=ON ..
- nmake
105 changes: 105 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
language: cpp
matrix:
include:
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.9
env: COMPILER=gcc GCC=4.9
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-5
env: COMPILER=gcc GCC=5
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
env: COMPILER=gcc GCC=6
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.6
packages:
- clang-3.6
env: COMPILER=clang CLANG=3.6
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.7
packages:
- clang-3.7
env: COMPILER=clang CLANG=3.7
- os: linux
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
env: COMPILER=clang CLANG=3.8
#- os: osx
# osx_image: xcode8
# compiler: clang
env:
global:
- MINCONDA_VERSION="latest"
- MINCONDA_LINUX="Linux-x86_64"
- MINCONDA_OSX="MacOSX-x86_64"
before_install:
- |
# Configure build variables
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
if [[ "$COMPILER" == "gcc" ]]; then
export CXX=g++-$GCC CC=gcc-$GCC;
fi
if [[ "$COMPILER" == "clang" ]]; then
export CXX=clang++-$CLANG CC=clang-$CLANG;
fi
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
export CXX=clang++ CC=clang;
fi
install:
# Install conda
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
MINCONDA_OS=$MINCONDA_LINUX;
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
MINCONDA_OS=$MINCONDA_OSX;
fi
- wget "http://repo.continuum.io/miniconda/Miniconda3-$MINCONDA_VERSION-$MINCONDA_OS.sh" -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- hash -r
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda info -a
# Start test environement
- conda env create -f ./test/test-environment.yml
- source activate test-xeus
# Build
- mkdir build
- cd build
- cmake -D BUILD_EXAMPLES=ON ..
- make
script:
- |
cd example
cd echo_kernel
./echo_kernel &
cd ..
cd echo_client
./echo_client
57 changes: 35 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ![xeus](http://quantstack.net/assets/images/xeus.svg)

[![Travis](https://travis-ci.org/QuantStack/xeus.svg?branch=master)](https://travis-ci.org/QuantStack/xeus)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/5alkw5iiere4mox2?svg=true)](https://ci.appveyor.com/project/QuantStack/xeus)
[![Documentation Status](http://readthedocs.org/projects/xeus/badge/?version=latest)](https://xeus.readthedocs.io/en/latest/?badge=latest)

C++ implementation of the Jupyter Kernel protocol

## Introduction
Expand All @@ -8,21 +12,38 @@ C++ implementation of the Jupyter Kernel protocol
burden of implementing the Jupyter Kernel protocol so developers can focus on implementing the
interpreter part of the Kernel.

## Manual Building and installation
## Building and Installing from Source

`xeus` depends on the following libraries:

- [libzmq](https://github.com/zeromq/libzmq)
- [cppzmq](https://github.com/zeromq/cppzmq)
- [rapidjson](https://github.com/miloyip/rapidjson)
- [cryptopp](https://github.com/weidai11/cryptopp)
- [`libzmq`](https://github.com/zeromq/libzmq) ^4.2.1, [`cppzmq`](https://github.com/zeromq/cppzmq), [`rapidjson`](https://github.com/miloyip/rapidjson) and [`cryptopp`](https://github.com/weidai11/cryptopp).

On Unix platforms, `xeus` also requires `libuuid`, which is available in all linux distributions (`uuid-dev` on Debian).

We have packaged all these dependencies for the conda package manager. The simplest way to install them with
conda is to run:

```bash
conda install cmake zeromq cppzmq rapidjson cryptopp -c conda-forge
```

On Unix platform, you will also need:

```bash
conda install libuuid -c conda-forge
```

Once you have installed the dependencies, you can build and install `xeus`:

```bash
cmake -D BUILD_EXAMPLES=ON -D CMAKE_BUILD_TYPE=Release
make
make install
```

Depending on your system and the installation method you use, cmake may not be able to find them.
In that case, a solution is to build these dependencies with cmake. On windows, you can use the
"NMake Makefiles" generator so you don't have to open Visual Studio to compile and install. Be
sure to run cmake from the Developer Command Prompt for Visual Studio.
If you need the `xeus` library only, you can omit the `BUILD_EXAMPLES` settings.

On Unix operating systems, `xeus` also depends on `libuuid`, which is generally provided as a package for common linux distribution (`uuid-dev` on Debian).
## Installing the Dependencies from Source

### libzmq

Expand All @@ -32,8 +53,6 @@ cmake -D WITH_PERF_TOOL=OFF -D ZMQ_BUILD_TESTS=OFF -D ENABLE_CPACK=OFF
make
make install
```
Note: this ensures you build the library only, tests and performance tools are not required
for building `xeus`.

### cppzmq

Expand Down Expand Up @@ -66,15 +85,9 @@ make
make install
```

### xeus

Once you've built and installed the dependencies, you can build `xeus`:
## License

```bash
cmake -D BUILD_EXAMPLES=ON -D CMAKE_BUILD_TYPE=Release
make
make install
```

If you need the `xeus` library only, you can omit the `BUILD_EXAMPLES` settings.
We use a shared copyright model that enables all contributors to maintain the
copyright on their contributions.

This software is licensed under the BSD-3-Clause license. See the [LICENSE](LICENSE) file for details.
18 changes: 11 additions & 7 deletions example/echo_client/echo_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ std::mutex cout_mutex;

xclient::xclient(const xeus::xconfiguration& config,
const std::string& user_name,
int nb_msg,
zmq::context_t& context)
: m_shell(context, zmq::socket_type::req),
m_control(context, zmq::socket_type::req),
m_iosub(context, zmq::socket_type::sub),
p_authentication(xeus::make_xauthentication(config.m_signature_scheme, config.m_key)),
p_io_authentication(xeus::make_xauthentication(config.m_signature_scheme, config.m_key)),
m_user_name(user_name),
m_session_id(xeus::new_xguid().to_string()),
m_nb_msg(nb_msg)
m_session_id(xeus::new_xguid().to_string())
{
std::string sep = get_end_point(config.m_transport, config.m_ip, config.m_shell_port);
m_shell.connect(sep);
Expand Down Expand Up @@ -134,8 +132,7 @@ std::mutex cout_mutex;

void xclient::run_io_suscriber()
{
int nb_rcv = 0;
while (nb_rcv < m_nb_msg * 2)
while (true)
{
zmq::multipart_t wire_msg;
wire_msg.recv(m_iosub);
Expand All @@ -158,7 +155,6 @@ std::mutex cout_mutex;
}
else if(topic.substr(topic_size - 13, topic_size) == "execute_input")
{
++nb_rcv;
const xeus::xjson& content = msg.content();
const xeus::xjson::node_type* code_ptr = content.get_node("/code");
std::string code = std::string(code_ptr->GetString(), code_ptr->GetStringLength());
Expand All @@ -168,9 +164,17 @@ std::mutex cout_mutex;
oss << std::endl;
print(oss.str());
}
else if(topic.substr(topic_size - 8, topic_size) == "shutdown")
{
const xeus::xjson& content = msg.content();
std::ostringstream oss;
oss << "Kernel shut down" << std::endl;
oss << std::endl;
print(oss.str());
break;
}
else
{
++nb_rcv;
const xeus::xjson& content = msg.content();
int execution_count = content.get_int("/execution_count");
std::ostringstream oss;
Expand Down
2 changes: 0 additions & 2 deletions example/echo_client/echo_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ namespace echo_client

xclient(const xeus::xconfiguration& config,
const std::string& user_name,
int nb_msg,
zmq::context_t& context);

void send_code(const std::string& code);
Expand All @@ -42,7 +41,6 @@ namespace echo_client

std::string m_user_name;
std::string m_session_id;
int m_nb_msg;
};

}
6 changes: 3 additions & 3 deletions example/echo_client/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@

using namespace std::chrono_literals;

int main(int argc, char* argv[])
int main(int, char**)
{
xeus::xconfiguration config = xeus::load_configuration("connection.json");

std::string user_name = "jmabille";
std::string user_name = "JohanMabille";
int nb_msg = 4;
zmq::context_t context;

echo_client::xclient client(config, user_name, nb_msg, context);
echo_client::xclient client(config, user_name, context);

std::this_thread::sleep_for(50ms);

Expand Down
6 changes: 3 additions & 3 deletions include/xeus/xjson.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ namespace xeus
const node_type* node = get_bool_impl(name);
if (node == nullptr)
{
throw std::runtime_error("Bool attribute not found in json");
throw std::runtime_error("Bool attribute " + std::string(name) + " not found in json");
}
return node->GetBool();
}
Expand All @@ -137,7 +137,7 @@ namespace xeus
const node_type* node = get_int_impl(name);
if (node == nullptr)
{
throw std::runtime_error("Int attribute not found in json");
throw std::runtime_error("Int attribute " + std::string(name) + " not found in json");
}
return node->GetInt();
}
Expand All @@ -155,7 +155,7 @@ namespace xeus
const node_type* node = get_string_impl(name);
if (node == nullptr)
{
throw std::runtime_error("String attribute not found in json");
throw std::runtime_error("String attribute " + std::string(name) + " not found in json");
}
return std::string(node->GetString(), node->GetStringLength());
}
Expand Down
2 changes: 1 addition & 1 deletion include/xeus/xkernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* The full license is in the file LICENSE, distributed with this software. *
****************************************************************************/

#ifndef XKERNERL_HPP
#ifndef XKERNEL_HPP
#define XKERNEL_HPP

#include <memory>
Expand Down
2 changes: 2 additions & 0 deletions readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
conda:
file: docs/environment.yml
11 changes: 11 additions & 0 deletions test/test-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: test-xeus
channels:
- conda-forge
- defaults
dependencies:
- cmake
- libuuid
- zeromq
- cppzmq
- rapidjson
- cryptopp

0 comments on commit 6fd530d

Please sign in to comment.