~singpolyma/biboumi

0ab40dc1ab4e689921da54080b135e1d22b1c586 — louiz’ 5 years ago 2d38061
Refactoring louloulibs and cmake

Use OBJECT libraries
Remove the louloulibs directory
Write FOUND variables in the cache
77 files changed, 220 insertions(+), 281 deletions(-)

M .gitlab-ci.yml
M CMakeLists.txt
M biboumi.h.cmake
R louloulibs/cmake/Modules/FindBOTAN.cmake => cmake/Modules/FindBOTAN.cmake
R louloulibs/cmake/Modules/FindGCRYPT.cmake => cmake/Modules/FindGCRYPT.cmake
R louloulibs/cmake/Modules/FindICONV.cmake => cmake/Modules/FindICONV.cmake
R louloulibs/cmake/Modules/FindLIBIDN.cmake => cmake/Modules/FindLIBIDN.cmake
R louloulibs/cmake/Modules/FindLIBUUID.cmake => cmake/Modules/FindLIBUUID.cmake
M cmake/Modules/FindLITESQL.cmake
R louloulibs/cmake/Modules/FindSYSTEMD.cmake => cmake/Modules/FindSYSTEMD.cmake
R louloulibs/cmake/Modules/FindUDNS.cmake => cmake/Modules/FindUDNS.cmake
D louloulibs/CMakeLists.txt
D louloulibs/louloulibs.h.cmake
R louloulibs/config/config.cpp => src/config/config.cpp
R louloulibs/config/config.hpp => src/config/config.hpp
M src/irc/irc_client.cpp
R louloulibs/logger/logger.cpp => src/logger/logger.cpp
R louloulibs/logger/logger.hpp => src/logger/logger.hpp
R louloulibs/network/credentials_manager.cpp => src/network/credentials_manager.cpp
R louloulibs/network/credentials_manager.hpp => src/network/credentials_manager.hpp
R louloulibs/network/dns_handler.cpp => src/network/dns_handler.cpp
R louloulibs/network/dns_handler.hpp => src/network/dns_handler.hpp
R louloulibs/network/dns_socket_handler.cpp => src/network/dns_socket_handler.cpp
R louloulibs/network/dns_socket_handler.hpp => src/network/dns_socket_handler.hpp
R louloulibs/network/poller.cpp => src/network/poller.cpp
R louloulibs/network/poller.hpp => src/network/poller.hpp
R louloulibs/network/resolver.cpp => src/network/resolver.cpp
R louloulibs/network/resolver.hpp => src/network/resolver.hpp
R louloulibs/network/socket_handler.hpp => src/network/socket_handler.hpp
R louloulibs/network/tcp_client_socket_handler.cpp => src/network/tcp_client_socket_handler.cpp
R louloulibs/network/tcp_client_socket_handler.hpp => src/network/tcp_client_socket_handler.hpp
R louloulibs/network/tcp_server_socket.hpp => src/network/tcp_server_socket.hpp
R louloulibs/network/tcp_socket_handler.cpp => src/network/tcp_socket_handler.cpp
R louloulibs/network/tcp_socket_handler.hpp => src/network/tcp_socket_handler.hpp
R louloulibs/utils/encoding.cpp => src/utils/encoding.cpp
R louloulibs/utils/encoding.hpp => src/utils/encoding.hpp
R louloulibs/utils/get_first_non_empty.cpp => src/utils/get_first_non_empty.cpp
R louloulibs/utils/get_first_non_empty.hpp => src/utils/get_first_non_empty.hpp
R louloulibs/utils/revstr.cpp => src/utils/revstr.cpp
R louloulibs/utils/revstr.hpp => src/utils/revstr.hpp
R louloulibs/utils/scopeguard.hpp => src/utils/scopeguard.hpp
R louloulibs/utils/sha1.cpp => src/utils/sha1.cpp
R louloulibs/utils/sha1.hpp => src/utils/sha1.hpp
R louloulibs/utils/split.cpp => src/utils/split.cpp
R louloulibs/utils/split.hpp => src/utils/split.hpp
R louloulibs/utils/string.cpp => src/utils/string.cpp
R louloulibs/utils/string.hpp => src/utils/string.hpp
R louloulibs/utils/system.cpp => src/utils/system.cpp
R louloulibs/utils/system.hpp => src/utils/system.hpp
R louloulibs/utils/time.cpp => src/utils/time.cpp
R louloulibs/utils/time.hpp => src/utils/time.hpp
R louloulibs/utils/timed_events.cpp => src/utils/timed_events.cpp
R louloulibs/utils/timed_events.hpp => src/utils/timed_events.hpp
R louloulibs/utils/timed_events_manager.cpp => src/utils/timed_events_manager.cpp
R louloulibs/utils/tolower.cpp => src/utils/tolower.cpp
R louloulibs/utils/tolower.hpp => src/utils/tolower.hpp
R louloulibs/utils/xdg.cpp => src/utils/xdg.cpp
R louloulibs/utils/xdg.hpp => src/utils/xdg.hpp
R louloulibs/xmpp/adhoc_command.cpp => src/xmpp/adhoc_command.cpp
R louloulibs/xmpp/adhoc_command.hpp => src/xmpp/adhoc_command.hpp
R louloulibs/xmpp/adhoc_commands_handler.cpp => src/xmpp/adhoc_commands_handler.cpp
R louloulibs/xmpp/adhoc_commands_handler.hpp => src/xmpp/adhoc_commands_handler.hpp
R louloulibs/xmpp/adhoc_session.cpp => src/xmpp/adhoc_session.cpp
R louloulibs/xmpp/adhoc_session.hpp => src/xmpp/adhoc_session.hpp
R louloulibs/xmpp/auth.cpp => src/xmpp/auth.cpp
R louloulibs/xmpp/auth.hpp => src/xmpp/auth.hpp
M src/xmpp/biboumi_component.cpp
R louloulibs/xmpp/body.hpp => src/xmpp/body.hpp
R louloulibs/xmpp/jid.cpp => src/xmpp/jid.cpp
R louloulibs/xmpp/jid.hpp => src/xmpp/jid.hpp
R louloulibs/xmpp/xmpp_component.cpp => src/xmpp/xmpp_component.cpp
R louloulibs/xmpp/xmpp_component.hpp => src/xmpp/xmpp_component.hpp
R louloulibs/xmpp/xmpp_parser.cpp => src/xmpp/xmpp_parser.cpp
R louloulibs/xmpp/xmpp_parser.hpp => src/xmpp/xmpp_parser.hpp
R louloulibs/xmpp/xmpp_stanza.cpp => src/xmpp/xmpp_stanza.cpp
R louloulibs/xmpp/xmpp_stanza.hpp => src/xmpp/xmpp_stanza.hpp
M tests/jid.cpp
M .gitlab-ci.yml => .gitlab-ci.yml +3 -3
@@ 31,7 31,7 @@ variables:
  script:
    - "echo Running cmake with the following parameters: -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}"
    - cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}
    - make biboumi -j$(nproc || echo 1)
    - make -j$(nproc || echo 1)
    - make coverage_check -j$(nproc || echo 1)
  artifacts:
    expire_in: 8 hours


