Skip to content

Commit

Permalink
Minimall supported build without boost.
Browse files Browse the repository at this point in the history
To remove boost dependency, `-DMSGPACK_USE_BOOST=OFF` for cmake.
By default, `-DMSGPACK_USE_BOOST` is `ON`.
NOTE: In order to build tests `-DMSGPACK_USE_BOOST=ON` is required.

For C++ compiler, the option `-DMSGPACK_NO_BOOST` is required to remove
boost.
  • Loading branch information
redboltz committed Feb 7, 2022
1 parent 59f2da6 commit 9e14be5
Show file tree
Hide file tree
Showing 435 changed files with 47,662 additions and 68 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/gha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ jobs:
4)
export CXX="clang++-10"
export MSGPACK_CXX_VERSION="MSGPACK_CXX20=ON"
export NO_BOOST="-DMSGPACK_NO_BOOST"
;;
5)
export CXX="g++-10"
Expand Down Expand Up @@ -183,7 +184,7 @@ jobs:
esac
# build and test
CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE}" ci/build_cmake.sh || exit 1
CMAKE_CXX_COMPILER="$CXX" CXXFLAGS="-Werror -g ${SANITIZE} ${NO_BOOST}" ci/build_cmake.sh || exit 1
cat Files.cmake| grep ".*\.[h|hpp]" | perl -pe 's/ //g' | sort > tmp1 && find include -name "*.h" -o -name "*.hpp" | sort > tmp2 && diff tmp1 tmp2
windows:
Expand Down
27 changes: 19 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ OPTION (MSGPACK_CXX17 "Using c++17 compiler" OFF)
OPTION (MSGPACK_CXX20 "Using c++20 compiler" OFF)

OPTION (MSGPACK_32BIT "32bit compile" OFF)
OPTION (MSGPACK_USE_BOOST "Use Boost libraried" ON)
OPTION (MSGPACK_USE_X3_PARSE "Use Boost X3 parse" OFF)
OPTION (MSGPACK_BUILD_TESTS "Build tests" OFF)
OPTION (MSGPACK_BUILD_DOCS "Build Doxygen documentation" ON)
Expand Down Expand Up @@ -62,14 +63,20 @@ IF (MSGPACK_32BIT)
ENDIF ()
ENDIF ()

SET (Boost_USE_MULTITHREADED ON)
IF (MSGPACK_USE_BOOST)
SET (Boost_USE_MULTITHREADED ON)

IF (MSGPACK_USE_STATIC_BOOST)
MESSAGE (STATUS "Staticly linking with Boost")
SET (Boost_USE_STATIC_LIBS TRUE)
IF (MSGPACK_USE_STATIC_BOOST)
MESSAGE (STATUS "Staticly linking with Boost")
SET (Boost_USE_STATIC_LIBS TRUE)
ELSE ()
MESSAGE (STATUS "Dynamically linking with Boost")
SET (Boost_USE_STATIC_LIBS FALSE)
ENDIF ()

FIND_PACKAGE (Boost REQUIRED)
ELSE ()
MESSAGE (STATUS "Dynamically linking with Boost")
SET (Boost_USE_STATIC_LIBS FALSE)
SET (CMAKE_CXX_FLAGS "-DMSGPACK_NO_BOOST ${CMAKE_CXX_FLAGS}")
ENDIF ()

IF (MSGPACK_CHAR_SIGN)
Expand Down Expand Up @@ -100,7 +107,6 @@ int main(int argc, char * argv[])
ENDIF ()
ENDIF ()

FIND_PACKAGE (Boost REQUIRED)

INCLUDE (Files.cmake)

Expand All @@ -113,7 +119,9 @@ TARGET_INCLUDE_DIRECTORIES (msgpackc-cxx
$<INSTALL_INTERFACE:include>
)

TARGET_LINK_LIBRARIES (msgpackc-cxx INTERFACE Boost::boost)
IF (MSGPACK_USE_BOOST)
TARGET_LINK_LIBRARIES (msgpackc-cxx INTERFACE Boost::boost)
ENDIF ()

IF (MSGPACK_GEN_COVERAGE)
IF (NOT MSGPACK_BUILD_TESTS)
Expand All @@ -131,6 +139,9 @@ IF (MSGPACK_GEN_COVERAGE)
ENDIF ()

