Skip to content

merge from master #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
Aug 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
bbd2419
fix: large message cache may not be recycled with multiple receivers
mutouyun Jun 26, 2021
2179ce2
fix some bugs, adjust the test cases
mutouyun Jun 27, 2021
7dd9937
try to adjust recycling strategy for large message cache
mutouyun Jun 27, 2021
7c063f8
Update c-cpp.yml
mutouyun Jun 27, 2021
74f0803
horrible_cast
mutouyun Jun 27, 2021
9f23561
adjust test, chunk_storages revert to static
mutouyun Jun 27, 2021
cca4664
option(LIBIPC_BUILD_SHARED_LIBS 'Build shared libraries (DLLs).' OFF)
mutouyun Jul 10, 2021
a97b12f
Update c-cpp.yml
mutouyun Jul 10, 2021
69e1586
remove tls
mutouyun Jul 10, 2021
130e4d6
Merge pull request #48 from mutouyun/issue-47
mutouyun Jul 10, 2021
7bedfbf
fix: large message cache may not be recycled with multiple receivers
mutouyun Jun 26, 2021
98a3449
fix some bugs, adjust the test cases
mutouyun Jun 27, 2021
628914d
try to adjust recycling strategy for large message cache
mutouyun Jun 27, 2021
3490945
horrible_cast
mutouyun Jun 27, 2021
e3c8f8e
adjust test, chunk_storages revert to static
mutouyun Jun 27, 2021
57a62bc
fix some bugs
mutouyun Jul 11, 2021
b992b5f
Merge branch 'issue-45' of github.com:mutouyun/cpp-ipc into issue-45
mutouyun Jul 11, 2021
d0f9653
recycle storage for large message
mutouyun Jul 11, 2021
1bb96fe
update chunk_storage_info
mutouyun Jul 11, 2021
564f511
Merge pull request #49 from mutouyun/issue-45
mutouyun Jul 12, 2021
faa2f10
target_include_directories
mutouyun Jul 12, 2021
43179d6
Add USE_STATIC_CRT option to support static CRT(/MT).
Jul 30, 2021
df84522
Set target output directory
Jul 30, 2021
cc7b52a
Update INSTALL directory.
Jul 30, 2021
8dadafa
Merge pull request #50 from winsoft666/master
mutouyun Jul 31, 2021
df8bca2
codecvt_utf8_utf16/std::wstring_convert is deprecated
mutouyun Aug 7, 2021
8170836
utf-8 for test cpp
mutouyun Aug 7, 2021
c9d92b5
CP_ACP => CP_UTF8
mutouyun Aug 15, 2021
3c7e94a
modify cmakelists options
mutouyun Aug 15, 2021
e47902d
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
mutouyun Aug 15, 2021
36717e6
cmake_policy(SET CMP0077 NEW)
mutouyun Aug 15, 2021
8bc418e
set_target_properties version
mutouyun Aug 15, 2021
619f84c
还原最朴素的写法
mutouyun Aug 15, 2021
e8cf471
modify to_tchar test
mutouyun Aug 15, 2021
df3cf1b
modify to_tchar test
mutouyun Aug 15, 2021
d80bea9
fix: unexpected crash
mutouyun Aug 23, 2021
78be14b
Merge branch 'develop' into master
mutouyun Aug 29, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: C/C++ CI

on:
push:
branches: [ master, develop ]
branches: [ master, develop, issue-* ]
pull_request:
branches: [ master, develop ]

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,7 @@ CMakeLists.txt.user*

# My output files
build

# vs
.vs
.vscode
6 changes: 5 additions & 1 deletion 3rdparty/gtest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@
# ctest. You can select which tests to run using 'ctest -R regex'.
# For more options, run 'ctest --help'.

if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif (POLICY CMP0077)

# When other libraries are using a shared version of runtime libraries,
# Google Test also has to use one.
option(
gtest_force_shared_crt
"Use shared (DLL) run-time lib even when Google Test is built as static lib."
ON)
OFF)

option(gtest_build_tests "Build all of gtest's own tests." OFF)

Expand Down
33 changes: 28 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,48 @@
cmake_minimum_required(VERSION 3.10)
project(cpp-ipc)

