add boost library

This commit is contained in:
Bechir Braham 2024-04-09 15:45:01 +02:00
parent a48820059d
commit 59b04ad6e8
No known key found for this signature in database
GPG Key ID: 7F511B55FD8E9671
4 changed files with 48 additions and 11 deletions

View File

@ -27,6 +27,8 @@ option(AARE_FETCH_PYBIND11 "Use FetchContent to download pybind11" ON)
option(AARE_FETCH_CATCH "Use FetchContent to download catch2" ON)
option(AARE_FETCH_JSON "Use FetchContent to download nlohmann::json" ON)
option(AARE_FETCH_ZMQ "Use FetchContent to download libzmq" ON)
option(AARE_FETCH_BOOST "Use FetchContent to download boost" ON)
#Convenience option to use system libraries
option(AARE_SYSTEM_LIBRARIES "Use system libraries" OFF)
@ -37,6 +39,8 @@ if(AARE_SYSTEM_LIBRARIES)
set(AARE_FETCH_CATCH OFF CACHE BOOL "Disabled FetchContent for catch2" FORCE)
set(AARE_FETCH_JSON OFF CACHE BOOL "Disabled FetchContent for nlohmann::json" FORCE)
set(AARE_FETCH_ZMQ OFF CACHE BOOL "Disabled FetchContent for libzmq" FORCE)
set(AARE_FETCH_BOOST OFF CACHE BOOL "Disabled FetchContent for boost" FORCE)
endif()
@ -72,9 +76,26 @@ if (AARE_FETCH_FMT)
)
FetchContent_MakeAvailable(fmt)
else()
find_package(fmt 6 REQUIRED)
find_package(fmt 6 REQUIRED)
endif()
if (AARE_FETCH_BOOST)
set(BOOST_INCLUDE_LIBRARIES program_options)
set(BOOST_ENABLE_CMAKE ON)
FetchContent_Declare(
Boost
GIT_REPOSITORY https://github.com/boostorg/boost.git
GIT_TAG boost-1.80.0
)
FetchContent_MakeAvailable(Boost)
else()
find_package(Boost 1.80 REQUIRED COMPONENTS program_options)
endif()
add_library(aare_compiler_flags INTERFACE)
target_compile_features(aare_compiler_flags INTERFACE cxx_std_17)
@ -88,7 +109,7 @@ else()
INTERFACE
-Og
-ggdb3
-D_GLIBCXX_DEBUG
# -D_GLIBCXX_DEBUG # causes errors with boost
-D_GLIBCXX_DEBUG_PEDANTIC
)
@ -153,7 +174,7 @@ add_subdirectory(network_io)
#Overall target to link to when using the library
add_library(aare INTERFACE)
target_link_libraries(aare INTERFACE core file_io utils network_io)
target_link_libraries(aare INTERFACE core file_io utils network_io ${Boost_LIBRARIES})
target_include_directories(aare INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>

View File

@ -8,3 +8,4 @@ dependencies:
- nlohmann_json # should be removed
- catch2
- zeromq
- boost-cpp

View File

@ -1,14 +1,13 @@
set(EXAMPLE_LIST "json_example;logger_example;numpy_read_example;multiport_example;raw_example;")
set(EXAMPLE_LIST "${EXAMPLE_LIST};mythen_example;numpy_write_example;zmq_receiver_example;zmq_sender_example;")
set(EXAMPLE_LIST "json_example;logger_example;numpy_read_example;multiport_example;raw_example;restream_example")
set(EXAMPLE_LIST "${EXAMPLE_LIST};mythen_example;numpy_write_example;zmq_receiver_example;zmq_sender_example;")
foreach(example ${EXAMPLE_LIST})
add_executable(${example} ${example}.cpp)
target_link_libraries(${example} PUBLIC aare PRIVATE aare_compiler_flags)
endforeach()
message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}")

View File

@ -1,10 +1,26 @@
#include <iostream>
#include <string>
#include <filesystem>
#include <vector>
#include <memory>
#include <boost/program_options.hpp>
#include "aare/network_io/ZmqSocketSender.hpp"
#include "aare/
#include <boost/program_options/options_description.hpp>
using namespace aare;
using namespace std;
namespace po = boost::program_options;
int main(){
int main(int argc, char **argv) {
po::options_description desc("Allowed options");
desc.add_options()
("help", "produce help message")
// ("input,i", po::value<string>(), "input file");
("port,p", po::value<int>(), "port number");
// ("loop,l", "loop over the file");
// po::positional_options_description pd;
// pd.add("input,i", 1);
}