Skip to content
Open
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ set(SCN_PUBLIC_HEADERS
include/scn/regex.h
include/scn/istream.h
include/scn/xchar.h
"${CMAKE_CURRENT_BINARY_DIR}/include/scn/scn_export.h"
)
set(SCN_PRIVATE_HEADERS
src/scn/impl.h
Expand All @@ -60,6 +61,7 @@ add_library(scn
target_include_directories(scn
PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>
Expand All @@ -70,7 +72,15 @@ target_link_libraries(scn PRIVATE
)
set_library_flags(scn)

set_property(TARGET scn PROPERTY SOVERSION 4)
include(GenerateExportHeader)
generate_export_header(scn
EXPORT_MACRO_NAME SCN_EXPORT
EXPORT_FILE_NAME include/scn/scn_export.h)

set_target_properties(scn PROPERTIES
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON
SOVERSION 4)
add_library(scn::scn ALIAS scn)

add_library(scn_internal INTERFACE)
Expand All @@ -82,6 +92,7 @@ target_link_libraries(scn_internal INTERFACE
target_include_directories(scn_internal
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>
)
set_interface_flags(scn_internal)
Expand Down
1 change: 0 additions & 1 deletion benchmark/runtime/float/repeated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,3 @@ static void scan_float_repeated_fastfloat(benchmark::State& state)
}
BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, float);
BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, double);
BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, long double);
1 change: 0 additions & 1 deletion benchmark/runtime/float/single.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,3 @@ static void scan_float_single_fastfloat(benchmark::State& state)
}
BENCHMARK_TEMPLATE(scan_float_single_fastfloat, float);
BENCHMARK_TEMPLATE(scan_float_single_fastfloat, double);
BENCHMARK_TEMPLATE(scan_float_single_fastfloat, long double);
2 changes: 1 addition & 1 deletion cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ else ()
FetchContent_Declare(
fast_float
GIT_REPOSITORY https://github.com/fastfloat/fast_float.git
GIT_TAG v6.1.6
GIT_TAG v7.0.0
GIT_SHALLOW TRUE
)

Expand Down
6 changes: 6 additions & 0 deletions cmake/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ install(FILES
COMPONENT scnlib_Development
)

install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/include/scn/scn_export.h"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/scn"
COMPONENT scnlib_Development
)

export(EXPORT scn-targets
FILE "${CMAKE_CURRENT_BINARY_DIR}/scn-targets.cmake"
NAMESPACE scn::
Expand Down
34 changes: 31 additions & 3 deletions include/scn/chrono.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ struct datetime_components {
* The fields `subsec` and `tz_name` are discarded.
* `tz_offset` is set to `tm_gmtoff`, if it's available.
*/
[[nodiscard]] std::tm to_tm() const
SCN_NODISCARD std::tm to_tm() const
{
SCN_UNUSED(subsec);
std::tm t{
Expand Down Expand Up @@ -1462,7 +1462,7 @@ struct tm_format_checker {
st.verify(*this);
}

[[nodiscard]] constexpr scan_expected<void> get_error() const
SCN_NODISCARD constexpr scan_expected<void> get_error() const
{
return err;
}
Expand Down Expand Up @@ -1512,9 +1512,37 @@ constexpr auto chrono_parse_impl(ParseCtx& pctx,
}

template <typename CharT, typename T, typename Context>
auto chrono_scan_impl(std::basic_string_view<CharT> fmt_str, T& t, Context& ctx)
SCN_EXPORT auto chrono_scan_impl(std::basic_string_view<CharT> fmt_str,
T& t,
Context& ctx)
-> scan_expected<typename Context::iterator>;

extern template SCN_EXPORT auto chrono_scan_impl(std::string_view,
std::tm&,
scan_context&)
-> scan_expected<scan_context::iterator>;
extern template SCN_EXPORT auto chrono_scan_impl(std::string_view,
tm_with_tz&,
scan_context&)
-> scan_expected<scan_context::iterator>;
extern template SCN_EXPORT auto chrono_scan_impl(std::string_view,
datetime_components&,
scan_context&)
-> scan_expected<scan_context::iterator>;

extern template SCN_EXPORT auto chrono_scan_impl(std::wstring_view,
std::tm&,
wscan_context&)
-> scan_expected<wscan_context::iterator>;
extern template SCN_EXPORT auto chrono_scan_impl(std::wstring_view,
tm_with_tz&,
wscan_context&)
-> scan_expected<wscan_context::iterator>;
extern template SCN_EXPORT auto chrono_scan_impl(std::wstring_view,
datetime_components&,
wscan_context&)
-> scan_expected<wscan_context::iterator>;

template <typename CharT, typename T>
struct chrono_datetime_scanner {
template <typename ParseCtx>
Expand Down
5 changes: 5 additions & 0 deletions include/scn/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ SCN_GCC_IGNORE("-Wrestrict")

SCN_GCC_POP

/////////////////////////////////////////////////////////////////
// Export include
/////////////////////////////////////////////////////////////////
#include <scn/scn_export.h>

/////////////////////////////////////////////////////////////////
// Environment detection (preprocessor only)
/////////////////////////////////////////////////////////////////
Expand Down
Loading
Loading