@@ 140,7 140,7 @@ test:freebsd:
  stage: test
  script:
    - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}
    - make biboumi
    - make
    - make check
    - make e2e



@@ 226,7 226,7 @@ coverity:
  script:
    - export PATH=$PATH:~/coverity/bin
    - cmake .. -DWITHOUT_SYSTEMD=1
    - cov-build --dir cov-int   make biboumi test_suite -j$(nproc || echo 1)
    - cov-build --dir cov-int   make -j$(nproc || echo 1)
    - tar czvf biboumi_coverity.tgz cov-int
    - curl --form token=$COVERITY_TOKEN   --form email=louiz@louiz.org   --form file=@biboumi_coverity.tgz  --form version="$(git rev-parse --short HEAD)" --form description="Automatic submission by gitlab-ci" https://scan.coverity.com/builds?project=louiz%2Fbiboumi


M CMakeLists.txt => CMakeLists.txt +166 -94
@@ 6,34 6,28 @@ set(${PROJECT_NAME}_VERSION_MAJOR 5)
set(${PROJECT_NAME}_VERSION_MINOR 0)
set(${PROJECT_NAME}_VERSION_SUFFIX "~dev")

#
## Find optional instrumentation libraries that will be used in debug only
#
find_library(LIBASAN NAMES asan libasan.so.3 libasan.so.2 libasan.so.1)
find_library(LIBUBSAN NAMES ubsan libubsan.so.0)

#
## Set various debug flags (instrumentation libs, coverage, …)
#
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -pedantic -Wall -Wextra")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fprofile-arcs -ftest-coverage --coverage")
endif()
if(LIBASAN)
  message(STATUS "Libasan found.")
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address")
else()
  message(STATUS "Libasan NOT found.")
endif()
if(LIBUBSAN)
  message(STATUS "Libubsan found.")
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=undefined")
else()
  message(STATUS "Libubsan NOT found.")
endif()


#
## Look for external libraries
#
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")

#
## Get the software version
## Set the software version, archive name, RPM name etc
#
set(ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR})
set(RPM_VERSION ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR})


@@ 62,16 56,8 @@ endif()
set(SOFTWARE_VERSION
  ${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}${${PROJECT_NAME}_VERSION_SUFFIX})

include(CheckFunctionExists)
check_function_exists(ppoll HAVE_PPOLL_FUNCTION)

# To be able to include the config.h and other files generated by cmake
include_directories("${CMAKE_CURRENT_BINARY_DIR}/src/")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/")

#
## Documentation
## The rule that generates the documentation
#
execute_process(COMMAND "date" "+%Y-%m-%d" OUTPUT_VARIABLE DOC_DATE
                OUTPUT_STRIP_TRAILING_WHITESPACE)


@@ 94,28 80,57 @@ if (NOT PANDOC_EXECUTABLE)
endif()
mark_as_advanced(PANDOC_EXECUTABLE)

# Look for litesql and enable the database if found
if(WITH_LITESQL)
  find_package(LITESQL REQUIRED)
elseif(NOT WITHOUT_LITESQL)
  find_package(LITESQL)
#
## Set this search path for cmake, to find our custom search modules
#
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
find_package(ICONV REQUIRED)
find_package(LIBUUID REQUIRED)
find_package(EXPAT REQUIRED)

#
## Find all the libraries (optional or not)
#
if(WITH_LIBIDN)
  find_package(LIBIDN REQUIRED)
elseif(NOT WITHOUT_LIBIDN)
  find_package(LIBIDN)
endif()

if(LITESQL_FOUND)
  LITESQL_GENERATE_CPP("database/database.xml"
    "biboudb"
    LITESQL_GENERATED_SOURCES)
if(WITH_SYSTEMD)
  find_package(SYSTEMD REQUIRED)
elseif(NOT WITHOUT_SYSTEMD)
  find_package(SYSTEMD)
