From 454e358882af85e269d247cc007dc31e05adc4cb Mon Sep 17 00:00:00 2001 From: momo5502 Date: Fri, 27 Jan 2017 10:17:33 +0100 Subject: [PATCH] [General] Use boost for IPC --- .gitmodules | 69 ++++++++++++++++++++++++++++++ deps/boost/assert | 1 + deps/boost/config | 1 + deps/boost/container | 1 + deps/boost/core | 1 + deps/boost/date_time | 1 + deps/boost/detail | 1 + deps/boost/functional | 1 + deps/boost/integer | 1 + deps/boost/interprocess | 1 + deps/boost/intrusive | 1 + deps/boost/iterator | 1 + deps/boost/move | 1 + deps/boost/mpl | 1 + deps/boost/predef | 1 + deps/boost/preprocessor | 1 + deps/boost/smart_ptr | 1 + deps/boost/static_assert | 1 + deps/boost/throw_exception | 1 + deps/boost/tuple | 1 + deps/boost/type_traits | 1 + deps/boost/unordered | 1 + deps/boost/utility | 1 + deps/boost/winapi | 1 + premake5.lua | 27 +++++++++++- src/Components/Modules/IPCPipe.cpp | 29 +++++++++++++ 26 files changed, 147 insertions(+), 1 deletion(-) create mode 160000 deps/boost/assert create mode 160000 deps/boost/config create mode 160000 deps/boost/container create mode 160000 deps/boost/core create mode 160000 deps/boost/date_time create mode 160000 deps/boost/detail create mode 160000 deps/boost/functional create mode 160000 deps/boost/integer create mode 160000 deps/boost/interprocess create mode 160000 deps/boost/intrusive create mode 160000 deps/boost/iterator create mode 160000 deps/boost/move create mode 160000 deps/boost/mpl create mode 160000 deps/boost/predef create mode 160000 deps/boost/preprocessor create mode 160000 deps/boost/smart_ptr create mode 160000 deps/boost/static_assert create mode 160000 deps/boost/throw_exception create mode 160000 deps/boost/tuple create mode 160000 deps/boost/type_traits create mode 160000 deps/boost/unordered create mode 160000 deps/boost/utility create mode 160000 deps/boost/winapi diff --git a/.gitmodules b/.gitmodules index 08ae18e6..80d9dfd4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -35,3 +35,72 @@ path = deps/protobuf url = https://github.com/google/protobuf.git branch = 3.2.x +[submodule "deps/boost/interprocess"] + path = deps/boost/interprocess + url = https://github.com/boostorg/interprocess.git +[submodule "deps/boost/config"] + path = deps/boost/config + url = https://github.com/boostorg/config.git +[submodule "deps/boost/date_time"] + path = deps/boost/date_time + url = https://github.com/boostorg/date_time.git +[submodule "deps/boost/assert"] + path = deps/boost/assert + url = https://github.com/boostorg/assert.git +[submodule "deps/boost/utility"] + path = deps/boost/utility + url = https://github.com/boostorg/utility.git +[submodule "deps/boost/detail"] + path = deps/boost/detail + url = https://github.com/boostorg/detail.git +[submodule "deps/boost/winapi"] + path = deps/boost/winapi + url = https://github.com/boostorg/winapi.git +[submodule "deps/boost/integer"] + path = deps/boost/integer + url = https://github.com/boostorg/integer.git +[submodule "deps/boost/move"] + path = deps/boost/move + url = https://github.com/boostorg/move.git +[submodule "deps/boost/static_assert"] + path = deps/boost/static_assert + url = https://github.com/boostorg/static_assert.git +[submodule "deps/boost/container"] + path = deps/boost/container + url = https://github.com/boostorg/container.git +[submodule "deps/boost/intrusive"] + path = deps/boost/intrusive + url = https://github.com/boostorg/intrusive.git +[submodule "deps/boost/core"] + path = deps/boost/core + url = https://github.com/boostorg/core.git +[submodule "deps/boost/functional"] + path = deps/boost/functional + url = https://github.com/boostorg/functional.git +[submodule "deps/boost/type_traits"] + path = deps/boost/type_traits + url = https://github.com/boostorg/type_traits.git +[submodule "deps/boost/preprocessor"] + path = deps/boost/preprocessor + url = https://github.com/boostorg/preprocessor.git +[submodule "deps/boost/smart_ptr"] + path = deps/boost/smart_ptr + url = https://github.com/boostorg/smart_ptr.git +[submodule "deps/boost/throw_exception"] + path = deps/boost/throw_exception + url = https://github.com/boostorg/throw_exception.git +[submodule "deps/boost/predef"] + path = deps/boost/predef + url = https://github.com/boostorg/predef.git +[submodule "deps/boost/mpl"] + path = deps/boost/mpl + url = https://github.com/boostorg/mpl.git +[submodule "deps/boost/unordered"] + path = deps/boost/unordered + url = https://github.com/boostorg/unordered.git +[submodule "deps/boost/iterator"] + path = deps/boost/iterator + url = https://github.com/boostorg/iterator.git +[submodule "deps/boost/tuple"] + path = deps/boost/tuple + url = https://github.com/boostorg/tuple.git diff --git a/deps/boost/assert b/deps/boost/assert new file mode 160000 index 00000000..89e5b86c --- /dev/null +++ b/deps/boost/assert @@ -0,0 +1 @@ +Subproject commit 89e5b86c469c993ea4c53ebc7ed4a9b133f785a6 diff --git a/deps/boost/config b/deps/boost/config new file mode 160000 index 00000000..b4628d91 --- /dev/null +++ b/deps/boost/config @@ -0,0 +1 @@ +Subproject commit b4628d91eb8b2cbf96e3dadee3d6bff97b50ae46 diff --git a/deps/boost/container b/deps/boost/container new file mode 160000 index 00000000..23e9e8b4 --- /dev/null +++ b/deps/boost/container @@ -0,0 +1 @@ +Subproject commit 23e9e8b4946f8b026ced6b048d7a62b4ca81b722 diff --git a/deps/boost/core b/deps/boost/core new file mode 160000 index 00000000..1abd6810 --- /dev/null +++ b/deps/boost/core @@ -0,0 +1 @@ +Subproject commit 1abd68102d26d87109b5eda8d80f8bb0382ce4df diff --git a/deps/boost/date_time b/deps/boost/date_time new file mode 160000 index 00000000..47cf10d5 --- /dev/null +++ b/deps/boost/date_time @@ -0,0 +1 @@ +Subproject commit 47cf10d5fd7cee50d4e53a6132c69a7e1cbb2d0b diff --git a/deps/boost/detail b/deps/boost/detail new file mode 160000 index 00000000..6c111975 --- /dev/null +++ b/deps/boost/detail @@ -0,0 +1 @@ +Subproject commit 6c111975865d112c11101ef8221695cc4cd57562 diff --git a/deps/boost/functional b/deps/boost/functional new file mode 160000 index 00000000..c592e854 --- /dev/null +++ b/deps/boost/functional @@ -0,0 +1 @@ +Subproject commit c592e854919730597b1793f85667e7d88f000d29 diff --git a/deps/boost/integer b/deps/boost/integer new file mode 160000 index 00000000..13b153c6 --- /dev/null +++ b/deps/boost/integer @@ -0,0 +1 @@ +Subproject commit 13b153c657697129cabe7ac8b3e62ef844a62945 diff --git a/deps/boost/interprocess b/deps/boost/interprocess new file mode 160000 index 00000000..0cd4548b --- /dev/null +++ b/deps/boost/interprocess @@ -0,0 +1 @@ +Subproject commit 0cd4548b45a9b9fdac2c58f2acb793095754f821 diff --git a/deps/boost/intrusive b/deps/boost/intrusive new file mode 160000 index 00000000..286f5976 --- /dev/null +++ b/deps/boost/intrusive @@ -0,0 +1 @@ +Subproject commit 286f597606de0d139e256af8c2695d90535be905 diff --git a/deps/boost/iterator b/deps/boost/iterator new file mode 160000 index 00000000..760da84f --- /dev/null +++ b/deps/boost/iterator @@ -0,0 +1 @@ +Subproject commit 760da84f9cbbe87afb7ef845ef5fa6be158637b7 diff --git a/deps/boost/move b/deps/boost/move new file mode 160000 index 00000000..135e598b --- /dev/null +++ b/deps/boost/move @@ -0,0 +1 @@ +Subproject commit 135e598bc4ffc63001d84f93764fddee234f1da2 diff --git a/deps/boost/mpl b/deps/boost/mpl new file mode 160000 index 00000000..3b126bdf --- /dev/null +++ b/deps/boost/mpl @@ -0,0 +1 @@ +Subproject commit 3b126bdf8c7abbfef27101232a379c8e0c3db1ac diff --git a/deps/boost/predef b/deps/boost/predef new file mode 160000 index 00000000..822d09f1 --- /dev/null +++ b/deps/boost/predef @@ -0,0 +1 @@ +Subproject commit 822d09f19bc2f4ea6f42da8e0be83d10ce912ce1 diff --git a/deps/boost/preprocessor b/deps/boost/preprocessor new file mode 160000 index 00000000..d8389ffd --- /dev/null +++ b/deps/boost/preprocessor @@ -0,0 +1 @@ +Subproject commit d8389ffda600ce73d62b077616987744f5f83453 diff --git a/deps/boost/smart_ptr b/deps/boost/smart_ptr new file mode 160000 index 00000000..19147212 --- /dev/null +++ b/deps/boost/smart_ptr @@ -0,0 +1 @@ +Subproject commit 19147212a9edd1facdc9a17cf586b79c92f4116a diff --git a/deps/boost/static_assert b/deps/boost/static_assert new file mode 160000 index 00000000..c2f58a18 --- /dev/null +++ b/deps/boost/static_assert @@ -0,0 +1 @@ +Subproject commit c2f58a187a67502a20aaa14c88625f12e400c5c1 diff --git a/deps/boost/throw_exception b/deps/boost/throw_exception new file mode 160000 index 00000000..f94638e5 --- /dev/null +++ b/deps/boost/throw_exception @@ -0,0 +1 @@ +Subproject commit f94638e5225afff877347576ff7b4170971e7a2a diff --git a/deps/boost/tuple b/deps/boost/tuple new file mode 160000 index 00000000..895af7c9 --- /dev/null +++ b/deps/boost/tuple @@ -0,0 +1 @@ +Subproject commit 895af7c97a2f74980eb459badf67787c2a3ecadf diff --git a/deps/boost/type_traits b/deps/boost/type_traits new file mode 160000 index 00000000..4fffc763 --- /dev/null +++ b/deps/boost/type_traits @@ -0,0 +1 @@ +Subproject commit 4fffc7637da8479e3f94674ef1dd0fc996a7d027 diff --git a/deps/boost/unordered b/deps/boost/unordered new file mode 160000 index 00000000..57cc6d4b --- /dev/null +++ b/deps/boost/unordered @@ -0,0 +1 @@ +Subproject commit 57cc6d4bac1cc93fb8fb05696116b184f3d1fecc diff --git a/deps/boost/utility b/deps/boost/utility new file mode 160000 index 00000000..ccfd741c --- /dev/null +++ b/deps/boost/utility @@ -0,0 +1 @@ +Subproject commit ccfd741c0a423e6c8dc4493e3a4e042b5a34a329 diff --git a/deps/boost/winapi b/deps/boost/winapi new file mode 160000 index 00000000..b017fd88 --- /dev/null +++ b/deps/boost/winapi @@ -0,0 +1 @@ +Subproject commit b017fd886612a9001dfdffeb1aa4663b6e2acda8 diff --git a/premake5.lua b/premake5.lua index d57a9184..d23808ba 100644 --- a/premake5.lua +++ b/premake5.lua @@ -304,7 +304,32 @@ workspace "iw4x" } includedirs { "%{prj.location}/src", - "./src" + "./src", + + -- boost includes + "./deps/boost/mpl/include", + "./deps/boost/core/include", + "./deps/boost/move/include", + "./deps/boost/assert/include", + "./deps/boost/predef/include", + "./deps/boost/config/include", + "./deps/boost/detail/include", + "./deps/boost/winapi/include", + "./deps/boost/integer/include", + "./deps/boost/tuple/include", + "./deps/boost/iterator/include", + "./deps/boost/utility/include", + "./deps/boost/container/include", + "./deps/boost/unordered/include", + "./deps/boost/date_time/include", + "./deps/boost/type_traits/include", + "./deps/boost/preprocessor/include", + "./deps/boost/smart_ptr/include", + "./deps/boost/throw_exception/include", + "./deps/boost/functional/include", + "./deps/boost/intrusive/include", + "./deps/boost/interprocess/include", + "./deps/boost/static_assert/include", } resincludedirs { "$(ProjectDir)src" -- fix for VS IDE diff --git a/src/Components/Modules/IPCPipe.cpp b/src/Components/Modules/IPCPipe.cpp index bc664de4..502dc30c 100644 --- a/src/Components/Modules/IPCPipe.cpp +++ b/src/Components/Modules/IPCPipe.cpp @@ -1,5 +1,21 @@ #include "STDInclude.hpp" +namespace boost +{ + typedef unsigned long long ulong_long_type; +} + +#pragma warning(push) +#pragma warning(disable: 4091) + +#undef sleep +//#define BOOST_DISABLE_WIN32 +#define BOOST_USE_WINDOWS_H +#define BOOST_DATE_TIME_NO_LIB +#include + +#pragma warning(pop) + namespace Components { Pipe IPCPipe::ServerPipe; @@ -242,4 +258,17 @@ namespace Components IPCPipe::ServerPipe.destroy(); IPCPipe::ClientPipe.destroy(); } + + void test() + { + boost::interprocess::message_queue::remove("message_queue"); + + //Create a message_queue. + boost::interprocess::message_queue mq + (boost::interprocess::create_only //only create + , "message_queue" //name + , 100 //max message number + , sizeof(int) //max message size + ); + } }