Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove some boost depedencies #278

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ if(SERIALBOX_TESTING_GRIDTOOLS)
set(SERIALBOX_HAS_GRIDTOOLS 1)
endif(SERIALBOX_TESTING_GRIDTOOLS)

# If ${REQUIRED_BOOST_COMPONENTS} is empty we still need the headers
find_package(Boost 1.54 REQUIRED)
find_package(Boost 1.54 REQUIRED) # only Boost headers
set(SERIALBOX_BOOST_VERSION ${Boost_VERSION})

#---------------------------------------- ClangTools -----------------------------------------------
Expand Down
28 changes: 2 additions & 26 deletions cmake/SerialboxConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ set(SERIALBOX_HAS_NETCDF "@SERIALBOX_USE_NETCDF@")
# SERIALBOX was compiled with logging support (requires Boost.Log)
set(SERIALBOX_HAS_LOGGING "@SERIALBOX_LOGGING@")

# Set Boost configuration
set(SERIALBOX_BOOST_LIB_VERSION "@Boost_LIB_VERSION@")
STRING(REGEX REPLACE "_" "." SERIALBOX_BOOST_VERSION ${SERIALBOX_BOOST_LIB_VERSION})
set(SERIALBOX_BOOST_LIBRARY_DIRS "@Boost_LIBRARY_DIRS@")
set(SERIALBOX_BOOST_INCLUDE_DIRS "@Boost_INCLUDE_DIRS@")
set(SERIALBOX_REQUIRED_BOOST_COMPONENTS "@REQUIRED_BOOST_COMPONENTS@")

#===---------------------------------------------------------------------------------------------===
# Helper functions used in this file
#====--------------------------------------------------------------------------------------------===
Expand Down Expand Up @@ -154,30 +147,13 @@ if(NOT(DEFINED SERIALBOX_NO_EXTERNAL_LIBS))
message( STATUS "Serialbox: find_dependency(Threads)" )
find_dependency(Threads)

set(BOOST_LIBRARYDIR "${SERIALBOX_BOOST_LIBRARY_DIRS}")
set(BOOST_INCLUDEDIR "${SERIALBOX_BOOST_INCLUDE_DIRS}")
set(Boost_NO_SYSTEM_PATHS "ON") # Force boost to search locations specified above

message( STATUS "Serialbox: find_dependency(Boost ${SERIALBOX_BOOST_VERSION} COMPONENTS ${SERIALBOX_REQUIRED_BOOST_COMPONENTS})")
find_dependency(Boost
${SERIALBOX_BOOST_VERSION} COMPONENTS ${SERIALBOX_REQUIRED_BOOST_COMPONENTS})
message( STATUS "Serialbox: find_dependency(Boost ${SERIALBOX_BOOST_VERSION})")
find_dependency(Boost ${SERIALBOX_BOOST_VERSION})
if(Boost_FOUND)
list(APPEND SERIALBOX_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
else()
# Give some diagnostic infos
set(WARN_STR "Serialbox: Boost (${SERIALBOX_BOOST_VERSION}) NOT found!")

if(DEFINED Boost_LIB_VERSION)
string(REPLACE "_" "." FOUND_BOOST_VERSION ${Boost_LIB_VERSION})
list(APPEND WARN_STR " (Found Boost ${FOUND_BOOST_VERSION})")
endif()

list(APPEND WARN_STR "\nRequired components:")

foreach(component ${SERIALBOX_REQUIRED_BOOST_COMPONENTS})
list(APPEND WARN_STR "\n - ${component}")
endforeach()

message(WARNING ${WARN_STR} "\n")
endif()

Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx/Building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Serialbox relies on `CMake <http://www.cmake.org/>`_ (>= 3.1), a cross-platform
Quick start
===========

To build Serialbox you need a C++17 toolchain, `CMake <http://www.cmake.org/>`_ and a fairly recent version of `Boost <http://www.boost.org/>`_. We use here the command-line, non-interactive CMake interface.
To build Serialbox you need a C++17 toolchain, `CMake <http://www.cmake.org/>`_ and `Boost <http://www.boost.org/>`_ headers. We use here the command-line, non-interactive CMake interface.

#. Make sure you have installed all the tools and dependencies, especially Boost and CMake.
See `Dependencies`_.
Expand Down
3 changes: 1 addition & 2 deletions docs/sphinx/C.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Consider the following minimalistic example, ``test.c``, which simply creates an
serialboxSerializerDestroy(serializer);
}

