Skip to content
Merged
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ if(FB_CPP_USE_BOOST_MULTIPRECISION)
set(FB_CPP_USE_BOOST_MULTIPRECISION_VALUE 1)
endif()

set(FB_CPP_USE_BOOST_DECIMAL_VALUE 0)
if(FB_CPP_USE_BOOST_DECIMAL)
set(FB_CPP_USE_BOOST_DECIMAL_VALUE 1)
endif()


include(CMakePackageConfigHelpers)
write_basic_package_version_file(
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ It wraps the Firebird C++ API with RAII principles, smart pointers, and modern C
- **RAII**: Automatic resource management with smart pointers
- **Type Safety**: Strong typing for database operations
- **Exception Safety**: Proper error handling with exceptions
- **Boost Integration**: Optional Boost.DLL for loading fbclient and Boost.Multiprecision support for large numbers
- **Boost Integration**: Optional Boost.DLL for loading fbclient, Boost.Multiprecision support for large numbers, and
Boost.Decimal support for decimal floating-point values

## Quick Start

Expand Down Expand Up @@ -102,6 +103,7 @@ Or add it to your `vcpkg.json` manifest:
The default features are:
- `boost-dll`: Enable Boost.DLL support for runtime dynamic loading of Firebird client library
- `boost-multiprecision`: Enable Boost.Multiprecision support for INT128 and DECFLOAT types
- `boost-decimal`: Enable Boost.Decimal support for DECFLOAT types

## Building

Expand Down
6 changes: 6 additions & 0 deletions cmake/fb-cppConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ find_dependency(firebird CONFIG)

set(_fb_cpp_use_boost_dll "@FB_CPP_USE_BOOST_DLL_VALUE@")
set(_fb_cpp_use_boost_multiprecision "@FB_CPP_USE_BOOST_MULTIPRECISION_VALUE@")
set(_fb_cpp_use_boost_decimal "@FB_CPP_USE_BOOST_DECIMAL_VALUE@")

if(_fb_cpp_use_boost_dll)
find_dependency(Boost COMPONENTS dll)
Expand All @@ -15,9 +16,14 @@ if(_fb_cpp_use_boost_multiprecision)
find_dependency(Boost COMPONENTS multiprecision)
endif()

if(_fb_cpp_use_boost_decimal)
find_dependency(Boost COMPONENTS decimal)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/fb-cppTargets.cmake")

unset(_fb_cpp_use_boost_dll)
unset(_fb_cpp_use_boost_multiprecision)
unset(_fb_cpp_use_boost_decimal)

check_required_components(fb-cpp)
1 change: 1 addition & 0 deletions doc/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = FB_CPP_USE_BOOST_MULTIPRECISION=1 \
FB_CPP_USE_BOOST_DECIMAL=1 \
FB_CPP_USE_BOOST_DLL=1
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
Expand Down
28 changes: 28 additions & 0 deletions src/fb-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ option(FB_CPP_USE_BOOST_MULTIPRECISION "Enable Boost.Multiprecision helpers for
${_fb_cpp_use_boost_multiprecision_default})
unset(_fb_cpp_use_boost_multiprecision_default)

set(_fb_cpp_use_boost_decimal_default ON)
if(DEFINED VCPKG_INSTALLED_DIR AND DEFINED VCPKG_TARGET_TRIPLET)
if(NOT EXISTS "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/boost-decimal")
set(_fb_cpp_use_boost_decimal_default OFF)
endif()
endif()
option(FB_CPP_USE_BOOST_DECIMAL "Enable Boost.Decimal helpers for DECFLOAT types"
${_fb_cpp_use_boost_decimal_default})
unset(_fb_cpp_use_boost_decimal_default)

file(GLOB_RECURSE SRC
"*.h"
"*.cpp"
Expand All @@ -34,6 +44,9 @@ endif()
if(FB_CPP_USE_BOOST_MULTIPRECISION)
list(APPEND _fb_cpp_boost_components multiprecision)
endif()
if(FB_CPP_USE_BOOST_DECIMAL)
list(APPEND _fb_cpp_boost_components decimal)
endif()

if(_fb_cpp_boost_components)
find_package(Boost REQUIRED
Expand Down Expand Up @@ -77,10 +90,19 @@ if(NOT DEFINED FB_CPP_USE_BOOST_MULTIPRECISION_VALUE)
endif()
endif()

if(NOT DEFINED FB_CPP_USE_BOOST_DECIMAL_VALUE)
if(FB_CPP_USE_BOOST_DECIMAL)
set(FB_CPP_USE_BOOST_DECIMAL_VALUE 1)
else()
set(FB_CPP_USE_BOOST_DECIMAL_VALUE 0)
endif()
endif()

target_compile_definitions(${PROJECT_NAME}
PUBLIC
FB_CPP_USE_BOOST_DLL=${FB_CPP_USE_BOOST_DLL_VALUE}
FB_CPP_USE_BOOST_MULTIPRECISION=${FB_CPP_USE_BOOST_MULTIPRECISION_VALUE}
FB_CPP_USE_BOOST_DECIMAL=${FB_CPP_USE_BOOST_DECIMAL_VALUE}
)

target_link_libraries(${PROJECT_NAME}
Expand All @@ -100,6 +122,12 @@ if(FB_CPP_USE_BOOST_MULTIPRECISION)
)
endif()

if(FB_CPP_USE_BOOST_DECIMAL)
target_link_libraries(${PROJECT_NAME}
PUBLIC Boost::decimal
)
endif()

unset(_fb_cpp_boost_components)

file(GLOB_RECURSE HEADER_FILES
Expand Down
Loading
Loading