Skip to content

Commit

Permalink
MPark.Variant: CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Feb 16, 2018
1 parent d1ef948 commit e05de7a
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 16 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ openpmd_option(ADIOS2 "Enable ADIOS2 support" OFF)
# openpmd_option(JSON "Enable JSON support" AUTO)
# openpmd_option(PYTHON "Enable Python bindings" OFF)

option(openPMD_USE_INTERNAL_VARIANT "Use internally shipped MPark.Variant" ON)

set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING
Expand Down Expand Up @@ -218,6 +220,15 @@ target_include_directories(openPMD PUBLIC
$<INSTALL_INTERFACE:include>
)

# C++11 std::variant (C++17 stdlib preview)
if(openPMD_USE_INTERNAL_VARIANT)
target_include_directories(openPMD PUBLIC ${openPMD_SOURCE_DIR}/include/mpark_variant)
message(STATUS "MPark.Variant: Using INTERNAL version 1.3.0")
else()
find_package(mpark_variant 1.3.0 REQUIRED)
endif()
target_link_libraries(openPMD PUBLIC mpark_variant)

if(TARGET Boost::filesystem)
target_link_libraries(openPMD PUBLIC
Boost::boost Boost::system Boost::filesystem)
Expand Down
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ Required:
* CMake 3.10.0+
* Boost 1.62.0+: `filesystem`, `system`, `unit_test_framework`

Shipped internally:
* [MPark.Variant](https://github.com/mpark/variant) 1.3.0+

Optional I/O backends:
* HDF5 1.8.6+
* ADIOS 1.10+ (*not yet implemented*)
Expand Down Expand Up @@ -129,16 +132,23 @@ sudo make install
The following options can be added to the `cmake` call to control features.
CMake controls options with prefixed `-D`, e.g. `-DopenPMD_USE_MPI=OFF`:

| CMake Option | Values | Description |
|--------------------|------------------|----------------------------------------|
| openPMD_USE_MPI | **AUTO**/ON/OFF | Enable MPI support |
| openPMD_USE_HDF5 | **AUTO**/ON/OFF | Enable support for HDF5 |
| openPMD_USE_ADIOS1 | **AUTO**/ON/OFF | Enable support for ADIOS1 <sup>1</sup> |
| openPMD_USE_ADIOS2 | AUTO/ON/**OFF** | Enable support for ADIOS2 <sup>1</sup> |
| openPMD_USE_PYTHON | AUTO/ON/**OFF** | Enable Python bindings <sup>1</sup> |
| CMake Option | Values | Description |
|----------------------|------------------|----------------------------------------|
| `openPMD_USE_MPI` | **AUTO**/ON/OFF | Enable MPI support |
| `openPMD_USE_HDF5` | **AUTO**/ON/OFF | Enable support for HDF5 |
| `openPMD_USE_ADIOS1` | **AUTO**/ON/OFF | Enable support for ADIOS1 <sup>1</sup> |
| `openPMD_USE_ADIOS2` | AUTO/ON/**OFF** | Enable support for ADIOS2 <sup>1</sup> |
| `openPMD_USE_PYTHON` | AUTO/ON/**OFF** | Enable Python bindings <sup>1</sup> |

<sup>1</sup> *not yet implemented*

Additionally, the following libraries are shipped internally.
The following options allow to switch to external installs:

| CMake Option | Values | Library | Version |
|--------------------------------|------------|---------------|---------|
| `openPMD_USE_INTERNAL_VARIANT` | **ON**/OFF | MPark.Variant | 1.13.0+ |

By default, this will build as a static library (`libopenPMD.a`) and installs also its headers.
In order to build a static library, append `-DBUILD_SHARED_LIBS=ON` to the `cmake` command.
You can only build a static or a shared library at a time.
Expand Down Expand Up @@ -170,3 +180,4 @@ if(openPMD_FOUND)
target_link_libraries(YourTarget PRIVATE openPMD::openPMD)
endif()
```

28 changes: 19 additions & 9 deletions docs/source/dev/buildoptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,31 @@ Build Options
The following options can be added to the ``cmake`` call to control features.
CMake controls options with prefixed ``-D``, e.g. ``-DopenPMD_USE_MPI=OFF``:

=================== =============== ==================================
CMake Option Values Description
=================== =============== ==================================
openPMD_USE_MPI **AUTO**/ON/OFF Enable MPI support
openPMD_USE_HDF5 **AUTO**/ON/OFF Enable support for HDF5
openPMD_USE_ADIOS1 **AUTO**/ON/OFF Enable support for ADIOS1 :sup:`1`
openPMD_USE_ADIOS2 AUTO/ON/**OFF** Enable support for ADIOS2 :sup:`1`
openPMD_USE_PYTHON AUTO/ON/**OFF** Enable Python bindings :sup:`1`
=================== =============== ==================================
====================== =============== ==================================
CMake Option Values Description
====================== =============== ==================================
``openPMD_USE_MPI`` **AUTO**/ON/OFF Enable MPI support
``openPMD_USE_HDF5`` **AUTO**/ON/OFF Enable support for HDF5
``openPMD_USE_ADIOS1`` **AUTO**/ON/OFF Enable support for ADIOS1 :sup:`1`
``openPMD_USE_ADIOS2`` AUTO/ON/**OFF** Enable support for ADIOS2 :sup:`1`
``openPMD_USE_PYTHON`` AUTO/ON/**OFF** Enable Python bindings :sup:`1`
====================== =============== ==================================

:sup:`1` *not yet implemented*

Additionally, the following libraries are shipped internally.
The following options allow to switch to external installs:

================================ =========== ============= ========
CMake Option Values Library Version
================================ =========== ============= ========
``openPMD_USE_INTERNAL_VARIANT`` **ON**/OFF MPark.Variant 1.13.0+
================================ =========== ============= ========

By default, this will build as a static library (``libopenPMD.a``) and installs also its headers.
In order to build a static library, append ``-DBUILD_SHARED_LIBS=ON`` to the ``cmake`` command.
You can only build a static or a shared library at a time.

By default, the ``Release`` version is built.
In order to build with debug symbols, pass ``-DCMAKE_BUILD_TYPE=Debug`` to your ``cmake`` command.

8 changes: 8 additions & 0 deletions docs/source/dev/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ Required
* CMake 3.10.0+
* Boost 1.62.0+: ``filesystem``, ``system``, ``unit_test_framework``

Shipped internally
------------------

The following libraries shipped internally:

* `MPark.Variant <https://github.com/mpark/variant>`_ 1.3.0+

Optional: I/O backends
----------------------

Expand All @@ -32,3 +39,4 @@ Optional: language bindings

* pybind11 2.3.0+
* xtensor-python 0.17.0+

0 comments on commit e05de7a

Please sign in to comment.