option(LIBIPC_BUILD_TESTS "Build all of libipc's own tests." OFF)
option(LIBIPC_BUILD_DEMOS "Build all of libipc's own demos." OFF)
option(LIBIPC_BUILD_TESTS "Build all of libipc's own tests." OFF)
option(LIBIPC_BUILD_DEMOS "Build all of libipc's own demos." OFF)
option(LIBIPC_BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
option(LIBIPC_USE_STATIC_CRT "Set to ON to build with static CRT on Windows (/MT)." OFF)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
if(NOT MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
endif()

include_directories(${CMAKE_SOURCE_DIR}/include)
if (MSVC AND LIBIPC_USE_STATIC_CRT)
set(CompilerFlags
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
foreach(CompilerFlag ${CompilerFlags})
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
endforeach()
endif()

set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
set(LIBIPC_PROJECT_DIR ${PROJECT_SOURCE_DIR})

# Unicode Support
add_definitions(-DUNICODE -D_UNICODE)

add_subdirectory(src)

if (LIBIPC_BUILD_TESTS)
set(GOOGLETEST_VERSION 1.10.0)
if (LIBIPC_USE_STATIC_CRT)
set(gtest_force_shared_crt OFF)
else()
set(gtest_force_shared_crt ON)
endif()
add_subdirectory(3rdparty/gtest)
add_subdirectory(test)
endif()
Expand All @@ -30,6 +53,6 @@ if (LIBIPC_BUILD_DEMOS)
endif()

install(
DIRECTORY "include/"
DESTINATION "include"
DIRECTORY "include/"
DESTINATION "include"
)
2 changes: 1 addition & 1 deletion demo/msg_que/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ constexpr std::size_t const max_sz = 1024 * 16;
std::atomic<bool> is_quit__{ false };
std::atomic<std::size_t> size_counter__{ 0 };

using msg_que_t = ipc::chan<ipc::relat::single, ipc::relat::single, ipc::trans::unicast>;
using msg_que_t = ipc::chan<ipc::relat::single, ipc::relat::multi, ipc::trans::broadcast>;

msg_que_t que__{ name__ };
ipc::byte_t buff__[max_sz];
Expand Down
2 changes: 1 addition & 1 deletion include/libipc/def.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum : std::uint32_t {
enum : std::size_t {
data_length = 64,
large_msg_limit = data_length,
large_msg_align = 512,
large_msg_align = 1024,
large_msg_cache = 32,
};

Expand Down
6 changes: 4 additions & 2 deletions include/libipc/export.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@
*/

#ifndef IPC_EXPORT
#if defined(__IPC_LIBRARY__)
#if defined(LIBIPC_LIBRARY_SHARED_BUILDING__)
# define IPC_EXPORT IPC_DECL_EXPORT
#else
#elif defined(LIBIPC_LIBRARY_SHARED_USING__)
# define IPC_EXPORT IPC_DECL_IMPORT
#else
# define IPC_EXPORT
#endif
#endif /*IPC_EXPORT*/
1 change: 1 addition & 0 deletions include/libipc/pool_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ inline void free(void* p, std::size_t size) {

template <typename T>
void free(T* p) {
if (p == nullptr) return;
destruct(p);
pool_alloc::free(p, sizeof(T));
}
Expand Down
112 changes: 0 additions & 112 deletions include/libipc/tls_pointer.h

This file was deleted.

48 changes: 34 additions & 14 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
project(ipc)

add_compile_options(-D__IPC_LIBRARY__)

if(NOT MSVC)
add_compile_options(-fPIC)
endif()

include_directories(
${LIBIPC_PROJECT_DIR}/include
${LIBIPC_PROJECT_DIR}/src)

if(UNIX)
file(GLOB SRC_FILES ${LIBIPC_PROJECT_DIR}/src/libipc/platform/*_linux.cpp)
else()
Expand All @@ -26,14 +16,44 @@ file(GLOB HEAD_FILES
${LIBIPC_PROJECT_DIR}/src/libipc/platform/*.h
${LIBIPC_PROJECT_DIR}/src/libipc/utility/*.h)

add_library(${PROJECT_NAME} SHARED ${SRC_FILES} ${HEAD_FILES})
if (LIBIPC_BUILD_SHARED_LIBS)
add_library(${PROJECT_NAME} SHARED ${SRC_FILES} ${HEAD_FILES})
target_compile_definitions(${PROJECT_NAME}
INTERFACE
LIBIPC_LIBRARY_SHARED_USING__
PRIVATE
LIBIPC_LIBRARY_SHARED_BUILDING__)
else()
add_library(${PROJECT_NAME} STATIC ${SRC_FILES} ${HEAD_FILES})
endif()

# set output directory
set_target_properties(${PROJECT_NAME}
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" )

# set version
set_target_properties(${PROJECT_NAME}
PROPERTIES
VERSION 1.0.0
SOVERSION 1)

target_include_directories(${PROJECT_NAME}
PUBLIC ${LIBIPC_PROJECT_DIR}/include
PRIVATE ${LIBIPC_PROJECT_DIR}/src
)

if(NOT MSVC)
target_link_libraries(${PROJECT_NAME} PUBLIC
pthread
$<$<NOT:$<STREQUAL:${CMAKE_SYSTEM_NAME},Windows>>:rt>)
pthread
$<$<NOT:$<STREQUAL:${CMAKE_SYSTEM_NAME},Windows>>:rt>)
endif()

install(
TARGETS ${PROJECT_NAME}
DESTINATION "lib"
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
Loading