Skip to content
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

Module2 #11

Open
wants to merge 227 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
227 commits
Select commit Hold shift + click to select a range
136b30b
create directory structure
ptesavol May 31, 2024
13fc96a
working empty monorepo
ptesavol Jun 2, 2024
6b1bd4a
add build instructions to readme
ptesavol Jun 2, 2024
51e9d51
also clean the main build folder
ptesavol Jun 2, 2024
857e373
add CONFIG flag to folly find_package
ptesavol Jun 2, 2024
34b89a6
it builds
ptesavol Jun 2, 2024
628d430
rename build.sh to install.sh so build.sh can be the name for the nor…
ptesavol Jun 2, 2024
d2d6c55
add testing scripts
ptesavol Jun 3, 2024
ae8fdb4
lint works in sub-projects
ptesavol Jun 3, 2024
3dee7c3
update README
ptesavol Jun 3, 2024
06a79c0
Merge branch 'wp1' of github.com:streamr-dev/native-sdk into wp1
ptesavol Jun 3, 2024
f0572b6
updated tooling
ptesavol Jun 5, 2024
051cd33
updated prerequisities script
ptesavol Jun 5, 2024
13da152
StreamrFormatter is ready for implementation
SanttuRantanen Jun 6, 2024
149e42e
Output of StreamrFormatter is now in format like this: INFO [2024-06-…
SanttuRantanen Jun 6, 2024
451a5d9
enable linting
ptesavol Jun 7, 2024
ec86faf
Fixed size filename and linenumber added (Including filename truncate…
SanttuRantanen Jun 7, 2024
fef18f3
remove automatic pre-commit formatting
ptesavol Jun 7, 2024
d47619d
add pre-commit checking
ptesavol Jun 7, 2024
d1dc6c3
logDebug level fixed
SanttuRantanen Jun 7, 2024
b197766
get runk to work with clangd-tidy
ptesavol Jun 7, 2024
cf83b7e
improve testing setup
ptesavol Jun 7, 2024
9722c1a
formatMessageInStreamrStyle added. It is easier to unit test with it
SanttuRantanen Jun 7, 2024
ec6fdfd
StreamrFormatterTest template added
SanttuRantanen Jun 7, 2024
ef03d41
added ci workflows
ptesavol Jun 7, 2024
3fb4ada
Correct colors included
SanttuRantanen Jun 7, 2024
4162eb0
Message color added
SanttuRantanen Jun 7, 2024
257e54e
StreamrLogFormatterTest tests added
SanttuRantanen Jun 7, 2024
7c2b25c
SLOG_TRACE, SLOG_DEBUG... macros added. They work with lazy init so t…
SanttuRantanen Jun 7, 2024
a71e922
Little bit cleaning
SanttuRantanen Jun 7, 2024
94d1ac3
WP1
ptesavol Jun 8, 2024
6993f8c
Bit cleaning
SanttuRantanen Jun 8, 2024
19b2301
Merge branch 'module1' into add-basic-logger
SanttuRantanen Jun 8, 2024
42d7c6c
Folly root log level added. Also now Folly log C++ API is called dire…
SanttuRantanen Jun 10, 2024
7a44705
getFollyLogLevelFromEnv added
SanttuRantanen Jun 10, 2024
2283db0
Folly root log level updated only if env different
SanttuRantanen Jun 10, 2024
e07213d
New tests added
SanttuRantanen Jun 10, 2024
ad73c72
Cleanup
SanttuRantanen Jun 10, 2024
f9e3765
Unit testing
SanttuRantanen Jun 10, 2024
f5b0c23
Added bit comments
SanttuRantanen Jun 11, 2024
8232fde
Added bit comments
SanttuRantanen Jun 11, 2024
3c0f6c0
Unit Tests done
SanttuRantanen Jun 12, 2024
60c0dcc
Unit Tests done
SanttuRantanen Jun 12, 2024
97603ea
Add streamr-json package (#2)
ptesavol Jun 12, 2024
15a7a2d
Unit Tests done
SanttuRantanen Jun 12, 2024
987c71e
some fix
SanttuRantanen Jun 12, 2024
13947b8
some fix
SanttuRantanen Jun 12, 2024
67dfe42
some fix
SanttuRantanen Jun 12, 2024
60c4351
Classes split to different files
SanttuRantanen Jun 12, 2024
85f61c6
chore: set script as executable (a+x)
jtakalai Jun 12, 2024
15596de
Streamr enum classes added to protect the API for invalid values
SanttuRantanen Jun 12, 2024
04c1825
Formatter Log level data mapping changed to switch
SanttuRantanen Jun 12, 2024
e8f9f3b
Revert "chore: set script as executable (a+x)"
jtakalai Jun 12, 2024
e795c68
Formatter string changed
SanttuRantanen Jun 13, 2024
cc1094d
Some cleaning
SanttuRantanen Jun 13, 2024
2dbb4de
temp commit
SanttuRantanen Jun 14, 2024
be6ef4a
temp commit
SanttuRantanen Jun 14, 2024
797befc
temp commit
SanttuRantanen Jun 14, 2024
aef404f
log functions as templates
SanttuRantanen Jun 14, 2024
aa3c69a
log functions as templates
SanttuRantanen Jun 14, 2024
3855c5f
log functions as templates
SanttuRantanen Jun 14, 2024
bf05140
fix lint formatting issues
SanttuRantanen Jun 14, 2024
0cc2b07
Fixed issue with constant initialization
SanttuRantanen Jun 15, 2024
3924bc5
Fixed issue with constant initialization
SanttuRantanen Jun 15, 2024
ad8945e
LogFormatter strings fixed
SanttuRantanen Jun 15, 2024
b2befdb
LogFormatter tests changed to regex check to avoid timezone issues
SanttuRantanen Jun 16, 2024
130890f
One unused member variable deleted.
SanttuRantanen Jun 16, 2024
8d0b4f0
Merge branch 'module1' of github.com:streamr-dev/native-sdk into module1
SanttuRantanen Jun 16, 2024
d5750ed
Merge branch 'module1' into add-basic-logger
SanttuRantanen Jun 16, 2024
3003ee3
log meta data requires the concept type TypeWithToString
SanttuRantanen Jun 16, 2024
0aa8743
include dir changed
SanttuRantanen Jun 16, 2024
6d56539
include dir changed
SanttuRantanen Jun 16, 2024
7872dd2
TypeWithToString added to the context binding contructor argument. An…
SanttuRantanen Jun 17, 2024
b8f7b0e
Improve streamr json and enable transitive monorepo dependencies (#4)
ptesavol Jun 17, 2024
934dbc5
Merge branch 'module1' of github.com:streamr-dev/native-sdk into module1
SanttuRantanen Jun 18, 2024
8167fdb
Merge branch 'module1' into add-basic-logger
SanttuRantanen Jun 18, 2024
8ac96a3
Merge functionality added to concept bindings and metadata.
SanttuRantanen Jun 18, 2024
72f19be
Consts added to function parameters.
SanttuRantanen Jun 18, 2024
5d0de02
Maps changed to constexpr functions and code updated based on review …
SanttuRantanen Jun 18, 2024
01496fa
Memset removed.
SanttuRantanen Jun 18, 2024
1b66ff4
CMake change.
SanttuRantanen Jun 18, 2024
8f4d2ca
CMake change
SanttuRantanen Jun 18, 2024
296a284
Context bindings name changed
SanttuRantanen Jun 18, 2024
ecf5759
Linux merge issue fixed
SanttuRantanen Jun 18, 2024
49320a2
One comment removed
SanttuRantanen Jun 18, 2024
7cf3c8b
fix build by adding namespace streamr:: when linking against other mo…
ptesavol Jun 19, 2024
adf1cb1
Macros added back because it is only way to get filename and lininumber
SanttuRantanen Jun 19, 2024
a30f2d0
Constructor parameters changed to have default values.
SanttuRantanen Jun 19, 2024
f623e2e
Merge branch 'add-basic-logger' of github.com:streamr-dev/native-sdk …
SanttuRantanen Jun 19, 2024
63d2509
Removed Lint complains from a test file.
SanttuRantanen Jun 19, 2024
03d5527
Changed based on lint comments.
SanttuRantanen Jun 19, 2024
ba842e9
A couple of merge unit tests added.
SanttuRantanen Jun 19, 2024
78ef1d5
Member variables changed to the naming convention mVarName
SanttuRantanen Jun 24, 2024
f4b137e
source_location is used instead of macros.
SanttuRantanen Jun 24, 2024
15e4c3e
Mock output removed
SanttuRantanen Jun 24, 2024
5c7cc84
Log overloading functions not needed
SanttuRantanen Jun 24, 2024
19f781c
Mock output removed.
SanttuRantanen Jun 24, 2024
db375b7
move mapping between streamr and folly log levels to a compile-time map
ptesavol Jun 26, 2024
b2aac58
simplify contexBinding handling, add colors to test output
ptesavol Jun 26, 2024
f4137ef
return folly::loglevel::INFO if log level mapping is not found
ptesavol Jun 26, 2024
78b8c0c
remove constexpr from getLogLevelMap(), gcc does not allow setting st…
ptesavol Jun 26, 2024
b7e96c3
Enable per-filename loglevels, create LoggerImpl interface, move all …
ptesavol Jun 30, 2024
f88aaff
move all log level naming, colors to StreamrLogeLevel.hpp and access …
ptesavol Jul 2, 2024
89abda3
clean up StreamrLogFormatter.hpp
ptesavol Jul 5, 2024
5dc10b1
move std::visit() usage to a helper function
ptesavol Jul 5, 2024
30e8062
Add magic static instance() method to allow singleton-like usage
ptesavol Jul 5, 2024
77605a0
only read LOG_LEVEL env variable in Logger constructor
ptesavol Jul 6, 2024
53b246f
add example to streamr-logger
ptesavol Jul 6, 2024
9dfffe3
fix LoggerExample to work
ptesavol Jul 6, 2024
42319fb
add support for struct-containing json in contextBindings
ptesavol Jul 6, 2024
7f67e55
rework env variables handling
ptesavol Jul 8, 2024
1733f23
add README.md and use different log levels in example
ptesavol Jul 8, 2024
fcb1762
prioritize category log level over the default log level
ptesavol Jul 8, 2024
02df2f1
use latest homebrew clang on mac, create setenvs.sh (#6)
ptesavol Jul 8, 2024
b7805f9
Merge branch 'module1' into add-basic-logger
ptesavol Jul 8, 2024
80ef194
use HOMEBREW_PREFIX env variable to find the actual homebrew installa…
ptesavol Jul 9, 2024
debf3a9
Log Category tests added
SanttuRantanen Jul 9, 2024
c0366a4
A bit of cleaning
SanttuRantanen Jul 10, 2024
8df31b5
One test added to category log level
SanttuRantanen Jul 10, 2024
83198a1
remove using namespace statement according to reviewer comments
ptesavol Jul 14, 2024
3598d66
Add basic logger (#3)
SanttuRantanen Jul 14, 2024
6f0251a
Add event emitter (#5)
ptesavol Jul 14, 2024
1b39775
Install troubleshooting (#7)
jtakalai Jul 15, 2024
ac2fd0e
Improve streamr-json documentation (#8)
ptesavol Jul 15, 2024
64b9e0c
Add Implementation details section to README.md
ptesavol Jul 18, 2024
2eb8feb
Protobuffer Plugin template added
SanttuRantanen Jul 18, 2024
6a9c862
Printer added
SanttuRantanen Jul 19, 2024
9acaf29
intermediate commit
SanttuRantanen Jul 19, 2024
504ae73
Plugin creates Client proto file now
SanttuRantanen Jul 19, 2024
8236fe9
proto.sh added
SanttuRantanen Jul 29, 2024
8c191c5
Module1 review response: add example of emitting an event in README.md
ptesavol Jul 29, 2024
53de964
proto.sh added
SanttuRantanen Jul 29, 2024
1b3cb35
Module1 review response: disable the need for NOLINT in gtest protect…
ptesavol Jul 29, 2024
f21f196
Module1 review response: move forced linting from pre-commit to pre-p…
ptesavol Jul 29, 2024
af8048f
add nolint to extern environ declaration
ptesavol Jul 29, 2024
2acb24b
Module1 Review response: introduce static SLogger (#10)
ptesavol Jul 29, 2024
322bab4
Module1 review response: add IDE and extension recommendations to readme
ptesavol Jul 29, 2024
4de5676
x# Please enter a commit message to explain why this merge is necessary,
ptesavol Jul 29, 2024
648fd4a
Module1 review response: add --prod parameter to install.sh to config…
ptesavol Jul 30, 2024
12d6d4b
merged with module1
ptesavol Jul 31, 2024
824d5e5
fix typos
ptesavol Jul 31, 2024
d56772c
first version of streamr-proto-rpc
ptesavol Aug 2, 2024
605fe7f
compiles with new vcpkg and clangd-tidy
ptesavol Aug 5, 2024
404e488
Unit tests added
SanttuRantanen Aug 5, 2024
77cd8f8
Unit tests added
SanttuRantanen Aug 5, 2024
53f4d8d
happy path rpc call test works
ptesavol Aug 5, 2024
0a75e9b
Merge branch 'add-proto-rpc' of github.com:streamr-dev/native-sdk int…
ptesavol Aug 5, 2024
87a891b
add notifyRemote()
ptesavol Aug 5, 2024
76cb47b
remove generated files from git
ptesavol Aug 5, 2024
1f9f228
fix linting
ptesavol Aug 6, 2024
df8d193
Unit tests added
SanttuRantanen Aug 6, 2024
bdf8f2a
implement real code generation
ptesavol Aug 6, 2024
9ba7480
make rpc clients regular classes
ptesavol Aug 6, 2024
12e7c04
Unit tests added
SanttuRantanen Aug 6, 2024
6d18bf2
Merge branch 'add-proto-rpc' of github.com:streamr-dev/native-sdk int…
SanttuRantanen Aug 6, 2024
98a1898
Unit tests added and exception handling bug fixed
SanttuRantanen Aug 6, 2024
00ceb5d
Integration tests added
SanttuRantanen Aug 6, 2024
7b3b68b
Capture list changed from references to copies
SanttuRantanen Aug 7, 2024
160e7e2
fix linting
ptesavol Aug 7, 2024
3c3a9c0
fix exception handling
ptesavol Aug 7, 2024
e332f0c
fix linting
ptesavol Aug 7, 2024
b4cbcb4
fix linting
ptesavol Aug 7, 2024
8e168ee
Integration tests added
SanttuRantanen Aug 7, 2024
bd4d7bf
Merge branch 'add-proto-rpc' of github.com:streamr-dev/native-sdk int…
SanttuRantanen Aug 7, 2024
92aa6f0
capture list references changed to copies in notifyRemote
SanttuRantanen Aug 7, 2024
bddc580
Old Exception type changed to string
SanttuRantanen Aug 7, 2024
39c9d34
server-side exceptions work
ptesavol Aug 8, 2024
f9c1bee
fix linting
ptesavol Aug 8, 2024
5be4e41
fix linting
ptesavol Aug 8, 2024
423e02c
These generated files should be in git otherwise install does not work
SanttuRantanen Aug 8, 2024
b5890fe
Exception unit tests added for client and server
SanttuRantanen Aug 8, 2024
2b76012
Exception wrapping added to notifyRemote. Also exception handling uni…
SanttuRantanen Aug 8, 2024
64ba7b3
More integration tests added
SanttuRantanen Aug 8, 2024
17db5ce
timeouts work for calls
ptesavol Aug 8, 2024
762bd37
fix linting
ptesavol Aug 8, 2024
f611152
fix linting
ptesavol Aug 8, 2024
d9ad14c
Unit tests cleaned
SanttuRantanen Aug 8, 2024
2aff31a
ServerRegistry unit tests cleaned
SanttuRantanen Aug 8, 2024
cabc85e
ProtoRpcTest integration tests cleaned
SanttuRantanen Aug 8, 2024
f5a6221
Linter modifications
SanttuRantanen Aug 8, 2024
bfaefbd
merged with add-rpc-timeouts
ptesavol Aug 8, 2024
2d745ad
minimal cleanup, tests working
ptesavol Aug 8, 2024
cbf2b15
clean up onIncomingMessage()
ptesavol Aug 8, 2024
54ce037
added client-side timeouts for notifications
ptesavol Aug 8, 2024
d49ce71
protect mOngoingRequests with a mutex
ptesavol Aug 8, 2024
a5846ac
rename outgoingMessageListener to outgoingMessageCallback
ptesavol Aug 8, 2024
2081cce
reduce logging levels
ptesavol Aug 8, 2024
260c235
fix linting
ptesavol Aug 8, 2024
3b18ea3
add protobuf-generated files
ptesavol Aug 8, 2024
3087200
fix linting in CI
ptesavol Aug 8, 2024
7a56536
increase CI caching
ptesavol Aug 8, 2024
755c169
add example hello
ptesavol Aug 9, 2024
2139930
add custom test main that calls folly::init
ptesavol Aug 9, 2024
955801a
add custom test main that calls folly::init lint
ptesavol Aug 9, 2024
3ecbc47
improve CI caching
ptesavol Aug 9, 2024
db9da95
try fixing tests
ptesavol Aug 9, 2024
7628f34
Part of RoutesHello example added
SanttuRantanen Aug 9, 2024
1c91ce1
Merge branch 'module2' of github.com:streamr-dev/native-sdk into module2
SanttuRantanen Aug 9, 2024
ca28a64
add example routedhello
ptesavol Aug 9, 2024
47fe7f4
add readme
ptesavol Aug 9, 2024
fea414d
try making notifytask a member function
ptesavol Aug 10, 2024
eaa747a
try making notifytask a member function
ptesavol Aug 10, 2024
d6760d6
remove task-creating labda
ptesavol Aug 10, 2024
2a83b68
lint
ptesavol Aug 10, 2024
316965a
use own executors
ptesavol Aug 11, 2024
e861471
increase logging
ptesavol Aug 11, 2024
7dd949c
debugging
ptesavol Aug 11, 2024
065c840
use cpu executor directly instead of through a task
ptesavol Aug 11, 2024
fc938c2
lint
ptesavol Aug 11, 2024
3b4925c
move callback by value
ptesavol Aug 12, 2024
cfab538
add folly example
ptesavol Aug 12, 2024
e3f8acb
Reference removed in capture list
SanttuRantanen Aug 13, 2024
93c65b5
Typo fixed
SanttuRantanen Aug 13, 2024
c874f33
fix linting
ptesavol Aug 13, 2024
392d354
add overlay triplet for x64 linux to compile folly in release mode only
ptesavol Aug 14, 2024
648bba2
added temporary overlay port for magic-enum to fix changed hash
ptesavol Aug 14, 2024
704937c
split RpcCommunicator into three parts
ptesavol Aug 14, 2024
52bdac8
add comments and clean up
ptesavol Aug 14, 2024
f1c4b07
add permalinks to protobuf files pointing to github commits of netwo…
ptesavol Aug 14, 2024
abd7623
rename callRemote() and notifyRemote() to request() and notify()
ptesavol Aug 14, 2024
66b098b
iOS overlaytriplet added
SanttuRantanen Aug 14, 2024
035d6ee
only install dependencies once in monorepo
ptesavol Aug 15, 2024
33fe7da
simplify install action of github
ptesavol Aug 15, 2024
b2a3cba
lint
ptesavol Aug 15, 2024
6d0984f
Merge branch 'module2' of github.com:streamr-dev/native-sdk into module2
ptesavol Aug 15, 2024
757d7a4
merge with main
ptesavol Aug 15, 2024
f87873a
add checks to install.sh to prevent running with false settings
ptesavol Aug 19, 2024
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
25 changes: 21 additions & 4 deletions .github/workflows/reusable/cached-install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ runs:
steps:
- name: cache homedir
id: cache-homedir
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
key: cache-homedir-${{ hashFiles('./vcpkg.json') }}
path: |
~/.cache
~/.cache/vcpkg/archives
- name: cache vcpkg installed
id: cache-vcpkg-installed
uses: actions/cache@v4
uses: actions/cache/restore@v4
with:
key: cache-vcpkg-installed-${{ hashFiles('./vcpkg.json') }}
path: |
**/vcpkg_installed
./build/vcpkg_installed
- name: install-prerequisities
run:
source install-prerequisities.sh
Expand All @@ -26,3 +26,20 @@ runs:
run:
./install.sh
shell: bash
- name: cache homedir save
id: cache-homedir-save
if: always()
uses: actions/cache/save@v4
with:
key: cache-homedir-${{ hashFiles('./vcpkg.json') }}
path: |
~/.cache/vcpkg/archives
- name: cache vcpkg installed save
id: cache-vcpkg-installed-save
if: always()
uses: actions/cache/save@v4
with:
key: cache-vcpkg-installed-${{ hashFiles('./vcpkg.json') }}
path: |
./build/vcpkg_installed

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ vcpkg_installed
.vscode
.trunk
setenvs.sh
*.DS_Store*
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
cmake_minimum_required(VERSION 3.22)
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)

set(VCPKG_MANIFEST_INSTALL OFF)
set(VCPKG_INSTALLED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/vcpkg_installed)


set (VCPKG_OVERLAY_TRIPLETS ENV{VCPKG_OVERLAY_TRIPLETS})
set(CMAKE_CXX_STANDARD 26)
include(homebrewClang.cmake)

Expand Down
2 changes: 1 addition & 1 deletion clangd-tidy
2 changes: 2 additions & 0 deletions clean.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

rm -rf ~/.cache/vcpkg

# Parse MonorepoPackages.cmake and loop through them
for package in $(cat MonorepoPackages.cmake | grep -v "set(MonorepoPackages" | grep -v ")"); do
cd packages/$package/build && ls -A | while read FILE; do echo "\"$FILE\""; done | grep -v ".gitignore" | xargs rm -rf && cd ../../..
Expand Down
4 changes: 2 additions & 2 deletions homebrewClang.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if (${APPLE})
set(HOMEBREW_PREFIX $ENV{HOMEBREW_PREFIX})

set(LLVM_PREFIX "${HOMEBREW_PREFIX}/opt/llvm")
set(LLVM_PREFIX "${HOMEBREW_PREFIX}")
set(CMAKE_C_COMPILER "${LLVM_PREFIX}/bin/clang")
set(CMAKE_CXX_COMPILER "${LLVM_PREFIX}/bin/clang++")
set(ENV{CC} "${CMAKE_C_COMPILER}")
Expand All @@ -20,7 +20,7 @@ if (${APPLE})
set(CMAKE_FIND_FRAMEWORK LAST)
set(CMAKE_FIND_APPBUNDLE LAST)

add_link_options("-L/opt/homebrew/opt/llvm/lib/c++" "-Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++")
add_link_options("-L/opt/homebrew/lib/c++" "-Wl,-rpath,/opt/homebrew/lib/c++")
#set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH FALSE)
#set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH FALSE)
endif()
33 changes: 26 additions & 7 deletions install-prerequisities.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@ if [[ "$OSTYPE" == "darwin"* ]]; then

xcode-select --install
brew install jq
brew install llvm
brew uninstall llvm
brew install llvm@17
brew install cmake
brew install pkg-config

rm -f $HOMEBREW_PREFIX/bin/clang-format
rm -f $HOMEBREW_PREFIX/bin/clangd
rm -f $HOMEBREW_PREFIX/bin/lldb
ln -s $HOMEBREW_PREFIX/opt/llvm/bin/clang-format $HOMEBREW_PREFIX/bin/clang-format
ln -s $HOMEBREW_PREFIX/opt/llvm/bin/clangd $HOMEBREW_PREFIX/bin/clangd
ln -s $HOMEBREW_PREFIX/opt/llvm/bin/lldb $HOMEBREW_PREFIX/bin/lldb
brew link --overwrite --force llvm@17
#rm -f $HOMEBREW_PREFIX/bin/clang-format
#rm -f $HOMEBREW_PREFIX/bin/clangd
#rm -f $HOMEBREW_PREFIX/bin/lldb
#ln -s $HOMEBREW_PREFIX/bin/clang-format $HOMEBREW_PREFIX/bin/clang-format
#ln -s $HOMEBREW_PREFIX/bin/clangd $HOMEBREW_PREFIX/bin/clangd
#ln -s $HOMEBREW_PREFIX/bin/lldb $HOMEBREW_PREFIX/bin/lldb

rm -f $HOMEBREW_PREFIX/bin/clang-tidy

else
Expand Down Expand Up @@ -59,6 +62,16 @@ if [[ -n "$GITHUB_ENV" ]]; then
echo "VCPKG_ROOT=$VCPKG_ROOT" >> $GITHUB_ENV
fi

export VCPKG_OVERLAY_TRIPLETS=$(pwd)/overlaytriplets
if [[ -n "$GITHUB_ENV" ]]; then
echo "VCPKG_OVERLAY_TRIPLETS=$VCPKG_OVERLAY_TRIPLETS" >> $GITHUB_ENV
fi

export VCPKG_OVERLAY_PORTS=$(pwd)/overlayports
if [[ -n "$GITHUB_ENV" ]]; then
echo "VCPKG_OVERLAY_PORTS=$VCPKG_OVERLAY_PORTS" >> $GITHUB_ENV
fi

if [[ ":$PATH:" != *":$VCPKG_ROOT:"* ]]; then
export PATH=$PATH:$VCPKG_ROOT
if [[ -n "$GITHUB_PATH" ]]; then
Expand All @@ -72,6 +85,12 @@ TEMP_PROFILE_CONTENTS+="export VCPKG_ROOT=$(pwd)/vcpkg\n"
# Add PATH environment variable to include VCPKG_ROOT
TEMP_PROFILE_CONTENTS+="export PATH=\$VCPKG_ROOT:\$PATH\n"

# Add VCPKG_OVERLAY_TRIPLETS environment variable
TEMP_PROFILE_CONTENTS+="export VCPKG_OVERLAY_TRIPLETS=$(pwd)/overlaytriplets\n"

# Add VCPKG_OVERLAY_PORTS environment variable
TEMP_PROFILE_CONTENTS+="export VCPKG_OVERLAY_PORTS=$(pwd)/overlayports\n"

echo $TEMP_PROFILE_CONTENTS

touch $PROFILE_FILE
Expand Down
17 changes: 17 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#!/bin/bash

set -e

# Check if VCPKG_ROOT is set and points to the correct directory
if [ -z "$VCPKG_ROOT" ]; then
echo "Error: VCPKG_ROOT is not set. Please run 'source install-prerequisities.sh' or 'source setenvs.sh' before running this script."
exit 1
fi

EXPECTED_VCPKG_ROOT="$(pwd)/vcpkg"
if [ "$VCPKG_ROOT" != "$EXPECTED_VCPKG_ROOT" ]; then
echo "Error: VCPKG_ROOT points to the vcpkg of another project '$VCPKG_ROOT'. Please run 'source install-prerequisities.sh' or 'source setenvs.sh' before running this script."
exit 1
fi

# Parse command-line options
PROD_BUILD=false

Expand All @@ -21,6 +35,8 @@ fi
git config core.hooksPath .githooks
./merge-dependencies.sh

vcpkg install --x-install-root=build/vcpkg_installed

# Call build for all monorepo packages in their own build directories
for package in $(cat MonorepoPackages.cmake | grep -v "set(MonorepoPackages" | grep -v ")"); do
cd packages/$package/build && cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && cmake --build . && cd ../../..
Expand All @@ -29,3 +45,4 @@ done
# Call build for the root project
echo "Building root project"
cd build && cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. && cmake --build . && cd ..

2 changes: 1 addition & 1 deletion lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e

FILES=$(find ./packages -type d \( -name src -o -name include -o -name test \) ! -path '*/build/*' -print0 | xargs -0 -I{} find {} -type f \( -name "*.hpp" -o -name "*.cpp" \) -print0 | xargs -0 echo)
FILES=$(find ./packages -type d \( -name src -o -name include -o -name test \) ! -path '*/build/*' ! -path '*/proto/*' -print0 | xargs -0 -I{} find {} -type f \( -name "*.hpp" -o -name "*.cpp" \) -print0 | xargs -0 echo)
echo "Running clangd-tidy on $FILES"

./clangd-tidy/clangd-tidy -p ./build $FILES
Expand Down
27 changes: 27 additions & 0 deletions overlayports/magic-enum/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Neargye/magic_enum
REF "v${VERSION}"
SHA512 fa3792e9c69c57e437d6325b7659cf25e6cbdda3326ffeaf0411d9838822095b15306f322ad2ebd5ec68b905ef2aed08880d2507e7d8a8559ab3c5be6c8ce99c
HEAD_REF master
)

set(VCPKG_BUILD_TYPE release) # header-only port

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DMAGIC_ENUM_OPT_BUILD_EXAMPLES=OFF
-DMAGIC_ENUM_OPT_BUILD_TESTS=OFF
-DMAGIC_ENUM_OPT_INSTALL=ON
)

vcpkg_cmake_install()

vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/magic_enum PACKAGE_NAME magic_enum)

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib")

# Handle copyright
configure_file("${SOURCE_PATH}/LICENSE" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY)
file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
4 changes: 4 additions & 0 deletions overlayports/magic-enum/usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
magic-enum provides CMake targets:

find_package(magic_enum CONFIG REQUIRED)
target_link_libraries(main PRIVATE magic_enum::magic_enum)
17 changes: 17 additions & 0 deletions overlayports/magic-enum/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "magic-enum",
"version": "0.9.6",
"description": "Header-only C++17 library provides static reflection for enums, work with any enum type without any macro or boilerplate code.",
"homepage": "https://github.com/Neargye/magic_enum",
"license": "MIT",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
20 changes: 20 additions & 0 deletions overlaytriplets/arm64-ios.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME iOS)

set(CMAKE_CXX_STANDARD 26)
set(HOMEBREW_PREFIX $ENV{HOMEBREW_PREFIX})

set(LLVM_PREFIX "${HOMEBREW_PREFIX}")
set(CMAKE_C_COMPILER "${LLVM_PREFIX}/bin/clang")
set(CMAKE_CXX_COMPILER "${LLVM_PREFIX}/bin/clang++")
set(ENV{CC} "${CMAKE_C_COMPILER}")
set(ENV{CXX} "${CMAKE_CXX_COMPILER}")

set(VCPKG_CMAKE_CONFIGURE_OPTIONS -DCMAKE_C_COMPILER=${LLVM_PREFIX}/bin/clang -DCMAKE_CXX_COMPILER=${LLVM_PREFIX}/bin/clang++ -DCMAKE_CXX_STANDARD=26 -DGFLAGS_INTTYPES_FORMAT=C99 -DBUILD_gflags_LIB=OFF -DBUILD_gflags_nothreads_LIB=ON)

set(VCPKG_CXX_FLAGS "-isystem /opt/homebrew/include/c++/v1")
set(VCPKG_C_FLAGS "-isystem /opt/homebrew/include/c++/v1")
set(VCPKG_LINKER_FLAGS "-L/opt/homebrew/lib/c++ -Wl,-rpath,/opt/homebrew/lib/c++")

23 changes: 23 additions & 0 deletions overlaytriplets/arm64-osx.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
set(VCPKG_TARGET_ARCHITECTURE arm64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES arm64)

set(CMAKE_CXX_STANDARD 26)
set(HOMEBREW_PREFIX $ENV{HOMEBREW_PREFIX})

set(LLVM_PREFIX "${HOMEBREW_PREFIX}")
set(CMAKE_C_COMPILER "${LLVM_PREFIX}/bin/clang")
set(CMAKE_CXX_COMPILER "${LLVM_PREFIX}/bin/clang++")
set(ENV{CC} "${CMAKE_C_COMPILER}")
set(ENV{CXX} "${CMAKE_CXX_COMPILER}")

set(VCPKG_CMAKE_CONFIGURE_OPTIONS -DCMAKE_C_COMPILER=${LLVM_PREFIX}/bin/clang -DCMAKE_CXX_COMPILER=${LLVM_PREFIX}/bin/clang++ -DCMAKE_CXX_STANDARD=26)

set(VCPKG_CXX_FLAGS "-isystem /opt/homebrew/include/c++/v1")
set(VCPKG_C_FLAGS "-isystem /opt/homebrew/include/c++/v1")
set(VCPKG_LINKER_FLAGS "-L/opt/homebrew/lib/c++ -Wl,-rpath,/opt/homebrew/lib/c++")

message(STATUS "OVERLAY TRIPLET arm64-osx loaded")
12 changes: 12 additions & 0 deletions overlaytriplets/x64-linux.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Linux)

if(${PORT} MATCHES "folly")
message(STATUS "Port name is folly, setting build type to release")
set(VCPKG_BUILD_TYPE release)
endif()

message(STATUS "OVERLAY TRIPLET x64-linux loaded")
23 changes: 23 additions & 0 deletions overlaytriplets/x64-osx.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)

set(VCPKG_CMAKE_SYSTEM_NAME Darwin)
set(VCPKG_OSX_ARCHITECTURES x86_64)

set(CMAKE_CXX_STANDARD 26)
set(HOMEBREW_PREFIX $ENV{HOMEBREW_PREFIX})

set(LLVM_PREFIX "${HOMEBREW_PREFIX}")
set(CMAKE_C_COMPILER "${LLVM_PREFIX}/bin/clang")
set(CMAKE_CXX_COMPILER "${LLVM_PREFIX}/bin/clang++")
set(ENV{CC} "${CMAKE_C_COMPILER}")
set(ENV{CXX} "${CMAKE_CXX_COMPILER}")

set(VCPKG_CMAKE_CONFIGURE_OPTIONS -DCMAKE_C_COMPILER=${LLVM_PREFIX}/bin/clang -DCMAKE_CXX_COMPILER=${LLVM_PREFIX}/bin/clang++ -DCMAKE_CXX_STANDARD=26)

set(VCPKG_CXX_FLAGS "-isystem /opt/homebrew/include/c++/v1")
set(VCPKG_C_FLAGS "-isystem /opt/homebrew/include/c++/v1")
set(VCPKG_LINKER_FLAGS "-L/opt/homebrew/lib/c++ -Wl,-rpath,/opt/homebrew/lib/c++")

message(STATUS "OVERLAY TRIPLET x64-osx loaded")
4 changes: 2 additions & 2 deletions packages/streamr-eventemitter/homebrewClang.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if (${APPLE})
set(HOMEBREW_PREFIX $ENV{HOMEBREW_PREFIX})

set(LLVM_PREFIX "${HOMEBREW_PREFIX}/opt/llvm")
set(LLVM_PREFIX "${HOMEBREW_PREFIX}")
set(CMAKE_C_COMPILER "${LLVM_PREFIX}/bin/clang")
set(CMAKE_CXX_COMPILER "${LLVM_PREFIX}/bin/clang++")
set(ENV{CC} "${CMAKE_C_COMPILER}")
Expand All @@ -20,7 +20,7 @@ if (${APPLE})
set(CMAKE_FIND_FRAMEWORK LAST)
set(CMAKE_FIND_APPBUNDLE LAST)

add_link_options("-L/opt/homebrew/opt/llvm/lib/c++" "-Wl,-rpath,/opt/homebrew/opt/llvm/lib/c++")
add_link_options("-L/opt/homebrew/lib/c++" "-Wl,-rpath,/opt/homebrew/lib/c++")
#set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH FALSE)
#set(CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH FALSE)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,11 @@ struct Event {
};

template <typename T, typename EmitterEventType>
concept MatchingEventType = std::is_same<T, EmitterEventType>::value;
concept MatchingEventType = std::is_same_v<T, EmitterEventType>;

template <typename T, typename EmitterEventType>
concept MatchingCallbackType =
std::is_assignable<typename EmitterEventType::Handler::HandlerFunction, T>::
value;
concept MatchingCallbackType = std::
is_assignable_v<typename EmitterEventType::Handler::HandlerFunction, T>;

// Immutable reference to a Handler.
// This is needed because there is no way of checking the validity
Expand Down
9 changes: 8 additions & 1 deletion packages/streamr-eventemitter/monorepoPackage.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)

if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/../../MonorepoPackages.cmake)
message(STATUS "In monorepo sub-package ${CMAKE_CURRENT_SOURCE_DIR}")


# if in monorepo, do not install vcpkg dependencies
set(VCPKG_MANIFEST_INSTALL OFF)

# if in monorepo, use the vcpkg dependencies from the monorepo root
set(VCPKG_INSTALLED_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../build/vcpkg_installed)

# if in monorepo, use the monorepo deps from filesystem
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg.json)
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg.json VCPKG_JSON)
Expand Down
Loading
Loading