Commit a52c8931 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Use bctoolbox for logs + fixed a few things in autotools build

parent eb2cc780
......@@ -84,6 +84,7 @@ include_directories(
include/
src/
${BELR_INCLUDE_DIRS}
${BCTOOLBOX_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}
)
if(MSVC)
......
......@@ -30,6 +30,20 @@ dnl # Check for BcToolbox
dnl ##################################################
dnl check bctoolbox
PKG_CHECK_MODULES(BCTOOLBOX, [bctoolbox],[libbctoolbox_found=yes],foo=bar)
if test "$libbctoolbox_found" != "yes" ; then
dnl Check the lib presence in case the PKG-CONFIG version is not found
AC_LANG_CPLUSPLUS
AC_CHECK_LIB(bctoolbox, main, [BCTOOLBOX_LIBS+=" -lbctoolbox"; libbctoolbox_found=yes], [foo=bar])
AC_LANG_C
fi
if test "$libbctoolbox_found" != "yes" ; then
AC_MSG_ERROR([libbctoolbox not found. Install it and try again])
fi
AC_SUBST(BCTOOLBOX_LIBS)
dnl check bctoolbox-tester
PKG_CHECK_MODULES(BCTOOLBOXTESTER, [bctoolbox-tester],[libbctoolbox_tester_found=yes],foo=bar)
if test "$libbctoolbox_tester_found" != "yes" ; then
dnl Check the lib presence in case the PKG-CONFIG version is not found
......
......@@ -54,7 +54,7 @@ else()
set_target_properties(belcard PROPERTIES VERSION ${BELCARD_SO_VERSION})
endif()
target_link_libraries(belcard ${BELR_LIBRARIES})
target_link_libraries(belcard ${BELR_LIBRARIES} ${BCTOOLBOX_LIBRARIES})
install(TARGETS belcard EXPORT ${EXPORT_TARGETS_NAME}Targets
RUNTIME DESTINATION bin
......
......@@ -20,4 +20,4 @@ libbelcard_la_SOURCES=belcard_parser.cpp \
AM_CPPFLAGS=-I$(top_srcdir)/include
libbelcard_la_LIBADD=$(BELR_LIBS)
\ No newline at end of file
libbelcard_la_LIBADD=$(BELR_LIBS) $(BCTOOLBOX_LIBS)
\ No newline at end of file
......@@ -20,6 +20,8 @@
#include "belcard/belcard.hpp"
#include "belcard/belcard_utils.hpp"
#include "bctoolbox/logging.h"
#include <iostream>
#include <fstream>
#include <sstream>
......@@ -95,7 +97,7 @@ shared_ptr<BelCardGeneric> BelCardParser::_parse(const string &input, const stri
size_t parsedSize = 0;
shared_ptr<BelCardGeneric> ret = parser.parseInput(rule, input, &parsedSize);
if (parsedSize < input.size()){
cerr << "[belcard] Parsing ended prematuraly at pos " << parsedSize << endl;
bctbx_error("[belcard] Parsing ended prematuraly at pos %llu", (unsigned long long)parsedSize);
}
return ret;
}
......@@ -116,10 +118,10 @@ shared_ptr<BelCardList> BelCardParser::parse(const string &input) {
shared_ptr<BelCardList> BelCardParser::parseFile(const string &filename) {
ifstream istr;
istr.open(filename, ifstream::binary);
istr.open(filename.c_str(), ifstream::binary);
if (!istr.is_open() || istr.fail()) {
cerr << "[belcard] Couldn't open file " << filename << endl;
bctbx_error("[belcard] Couldn't open file %s", filename.c_str());
return NULL;
}
......
......@@ -15,7 +15,7 @@ belcard_tester_SOURCES=belcard-tester.cpp belcard-tester.hpp \
belcard-calendar-tester.cpp \
belcard-rfc6474-tester.cpp \
belcard-vcard-tester.cpp
belcard_tester_LDADD=$(top_builddir)/src/libbelcard.la -lbelr $(CUNIT_LIBS) ${BCTOOLBOX_TESTER_LIBS}
belcard_tester_LDADD=$(top_builddir)/src/libbelcard.la -lbelr $(CUNIT_LIBS) -lbctoolbox-tester
belcard_tester_CFLAGS=\
-DBC_CONFIG_FILE=\"config.h\" \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment