diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a505139 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Harvey Fong + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 5773f4c..0dde847 100644 --- a/README.md +++ b/README.md @@ -1,55 +1,107 @@ -# zmqprototype -[ALPHA CODE] My learning project to prototype a cross platform zmq rep-req render node +# poomer-zmq-client_server +c++ cross platform prototype zmq rep-req render node -- This is the code before integration with bella_engine_sdk +[ZeroMQ messaging library](https://zeromq.org) server starts in pubkey server mode, allowing one client to grab the pubkey -- keypairs are generated on every start -- requires port 5555, 5556, 5557 -client +- keypairs are generated on every start +- used tcp ports 5555, 5556, 5557 -###Build +# Build -##Linux ``` -apt install -y libzmq-dev -ldconfig +workdir/ +├── libzmq/ +├── cppzmq/ +├── poomer-zmq-client_server/ + +( additional Windows package manager dependency ) +├── vcpkg/ + +( additional MacOS package manager dependency ) +└── homebrew/ + +``` + +## Linux +``` +//apt install -y libzmq-dev +//ldconfig apt install -y libtool apt install -y libsodium-dev apt install -y cmake - -git clone https://github.com/zeromq/libzmq +mkdir workdir +cd workdir apt install libgnutls28-dev apt install pkg-config +git clone https://github.com/zeromq/libzmq cd libzmq mkdir build cd build cmake .. -DENABLE_CURVE=ON -DWITH_LIBSODIUM=/usr/include/sodium - - +cd ../.. git https://github.com/zeromq/cppzmq cd cppzmq mkdir build cd build cmake .. - g++ server.cpp -o server -lzmq -Wl,-rpath,. ``` -##MacOS +## MacOS +Install Cmake to /Applications ``` +curl -LO https://github.com/Kitware/CMake/releases/download/v3.31.6/cmake-3.31.6-macos-universal.dmg +open cmake-3.31.6-macos-universal.dmg +``` +Install Xcode + +``` +mkdir -p workdir/homebrew +cd workdir +curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip-components 1 -C homebrew +eval "$(homebrew/bin/brew shellenv)" +brew update --force --quiet +//chmod -R go-w "$(brew --prefix)/share/zsh" +brew install libsodium +//brew install gnutls +brew install pkg-config +git clone https://github.com/zeromq/libzmq +cd libzmq +mkdir build +cd build +/Applications/CMake.app/Contents/bin/cmake .. -DENABLE_CURVE=ON -DWITH_LIBSODIUM=../../homebrew/Cellar/libsodium/1.0.20/include/sodium -DSODIUM_INCLUDE_DIRS=../../homebrew/Cellar/libsodium/1.0.20/include -DSODIUM_LIBRARIES=../../homebrew/Cellar/libsodium/1.0.20/lib/libsodium.a +make -j4 +cd ../.. +git clone https://github.com/zeromq/cppzmq +git clone https://github.com/oomer/poomer-zmq-client_server.git +cd poomer-zmq-client_server g++ -std=c++11 server.cpp -o server -I../libzmq/include -I../cppzmq -L../libzmq/build/lib -lzmq -Wl,-rpath,. -g++ -std=c++11 server.cpp -o server -I../libzmq/include -I../cppzmq -L../libzmq/build/lib -lzmq -Wl,-rpath,. +g++ -std=c++11 client.cpp -o client -I../libzmq/include -I../cppzmq -L../libzmq/build/lib -lzmq -Wl,-rpath,. +cp ../libzmq/build/lib/libzmq.5.dylib . +``` +[TODO] wrap in a makefile, see bellatui +[TODO] put in bin/Darwin +[TODO] clears compile time warnings -cl /std:c++17 client.cpp -Fe:client.exe -Ic:\Users\cupcake\github\vcpkg\installed\x64-windows\include\ /link c:\Users\cupcake\github\vcpkg\installed\x64-windows\lib\libzmq-mt-4_3_5.lib - -cl /std:c++17 server.cpp -Fe:server.exe -Ic:\Users\cupcake\github\vcpkg\installed\x64-windows\include\ /link c:\Users\cupcake\github\vcpkg\installed\x64-windows\lib\libzmq-mt-4_3_5.lib - - - -clang++ -o bin/Darwin/client obj/Darwin/client.o -mmacosx-version-min=11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -framework Cocoa -framework IOKit -framework CoreVideo -framework CoreFoundation -framework Accelerate -fvisibility=hidden -O5 -rpath @executable_path -weak_library ./lib/libvulkan.dylib -L./lib -L../libzmq/build/lib -lbella_engine_sdk -lm -lzmq -ldl +## Windows +Install Visual Studio Community with Desktop C++ +open a x64 Developer Shell ``` +mkdir workdir +cd workdir +git clone https://github.com/microsoft/vcpkg.git +cd vcpkg; .\bootstrap-vcpkg.bat +.\vcpkg.exe install boost:x64-windows zeromq[sodium]:x64-windows +.\vcpkg.exe install cppzmq:x64-windows +.\vcpkg integrate install +cd .. +git clone https://github.com/oomer/bellatui.git +cd bellatui +cl /std:c++17 client.cpp -Fe:client.exe -Ic:..\vcpkg\installed\x64-windows\include\ /link ..\vcpkg\installed\x64-windows\lib\libzmq-mt-4_3_5.lib +cl /std:c++17 server.cpp -Fe:server.exe -Ic:..\vcpkg\installed\x64-windows\include\ /link ..\vcpkg\installed\x64-windows\lib\libzmq-mt-4_3_5.lib +```