.dll .so 복사 자동화 완료
This commit is contained in:
@@ -47,6 +47,14 @@ target_link_libraries(${PROJECT_NAME} PRIVATE jsoncpp_lib)
|
||||
if(WIN32)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE ws2_32)
|
||||
endif()
|
||||
if(UNIX AND NOT APPLE AND CMAKE_BUILD_TYPE STREQUAL "Release")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
BUILD_WITH_INSTALL_RPATH TRUE
|
||||
INSTALL_RPATH "$ORIGIN"
|
||||
SKIP_BUILD_RPATH FALSE
|
||||
BUILD_RPATH "$ORIGIN"
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(${PROJECT_NAME} PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../include
|
||||
@@ -56,17 +64,27 @@ target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
|
||||
|
||||
target_precompile_headers(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../include/precomp.hpp")
|
||||
|
||||
if(WIN32)
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"$<TARGET_FILE:spdlog>"
|
||||
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
||||
COMMENT "Copying spdlog DLL to output directory"
|
||||
)
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"$<TARGET_FILE:jsoncpp_lib>"
|
||||
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
||||
COMMENT "Copying jsoncpp DLL to output directory"
|
||||
)
|
||||
endif()
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"$<TARGET_FILE:spdlog>"
|
||||
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
||||
COMMENT "Copying spdlog DLL/so to output directory"
|
||||
)
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||
"$<TARGET_FILE:jsoncpp_lib>"
|
||||
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
||||
COMMENT "Copying jsoncpp DLL/so to output directory"
|
||||
)
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"$<TARGET_FILE_DIR:spdlog>"
|
||||
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
||||
COMMENT "Copying spdlog library files and symlinks to output directory"
|
||||
)
|
||||
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"$<TARGET_FILE_DIR:jsoncpp_lib>"
|
||||
"$<TARGET_FILE_DIR:${PROJECT_NAME}>"
|
||||
COMMENT "Copying jsoncpp library files and symlinks to output directory"
|
||||
)
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Utils/ConfigManager.hpp"
|
||||
#include "Utils/Thread.hpp"
|
||||
#include "Utils/StringTokenizer.hpp"
|
||||
#include "Session/Session.hpp"
|
||||
|
||||
#include "precomp.hpp"
|
||||
|
||||
@@ -31,16 +32,33 @@ int main() {
|
||||
sock.bind(&serveraddr.addr, serveraddr.length);
|
||||
sock.listen(SOMAXCONN);
|
||||
|
||||
#ifdef _WIN32
|
||||
DWORD pid = GetCurrentProcessPid();
|
||||
#elif __linux__
|
||||
pid_t pid = getpid();
|
||||
#endif
|
||||
spdlog::info("PID : {}", pid);
|
||||
|
||||
while (true) {
|
||||
spdlog::info("Waiting for connection...");
|
||||
sock.accept(clientSock, clientAddr);
|
||||
|
||||
Chattr::Thread thread_(_TCPClient, std::move(clientSock), clientAddr);
|
||||
thread_.deatch();
|
||||
thread_.detach();
|
||||
}
|
||||
}
|
||||
|
||||
void _TCPClient(Chattr::TCPSocket sock, Chattr::Address addr) {
|
||||
spdlog::info("Connection accepted! from: {}, {}", sock, (std::string)addr);
|
||||
Sleep(10000);
|
||||
spdlog::info("Connection accepted. [{}:{}]", sock, (std::string)addr);
|
||||
|
||||
char buf[1024];
|
||||
|
||||
while (true) {
|
||||
int redSize = sock.recv(buf, 1024, 0);
|
||||
if (redSize == 0)
|
||||
break;
|
||||
std::string recvData(buf, redSize);
|
||||
spdlog::info("Red size : {}, {}", redSize, recvData);
|
||||
}
|
||||
spdlog::info("Client disconnected. [{}:{}]", sock, (std::string)addr);
|
||||
}
|
||||
Reference in New Issue
Block a user