diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 96f58fb..5d223c9 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -12,35 +12,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/CMakeLists.txt b/CMakeLists.txt index 5288e17..801814f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,14 @@ message( "copy third library") file(GLOB THIRD ${PROJECT_SOURCE_DIR}/third/include/*) file(COPY ${THIRD} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/third/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ) +message( "copy net ") + +file(GLOB NET ${PROJECT_SOURCE_DIR}/src/net/*.h) +file(COPY ${NET} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/ + FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ) +link_libraries(third/lib/libevent.a) +link_libraries(third/lib/libevent_core.a) + IF (WIN32) ELSEIF (UNIX) diff --git a/src/net/TcpClient.cpp b/src/net/TcpClient.cpp index cbe29c2..6d4243a 100644 --- a/src/net/TcpClient.cpp +++ b/src/net/TcpClient.cpp @@ -4,12 +4,7 @@ #include "TcpClient.h" -#include "third/include/event2/bufferevent.h" -#include "third/include/event2/buffer.h" -#include "third/include/event2/listener.h" -#include "third/include/event2/util.h" -#include "third/include/event2/event.h" -#include "third/include/event2/thread.h" + void conn_writecb(struct bufferevent *, void *); void conn_readcb(struct bufferevent *, void *); diff --git a/src/net/TcpClient.h b/src/net/TcpClient.h index 5dd89a2..771384b 100644 --- a/src/net/TcpClient.h +++ b/src/net/TcpClient.h @@ -4,7 +4,14 @@ #ifndef GENERAL_TCPCLIENT_H #define GENERAL_TCPCLIENT_H - +extern "C"{ +#include "third/include/event2/bufferevent.h" +#include "third/include/event2/buffer.h" +#include "third/include/event2/listener.h" +#include "third/include/event2/util.h" +#include "third/include/event2/event.h" +#include "third/include/event2/thread.h" +}; #include #include "PackageReceiver.h" #include diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 37dd815..6680280 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,7 +3,9 @@ project(tcptest) message("current dir" ${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../obj/inc) -link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../obj/) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../obj/inc/third/include) +link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../obj/) link_libraries(libGeneral.a) +link_libraries(ws2_32) add_executable(tcptest src/tcpclient_test.cpp) \ No newline at end of file diff --git a/test/src/tcpclient_test.cpp b/test/src/tcpclient_test.cpp index 855520d..5fd9f00 100644 --- a/test/src/tcpclient_test.cpp +++ b/test/src/tcpclient_test.cpp @@ -1,6 +1,5 @@ #include "TcpClient.h" int main(){ - TcpClientLibevent mTcp; - + TcpClientLibevent mTcp("127.0.0.1",8443, nullptr); } \ No newline at end of file