Skip to content

Commit

Permalink
feat: add version.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
shuai132 committed Sep 18, 2023
1 parent cd09ffa commit 7baaed0
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ if (ASIO_NET_BUILD_TEST)
# for android standalone e.g. termux
add_definitions(-DANDROID_STANDALONE)

add_executable(${PROJECT_NAME}_test_version test/version.cpp)
add_executable(${PROJECT_NAME}_test_tcp test/tcp.cpp)
add_executable(${PROJECT_NAME}_test_tcp_s test/tcp_s.cpp)
add_executable(${PROJECT_NAME}_test_tcp_c test/tcp_c.cpp)
Expand Down
3 changes: 3 additions & 0 deletions include/asio_net.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#pragma once

#include "asio_net/rpc_client.hpp"
#include "asio_net/rpc_server.hpp"
#include "asio_net/server_discovery.hpp"
#include "asio_net/tcp_client.hpp"
#include "asio_net/tcp_server.hpp"
#include "asio_net/udp_client.hpp"
#include "asio_net/udp_server.hpp"
#include "asio_net/version.hpp"
1 change: 0 additions & 1 deletion include/asio_net/config.h → include/asio_net/config.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include <algorithm>
#include <cstdint>

namespace asio_net {
Expand Down
2 changes: 1 addition & 1 deletion include/asio_net/detail/tcp_channel_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <deque>
#include <utility>

#include "../config.h"
#include "../config.hpp"
#include "asio.hpp"
#include "log.h"
#include "message.hpp"
Expand Down
2 changes: 1 addition & 1 deletion include/asio_net/detail/tcp_server_t.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <utility>

#include "../config.h"
#include "../config.hpp"
#include "asio.hpp"
#include "tcp_channel_t.hpp"

Expand Down
2 changes: 1 addition & 1 deletion include/asio_net/rpc_core
8 changes: 8 additions & 0 deletions include/asio_net/version.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once

#define ASIO_NET_VER_MAJOR 2
#define ASIO_NET_VER_MINOR 0
#define ASIO_NET_VER_PATCH 0

#define ASIO_NET_TO_VERSION(major, minor, patch) (major * 10000 + minor * 100 + patch)
#define ASIO_NET_VERSION ASIO_NET_TO_VERSION(ASIO_NET_VER_MAJOR, ASIO_NET_VER_MINOR, ASIO_NET_VER_PATCH)
9 changes: 9 additions & 0 deletions test/version.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "asio_net.hpp"
#include "log.h"

int main(int argc, char** argv) {
LOGI("asio: %d", ASIO_VERSION);
LOGI("rpc_core: %d", RPC_CORE_VERSION);
LOGI("asio_net: %d", ASIO_NET_VERSION);
return 0;
}

0 comments on commit 7baaed0

Please sign in to comment.