endif()

  set(source_database src/database/database.cpp ${LITESQL_GENERATED_SOURCES})
  set(USE_DATABASE TRUE)
else()
  set(source_database)
if(WITH_BOTAN)
  find_package(BOTAN REQUIRED)
elseif(NOT WITHOUT_BOTAN)
  find_package(BOTAN)
endif()

add_subdirectory("louloulibs")
include_directories("louloulibs")
if(NOT BOTAN_FOUND)
  find_package(GCRYPT REQUIRED)
endif()

# If they are found in louloulibs CMakeLists.txt, we inherite these values
if(WITH_UDNS)
  find_package(UDNS REQUIRED)
elseif(NOT WITHOUT_UDNS)
  find_package(UDNS)
endif()

if(WITH_LITESQL)
  find_package(LITESQL REQUIRED)
elseif(NOT WITHOUT_LITESQL)
  find_package(LITESQL)
endif()

#
## Set all the include directories, depending on what libraries are used
#
include_directories(${EXPAT_INCLUDE_DIRS})
include_directories(${ICONV_INCLUDE_DIRS})
include_directories(${LIBUUID_INCLUDE_DIRS})
if(SYSTEMD_FOUND)
  include_directories(${SYSTEMD_INCLUDE_DIRS})
endif()


@@ 126,70 141,92 @@ if(UDNS_FOUND)
  include_directories(${UDNS_INCLUDE_DIRS})
endif()

