From b329af05c4b32f93cacdcb58289df7e5ab193622 Mon Sep 17 00:00:00 2001 From: Jean-Francois Smigielski Date: Sun, 24 Mar 2024 23:02:22 +0100 Subject: [PATCH 1/6] Reorganize the CMake config There was some room for improvements, at least to ease using binapi as an ExternalProject --- CMakeLists.txt | 95 +++++++------------ .../asynchronous-user_data/CMakeLists.txt | 70 -------------- examples/asynchronous/CMakeLists.txt | 71 -------------- examples/synchronous-user_data/CMakeLists.txt | 71 -------------- examples/synchronous/CMakeLists.txt | 71 -------------- examples/websockets/CMakeLists.txt | 71 -------------- 6 files changed, 35 insertions(+), 414 deletions(-) delete mode 100644 examples/asynchronous-user_data/CMakeLists.txt delete mode 100644 examples/asynchronous/CMakeLists.txt delete mode 100644 examples/synchronous-user_data/CMakeLists.txt delete mode 100644 examples/synchronous/CMakeLists.txt delete mode 100644 examples/websockets/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index a271f88..a21fd82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,71 +1,46 @@ -cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.22) project(binapi) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fsanitize=address") +find_package(Threads REQUIRED) -add_definitions( - -UNDEBUG - -DDTF_HEADER_ONLY -) +add_library(binapi SHARED + src/api.cpp + src/enums.cpp + src/errors.cpp + src/pairslist.cpp + src/reports.cpp + src/tools.cpp + src/types.cpp + src/websocket.cpp) -include_directories( - ./include -) +target_include_directories(binapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) -if (DEFINED ${BOOST_INCLUDE_DIR}) - include_directories( - ${BOOST_INCLUDE_DIR} - ) -endif() +target_compile_options(binapi PUBLIC + -pipe -Wall -Wextra + $<$:-g3 -Og -fno-inline -fstack-protector-all -fsanitize=address> + $<$:-O3 -s>) -set(BINAPI_HEADERS - binapi/api.hpp - binapi/flatjson.hpp - binapi/dtf.hpp - binapi/double_type.hpp - binapi/enums.hpp - binapi/errors.hpp - binapi/invoker.hpp - binapi/message.hpp - binapi/pairslist.hpp - binapi/reports.hpp - binapi/tools.hpp - binapi/types.hpp - binapi/websocket.hpp -) +target_compile_definitions(binapi PRIVATE -DDTF_HEADER_ONLY) -set(BINAPI_SOURCES - src/api.cpp - src/enums.cpp - src/errors.cpp - src/pairslist.cpp - src/reports.cpp - src/tools.cpp - src/types.cpp - src/websocket.cpp -) +target_link_libraries(binapi ${BOOST_LIBRARIES}) -add_executable( - ${PROJECT_NAME} - # - main.cpp - # - ${BINAPI_SOURCES} -) +target_link_libraries(binapi PUBLIC z crypto ssl ${CMAKE_THREAD_LIBS_INIT}) -if (DEFINED ${BOOST_LIB_DIR}) - target_link_libraries( - ${PROJECT_NAME} - -L${BOOST_LIB_DIR} - ) -endif() +target_include_directories(binapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) -target_link_libraries( - ${PROJECT_NAME} - z - crypto - ssl - pthread -) +add_executable(asynchronous examples/asynchronous/main.cpp) +target_link_libraries(asynchronous binapi) + +add_executable(asynchronous-user_data examples/asynchronous-user_data/main.cpp) +target_link_libraries(asynchronous-user_data binapi) + +add_executable(synchronous examples/synchronous/main.cpp) +target_link_libraries(synchronous binapi) + +add_executable(synchronous-user_data examples/synchronous-user_data/main.cpp) +target_link_libraries(synchronous-user_data binapi) + +add_executable(websockets examples/websockets/main.cpp) +target_link_libraries(websockets binapi) diff --git a/examples/asynchronous-user_data/CMakeLists.txt b/examples/asynchronous-user_data/CMakeLists.txt deleted file mode 100644 index 3ab159e..0000000 --- a/examples/asynchronous-user_data/CMakeLists.txt +++ /dev/null @@ -1,70 +0,0 @@ -cmake_minimum_required(VERSION 3.2) -project(asynchronous-user_data) - -set(CMAKE_CXX_STANDARD 14) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") - -add_definitions( - -UNDEBUG - -DDTF_HEADER_ONLY -) - -include_directories( - ../../include -) - -if (DEFINED ${BOOST_INCLUDE_DIR}) - include_directories( - ${BOOST_INCLUDE_DIR} - ) -endif() - -set(BINAPI_HEADERS - binapi/errors.hpp - binapi/api.hpp - binapi/flatjson.hpp - binapi/dtf.hpp - binapi/double_type.hpp - binapi/invoker.hpp - binapi/message.hpp - binapi/pairslist.hpp - binapi/reports.hpp - binapi/tools.hpp - binapi/types.hpp - binapi/websocket.hpp -) - -set(BINAPI_SOURCES - ../../src/errors.cpp - ../../src/api.cpp - ../../src/enums.cpp - ../../src/pairslist.cpp - ../../src/reports.cpp - ../../src/tools.cpp - ../../src/types.cpp - ../../src/websocket.cpp -) - -add_executable( - ${PROJECT_NAME} - # - main.cpp - # - ${BINAPI_SOURCES} -) - -if (DEFINED ${BOOST_LIB_DIR}) - target_link_libraries( - ${PROJECT_NAME} - -L${BOOST_LIB_DIR} - ) -endif() - -target_link_libraries( - ${PROJECT_NAME} - z - crypto - ssl - pthread -) diff --git a/examples/asynchronous/CMakeLists.txt b/examples/asynchronous/CMakeLists.txt deleted file mode 100644 index d761205..0000000 --- a/examples/asynchronous/CMakeLists.txt +++ /dev/null @@ -1,71 +0,0 @@ -cmake_minimum_required(VERSION 3.2) -project(asynchronous) - -set(CMAKE_CXX_STANDARD 14) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") - -add_definitions( - -UNDEBUG - -DDTF_HEADER_ONLY -) - -include_directories( - ../../include -) - -if (DEFINED ${BOOST_INCLUDE_DIR}) - include_directories( - ${BOOST_INCLUDE_DIR} - ) -endif() - -set(BINAPI_HEADERS - binapi/errors.hpp - binapi/api.hpp - binapi/flatjson.hpp - binapi/dtf.hpp - binapi/double_type.hpp - binapi/enums.hpp - binapi/invoker.hpp - binapi/message.hpp - binapi/pairslist.hpp - binapi/reports.hpp - binapi/tools.hpp - binapi/types.hpp - binapi/websocket.hpp -) - -set(BINAPI_SOURCES - ../../src/errors.cpp - ../../src/api.cpp - ../../src/enums.cpp - ../../src/pairslist.cpp - ../../src/reports.cpp - ../../src/tools.cpp - ../../src/types.cpp - ../../src/websocket.cpp -) - -add_executable( - ${PROJECT_NAME} - # - main.cpp - # - ${BINAPI_SOURCES} -) - -if (DEFINED ${BOOST_LIB_DIR}) - target_link_libraries( - ${PROJECT_NAME} - -L${BOOST_LIB_DIR} - ) -endif() - -target_link_libraries( - ${PROJECT_NAME} - z - crypto - ssl - pthread -) diff --git a/examples/synchronous-user_data/CMakeLists.txt b/examples/synchronous-user_data/CMakeLists.txt deleted file mode 100644 index b5f91be..0000000 --- a/examples/synchronous-user_data/CMakeLists.txt +++ /dev/null @@ -1,71 +0,0 @@ -cmake_minimum_required(VERSION 3.2) -project(synchronous-user_data) - -set(CMAKE_CXX_STANDARD 14) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") - -add_definitions( - -UNDEBUG - -DDTF_HEADER_ONLY -) - -include_directories( - ../../include -) - -if (DEFINED ${BOOST_INCLUDE_DIR}) - include_directories( - ${BOOST_INCLUDE_DIR} - ) -endif() - -set(BINAPI_HEADERS - binapi/errors.hpp - binapi/api.hpp - binapi/flatjson.hpp - binapi/dtf.hpp - binapi/double_type.hpp - binapi/enums.hpp - binapi/invoker.hpp - binapi/message.hpp - binapi/pairslist.hpp - binapi/reports.hpp - binapi/tools.hpp - binapi/types.hpp - binapi/websocket.hpp -) - -set(BINAPI_SOURCES - ../../src/errors.cpp - ../../src/api.cpp - ../../src/enums.cpp - ../../src/pairslist.cpp - ../../src/reports.cpp - ../../src/tools.cpp - ../../src/types.cpp - ../../src/websocket.cpp -) - -add_executable( - ${PROJECT_NAME} - # - main.cpp - # - ${BINAPI_SOURCES} -) - -if (DEFINED ${BOOST_LIB_DIR}) - target_link_libraries( - ${PROJECT_NAME} - -L${BOOST_LIB_DIR} - ) -endif() - -target_link_libraries( - ${PROJECT_NAME} - z - crypto - ssl - pthread -) diff --git a/examples/synchronous/CMakeLists.txt b/examples/synchronous/CMakeLists.txt deleted file mode 100644 index 1ff4c8b..0000000 --- a/examples/synchronous/CMakeLists.txt +++ /dev/null @@ -1,71 +0,0 @@ -cmake_minimum_required(VERSION 3.2) -project(synchronous) - -set(CMAKE_CXX_STANDARD 14) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") - -add_definitions( - -UNDEBUG - -DDTF_HEADER_ONLY -) - -include_directories( - ../../include -) - -if (DEFINED ${BOOST_INCLUDE_DIR}) - include_directories( - ${BOOST_INCLUDE_DIR} - ) -endif() - -set(BINAPI_HEADERS - binapi/errors.hpp - binapi/api.hpp - binapi/flatjson.hpp - binapi/dtf.hpp - binapi/double_type.hpp - binapi/enums.hpp - binapi/invoker.hpp - binapi/message.hpp - binapi/pairslist.hpp - binapi/reports.hpp - binapi/tools.hpp - binapi/types.hpp - binapi/websocket.hpp -) - -set(BINAPI_SOURCES - ../../src/errors.cpp - ../../src/api.cpp - ../../src/enums.cpp - ../../src/pairslist.cpp - ../../src/reports.cpp - ../../src/tools.cpp - ../../src/types.cpp - ../../src/websocket.cpp -) - -add_executable( - ${PROJECT_NAME} - # - main.cpp - # - ${BINAPI_SOURCES} -) - -if (DEFINED ${BOOST_LIB_DIR}) - target_link_libraries( - ${PROJECT_NAME} - -L${BOOST_LIB_DIR} - ) -endif() - -target_link_libraries( - ${PROJECT_NAME} - z - crypto - ssl - pthread -) diff --git a/examples/websockets/CMakeLists.txt b/examples/websockets/CMakeLists.txt deleted file mode 100644 index 3ea74c1..0000000 --- a/examples/websockets/CMakeLists.txt +++ /dev/null @@ -1,71 +0,0 @@ -cmake_minimum_required(VERSION 3.2) -project(websockets) - -set(CMAKE_CXX_STANDARD 14) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") - -add_definitions( - -UNDEBUG - -DDTF_HEADER_ONLY -) - -include_directories( - ../../include -) - -if (DEFINED ${BOOST_INCLUDE_DIR}) - include_directories( - ${BOOST_INCLUDE_DIR} - ) -endif() - -set(BINAPI_HEADERS - binapi/api.hpp - binapi/flatjson.hpp - binapi/dtf.hpp - binapi/double_type.hpp - binapi/enums.hpp - binapi/errors.hpp - binapi/invoker.hpp - binapi/message.hpp - binapi/pairslist.hpp - binapi/reports.hpp - binapi/tools.hpp - binapi/types.hpp - binapi/websocket.hpp -) - -set(BINAPI_SOURCES - ../../src/api.cpp - ../../src/enums.cpp - ../../src/errors.cpp - ../../src/pairslist.cpp - ../../src/reports.cpp - ../../src/tools.cpp - ../../src/types.cpp - ../../src/websocket.cpp -) - -add_executable( - ${PROJECT_NAME} - # - main.cpp - # - ${BINAPI_SOURCES} -) - -if (DEFINED ${BOOST_LIB_DIR}) - target_link_libraries( - ${PROJECT_NAME} - -L${BOOST_LIB_DIR} - ) -endif() - -target_link_libraries( - ${PROJECT_NAME} - z - crypto - ssl - pthread -) From ae15169da98b175f50caf4a51b4722e14e2f2c9b Mon Sep 17 00:00:00 2001 From: Jean-Francois Smigielski Date: Mon, 25 Mar 2024 00:00:28 +0100 Subject: [PATCH 2/6] WIP Fix the includes --- include/binapi/api.hpp | 6 +++--- main.cpp | 14 +++++++------- src/api.cpp | 17 +++++++++-------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/include/binapi/api.hpp b/include/binapi/api.hpp index e5d0549..820da0e 100644 --- a/include/binapi/api.hpp +++ b/include/binapi/api.hpp @@ -12,12 +12,12 @@ #ifndef __binapi__api_hpp #define __binapi__api_hpp -#include "types.hpp" -#include "enums.hpp" - #include #include +#include +#include + namespace boost { namespace asio { diff --git a/main.cpp b/main.cpp index e9a63fd..d2593ca 100644 --- a/main.cpp +++ b/main.cpp @@ -9,18 +9,18 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include "binapi/websocket.hpp" -#include "binapi/api.hpp" -#include "binapi/pairslist.hpp" -#include "binapi/reports.hpp" -#include "binapi/flatjson.hpp" +#include +#include #include #include -#include -#include #include +#include +#include +#include +#include +#include /*************************************************************************************************/ diff --git a/src/api.cpp b/src/api.cpp index e31c6c9..74a990d 100644 --- a/src/api.cpp +++ b/src/api.cpp @@ -9,9 +9,10 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include -#include -#include +#include +#include +#include +#include #include #include @@ -25,14 +26,14 @@ #include #include -#include -#include -#include -#include - #include #include + #include +#include +#include +#include + namespace binapi { namespace rest { From f286636e90fc4c5230f5ad0b7e9fe2d316ed3495 Mon Sep 17 00:00:00 2001 From: Jean-Francois Smigielski Date: Mon, 25 Mar 2024 00:00:28 +0100 Subject: [PATCH 3/6] Fix the includes --- CMakeLists.txt | 8 ++++---- examples/asynchronous-user_data/main.cpp | 6 +++--- examples/asynchronous/main.cpp | 4 ++-- examples/synchronous-user_data/main.cpp | 4 ++-- examples/synchronous/main.cpp | 4 ++-- examples/websockets/main.cpp | 6 +++--- include/binapi/dtf.hpp | 4 ---- include/binapi/invoker.hpp | 6 +++--- include/binapi/tools.hpp | 4 ++-- include/binapi/types.hpp | 10 +++++----- include/binapi/websocket.hpp | 4 ++-- src/api.cpp | 3 ++- {include/binapi => src}/dtf.cpp | 2 +- src/enums.cpp | 5 +++-- src/errors.cpp | 3 ++- src/pairslist.cpp | 9 +++++---- src/reports.cpp | 11 ++++++----- src/tools.cpp | 5 +++-- src/types.cpp | 7 ++++--- src/websocket.cpp | 21 +++++++++++---------- 20 files changed, 65 insertions(+), 61 deletions(-) rename {include/binapi => src}/dtf.cpp (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index a21fd82..436c9f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ find_package(Threads REQUIRED) add_library(binapi SHARED src/api.cpp + src/dtf.cpp src/enums.cpp src/errors.cpp src/pairslist.cpp @@ -22,11 +23,10 @@ target_compile_options(binapi PUBLIC $<$:-g3 -Og -fno-inline -fstack-protector-all -fsanitize=address> $<$:-O3 -s>) -target_compile_definitions(binapi PRIVATE -DDTF_HEADER_ONLY) +target_link_options(binapi PUBLIC + $<$:-fsanitize=address>) -target_link_libraries(binapi ${BOOST_LIBRARIES}) - -target_link_libraries(binapi PUBLIC z crypto ssl ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(binapi PUBLIC z crypto ssl ${CMAKE_THREAD_LIBS_INIT} ${BOOST_LIBRARIES}) target_include_directories(binapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) diff --git a/examples/asynchronous-user_data/main.cpp b/examples/asynchronous-user_data/main.cpp index ebf175a..2898f70 100644 --- a/examples/asynchronous-user_data/main.cpp +++ b/examples/asynchronous-user_data/main.cpp @@ -9,12 +9,12 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include -#include +#include #include -#include +#include +#include int main(int argc, char **argv) { assert(argc == 3); diff --git a/examples/asynchronous/main.cpp b/examples/asynchronous/main.cpp index 964602e..d185564 100644 --- a/examples/asynchronous/main.cpp +++ b/examples/asynchronous/main.cpp @@ -9,11 +9,11 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include +#include #include -#include +#include int main() { boost::asio::io_context ioctx; diff --git a/examples/synchronous-user_data/main.cpp b/examples/synchronous-user_data/main.cpp index 2486445..ae954d0 100644 --- a/examples/synchronous-user_data/main.cpp +++ b/examples/synchronous-user_data/main.cpp @@ -9,11 +9,11 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include +#include #include -#include +#include int main(int argc, char **argv) { assert(argc == 3); diff --git a/examples/synchronous/main.cpp b/examples/synchronous/main.cpp index c132eea..b9b92c0 100644 --- a/examples/synchronous/main.cpp +++ b/examples/synchronous/main.cpp @@ -9,11 +9,11 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include +#include #include -#include +#include int main() { boost::asio::io_context ioctx; diff --git a/examples/websockets/main.cpp b/examples/websockets/main.cpp index d7ff512..2700abf 100644 --- a/examples/websockets/main.cpp +++ b/examples/websockets/main.cpp @@ -9,13 +9,13 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include -#include +#include #include #include -#include +#include +#include int main() { boost::asio::io_context ioctx; diff --git a/include/binapi/dtf.hpp b/include/binapi/dtf.hpp index 65dd4a2..c455949 100644 --- a/include/binapi/dtf.hpp +++ b/include/binapi/dtf.hpp @@ -95,8 +95,4 @@ std::size_t dt_str_flags(const char *buf, std::size_t n); } // ns dtf -#ifdef DTF_HEADER_ONLY -# include "dtf.cpp" -#endif // DTF_HEADER_ONLY - #endif // __dtf__dtf_hpp diff --git a/include/binapi/invoker.hpp b/include/binapi/invoker.hpp index 9a0af21..2bc99bf 100644 --- a/include/binapi/invoker.hpp +++ b/include/binapi/invoker.hpp @@ -17,9 +17,9 @@ #include #include -#include "message.hpp" -#include "flatjson.hpp" -#include "errors.hpp" +#include +#include +#include namespace binapi { namespace detail { diff --git a/include/binapi/tools.hpp b/include/binapi/tools.hpp index cfee401..76b943c 100644 --- a/include/binapi/tools.hpp +++ b/include/binapi/tools.hpp @@ -12,11 +12,11 @@ #ifndef __binapi__tools_hpp #define __binapi__tools_hpp -#include "double_type.hpp" - #include #include +#include + namespace binapi { /*************************************************************************************************/ diff --git a/include/binapi/types.hpp b/include/binapi/types.hpp index 9c81769..2df575d 100644 --- a/include/binapi/types.hpp +++ b/include/binapi/types.hpp @@ -12,17 +12,17 @@ #ifndef __binapi__types_hpp #define __binapi__types_hpp -#include "double_type.hpp" -#include "enums.hpp" - -#include - #include #include #include #include #include +#include + +#include +#include + // forward namespace flatjson { struct fjson; diff --git a/include/binapi/websocket.hpp b/include/binapi/websocket.hpp index e6c66c0..7cd229b 100644 --- a/include/binapi/websocket.hpp +++ b/include/binapi/websocket.hpp @@ -12,11 +12,11 @@ #ifndef __binapi__websocket_hpp #define __binapi__websocket_hpp -#include "enums.hpp" - #include #include +#include + namespace boost { namespace asio { class io_context; diff --git a/src/api.cpp b/src/api.cpp index 74a990d..2673422 100644 --- a/src/api.cpp +++ b/src/api.cpp @@ -9,6 +9,8 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- +#include "binapi/api.hpp" + #include #include #include @@ -30,7 +32,6 @@ #include #include -#include #include #include diff --git a/include/binapi/dtf.cpp b/src/dtf.cpp similarity index 99% rename from include/binapi/dtf.cpp rename to src/dtf.cpp index 820fe58..5d5b021 100644 --- a/include/binapi/dtf.cpp +++ b/src/dtf.cpp @@ -24,7 +24,7 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -#include "dtf.hpp" +#include "binapi/dtf.hpp" #include #include diff --git a/src/enums.cpp b/src/enums.cpp index 1537849..3b65782 100644 --- a/src/enums.cpp +++ b/src/enums.cpp @@ -9,11 +9,12 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include -#include +#include "binapi/enums.hpp" #include +#include + namespace binapi { /*************************************************************************************************/ diff --git a/src/errors.cpp b/src/errors.cpp index 45e22e9..56c59f9 100644 --- a/src/errors.cpp +++ b/src/errors.cpp @@ -9,7 +9,8 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include +#include "binapi/errors.hpp" + #include namespace binapi { diff --git a/src/pairslist.cpp b/src/pairslist.cpp index 36b0740..2931d57 100644 --- a/src/pairslist.cpp +++ b/src/pairslist.cpp @@ -9,13 +9,14 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include -#include -#include +#include "binapi/pairslist.hpp" + +#include #include -#include +#include +#include namespace binapi { diff --git a/src/reports.cpp b/src/reports.cpp index 404aa94..60c5581 100644 --- a/src/reports.cpp +++ b/src/reports.cpp @@ -9,17 +9,18 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include +#include "binapi/reports.hpp" + +#include // TODO: comment out + +#include + #include #include #include #include #include -#include - -#include // TODO: comment out - namespace binapi { /*************************************************************************************************/ diff --git a/src/tools.cpp b/src/tools.cpp index b879a28..a167d2b 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -9,14 +9,15 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include -#include +#include "binapi/tools.hpp" #include #include #include #include +#include + namespace binapi { /*************************************************************************************************/ diff --git a/src/types.cpp b/src/types.cpp index af8fbf3..bd30bad 100644 --- a/src/types.cpp +++ b/src/types.cpp @@ -9,14 +9,15 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include -#include -#include +#include "binapi/types.hpp" #include #include +#include +#include + //#include // TODO: comment out namespace binapi { diff --git a/src/websocket.cpp b/src/websocket.cpp index a003818..3a539c7 100644 --- a/src/websocket.cpp +++ b/src/websocket.cpp @@ -9,12 +9,12 @@ // Copyright (c) 2019-2021 niXman (github dot nixman dog pm.me). All rights reserved. // ---------------------------------------------------------------------------- -#include -#include -#include -#include -#include -#include +#include "binapi/websocket.hpp" + +#include +#include +#include +//#include // TODO: comment out #include #include @@ -30,11 +30,12 @@ #include -#include -#include -#include +#include +#include +#include +#include +#include -//#include // TODO: comment out #define __BINAPI_CB_ON_ERROR(cb, ec) \ cb(__FILE__ "(" BOOST_PP_STRINGIZE(__LINE__) ")", ec.value(), ec.message(), nullptr, 0); From 22c285649fc7fe2564df585f3aaff45f86630096 Mon Sep 17 00:00:00 2001 From: Jean-Francois Smigielski Date: Mon, 25 Mar 2024 00:26:07 +0100 Subject: [PATCH 4/6] Introduce gitignore --- .gitignore | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..478223e --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +cmake-build-debug +.idea +*.so +CMakeFiles/ +CMakeCache.txt +Makefile +cmake_install.cmake + +asynchronous +asynchronous-user_data +synchronous +synchronous-user_data +websockets From 6069b1684b0c169c9e1e5d34aa640283e0aee209 Mon Sep 17 00:00:00 2001 From: Jean-Francois Smigielski Date: Mon, 25 Mar 2024 00:36:56 +0100 Subject: [PATCH 5/6] Fix the detection of system deps --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 436c9f2..3d76148 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,8 @@ project(binapi) set(CMAKE_CXX_STANDARD 20) find_package(Threads REQUIRED) +find_package(OpenSSL REQUIRED SSL Crypto) +find_package(ZLIB REQUIRED) add_library(binapi SHARED src/api.cpp @@ -26,7 +28,11 @@ target_compile_options(binapi PUBLIC target_link_options(binapi PUBLIC $<$:-fsanitize=address>) -target_link_libraries(binapi PUBLIC z crypto ssl ${CMAKE_THREAD_LIBS_INIT} ${BOOST_LIBRARIES}) +target_link_libraries(binapi PUBLIC + ZLIB::ZLIB + OpenSSL::Crypto OpenSSL::SSL + ${BOOST_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(binapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) From 5bcd9d86bf0c431ecbb790ecfa892018ceda0832 Mon Sep 17 00:00:00 2001 From: Jean-Francois Smigielski Date: Mon, 25 Mar 2024 08:54:32 +0100 Subject: [PATCH 6/6] Revert the version bump on CMake --- CMakeLists.txt | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d76148..4fb6a24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.22) +cmake_minimum_required(VERSION 3.2) project(binapi) set(CMAKE_CXX_STANDARD 20) @@ -36,17 +36,20 @@ target_link_libraries(binapi PUBLIC target_include_directories(binapi PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) -add_executable(asynchronous examples/asynchronous/main.cpp) -target_link_libraries(asynchronous binapi) +add_executable(example_asynchronous examples/asynchronous/main.cpp) +target_link_libraries(example_asynchronous binapi) -add_executable(asynchronous-user_data examples/asynchronous-user_data/main.cpp) -target_link_libraries(asynchronous-user_data binapi) +add_executable(example_asynchronous-user_data examples/asynchronous-user_data/main.cpp) +target_link_libraries(example_asynchronous-user_data binapi) -add_executable(synchronous examples/synchronous/main.cpp) -target_link_libraries(synchronous binapi) +add_executable(example_synchronous examples/synchronous/main.cpp) +target_link_libraries(example_synchronous binapi) -add_executable(synchronous-user_data examples/synchronous-user_data/main.cpp) -target_link_libraries(synchronous-user_data binapi) +add_executable(example_synchronous-user_data examples/synchronous-user_data/main.cpp) +target_link_libraries(example_synchronous-user_data binapi) -add_executable(websockets examples/websockets/main.cpp) -target_link_libraries(websockets binapi) +add_executable(example_websockets examples/websockets/main.cpp) +target_link_libraries(example_websockets binapi) + +add_executable(example_api main.cpp) +target_link_libraries(example_api binapi)