no message
parent
403f17a599
commit
7443d203fb
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"files.associations": {
|
||||
"*.rh": "cpp"
|
||||
"*.rh": "cpp",
|
||||
"iostream": "cpp"
|
||||
},
|
||||
"cmake.buildDirectory": "${workspaceFolder}/build",
|
||||
"cmake.mingwSearchDirs": [
|
||||
"D:\\qt\\Tools\\mingw730_32",
|
||||
"D:\\qt\\Tools\\mingw730_64"
|
||||
"H:\\Qt\\5.14.0\\mingw73_64",
|
||||
"H:\\Qt\\5.14.0\\mingw73_32"
|
||||
],
|
||||
"terminal.integrated.env.windows": {
|
||||
},
|
||||
"terminal.integrated.env.windows": {},
|
||||
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
|
||||
}
|
|
@ -5,9 +5,10 @@ add_subdirectory(general)
|
|||
|
||||
find_package(libevent REQUIRED)
|
||||
set(EVENT__HAVE_LIBEVENT 1)
|
||||
message(STATUS "PATH: " $ENV{CMAKE_MODULE_PATH})
|
||||
|
||||
message(STATUS "libevent include: " ${libevent_INCLUDE_DIR})
|
||||
message(STATUS "libevent lib: " ${libevent_LIBRARIES})
|
||||
message(STATUS "libevent include: " ${libevent_INCLUDE_DIRS})
|
||||
message(STATUS "libevent lib: " ${libevent_INCLUDE_DIR})
|
||||
message(STATUS "libevent lib Dirs: " ${libevent_LIB_DIRS})
|
||||
|
||||
SET(SRC_SDK sdk_main.c )#生成动态库需要至少包含一个源文件
|
||||
|
@ -77,7 +78,7 @@ add_custom_command(TARGET generallib PRE_LINK
|
|||
COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/general/src/math/eigen ${LIBRARY_OUTPUT_PATH}/inc/math/eigen)
|
||||
message( "copy third library")
|
||||
file(GLOB THIRD ${PROJECT_SOURCE_DIR}/general/third/include/*)
|
||||
file(COPY ${THIRD} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/third/
|
||||
file(COPY ${THIRD} DESTINATION ${LIBRARY_OUTPUT_PATH}/inc/third/include/
|
||||
FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_WRITE GROUP_READ WORLD_READ)
|
||||
message( "copy net ")
|
||||
|
||||
|
|
20
conanfile.py
20
conanfile.py
|
@ -1,5 +1,6 @@
|
|||
from conans import ConanFile, CMake, tools
|
||||
from conans import tools
|
||||
import shutil
|
||||
|
||||
class GenerallibConan(ConanFile):
|
||||
source_folder = "pkgsrc"
|
||||
|
@ -9,15 +10,17 @@ class GenerallibConan(ConanFile):
|
|||
author = "caiyuzheng"
|
||||
url = "https://gitee.com/290198252/generallib"
|
||||
description = "a simple cpp basic library"
|
||||
exports_sources = "general*", "test*"
|
||||
generators = "cmake_find_package"
|
||||
|
||||
def source(self):
|
||||
tools.rmdir("pkgsrc")
|
||||
git = tools.Git(folder=self.source_folder + "/pkgsrc")
|
||||
git = tools.Git(folder=self.source_folder + "/pkgsrc", verify_ssl=False)
|
||||
git.clone("https://gitee.com/290198252/generallib.git")
|
||||
|
||||
def package(self):
|
||||
self.copy(pattern ="*.h", dst="include", src="general",keep_path=True)
|
||||
self.copy(pattern ="*.hpp", dst="include", src="general",keep_path=True)
|
||||
self.copy(pattern = "*.a",src ="pkgsrc\\obj\\",dst = "lib",keep_path=True)
|
||||
shutil.copytree(self.build_folder + '\\pkgsrc\\obj\\inc', self.package_folder + "\\include\\generallib")
|
||||
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
|
@ -31,8 +34,11 @@ class GenerallibConan(ConanFile):
|
|||
print("cygwin build")
|
||||
if tools.get_env("BUILD_ENV")=="msys":
|
||||
print("msys build")
|
||||
tools.run_in_windows_bash(self, subsystem="msys",cwd="pkgsrc",msys_mingw=True,bashcmd="cmake build -G\"MinGW Makefiles\" " + tools.unix_path(self.source_folder + "/pkgsrc"))
|
||||
tools.run_in_windows_bash(self, subsystem="msys",cwd="pkgsrc",msys_mingw=True,bashcmd="cmake --build . ")
|
||||
tools.run_in_windows_bash(self, subsystem="msys", cwd="pkgsrc", bashcmd="cmake build -DCMAKE_MODULE_PATH=" + tools.unix_path(self.source_folder)
|
||||
+ " -G\"MinGW Makefiles\" " + tools.unix_path(self.source_folder) + "//pkgsrc")
|
||||
tools.run_in_windows_bash(
|
||||
self, subsystem="msys", cwd="pkgsrc", bashcmd="cmake --build .")
|
||||
|
||||
def requirements(self):
|
||||
self.requires("libevent/2.1.2", private=True, override=False)
|
||||
self.requires("libevent/2.1.2")
|
||||
|
|
@ -1,9 +1,7 @@
|
|||
cmake_minimum_required(VERSION 3.11)
|
||||
enable_language(CXX)
|
||||
project(General)
|
||||
set(MINGW_PATH $ENV{MINGW_TOOLCHAIN})
|
||||
message("path is " ${MINGW_PATH})
|
||||
message( "libevent path " ${CONAN_LIBEVENT_ROOT})
|
||||
|
||||
message( "current compiler " ${CMAKE_CXX_COMPILER_ID})
|
||||
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
|
@ -25,6 +23,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|||
endif()
|
||||
|
||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/obj)
|
||||
message( "LIBRARY_OUTPUT_PATH " ${LIBRARY_OUTPUT_PATH})
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
INCLUDE_DIRECTORIES (./)
|
||||
INCLUDE_DIRECTORIES (inc)
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
|
||||
class Timer
|
||||
{
|
||||
public:
|
||||
|
@ -35,10 +34,7 @@ public:
|
|||
double getElapsedTimeInMilliSec(); // get elapsed time in milli-second
|
||||
double getElapsedTimeInMicroSec(); // get elapsed time in micro-second
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
private:
|
||||
double startTimeInMicroSec; // starting time in micro-second
|
||||
double endTimeInMicroSec; // ending time in micro-second
|
||||
|
|
|
@ -1,13 +1,18 @@
|
|||
cmake_minimum_required(VERSION 3.15)
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
project(tcptest)
|
||||
message("cmake module " $ENV{CMAKE_MODULE_PATH})
|
||||
message("project dir " ${PROJECT_SOURCE_DIR})
|
||||
message("current dir " ${CMAKE_CURRENT_SOURCE_DIR}/../../../obj/inc)
|
||||
|
||||
message("current dir" ../..)
|
||||
include_directories(../../../../general/obj/inc)
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../general/obj/inc/third/include)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../../../obj/inc)
|
||||
|
||||
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake-build-debug/libgenerallib.a)
|
||||
link_libraries(libGeneral.a)
|
||||
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../build)
|
||||
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../obj)
|
||||
|
||||
link_libraries(libgenerallib.a)
|
||||
link_libraries(ws2_32)
|
||||
link_libraries(${CMAKE_CURRENT_SOURCE_DIR}/../../third/lib/libevent.a)
|
||||
link_libraries(${CMAKE_CURRENT_SOURCE_DIR}/../../third/lib/libevent_core.a)
|
||||
link_libraries(libevent.la)
|
||||
link_libraries(libevent_core.la)
|
||||
add_executable(tcptest tcpclient_test.cpp)
|
||||
|
||||
target_include_directories(tcptest SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../../obj/inc/third/include())
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#include "TcpClient.h"
|
||||
#include <iostream>
|
||||
#include <atomic>
|
||||
|
||||
using namespace std;
|
||||
int main(){
|
||||
TcpClientLibevent mTcp("127.0.0.1",8443, nullptr);
|
||||
}
|
Loading…
Reference in New Issue