#
## utils
#
file(GLOB source_src_utils
    src/utils/*.[hc]pp)
# To be able to include the config.h and other files generated by cmake
include_directories("${CMAKE_CURRENT_BINARY_DIR}/src/")
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/")

#
## irclib
## Define all the modules
#

file(GLOB source_utils
        src/utils/*.[hc]pp)
add_library(utils OBJECT ${source_utils})

file(GLOB source_irc
  src/irc/*.[hc]pp)
        src/irc/*.[hc]pp)
add_library(irc OBJECT ${source_irc})

#
## xmpp
#
file(GLOB source_xmpp
  src/xmpp/*.[hc]pp)
        src/xmpp/*.[hc]pp)
add_library(xmpp OBJECT ${source_xmpp})

#
## identd
#
file(GLOB source_identd
  src/identd/*.[hc]pp)
        src/identd/*.[hc]pp)
add_library(identd OBJECT ${source_identd})

#
## bridge
#
file(GLOB source_bridge
  src/bridge/*.[hc]pp)
        src/bridge/*.[hc]pp)
add_library(bridge OBJECT ${source_bridge})

#
## Main executable
#
add_executable(${PROJECT_NAME} src/main.cpp
        ${source_utils}
        ${source_config}
        ${source_logger}
        ${source_network}
        ${source_xmpplib}
        ${source_xmpp}
        ${source_src_utils}
        ${source_bridge}
        ${source_irc}
        ${source_identd}
        ${source_database})
file(GLOB source_config
        src/config/*.[hc]pp)
add_library(config OBJECT ${source_config})

file(GLOB source_logger
        src/logger/*.[hc]pp)
add_library(logger OBJECT ${source_logger})

file(GLOB source_network
        src/network/*.[hc]pp)
add_library(network OBJECT ${source_network})

if(LITESQL_FOUND)
  LITESQL_GENERATE_CPP("database/database.xml"
          "biboudb"
          LITESQL_GENERATED_SOURCES)

  add_library(database OBJECT src/database/database.cpp
          ${LITESQL_GENERATED_SOURCES})
  set(USE_DATABASE TRUE)
else()
  add_library(database OBJECT "")
endif()

#
## Tests
## Define the executables
#

## main
add_executable(${PROJECT_NAME} src/main.cpp
        $<TARGET_OBJECTS:utils>
        $<TARGET_OBJECTS:config>
        $<TARGET_OBJECTS:logger>
        $<TARGET_OBJECTS:network>
        $<TARGET_OBJECTS:xmpp>
        $<TARGET_OBJECTS:bridge>
        $<TARGET_OBJECTS:irc>
        $<TARGET_OBJECTS:identd>
        $<TARGET_OBJECTS:database>)

## test_suite
file(GLOB source_tests
  tests/*.cpp)
add_executable(test_suite EXCLUDE_FROM_ALL ${source_tests}
        ${source_utils}
        ${source_config}
        ${source_logger}
        ${source_network}
        ${source_xmpplib}
        ${source_xmpp}
        ${source_src_utils}
        ${source_bridge}
        ${source_irc}
        ${source_identd}
        ${source_database})
add_executable(test_suite ${source_tests}
        $<TARGET_OBJECTS:utils>
        $<TARGET_OBJECTS:config>
        $<TARGET_OBJECTS:logger>
        $<TARGET_OBJECTS:network>
        $<TARGET_OBJECTS:xmpp>
        $<TARGET_OBJECTS:bridge>
        $<TARGET_OBJECTS:irc>
        $<TARGET_OBJECTS:identd>
        $<TARGET_OBJECTS:database>)

#
## Link the executables with their libraries
#
target_link_libraries(${PROJECT_NAME}
        ${ICONV_LIBRARIES}
        ${LIBUUID_LIBRARIES}


@@ 230,6 267,9 @@ foreach(file ${source_all})
  set_property(SOURCE ${file} APPEND PROPERTY COMPILE_DEFINITIONS __FILENAME__="${shorter_file}")
endforeach()

#
## Add a rule to download the catch unit test framework
#
include(ExternalProject)
ExternalProject_Add(catch
  GIT_REPOSITORY "https://lab.louiz.org/louiz/Catch.git"


@@ 247,17 287,16 @@ if(NOT EXISTS ${CMAKE_SOURCE_DIR}/tests/catch.hpp)
    )
  add_dependencies(test_suite catch)
endif()

#
## Add some custom rules to launch the tests
#
add_custom_target(check COMMAND "test_suite"
  DEPENDS test_suite biboumi)
add_custom_target(e2e COMMAND "python3" "${CMAKE_CURRENT_SOURCE_DIR}/tests/end_to_end/"
  DEPENDS biboumi)
add_custom_target(e2e_valgrind COMMAND "E2E_BIBOUMI_SUPP_DIR=${CMAKE_CURRENT_SOURCE_DIR}/tests/end_to_end/" "E2E_BIBOUMI_VALGRIND=1" "python3" "${CMAKE_CURRENT_SOURCE_DIR}/tests/end_to_end/"
    DEPENDS biboumi)


#
## Code coverage
#
if(CMAKE_BUILD_TYPE MATCHES Debug)
  include(CodeCoverage)
  SETUP_TARGET_FOR_COVERAGE(coverage_check


@@ 278,7 317,6 @@ if(CMAKE_BUILD_TYPE MATCHES Debug)

    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
    )

endif()

#


@@ 315,8 353,9 @@ add_custom_target(rpm
  COMMAND rpmbuild --define "_topdir `pwd`/rpmbuild/" --define "_sourcedir `pwd`" -ba biboumi.spec
  )

configure_file(biboumi.h.cmake src/biboumi.h)

#
## Set some variables that will be used in the cmake-generated files
#
set(SYSTEMD_SERVICE_TYPE_DOCSTRING "The value used as the Type= in the systemd unit file.")
set(WATCHDOG_SEC_DOCSTRING "The value used as WatchdogSec= in the systemd unit file.")
if(SYSTEMD_FOUND)


@@ 334,7 373,6 @@ set(SERVICE_GROUP_DOCSTRING "The value used as the Group= in the systemd unit fi
if(NOT DEFINED SERVICE_GROUP)
  set(SERVICE_GROUP "nobody" CACHE STRING ${SERVICE_GROUP_DOCSTRING})
endif()
configure_file(unit/biboumi.service.cmake biboumi.service)

# Force the format of the date output
set(ENV{LANG} "C")


@@ 342,4 380,38 @@ execute_process(COMMAND "date" "+%a %b %d %Y" OUTPUT_VARIABLE RPM_DATE
                OUTPUT_STRIP_TRAILING_WHITESPACE)
unset(ENV{LANG})

set(POLLER_DOCSTRING "Choose the poller between POLL and EPOLL (Linux-only)")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
  set(POLLER "EPOLL" CACHE STRING ${POLLER_DOCSTRING})
else()
  set(POLLER "POLL" CACHE STRING ${POLLER_DOCSTRING})
endif()
if((NOT ${POLLER} MATCHES "POLL") AND
(NOT ${POLLER} MATCHES "EPOLL"))
  message(FATAL_ERROR "POLLER must be either POLL or EPOLL")
endif()

#
## Check if we have std::get_time and put_time
#
include(CheckCXXSourceCompiles)

check_cxx_source_compiles("
  #include <iomanip>
  int main()
  { std::get_time(nullptr, \"\"); }"
        HAS_GET_TIME)

mark_as_advanced(HAS_GET_TIME)

check_cxx_source_compiles("
  #include <iomanip>
  int main()
  { std::put_time(nullptr, \"\"); }"
        HAS_PUT_TIME)

mark_as_advanced(HAS_PUT_TIME)

configure_file(unit/biboumi.service.cmake biboumi.service)
configure_file(packaging/biboumi.spec.cmake biboumi.spec)
configure_file(biboumi.h.cmake src/biboumi.h)

M biboumi.h.cmake => biboumi.h.cmake +11 -0
@@ 1,1 1,12 @@
#cmakedefine USE_DATABASE
#cmakedefine ICONV_SECOND_ARGUMENT_IS_CONST
#cmakedefine LIBIDN_FOUND
#cmakedefine SYSTEMD_FOUND
#cmakedefine POLLER ${POLLER}
#cmakedefine BOTAN_FOUND
#cmakedefine GCRYPT_FOUND
#cmakedefine UDNS_FOUND
#cmakedefine SOFTWARE_VERSION "${SOFTWARE_VERSION}"
#cmakedefine PROJECT_NAME "${PROJECT_NAME}"
#cmakedefine HAS_GET_TIME
#cmakedefine HAS_PUT_TIME

R louloulibs/cmake/Modules/FindBOTAN.cmake => cmake/Modules/FindBOTAN.cmake +5 -6
@@ 16,10 16,9 @@
# This file is in the public domain

include(FindPkgConfig)

pkg_check_modules(BOTAN botan-2)
if(NOT BOTAN_FOUND)
  pkg_check_modules(BOTAN botan-1.11)
endif()
pkg_check_modules(BOTAN botan-1.11)

if(NOT BOTAN_FOUND)
  find_path(BOTAN_INCLUDE_DIRS NAMES botan/botan.h


@@ 35,9 34,9 @@ if(NOT BOTAN_FOUND)
  find_package_handle_standard_args(BOTAN REQUIRED_VARS BOTAN_LIBRARIES BOTAN_INCLUDE_DIRS)

  if(BOTAN_FOUND)
    set(BOTAN_LIBRARY ${BOTAN_LIBRARIES} PARENT_SCOPE)
    set(BOTAN_INCLUDE_DIR ${BOTAN_INCLUDE_DIRS} PARENT_SCOPE)
    set(BOTAN_FOUND ${BOTAN_FOUND} PARENT_SCOPE)
    set(BOTAN_LIBRARY ${BOTAN_LIBRARIES} CACHE INTERNAL "")
    set(BOTAN_INCLUDE_DIR ${BOTAN_INCLUDE_DIRS} CACHE INTERNAL "")
    set(BOTAN_FOUND ${BOTAN_FOUND} CACHE INTERNAL "")
  endif()
endif()


R louloulibs/cmake/Modules/FindGCRYPT.cmake => cmake/Modules/FindGCRYPT.cmake +3 -3
@@ 32,9 32,9 @@ if(NOT GCRYPT_FOUND)
  find_package_handle_standard_args(GCRYPT REQUIRED_VARS GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIRS)

  if(GCRYPT_FOUND)
    set(GCRYPT_LIBRARY ${GCRYPT_LIBRARIES} PARENT_SCOPE)
    set(GCRYPT_INCLUDE_DIR ${GCRYPT_INCLUDE_DIRS} PARENT_SCOPE)
    set(GCRYPT_FOUND ${GCRYPT_FOUND} PARENT_SCOPE)
    set(GCRYPT_LIBRARY ${GCRYPT_LIBRARIES} CACHE INTERNAL "")
    set(GCRYPT_INCLUDE_DIR ${GCRYPT_INCLUDE_DIRS} CACHE INTERNAL "")
    set(GCRYPT_FOUND ${GCRYPT_FOUND} CACHE INTERNAL "")
  endif()
endif()


R louloulibs/cmake/Modules/FindICONV.cmake => cmake/Modules/FindICONV.cmake +2 -3
@@ 53,9 53,8 @@ if(ICONV_FOUND)
   ICONV_SECOND_ARGUMENT_IS_CONST)

  # Compatibility for all the ways of writing these variables
  set(ICONV_LIBRARY ${ICONV_LIBRARIES} PARENT_SCOPE)
  set(ICONV_INCLUDE_DIR ${ICONV_INCLUDE_DIRS} PARENT_SCOPE)
  set(ICONV_FOUND ${ICONV_FOUND} PARENT_SCOPE)
  set(ICONV_LIBRARY ${ICONV_LIBRARIES})
  set(ICONV_INCLUDE_DIR ${ICONV_INCLUDE_DIRS})
endif()

mark_as_advanced(ICONV_INCLUDE_DIRS ICONV_LIBRARIES ICONV_SECOND_ARGUMENT_IS_CONST)

R louloulibs/cmake/Modules/FindLIBIDN.cmake => cmake/Modules/FindLIBIDN.cmake +3 -3
@@ 33,9 33,9 @@ if(NOT LIBIDN_FOUND)

  # Compatibility for all the ways of writing these variables
  if(LIBIDN_FOUND)
    set(LIBIDN_INCLUDE_DIR ${LIBIDN_INCLUDE_DIRS} PARENT_SCOPE)
    set(LIBIDN_LIBRARY ${LIBIDN_LIBRARIES} PARENT_SCOPE)
    set(LIBIDN_FOUND ${LIBIDN_FOUND} PARENT_SCOPE)
    set(LIBIDN_INCLUDE_DIR ${LIBIDN_INCLUDE_DIRS} CACHE INTERNAL "")
    set(LIBIDN_LIBRARY ${LIBIDN_LIBRARIES} CACHE INTERNAL "")
    set(LIBIDN_FOUN ${LIBIDN_FOUND} CACHE INTERNAL "")
  endif()
endif()


R louloulibs/cmake/Modules/FindLIBUUID.cmake => cmake/Modules/FindLIBUUID.cmake +3 -3
@@ 33,9 33,9 @@ if(NOT LIBUUID_FOUND)

  # Compatibility for all the ways of writing these variables
  if(LIBUUID_FOUND)
    set(LIBUUID_INCLUDE_DIR ${LIBUUID_INCLUDE_DIRS} PARENT_SCOPE)
    set(LIBUUID_LIBRARY ${LIBUUID_LIBRARIES} PARENT_SCOPE)
    set(LIBUUID_FOUND ${LIBUUID_FOUND} PARENT_SCOPE)
    set(LIBUUID_INCLUDE_DIR ${LIBUUID_INCLUDE_DIRS} CACHE INTERNAL "")
    set(LIBUUID_LIBRARY ${LIBUUID_LIBRARIES} CACHE INTERNAL "")
    set(LIBUUID_FOUND ${LIBUUID_FOUND} CACHE INTERNAL "")
  endif()
endif()


M cmake/Modules/FindLITESQL.cmake => cmake/Modules/FindLITESQL.cmake +1 -1
@@ 64,7 64,7 @@ function(LITESQL_GENERATE_CPP
  set(${OUTPUT_SOURCES})
  add_custom_command(
    OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME}.cpp"
    "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME}.hpp"
           "${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_NAME}.hpp"
    COMMAND  ${LITESQLGEN_EXECUTABLE}
    ARGS -t c++ --output-dir=${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_FILE}
    DEPENDS ${SOURCE_FILE}

R louloulibs/cmake/Modules/FindSYSTEMD.cmake => cmake/Modules/FindSYSTEMD.cmake +3 -3
@@ 31,9 31,9 @@ if(NOT SYSTEMD_FOUND)
  find_package_handle_standard_args(SYSTEMD REQUIRED_VARS SYSTEMD_LIBRARIES SYSTEMD_INCLUDE_DIRS)

  if(SYSTEMD_FOUND)
    set(SYSTEMD_LIBRARY ${SYSTEMD_LIBRARIES} PARENT_SCOPE)
    set(SYSTEMD_INCLUDE_DIR ${SYSTEMD_INCLUDE_DIRS} PARENT_SCOPE)
    set(SYSTEMD_FOUND ${SYSTEMD_FOUND} PARENT_SCOPE)
    set(SYSTEMD_LIBRARY ${SYSTEMD_LIBRARIES} CACHE INTERNAL "")
    set(SYSTEMD_INCLUDE_DIR ${SYSTEMD_INCLUDE_DIRS} CACHE INTERNAL "")
    set(SYSTEMD_FOUND ${SYSTEMD_FOUND} CACHE INTERNAL "")
  endif()
endif()


R louloulibs/cmake/Modules/FindUDNS.cmake => cmake/Modules/FindUDNS.cmake +3 -3
@@ 29,9 29,9 @@ if(NOT UDNS_FOUND)

  # Compatibility for all the ways of writing these variables
  if(UDNS_FOUND)
    set(UDNS_INCLUDE_DIR ${UDNS_INCLUDE_DIRS} PARENT_SCOPE)
    set(UDNS_LIBRARY ${UDNS_LIBRARIES} PARENT_SCOPE)
    set(UDNS_FOUND ${UDNS_FOUND} PARENT_SCOPE)
    set(UDNS_INCLUDE_DIR ${UDNS_INCLUDE_DIRS} CACHE INTERNAL "")
    set(UDNS_LIBRARY ${UDNS_LIBRARIES} CACHE INTERNAL "")
    set(UDNS_FOUND ${UDNS_FOUND} CACHE INTERNAL "")
  endif()
endif()


D louloulibs/CMakeLists.txt => louloulibs/CMakeLists.txt +0 -129
@@ 1,129 0,0 @@
cmake_minimum_required(VERSION 3.0)

set(${PROJECT_NAME}_VERSION_MAJOR 1)
set(${PROJECT_NAME}_VERSION_MINOR 0)
set(${PROJECT_NAME}_VERSION_SUFFIX "~dev")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y -pedantic -Wall -Wextra")

#
## Look for external libraries
#
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
find_package(ICONV REQUIRED)
find_package(LIBUUID REQUIRED)
find_package(EXPAT REQUIRED)
set(EXPAT_FOUND ${EXPAT_FOUND} PARENT_SCOPE)

if(WITH_LIBIDN)
  find_package(LIBIDN REQUIRED)
elseif(NOT WITHOUT_LIBIDN)
  find_package(LIBIDN)
endif()

if(WITH_SYSTEMD)
  find_package(SYSTEMD REQUIRED)
elseif(NOT WITHOUT_SYSTEMD)
  find_package(SYSTEMD)
endif()

if(WITH_BOTAN)
  find_package(BOTAN REQUIRED)
elseif(NOT WITHOUT_BOTAN)
  find_package(BOTAN)
endif()

if(NOT BOTAN_FOUND)
  find_package(GCRYPT REQUIRED)
endif()

if(WITH_UDNS)
  find_package(UDNS REQUIRED)
elseif(NOT WITHOUT_UDNS)
  find_package(UDNS)
endif()

# To be able to include the config.h file generated by cmake
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

include_directories(${EXPAT_INCLUDE_DIRS})
include_directories(${ICONV_INCLUDE_DIRS})
include_directories(${LIBUUID_INCLUDE_DIRS})

set(POLLER_DOCSTRING "Choose the poller between POLL and EPOLL (Linux-only)")
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
 set(POLLER "EPOLL" CACHE STRING ${POLLER_DOCSTRING})
else()
 set(POLLER "POLL" CACHE STRING ${POLLER_DOCSTRING})
endif()
if((NOT ${POLLER} MATCHES "POLL") AND
    (NOT ${POLLER} MATCHES "EPOLL"))
  message(FATAL_ERROR "POLLER must be either POLL or EPOLL")
endif()

#
## utils
#
file(GLOB source_utils
  utils/*.[hc]pp)
set(source_utils ${source_utils} PARENT_SCOPE)

#
## config
#
file(GLOB source_config
  config/*.[hc]pp)
set(source_config ${source_config} PARENT_SCOPE)

#
## logger
#
file(GLOB source_logger
  logger/*.[hc]pp)
set(source_logger ${source_logger} PARENT_SCOPE)

#
## network
#
file(GLOB source_network
  network/*.[hc]pp)
set(source_network ${source_network} PARENT_SCOPE)

#
## xmpplib
#
file(GLOB source_xmpplib
  xmpp/*.[hc]pp)
set(source_xmpplib ${source_xmpplib} PARENT_SCOPE)

# Define a __FILENAME__ macro with the relative path (from the base project directory)
# of each source file
file(GLOB_RECURSE source_all *.[hc]pp)
foreach(file ${source_all})
  file(RELATIVE_PATH shorter_file ${CMAKE_CURRENT_SOURCE_DIR} ${file})
  set_property(SOURCE ${file} APPEND PROPERTY COMPILE_DEFINITIONS __FILENAME__="${shorter_file}")
endforeach()

#
## Check if we have std::get_time
#
include(CheckCXXSourceCompiles)

check_cxx_source_compiles("
  #include <iomanip>
  int main()
  { std::get_time(nullptr, \"\"); }"
  HAS_GET_TIME)

mark_as_advanced(HAS_GET_TIME)

check_cxx_source_compiles("
  #include <iomanip>
  int main()
  { std::put_time(nullptr, \"\"); }"
  HAS_PUT_TIME)

mark_as_advanced(HAS_PUT_TIME)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/louloulibs.h.cmake ${CMAKE_BINARY_DIR}/src/louloulibs.h)

D louloulibs/louloulibs.h.cmake => louloulibs/louloulibs.h.cmake +0 -11
@@ 1,11 0,0 @@
#cmakedefine ICONV_SECOND_ARGUMENT_IS_CONST
#cmakedefine LIBIDN_FOUND
#cmakedefine SYSTEMD_FOUND
#cmakedefine POLLER ${POLLER}
#cmakedefine BOTAN_FOUND
#cmakedefine GCRYPT_FOUND
#cmakedefine UDNS_FOUND
#cmakedefine SOFTWARE_VERSION "${SOFTWARE_VERSION}"
#cmakedefine PROJECT_NAME "${PROJECT_NAME}"
#cmakedefine HAS_GET_TIME
#cmakedefine HAS_PUT_TIME

R louloulibs/config/config.cpp => src/config/config.cpp +0 -0
R louloulibs/config/config.hpp => src/config/config.hpp +0 -0
M src/irc/irc_client.cpp => src/irc/irc_client.cpp +0 -1
@@ 21,7 21,6 @@
#include <string>

#include "biboumi.h"
#include "louloulibs.h"

using namespace std::string_literals;
using namespace std::chrono_literals;

R louloulibs/logger/logger.cpp => src/logger/logger.cpp +0 -0
R louloulibs/logger/logger.hpp => src/logger/logger.hpp +1 -1
@@ 17,7 17,7 @@
#define warning_lvl 2
#define error_lvl 3

#include "louloulibs.h"
#include "biboumi.h"
#ifdef SYSTEMD_FOUND
# include <systemd/sd-daemon.h>
#else

R louloulibs/network/credentials_manager.cpp => src/network/credentials_manager.cpp +1 -1
@@ 1,4 1,4 @@
#include "louloulibs.h"
#include "biboumi.h"

#ifdef BOTAN_FOUND
#include <network/tcp_socket_handler.hpp>

R louloulibs/network/credentials_manager.hpp => src/network/credentials_manager.hpp +1 -1
@@ 1,6 1,6 @@
#pragma once

#include "louloulibs.h"
#include "biboumi.h"

#ifdef BOTAN_FOUND


R louloulibs/network/dns_handler.cpp => src/network/dns_handler.cpp +1 -1
@@ 1,4 1,4 @@
#include <louloulibs.h>
#include <biboumi.h>
#ifdef UDNS_FOUND

#include <network/dns_socket_handler.hpp>

R louloulibs/network/dns_handler.hpp => src/network/dns_handler.hpp +1 -1
@@ 1,6 1,6 @@
#pragma once

#include <louloulibs.h>
#include <biboumi.h>
#ifdef UDNS_FOUND

class Poller;

R louloulibs/network/dns_socket_handler.cpp => src/network/dns_socket_handler.cpp +1 -1
@@ 1,4 1,4 @@
#include <louloulibs.h>
#include <biboumi.h>
#ifdef UDNS_FOUND

#include <network/dns_socket_handler.hpp>

R louloulibs/network/dns_socket_handler.hpp => src/network/dns_socket_handler.hpp +1 -1
@@ 1,6 1,6 @@
#pragma once

#include <louloulibs.h>
#include <biboumi.h>
#ifdef UDNS_FOUND

#include <network/socket_handler.hpp>

R louloulibs/network/poller.cpp => src/network/poller.cpp +0 -0
R louloulibs/network/poller.hpp => src/network/poller.hpp +1 -1
@@ 10,7 10,7 @@
#define POLL 1
#define EPOLL 2
#define KQUEUE 3
#include <louloulibs.h>
#include <biboumi.h>
#ifndef POLLER
 #define POLLER POLL
#endif

R louloulibs/network/resolver.cpp => src/network/resolver.cpp +0 -0
R louloulibs/network/resolver.hpp => src/network/resolver.hpp +1 -1
@@ 1,6 1,6 @@
#pragma once

#include "louloulibs.h"
#include "biboumi.h"

#include <functional>
#include <vector>

R louloulibs/network/socket_handler.hpp => src/network/socket_handler.hpp +1 -1
@@ 1,6 1,6 @@
#pragma once

#include <louloulibs.h>
#include <biboumi.h>
#include <memory>

class Poller;

R louloulibs/network/tcp_client_socket_handler.cpp => src/network/tcp_client_socket_handler.cpp +0 -0
R louloulibs/network/tcp_client_socket_handler.hpp => src/network/tcp_client_socket_handler.hpp +0 -0
R louloulibs/network/tcp_server_socket.hpp => src/network/tcp_server_socket.hpp +0 -0
R louloulibs/network/tcp_socket_handler.cpp => src/network/tcp_socket_handler.cpp +0 -0
R louloulibs/network/tcp_socket_handler.hpp => src/network/tcp_socket_handler.hpp +1 -1
@@ 1,6 1,6 @@
#pragma once

#include "louloulibs.h"
#include "biboumi.h"

#include <network/socket_handler.hpp>
#include <network/resolver.hpp>

R louloulibs/utils/encoding.cpp => src/utils/encoding.cpp +0 -0
R louloulibs/utils/encoding.hpp => src/utils/encoding.hpp +0 -0
R louloulibs/utils/get_first_non_empty.cpp => src/utils/get_first_non_empty.cpp +0 -0
R louloulibs/utils/get_first_non_empty.hpp => src/utils/get_first_non_empty.hpp +0 -0
R louloulibs/utils/revstr.cpp => src/utils/revstr.cpp +0 -0
R louloulibs/utils/revstr.hpp => src/utils/revstr.hpp +0 -0
R louloulibs/utils/scopeguard.hpp => src/utils/scopeguard.hpp +0 -0
R louloulibs/utils/sha1.cpp => src/utils/sha1.cpp +1 -1
@@ 1,6 1,6 @@
#include <utils/sha1.hpp>

#include <louloulibs.h>
#include <biboumi.h>

#ifdef BOTAN_FOUND
# include <botan/hash.h>

R louloulibs/utils/sha1.hpp => src/utils/sha1.hpp +0 -0
R louloulibs/utils/split.cpp => src/utils/split.cpp +0 -0
R louloulibs/utils/split.hpp => src/utils/split.hpp +0 -0
R louloulibs/utils/string.cpp => src/utils/string.cpp +0 -0
R louloulibs/utils/string.hpp => src/utils/string.hpp +0 -0
R louloulibs/utils/system.cpp => src/utils/system.cpp +0 -0
R louloulibs/utils/system.hpp => src/utils/system.hpp +0 -0
R louloulibs/utils/time.cpp => src/utils/time.cpp +1 -1
@@ 5,7 5,7 @@
#include <iomanip>
#include <locale>

#include "louloulibs.h"
#include "biboumi.h"

namespace utils
{

R louloulibs/utils/time.hpp => src/utils/time.hpp +0 -0
R louloulibs/utils/timed_events.cpp => src/utils/timed_events.cpp +0 -0
R louloulibs/utils/timed_events.hpp => src/utils/timed_events.hpp +0 -0
R louloulibs/utils/timed_events_manager.cpp => src/utils/timed_events_manager.cpp +0 -0
R louloulibs/utils/tolower.cpp => src/utils/tolower.cpp +0 -0
R louloulibs/utils/tolower.hpp => src/utils/tolower.hpp +0 -0
R louloulibs/utils/xdg.cpp => src/utils/xdg.cpp +1 -1
@@ 1,7 1,7 @@
#include <utils/xdg.hpp>
#include <cstdlib>

#include "louloulibs.h"
#include "biboumi.h"

std::string xdg_path(const std::string& filename, const char* env_var)
{

R louloulibs/utils/xdg.hpp => src/utils/xdg.hpp +0 -0
R louloulibs/xmpp/adhoc_command.cpp => src/xmpp/adhoc_command.cpp +0 -0
R louloulibs/xmpp/adhoc_command.hpp => src/xmpp/adhoc_command.hpp +0 -0
R louloulibs/xmpp/adhoc_commands_handler.cpp => src/xmpp/adhoc_commands_handler.cpp +0 -0
R louloulibs/xmpp/adhoc_commands_handler.hpp => src/xmpp/adhoc_commands_handler.hpp +0 -0
R louloulibs/xmpp/adhoc_session.cpp => src/xmpp/adhoc_session.cpp +0 -0
R louloulibs/xmpp/adhoc_session.hpp => src/xmpp/adhoc_session.hpp +0 -0
R louloulibs/xmpp/auth.cpp => src/xmpp/auth.cpp +0 -0
R louloulibs/xmpp/auth.hpp => src/xmpp/auth.hpp +0 -0
M src/xmpp/biboumi_component.cpp => src/xmpp/biboumi_component.cpp +0 -1
@@ 16,7 16,6 @@

#include <cstdlib>

#include <louloulibs.h>
#include <biboumi.h>

#include <uuid/uuid.h>

R louloulibs/xmpp/body.hpp => src/xmpp/body.hpp +0 -0
R louloulibs/xmpp/jid.cpp => src/xmpp/jid.cpp +1 -1
@@ 3,7 3,7 @@
#include <cstring>
#include <map>

#include <louloulibs.h>
#include <biboumi.h>
#ifdef LIBIDN_FOUND
 #include <stringprep.h>
 #include <sys/types.h>

R louloulibs/xmpp/jid.hpp => src/xmpp/jid.hpp +0 -0
R louloulibs/xmpp/xmpp_component.cpp => src/xmpp/xmpp_component.cpp +1 -1
@@ 19,7 19,7 @@
#include <cstdlib>
#include <set>

#include <louloulibs.h>
#include <biboumi.h>
#ifdef SYSTEMD_FOUND
# include <systemd/sd-daemon.h>
#endif

R louloulibs/xmpp/xmpp_component.hpp => src/xmpp/xmpp_component.hpp +0 -0
R louloulibs/xmpp/xmpp_parser.cpp => src/xmpp/xmpp_parser.cpp +0 -0
R louloulibs/xmpp/xmpp_parser.hpp => src/xmpp/xmpp_parser.hpp +0 -0
R louloulibs/xmpp/xmpp_stanza.cpp => src/xmpp/xmpp_stanza.cpp +0 -0
R louloulibs/xmpp/xmpp_stanza.hpp => src/xmpp/xmpp_stanza.hpp +0 -0
M tests/jid.cpp => tests/jid.cpp +1 -1
@@ 1,7 1,7 @@
#include "catch.hpp"

#include <xmpp/jid.hpp>
#include <louloulibs.h>
#include <biboumi.h>

TEST_CASE("Jid")
{