Skip to content
This repository was archived by the owner on Mar 22, 2023. It is now read-only.

Commit 480c990

Browse files
authored
Merge pull request #985 from KFilipek/fix-readme_windows_build
readme: update readme file
2 parents bdb0b1b + ad4b9e8 commit 480c990

1 file changed

Lines changed: 112 additions & 38 deletions

File tree

README.md

Lines changed: 112 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
libpmemobj-cpp
2-
===============
1+
# libpmemobj-cpp
32

43
[![Build Status](https://travis-ci.org/pmem/libpmemobj-cpp.svg?branch=master)](https://travis-ci.org/pmem/libpmemobj-cpp)
54
[![Build status](https://github.com/pmem/libpmemobj-cpp/workflows/CPP/badge.svg)](https://github.com/pmem/libpmemobj-cpp/actions)
@@ -14,80 +13,155 @@ More implementation details can be found in [include/libpmemobj++/README.md](inc
1413
Latest releases can be found on the ["releases" tab](https://github.com/pmem/libpmemobj-cpp/releases).
1514
Up-to-date support/maintenance status of branches/releases is available on [pmem.io](https://pmem.io/libpmemobj-cpp).
1615

17-
# Compatibility note #
18-
In libpmemobj 1.12 we introduced a new transaction handler type: [pmem::obj::flat_transaction](https://pmem.io/libpmemobj-cpp/master/doxygen/classpmem_1_1obj_1_1flat__transaction.html). By defining LIBPMEMOBJ_CPP_USE_FLAT_TRANSACTION you can make pmem::obj::transaction to be an alias to pmem::obj::flat_transaction. In 1.12 we have also changed the default behavior of containers' transactional methods. Now, in case of any failure within such method, the outer transaction (if any) will not be immediately aborted. Instead, an exception will be thrown, which will lead to transaction abort only if it's not caught before the outer tx scope ends. To change the behavior to the old one, you can set LIBPMEMOBJ_CPP_FLAT_TX_USE_FAILURE_RETURN macro to 0. Be aware that the old behavior can lead to segfaults in some cases (see tx_nested_struct_example in this [file](examples/transaction/transaction.cpp)).
16+
## Compatibility note
17+
In libpmemobj 1.12 we introduced a new transaction handler type: [pmem::obj::flat_transaction](https://pmem.io/libpmemobj-cpp/master/doxygen/classpmem_1_1obj_1_1flat__transaction.html).
18+
By defining LIBPMEMOBJ_CPP_USE_FLAT_TRANSACTION you can make pmem::obj::transaction to be an alias to pmem::obj::flat_transaction.
19+
In 1.12 we have also changed the default behavior of containers' transactional methods. Now, in case of any failure within such method,
20+
the outer transaction (if any) will not be immediately aborted. Instead, an exception will be thrown, which will lead to transaction abort
21+
only if it's not caught before the outer tx scope ends. To change the behavior to the old one, you can set LIBPMEMOBJ_CPP_FLAT_TX_USE_FAILURE_RETURN macro to 0.
22+
Be aware that the old behavior can lead to segfaults in some cases (see tx_nested_struct_example in this [file](examples/transaction/transaction.cpp)).
23+
24+
## Table of contents
25+
1. [Pre-built packages](#pre-built-packages)
26+
- [Windows](#windows)
27+
- [Ubuntu/Debian](#ubuntudebian)
28+
- [Fedora/RHEL](#fedorarhel)
29+
2. [Dependencies](#dependencies)
30+
3. [Linux build](#linux-build)
31+
- [Standard compilation](#standard-compilation)
32+
- [Developer compilation](#developer-compilation)
33+
- [Distribution package build](#distribution-package-build)
34+
- [Compilation with Valgrind instrumentation](#compilation-with-valgrind-instrumentation)
35+
4. [Windows build](#windows-build)
36+
- [Install prerequisites via vcpkg](#install-prerequisites-via-vcpkg)
37+
- [Compilation with Visual Studio 2015](#compilation-with-visual-studio-2015)
38+
- [Compilation with Visual Studio 2017 or above](#compilation-with-visual-studio-2017-or-above)
39+
5. [Extra CMake compilation flags](#extra-cmake-compilation-flags)
40+
6. [Contact us](#contact-us)
41+
42+
## Pre-built packages
43+
The best way to install stable releases, tested on specific OS, is to use package manager.
44+
45+
### Windows
46+
The recommended and the easiest way to install **libpmemobj-cpp** on Windows is to use Microsoft's vcpkg. Vcpkg is an open source tool and ecosystem created for library management.
47+
For more information about vcpkg please see [vcpkg repository](https://github.com/microsoft/vcpkg#quick-start-windows).
48+
```ps
49+
.\vcpkg.exe install libpmemobj-cpp:x64-windows
50+
```
51+
52+
### Ubuntu/Debian
53+
For installation on Debian-related distros please execute following commands:
54+
```
55+
# apt install libpmemobj-cpp-dev
56+
```
57+
58+
### Fedora/RHEL
59+
To install **libpmemobj-cpp** on Fedora or RedHat execute:
60+
```
61+
# dnf install libpmemobj++-devel
62+
```
1963

20-
# How to build #
64+
## Dependencies
65+
You will need the following packages for compilation:
2166

22-
## Requirements: ##
23-
- cmake >= 3.3
24-
- libpmemobj-dev(el) >= 1.8 (https://pmem.io/pmdk/)
25-
- compiler with C++11 support:
26-
- GCC >= 4.8.1 (C++11 is supported in GCC since version 4.8.1, but it does not support expanding variadic template variables in lambda expressions, which is required to build persistent containers and is possible with GCC >= 4.9.0. If you want to build libpmemobj-cpp without testing containers, use flag TEST_XXX=OFF (separate flag for each container))
27-
- clang >= 3.3
67+
- **cmake** >= 3.3
68+
- **libpmemobj-dev(el)** >= 1.8 (https://pmem.io/pmdk/)
69+
- compiler with C++11 support
70+
- **gcc** >= 4.8.1<sup> 1</sup>
71+
- **clang** >= 3.3
72+
- **msbuild** >= 14<sup> 2</sup>
2873
- for testing and development:
29-
- valgrind-devel (at best with [pmemcheck support](https://github.com/pmem/valgrind))
30-
- clang format 9.0
31-
- perl
74+
- **valgrind-devel** (at best with [pmemcheck support](https://github.com/pmem/valgrind))
75+
- **clang-format** 9.0
76+
- **perl**
77+
- for Windows compilation:
78+
- [**vcpkg**](https://github.com/microsoft/vcpkg#quick-start-windows)
3279

33-
### Additional requirements: ###
34-
**radix_tree**: on Windows, Visual Studio in version at least 2017 is needed. Testing and/or installing radix_tree can be disable via CMake options.
80+
><sup>1</sup> C++11 is supported in GCC since version 4.8.1, but it does not support expanding variadic template variables in lambda expressions, which is required to build persistent containers and is possible with GCC >= 4.9.0. If you want to build libpmemobj-cpp without testing containers, use flag TEST_XXX=OFF (separate flag for each container).
3581
36-
## On Linux ##
82+
><sup>2</sup> **radix_tree** is supported on Windows with MSBuild >=15 (Visual Studio at least 2017 is needed). Testing radix_tree can be disabled via CMake option (use -DTEST_RADIX_TREE=OFF).
3783
38-
```sh
84+
## Linux build
85+
### Standard compilation
86+
```
3987
$ mkdir build
4088
$ cd build
4189
$ cmake ..
42-
$ make
43-
$ make install
90+
$ make [-DCMAKE_INSTALL_PREFIX=<path_to_installation_dir>]
91+
# make install
4492
```
4593

46-
#### When developing: ####
94+
### Developer compilation
4795
```sh
48-
$ ...
96+
$ mkdir build
97+
$ cd build
4998
$ cmake .. -DCMAKE_BUILD_TYPE=Debug -DDEVELOPER_MODE=1 -DCHECK_CPP_STYLE=1
50-
$ ...
99+
$ make
51100
$ ctest --output-on-failure
52101
```
53102

54-
#### To build packages ####
103+
### Distribution package build
55104
```sh
56-
...
57-
cmake .. -DCPACK_GENERATOR="$GEN" -DCMAKE_INSTALL_PREFIX=/usr
58-
make package
105+
$ mkdir build
106+
$ cd build
107+
$ cmake .. -DCPACK_GENERATOR="$GEN" -DCMAKE_INSTALL_PREFIX=/usr
108+
$ make package
59109
```
60110

61111
$GEN is type of package generator and can be RPM or DEB
62112

63113
CMAKE_INSTALL_PREFIX must be set to a destination were packages will be installed
64114

65-
#### To use with Valgrind ####
115+
### Compilation with Valgrind instrumentation
66116

67117
In order to build your application with libpmemobj-cpp and
68118
[pmemcheck](https://github.com/pmem/valgrind) / memcheck / helgrind / drd,
69119
Valgrind instrumentation must be enabled during compilation by adding flags:
70-
- LIBPMEMOBJ_CPP_VG_PMEMCHECK_ENABLED=1 for pmemcheck instrumentation,
71-
- LIBPMEMOBJ_CPP_VG_MEMCHECK_ENABLED=1 for memcheck instrumentation,
72-
- LIBPMEMOBJ_CPP_VG_HELGRIND_ENABLED=1 for helgrind instrumentation,
120+
- LIBPMEMOBJ_CPP_VG_PMEMCHECK_ENABLED=1 for pmemcheck instrumentation
121+
- LIBPMEMOBJ_CPP_VG_MEMCHECK_ENABLED=1 for memcheck instrumentation
122+
- LIBPMEMOBJ_CPP_VG_HELGRIND_ENABLED=1 for helgrind instrumentation
73123
- LIBPMEMOBJ_CPP_VG_DRD_ENABLED=1 for drd instrumentation, or
74124
- LIBPMEMOBJ_CPP_VG_ENABLED=1 for all Valgrind instrumentations (including pmemcheck).
75125

76126
If there are no memcheck / helgrind / drd / pmemcheck headers installed on your
77127
system, build will fail.
78128

79-
## On Windows ##
129+
## Windows build
80130

81-
#### Install libpmemobj via vcpkg ####
82-
```sh
131+
### Install prerequisites via vcpkg
132+
```ps
83133
vcpkg install pmdk:x64-windows
84134
vcpkg integrate install
85135
```
86136

87-
```sh
88-
...
137+
### Compilation with Visual Studio 2015
138+
```ps
89139
cmake . -Bbuild -G "Visual Studio 14 2015 Win64"
90-
-DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake
140+
-DCMAKE_TOOLCHAIN_FILE="c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake"
141+
-DTEST_RADIX_TREE=OFF
91142
92-
msbuild build/ALL_BUILD.vcxproj
143+
msbuild build/ALL_BUILD.vcxproj /m
93144
```
145+
### Compilation with Visual Studio 2017 or above
146+
```ps
147+
cmake . -Bbuild -G "Visual Studio 15 2017" -A "x64"
148+
-DCMAKE_TOOLCHAIN_FILE="c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake"
149+
150+
msbuild build/ALL_BUILD.vcxproj /m
151+
```
152+
153+
## Extra CMake compilation flags
154+
For custom build you can use CMake flags to change build type, change C++ standard, enable/disable components or features for testing purposes.
155+
To list all CMake flags use the following:
156+
```sh
157+
$ mkdir build
158+
$ cd build
159+
$ cmake ..
160+
$ cmake -LH
161+
```
162+
or just use graphical CMake frontend like **cmake-qt-gui** or **cmake-curses-gui**.
163+
164+
## Contact us
165+
For more information on this library, contact Szymon Romik (szymon.romik@intel.com),
166+
Piotr Balcer (piotr.balcer@intel.com) or post on our **#pmem** Slack channel using
167+
[this invite link](https://join.slack.com/t/pmem-io/shared_invite/enQtNzU4MzQ2Mzk3MDQwLWQ1YThmODVmMGFkZWI0YTdhODg4ODVhODdhYjg3NmE4N2ViZGI5NTRmZTBiNDYyOGJjYTIyNmZjYzQxODcwNDg) or [Google group](https://groups.google.com/group/pmem).

0 commit comments

Comments
 (0)