To compile this sample program, you have to link against ``SerialboxC`` and the dependency libraries. The dependency libraries include the Boost libraries (filesystem, system, chrono, log, date_time, log_setup, thread, regex and atomic) as well as the NetCDF and OpenSSL libraries. However, if you choose to link dynamically (i.e against ``libSerialboxC.so``), the dependencies will be resolved automatically:
To compile this sample program, you have to link against ``SerialboxC`` and the dependency libraries. The dependency libraries include the NetCDF and OpenSSL libraries. However, if you choose to link dynamically (i.e against ``libSerialboxC.so``), the dependencies will be resolved automatically:

.. code-block:: console

Expand All @@ -39,4 +39,3 @@ To compile this sample program, you have to link against ``SerialboxC`` and the
$ export LD_LIBRARY_PATH=$SERIALBOX_INSTALL_PATH/lib; ./test

In general, it is **strongly** advised to use the CMake find_package-module of Serialbox which takes care of linking against the correct libraries (see :doc:`Usage`).

3 changes: 1 addition & 2 deletions docs/sphinx/Fortran.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ The CMake build system of Serialbox takes care of setting the correct flags for
Using the Fortran Interface
===========================

To use the Fortran interface in your project, you need to link against ``libSerialboxFortran`` and the C++ standard library used to compile the code (e.g ``libstdc++`` for GNU gcc) as well as the dependency libraries (Boost and possibly NetCDF and OpenSSL). As this can be tedious, Serialbox provides a CMake find_package module (:ref:`FindSerialbox`) to handle this task.
To use the Fortran interface in your project, you need to link against ``libSerialboxFortran`` and the C++ standard library used to compile the code (e.g ``libstdc++`` for GNU gcc) as well as the dependency libraries (possibly NetCDF and OpenSSL). As this can be tedious, Serialbox provides a CMake find_package module (:ref:`FindSerialbox`) to handle this task.

To use the preprocessing script ``pp_ser.py``, take a look at the CMake module :ref:`SerialboxTooling`. For a self-contained example see ``examples/fortran/perturbation``.

7 changes: 2 additions & 5 deletions docs/sphinx/Usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ Example to find Serialbox headers and `shared` libraries for the C, C++ and Fort
set(SERIALBOX_USE_SHARED_LIBS ON)
find_package(Serialbox REQUIRED COMPONENTS C++ C Fortran)

The Serialbox module will look for the `exact` boost version used during compilation and append
the necessary libraries to the ``SERIALBOX_[LANGUAGE]_LIBRARIES`` variable. If Serialbox was
compiled with OpenSSL and/or NetCDF support, the necessary libraries will be appended as well.
If Serialbox was compiled with OpenSSL and/or NetCDF support,
the necessary libraries will be appended to the ``SERIALBOX_[LANGUAGE]_LIBRARIES``.

Variables used by this module, they can change the default behaviour and need to be set before
calling find_package::
Expand All @@ -61,7 +60,6 @@ Variables defined by this module::
SERIALBOX_FORTRAN_LIBRARIES - The Fortran libraries of Serialbox (libSerialboxFortran) and
possibly the external libraries.
SERIALBOX_PPSER - Path to the pp_ser.py script.
SERIALBOX_BOOST_VERSION - Boost version used during compilation.
SERIALBOX_HAS_OPENSSL - Serialbox was compiled with OpenSSL support.
SERIALBOX_HAS_NETCDF - Serialbox was compiled with NetCDF support.

Expand All @@ -78,4 +76,3 @@ Function arguments::

SOURCES - Sources to preprocess
OUTPUT_DIR - Output directory of the the source files. If nothing is specified ${PROJECT_BINARY_DIR}/pp is used.

5 changes: 0 additions & 5 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ function(serialbox_add_gridtools_example NAME)
SerialboxStatic
GridTools::gridtools
${CMAKE_THREAD_LIBS_INIT})
target_compile_definitions(${NAME} PUBLIC BOOST_NO_CXX11_DECLTYPE)
install(TARGETS ${NAME} DESTINATION bin)
if(SERIALBOX_TESTING)
serialbox_add_test(TARGET ${NAME} EXECUTABLE ${CMAKE_CURRENT_BINARY_DIR}/${NAME})
Expand Down Expand Up @@ -53,7 +52,3 @@ endif()
if(SERIALBOX_ENABLE_PYTHON)
add_subdirectory(python)
endif()

if(SERIALBOX_TESTING_GRIDTOOLS)
add_subdirectory(gridtools)
endif()
13 changes: 0 additions & 13 deletions examples/gridtools/CMakeLists.txt

This file was deleted.

15 changes: 0 additions & 15 deletions examples/gridtools/simple/CMakeLists.txt

This file was deleted.

Loading
Loading