IF (MSGPACK_BUILD_TESTS)
IF (NOT MSGPACK_USE_BOOST)
MESSAGE(FATAL_ERROR "Test requires -DMSGPACK_USE_BOOST=ON")
ENDIF ()
ENABLE_TESTING ()
# MEMORYCHECK_COMMAND_OPTIONS needs to place prior to CTEST_MEMORYCHECK_COMMAND
SET (MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --show-leak-kinds=definite,possible --error-exitcode=1")
Expand Down
271 changes: 271 additions & 0 deletions Files.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ SET (msgpackc_HEADERS
include/msgpack/adaptor/vector_char.hpp
include/msgpack/adaptor/vector_unsigned_char.hpp
include/msgpack/adaptor/wstring.hpp
include/msgpack/assert.hpp
include/msgpack/cpp_config.hpp
include/msgpack/cpp_config_decl.hpp
include/msgpack/cpp_version.hpp
Expand All @@ -91,6 +92,276 @@ SET (msgpackc_HEADERS
include/msgpack/parse.hpp
include/msgpack/parse_decl.hpp
include/msgpack/parse_return.hpp
include/msgpack/preprocessor.hpp
include/msgpack/preprocessor/arithmetic.hpp
include/msgpack/preprocessor/arithmetic/add.hpp
include/msgpack/preprocessor/arithmetic/dec.hpp
include/msgpack/preprocessor/arithmetic/detail/div_base.hpp
include/msgpack/preprocessor/arithmetic/div.hpp
include/msgpack/preprocessor/arithmetic/inc.hpp
include/msgpack/preprocessor/arithmetic/mod.hpp
include/msgpack/preprocessor/arithmetic/mul.hpp
include/msgpack/preprocessor/arithmetic/sub.hpp
include/msgpack/preprocessor/array.hpp
include/msgpack/preprocessor/array/data.hpp
include/msgpack/preprocessor/array/detail/get_data.hpp
include/msgpack/preprocessor/array/elem.hpp
include/msgpack/preprocessor/array/enum.hpp
include/msgpack/preprocessor/array/insert.hpp
include/msgpack/preprocessor/array/pop_back.hpp
include/msgpack/preprocessor/array/pop_front.hpp
include/msgpack/preprocessor/array/push_back.hpp
include/msgpack/preprocessor/array/push_front.hpp
include/msgpack/preprocessor/array/remove.hpp
include/msgpack/preprocessor/array/replace.hpp
include/msgpack/preprocessor/array/reverse.hpp
include/msgpack/preprocessor/array/size.hpp
include/msgpack/preprocessor/array/to_list.hpp
include/msgpack/preprocessor/array/to_seq.hpp
include/msgpack/preprocessor/array/to_tuple.hpp
include/msgpack/preprocessor/assert_msg.hpp
include/msgpack/preprocessor/cat.hpp
include/msgpack/preprocessor/comma.hpp
include/msgpack/preprocessor/comma_if.hpp
include/msgpack/preprocessor/comparison.hpp
include/msgpack/preprocessor/comparison/equal.hpp
include/msgpack/preprocessor/comparison/greater.hpp
include/msgpack/preprocessor/comparison/greater_equal.hpp
include/msgpack/preprocessor/comparison/less.hpp
include/msgpack/preprocessor/comparison/less_equal.hpp
include/msgpack/preprocessor/comparison/not_equal.hpp
include/msgpack/preprocessor/config/config.hpp
include/msgpack/preprocessor/config/limits.hpp
include/msgpack/preprocessor/control.hpp
include/msgpack/preprocessor/control/deduce_d.hpp
include/msgpack/preprocessor/control/detail/dmc/while.hpp
include/msgpack/preprocessor/control/detail/edg/while.hpp
include/msgpack/preprocessor/control/detail/msvc/while.hpp
include/msgpack/preprocessor/control/detail/while.hpp
include/msgpack/preprocessor/control/expr_if.hpp
include/msgpack/preprocessor/control/expr_iif.hpp
include/msgpack/preprocessor/control/if.hpp
include/msgpack/preprocessor/control/iif.hpp
include/msgpack/preprocessor/control/while.hpp
include/msgpack/preprocessor/debug.hpp
include/msgpack/preprocessor/debug/assert.hpp
include/msgpack/preprocessor/debug/error.hpp
include/msgpack/preprocessor/debug/line.hpp
include/msgpack/preprocessor/dec.hpp
include/msgpack/preprocessor/detail/auto_rec.hpp
include/msgpack/preprocessor/detail/check.hpp
include/msgpack/preprocessor/detail/dmc/auto_rec.hpp
include/msgpack/preprocessor/detail/is_binary.hpp
include/msgpack/preprocessor/detail/is_nullary.hpp
include/msgpack/preprocessor/detail/is_unary.hpp
include/msgpack/preprocessor/detail/null.hpp
include/msgpack/preprocessor/detail/split.hpp
include/msgpack/preprocessor/empty.hpp
include/msgpack/preprocessor/enum.hpp
include/msgpack/preprocessor/enum_params.hpp
include/msgpack/preprocessor/enum_params_with_a_default.hpp
include/msgpack/preprocessor/enum_params_with_defaults.hpp
include/msgpack/preprocessor/enum_shifted.hpp
include/msgpack/preprocessor/enum_shifted_params.hpp
include/msgpack/preprocessor/expand.hpp
include/msgpack/preprocessor/expr_if.hpp
include/msgpack/preprocessor/facilities.hpp
include/msgpack/preprocessor/facilities/apply.hpp
include/msgpack/preprocessor/facilities/detail/is_empty.hpp
include/msgpack/preprocessor/facilities/empty.hpp
include/msgpack/preprocessor/facilities/expand.hpp
include/msgpack/preprocessor/facilities/identity.hpp
include/msgpack/preprocessor/facilities/intercept.hpp
include/msgpack/preprocessor/facilities/is_1.hpp
include/msgpack/preprocessor/facilities/is_empty.hpp
include/msgpack/preprocessor/facilities/is_empty_or_1.hpp
include/msgpack/preprocessor/facilities/is_empty_variadic.hpp
include/msgpack/preprocessor/facilities/overload.hpp
include/msgpack/preprocessor/for.hpp
include/msgpack/preprocessor/identity.hpp
include/msgpack/preprocessor/if.hpp
include/msgpack/preprocessor/inc.hpp
include/msgpack/preprocessor/iterate.hpp
include/msgpack/preprocessor/iteration.hpp
include/msgpack/preprocessor/iteration/detail/bounds/lower1.hpp
include/msgpack/preprocessor/iteration/detail/bounds/lower2.hpp
include/msgpack/preprocessor/iteration/detail/bounds/lower3.hpp
include/msgpack/preprocessor/iteration/detail/bounds/lower4.hpp
include/msgpack/preprocessor/iteration/detail/bounds/lower5.hpp
include/msgpack/preprocessor/iteration/detail/bounds/upper1.hpp
include/msgpack/preprocessor/iteration/detail/bounds/upper2.hpp
include/msgpack/preprocessor/iteration/detail/bounds/upper3.hpp
include/msgpack/preprocessor/iteration/detail/bounds/upper4.hpp
include/msgpack/preprocessor/iteration/detail/bounds/upper5.hpp
include/msgpack/preprocessor/iteration/detail/finish.hpp
include/msgpack/preprocessor/iteration/detail/iter/forward1.hpp
include/msgpack/preprocessor/iteration/detail/iter/forward2.hpp
include/msgpack/preprocessor/iteration/detail/iter/forward3.hpp
include/msgpack/preprocessor/iteration/detail/iter/forward4.hpp
include/msgpack/preprocessor/iteration/detail/iter/forward5.hpp
include/msgpack/preprocessor/iteration/detail/iter/reverse1.hpp
include/msgpack/preprocessor/iteration/detail/iter/reverse2.hpp
include/msgpack/preprocessor/iteration/detail/iter/reverse3.hpp
include/msgpack/preprocessor/iteration/detail/iter/reverse4.hpp
include/msgpack/preprocessor/iteration/detail/iter/reverse5.hpp
include/msgpack/preprocessor/iteration/detail/local.hpp
include/msgpack/preprocessor/iteration/detail/rlocal.hpp
include/msgpack/preprocessor/iteration/detail/self.hpp
include/msgpack/preprocessor/iteration/detail/start.hpp
include/msgpack/preprocessor/iteration/iterate.hpp
include/msgpack/preprocessor/iteration/local.hpp
include/msgpack/preprocessor/iteration/self.hpp
include/msgpack/preprocessor/library.hpp
include/msgpack/preprocessor/limits.hpp
include/msgpack/preprocessor/list.hpp
include/msgpack/preprocessor/list/adt.hpp
include/msgpack/preprocessor/list/append.hpp
include/msgpack/preprocessor/list/at.hpp
include/msgpack/preprocessor/list/cat.hpp
include/msgpack/preprocessor/list/detail/dmc/fold_left.hpp
include/msgpack/preprocessor/list/detail/edg/fold_left.hpp
include/msgpack/preprocessor/list/detail/edg/fold_right.hpp
include/msgpack/preprocessor/list/detail/fold_left.hpp
include/msgpack/preprocessor/list/detail/fold_right.hpp
include/msgpack/preprocessor/list/enum.hpp
include/msgpack/preprocessor/list/filter.hpp
include/msgpack/preprocessor/list/first_n.hpp
include/msgpack/preprocessor/list/fold_left.hpp
include/msgpack/preprocessor/list/fold_right.hpp
include/msgpack/preprocessor/list/for_each.hpp
include/msgpack/preprocessor/list/for_each_i.hpp
include/msgpack/preprocessor/list/for_each_product.hpp
include/msgpack/preprocessor/list/rest_n.hpp
include/msgpack/preprocessor/list/reverse.hpp
include/msgpack/preprocessor/list/size.hpp
include/msgpack/preprocessor/list/to_array.hpp
include/msgpack/preprocessor/list/to_seq.hpp
include/msgpack/preprocessor/list/to_tuple.hpp
include/msgpack/preprocessor/list/transform.hpp
include/msgpack/preprocessor/logical.hpp
include/msgpack/preprocessor/logical/and.hpp
include/msgpack/preprocessor/logical/bitand.hpp
include/msgpack/preprocessor/logical/bitnor.hpp
include/msgpack/preprocessor/logical/bitor.hpp
include/msgpack/preprocessor/logical/bitxor.hpp
include/msgpack/preprocessor/logical/bool.hpp
include/msgpack/preprocessor/logical/compl.hpp
include/msgpack/preprocessor/logical/nor.hpp
include/msgpack/preprocessor/logical/not.hpp
include/msgpack/preprocessor/logical/or.hpp
include/msgpack/preprocessor/logical/xor.hpp
include/msgpack/preprocessor/max.hpp
include/msgpack/preprocessor/min.hpp
include/msgpack/preprocessor/punctuation.hpp
include/msgpack/preprocessor/punctuation/comma.hpp
include/msgpack/preprocessor/punctuation/comma_if.hpp
include/msgpack/preprocessor/punctuation/detail/is_begin_parens.hpp
include/msgpack/preprocessor/punctuation/is_begin_parens.hpp
include/msgpack/preprocessor/punctuation/paren.hpp
include/msgpack/preprocessor/punctuation/paren_if.hpp
include/msgpack/preprocessor/punctuation/remove_parens.hpp
include/msgpack/preprocessor/repeat.hpp
include/msgpack/preprocessor/repeat_2nd.hpp
include/msgpack/preprocessor/repeat_3rd.hpp
include/msgpack/preprocessor/repeat_from_to.hpp
include/msgpack/preprocessor/repeat_from_to_2nd.hpp
include/msgpack/preprocessor/repeat_from_to_3rd.hpp
include/msgpack/preprocessor/repetition.hpp
include/msgpack/preprocessor/repetition/deduce_r.hpp
include/msgpack/preprocessor/repetition/deduce_z.hpp
include/msgpack/preprocessor/repetition/detail/dmc/for.hpp
include/msgpack/preprocessor/repetition/detail/edg/for.hpp
include/msgpack/preprocessor/repetition/detail/for.hpp
include/msgpack/preprocessor/repetition/detail/msvc/for.hpp
include/msgpack/preprocessor/repetition/enum.hpp
include/msgpack/preprocessor/repetition/enum_binary_params.hpp
include/msgpack/preprocessor/repetition/enum_params.hpp
include/msgpack/preprocessor/repetition/enum_params_with_a_default.hpp
include/msgpack/preprocessor/repetition/enum_params_with_defaults.hpp
include/msgpack/preprocessor/repetition/enum_shifted.hpp
include/msgpack/preprocessor/repetition/enum_shifted_binary_params.hpp
include/msgpack/preprocessor/repetition/enum_shifted_params.hpp
include/msgpack/preprocessor/repetition/enum_trailing.hpp
include/msgpack/preprocessor/repetition/enum_trailing_binary_params.hpp
include/msgpack/preprocessor/repetition/enum_trailing_params.hpp
include/msgpack/preprocessor/repetition/for.hpp
include/msgpack/preprocessor/repetition/repeat.hpp
include/msgpack/preprocessor/repetition/repeat_from_to.hpp
include/msgpack/preprocessor/selection.hpp
include/msgpack/preprocessor/selection/max.hpp
include/msgpack/preprocessor/selection/min.hpp
include/msgpack/preprocessor/seq.hpp
include/msgpack/preprocessor/seq/cat.hpp
include/msgpack/preprocessor/seq/detail/binary_transform.hpp
include/msgpack/preprocessor/seq/detail/is_empty.hpp
include/msgpack/preprocessor/seq/detail/split.hpp
include/msgpack/preprocessor/seq/detail/to_list_msvc.hpp
include/msgpack/preprocessor/seq/elem.hpp
include/msgpack/preprocessor/seq/enum.hpp
include/msgpack/preprocessor/seq/filter.hpp
include/msgpack/preprocessor/seq/first_n.hpp
include/msgpack/preprocessor/seq/fold_left.hpp
include/msgpack/preprocessor/seq/fold_right.hpp
include/msgpack/preprocessor/seq/for_each.hpp
include/msgpack/preprocessor/seq/for_each_i.hpp
include/msgpack/preprocessor/seq/for_each_product.hpp
include/msgpack/preprocessor/seq/insert.hpp
include/msgpack/preprocessor/seq/pop_back.hpp
include/msgpack/preprocessor/seq/pop_front.hpp
include/msgpack/preprocessor/seq/push_back.hpp
include/msgpack/preprocessor/seq/push_front.hpp
include/msgpack/preprocessor/seq/remove.hpp
include/msgpack/preprocessor/seq/replace.hpp
include/msgpack/preprocessor/seq/rest_n.hpp
include/msgpack/preprocessor/seq/reverse.hpp
include/msgpack/preprocessor/seq/seq.hpp
include/msgpack/preprocessor/seq/size.hpp
include/msgpack/preprocessor/seq/subseq.hpp
include/msgpack/preprocessor/seq/to_array.hpp
include/msgpack/preprocessor/seq/to_list.hpp
include/msgpack/preprocessor/seq/to_tuple.hpp
include/msgpack/preprocessor/seq/transform.hpp
include/msgpack/preprocessor/seq/variadic_seq_to_seq.hpp
include/msgpack/preprocessor/slot.hpp
include/msgpack/preprocessor/slot/counter.hpp
include/msgpack/preprocessor/slot/detail/counter.hpp
include/msgpack/preprocessor/slot/detail/def.hpp
include/msgpack/preprocessor/slot/detail/shared.hpp
include/msgpack/preprocessor/slot/detail/slot1.hpp
include/msgpack/preprocessor/slot/detail/slot2.hpp
include/msgpack/preprocessor/slot/detail/slot3.hpp
include/msgpack/preprocessor/slot/detail/slot4.hpp
include/msgpack/preprocessor/slot/detail/slot5.hpp
include/msgpack/preprocessor/slot/slot.hpp
include/msgpack/preprocessor/stringize.hpp
include/msgpack/preprocessor/tuple.hpp
include/msgpack/preprocessor/tuple/detail/is_single_return.hpp
include/msgpack/preprocessor/tuple/eat.hpp
include/msgpack/preprocessor/tuple/elem.hpp
include/msgpack/preprocessor/tuple/enum.hpp
include/msgpack/preprocessor/tuple/insert.hpp
include/msgpack/preprocessor/tuple/pop_back.hpp
include/msgpack/preprocessor/tuple/pop_front.hpp
include/msgpack/preprocessor/tuple/push_back.hpp
include/msgpack/preprocessor/tuple/push_front.hpp
include/msgpack/preprocessor/tuple/rem.hpp
include/msgpack/preprocessor/tuple/remove.hpp
include/msgpack/preprocessor/tuple/replace.hpp
include/msgpack/preprocessor/tuple/reverse.hpp
include/msgpack/preprocessor/tuple/size.hpp
include/msgpack/preprocessor/tuple/to_array.hpp
include/msgpack/preprocessor/tuple/to_list.hpp
include/msgpack/preprocessor/tuple/to_seq.hpp
include/msgpack/preprocessor/variadic.hpp
include/msgpack/preprocessor/variadic/detail/is_single_return.hpp
include/msgpack/preprocessor/variadic/elem.hpp
include/msgpack/preprocessor/variadic/size.hpp
include/msgpack/preprocessor/variadic/to_array.hpp
include/msgpack/preprocessor/variadic/to_list.hpp
include/msgpack/preprocessor/variadic/to_seq.hpp
include/msgpack/preprocessor/variadic/to_tuple.hpp
include/msgpack/preprocessor/while.hpp
include/msgpack/preprocessor/wstringize.hpp
include/msgpack/sbuffer.hpp
include/msgpack/sbuffer_decl.hpp
include/msgpack/sysdep.hpp
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,23 @@ C++ version of msgpack-c itself is a header-only library and depends only on
boost headers. Tests depend on boost unit test framework and are linked with
it, so if you want to build them, you need to have this dependency installed.

Experimental support for removing boost dependency

For cmake:

```
cmake -DMSGPACK_USE_BOOST=OFF ..
```

NOTE: `-DMSGPACK_BUILD_TESTS=ON` doesn't work with `-DMSGPACK_USE_BOOST=OFF`.

For C++ compiler

```
clang++ -DMSGPACK_NO_BOOST your_code.cpp
```


Usage
-----

Expand Down
Loading

0 comments on commit 9e14be5

Please sign in to comment.