README.md 4.12 KB
Newer Older
1
2
3
4
# nRF5 Bluetooth Low Energy GAP/GATT driver

## Introduction
pc-ble-driver is a serialization library over serial port required by the following repos:
5

6
* [pc-ble-driver-js  library](https://github.com/NordicSemiconductor/pc-ble-driver-js)
cacu's avatar
cacu committed
7
* [pc-ble-driver-py  library](https://github.com/NordicSemiconductor/pc-ble-driver-py)
8

cacu's avatar
cacu committed
9
The library is included as a submodule by the repositories above, and it should be built as part of them.
10

cacu's avatar
cacu committed
11
# Installing and building Boost
12

cacu's avatar
cacu committed
13
The Boost static libraries required by this drivers must be built before you can build any of the
cacu's avatar
cacu committed
14
repositories above that depend on pc-ble-driver.
15

cacu's avatar
cacu committed
16
## Obtain the Boost source code
17

cacu's avatar
cacu committed
18
19
Note: This step is not required for OS X.

cacu's avatar
cacu committed
20
Use the following link to download the Boost source code:
cacu's avatar
cacu committed
21

cacu's avatar
cacu committed
22
* [Boost](http://www.boost.org/users/download) (>=1.54.0)
23

cacu's avatar
Doc fix    
cacu committed
24
- Download and extract Boost to a folder of your choice.
cacu's avatar
cacu committed
25
- Set the environment variable `BOOST_ROOT` to the path where you have extracted Boost.
cacu's avatar
cacu committed
26

cacu's avatar
cacu committed
27
For example on Windows assuming you've unpacked Boost in `c:\boost\boost_1_xx_y`:
cacu's avatar
cacu committed
28

cacu's avatar
cacu committed
29
    BOOST_ROOT = "c:\boost\boost_1_xx_y"
cacu's avatar
cacu committed
30

cacu's avatar
cacu committed
31
And on Linux or OS X assuming you've unpacked Boost in `~/boost/boost_1_xx_y`:
cacu's avatar
cacu committed
32

cacu's avatar
cacu committed
33
    BOOST_ROOT = "~/boost/boost_1_xx_y"
34

cacu's avatar
cacu committed
35
### Windows 
cacu's avatar
cacu committed
36

cacu's avatar
cacu committed
37
Install Microsoft Visual Studio. The following versions supported are:
cacu's avatar
cacu committed
38
39
40
41

* Visual Studio 2013 (MSVC 12.0)
* Visual Studio 2015 (MSVC 14.0)

cacu's avatar
cacu committed
42
Open a Microsoft Visual Studio Command Prompt and issue the following commands:
43

cacu's avatar
cacu committed
44
    > cd %BOOST_ROOT%
45
    > bootstrap.bat
cacu's avatar
cacu committed
46
    > b2 toolset=msvc-<VV.V> address-model=<32,64> link=static --with-thread --with-system --with-regex --with-date_time --with-chrono
cacu's avatar
cacu committed
47

Carles Cufi's avatar
Carles Cufi committed
48
49
50
**Note**: If you intend to build a 64-bit version of Boost, and depending on the version of Visual Studio you use, you might need to open a 64-bit command prompt such as
"Visual Studio 2015 x86 x64 Cross Tools Command Prompt" or similar, or run `vcvarsall.bat x86_amd64` or `setenv.cmd" /Release /x64`.

cacu's avatar
cacu committed
51
**Note**: Refer to the [compiler list](http://www.boost.org/build/doc/html/bbv2/reference/tools.html#bbv2.reference.tools.compilers) of the Boost documentation 
52
53
to find the version of the MSVC that you need to provide using the `toolset=` option.

cacu's avatar
cacu committed
54
55
**Note**: Select 32 or 64-bit with the `address-model=` option.

Carles Cufi's avatar
Carles Cufi committed
56
57
#### Examples

Carles Cufi's avatar
Carles Cufi committed
58
59
60
Build 32-bit Boost with Visual Studio 2013:

    > b2 toolset=msvc-12.0 address-model=32 link=static --with-thread --with-system --with-regex --with-date_time --with-chrono
Carles Cufi's avatar
Carles Cufi committed
61

Carles Cufi's avatar
Carles Cufi committed
62
Build 64-bit Boost with Visual Studio 2015:
Carles Cufi's avatar
Carles Cufi committed
63

Carles Cufi's avatar
Carles Cufi committed
64
    > b2 toolset=msvc-14.0 address-model=64 link=static --with-thread --with-system --with-regex --with-date_time --with-chrono
cacu's avatar
cacu committed
65

66
67
68
69
#### Side-by-side 32 and 64-bit versions

If you want to be able to have both the 32 and 64-bit versions of Boost available, add `--stagedir=./stage/x86` when building the 32-bit version and `--stagedir=./stage/x64` when building the 64-bit one, and they will be placed in `stage/x86` and `stage/x64` respectively. Later on you when building repositories that depend on this one, you will be able to point CMake the correct version of the libraries by using `-DBOOST_LIBRARYDIR:STRING="c:\boost\boost_1_61_0\stage\x<XX>\lib`.

cacu's avatar
cacu committed
70
### Ubuntu Linux
71

cacu's avatar
cacu committed
72
73
74
75
Install the required packages to build Boost:

    sudo apt-get install git make gcc g++

Carles Cufi's avatar
Carles Cufi committed
76
77
78
79
Additionally if you want to build non-native binaries (for example 32-bit binaries on a 64-bit Ubuntu installation):

    sudo apt-get install gcc-multilib

cacu's avatar
cacu committed
80
Open a terminal window and issue the following commands:
81

cacu's avatar
cacu committed
82
83
    $ cd $BOOST_ROOT
    $ ./bootstrap.sh
cacu's avatar
cacu committed
84
    $ ./b2 toolset=gcc cxxflags=-fPIC cflags=-fPIC address-model=<32,64> link=static --with-thread --with-system --with-regex --with-date_time --with-chrono
cacu's avatar
cacu committed
85
86

**Note**: Select 32 or 64-bit with the `address-model=` option.
cacu's avatar
cacu committed
87

cacu's avatar
cacu committed
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
### OS X 10.11 and later

Install Xcode from the App Store.

The simplest way to install Boost is to use Homebrew. If you don't have Homebrew installed simply run on a terminal:

    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

If you already have Homebrew installed, make sure it's up to date with:
  
    $ brew update
    $ brew upgrade

Once Homebrew is installed you can use the `brew` command on a terminal to install

    $ brew install boost
cacu's avatar
cacu committed
104