-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7cf211
commit f43a238
Showing
20 changed files
with
1,374 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
DerivePointerAlignment: false | ||
AccessModifierOffset: -4 | ||
AlignEscapedNewlinesLeft: true | ||
AlignTrailingComments: true | ||
AllowAllParametersOfDeclarationOnNextLine: true | ||
AllowShortFunctionsOnASingleLine: false | ||
AllowShortIfStatementsOnASingleLine: false | ||
AllowShortLoopsOnASingleLine: false | ||
AlwaysBreakBeforeMultilineStrings: true | ||
AlwaysBreakTemplateDeclarations: true | ||
BinPackParameters: false | ||
BreakBeforeBinaryOperators: false | ||
BreakBeforeBraces: Allman | ||
BreakBeforeTernaryOperators: false | ||
BreakConstructorInitializersBeforeComma: true | ||
ColumnLimit: 120 | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: false | ||
ConstructorInitializerIndentWidth: 4 | ||
ContinuationIndentWidth: 4 | ||
Cpp11BracedListStyle: true | ||
DerivePointerBinding: true | ||
ExperimentalAutoDetectBinPacking: false | ||
IndentCaseLabels: true | ||
IndentFunctionDeclarationAfterType: true | ||
IndentWidth: 4 | ||
Language: Cpp | ||
MaxEmptyLinesToKeep: 1 | ||
NamespaceIndentation: None | ||
ObjCSpaceBeforeProtocolList: false | ||
PenaltyBreakBeforeFirstCallParameter: 1 | ||
PenaltyBreakComment: 60 | ||
PenaltyBreakFirstLessLess: 120 | ||
PenaltyBreakString: 1000 | ||
PenaltyExcessCharacter: 1000000 | ||
PenaltyReturnTypeOnItsOwnLine: 200 | ||
PointerBindsToType: true | ||
SpaceBeforeAssignmentOperators: true | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: false | ||
SpacesBeforeTrailingComments: 2 | ||
SpacesInAngles: false | ||
SpacesInCStyleCastParentheses: false | ||
SpacesInParentheses: true | ||
Standard: Cpp11 | ||
TabWidth: 8 | ||
UseTab: Never | ||
... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Build & Test | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
schedule: | ||
- cron: "0 0 * * *" | ||
|
||
jobs: | ||
build_and_test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [macos-12, ubuntu-20.04, windows-2022] | ||
|
||
steps: | ||
- if: matrix.os == 'windows-2022' | ||
name: Install Cppcheck (Windows) | ||
run: | | ||
choco install -y --ignore-package-exit-codes cppcheck | ||
echo "C:\Program Files\Cppcheck" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | ||
- if: matrix.os == 'windows-2022' | ||
name: Configure MSVC (Windows) | ||
uses: ilammy/msvc-dev-cmd@v1 | ||
|
||
- name: Configure Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install Meson and Ninja | ||
run: | | ||
pip3 install --upgrade meson ninja | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Build - Release | ||
run: | | ||
meson setup --buildtype=release builddir | ||
meson compile -C builddir | ||
- name: Test - Release | ||
run: | | ||
meson test -vC builddir | ||
- if: matrix.os == 'windows-2022' | ||
name: Build - Debug (Windows) | ||
run: | | ||
meson setup --buildtype=debug --wipe builddir | ||
meson compile -C builddir | ||
- if: matrix.os == 'windows-2022' | ||
name: Test - Debug (Windows) | ||
run: | | ||
meson test -vC builddir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Meson Wraps | ||
subprojects/googletest-release-* | ||
subprojects/packagecache | ||
|
||
# Misc | ||
.DS_Store | ||
*.user | ||
|
||
# VSCode | ||
.vscode/settings.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"C_Cpp.default.cppStandard": "c++17", | ||
"lldb.showDisassembly": "never" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "IpcTests", | ||
"preLaunchTask": "Build", | ||
"program": "${workspaceFolder}/builddir/tests/IpcTests", | ||
"cwd": "${workspaceFolder}/builddir", | ||
"request": "launch", | ||
"type": "cppvsdbg", | ||
"osx": { | ||
"type": "lldb" | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"version": "2.0.0", | ||
"windows": { | ||
"options": { | ||
"shell": { | ||
"executable": "cmd.exe", | ||
"args": [ | ||
"/c", | ||
"\"C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/Common7/Tools/VsDevCmd.bat\"", | ||
"-arch=amd64", | ||
"&&" | ||
] | ||
} | ||
} | ||
}, | ||
"tasks": [ | ||
{ | ||
"label": "Build", | ||
"type": "shell", | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"windows": { | ||
"command": [ | ||
"copy /y .vscode\\_settings.json .vscode\\settings.json &&", | ||
"meson setup builddir --buildtype=debug &&", | ||
"meson compile -C builddir" | ||
], | ||
"problemMatcher": { | ||
"base": "$msCompile" | ||
} | ||
}, | ||
"osx": { | ||
"command": [ | ||
"cp .vscode/_settings.json .vscode/settings.json &&", | ||
"meson setup builddir --buildtype=debug &&", | ||
"meson compile -C builddir" | ||
], | ||
"problemMatcher": { | ||
"base": "$gcc", | ||
"fileLocation": [ | ||
"relative", | ||
"${workspaceFolder}/builddir/" | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# IPC | ||
|
||
Simple cross-platform C++ IPC library | ||
|
||
## Build | ||
|
||
This project is built using Meson: https://mesonbuild.com/Getting-meson.html | ||
|
||
``` | ||
meson setup builddir --buildtype=debug | ||
meson compile -C builddir | ||
meson test -vC builddir | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
project('ipc', 'cpp', | ||
default_options: [ | ||
'cpp_std=c++17', | ||
'warning_level=3', | ||
'werror=true' | ||
] | ||
) | ||
|
||
if host_machine.system() == 'darwin' | ||
add_project_arguments(['-mmacosx-version-min=10.15', '-arch', 'arm64', '-arch', 'x86_64'], language: 'cpp') | ||
add_project_link_arguments(['-mmacosx-version-min=10.15', '-arch', 'arm64', '-arch', 'x86_64'], language: 'cpp') | ||
else | ||
add_project_arguments(['-D_CRT_SECURE_NO_WARNINGS'], language: 'cpp') | ||
endif | ||
|
||
# Add formatting | ||
|
||
format_first = [] | ||
if find_program('clang-format', required: false).found() | ||
if host_machine.system() == 'windows' | ||
format_command = meson.current_source_dir() + '/scripts/clang-format.bat' | ||
else | ||
format_command = ['bash', meson.current_source_dir() + '/scripts/clang-format.sh'] | ||
endif | ||
|
||
format_first = custom_target( | ||
output: 'formatting', | ||
command: format_command, | ||
build_always: true | ||
) | ||
endif | ||
|
||
# Add static code analysis | ||
|
||
if find_program('cppcheck', required: false).found() | ||
if host_machine.system() == 'windows' | ||
extra_cppcheck_args = ['-D_WIN32'] | ||
else | ||
extra_cppcheck_args = [] | ||
endif | ||
|
||
custom_target( | ||
input: format_first, | ||
output: 'static code analysis', | ||
command: [ | ||
'cppcheck', | ||
|
||
'--error-exitcode=1', | ||
'--enable=all', | ||
'--inconclusive', | ||
'--inline-suppr', | ||
'--force', | ||
'--quiet', | ||
'--suppress=missingIncludeSystem', | ||
|
||
'-i', meson.current_build_dir(), | ||
'-i', meson.current_source_dir() + '/subprojects', | ||
|
||
'-I', meson.current_source_dir() + '/src', | ||
|
||
extra_cppcheck_args, | ||
|
||
meson.current_source_dir() | ||
], | ||
build_always: true | ||
) | ||
endif | ||
|
||
# Configure ipc_lib | ||
|
||
ipc_src = [ | ||
'src/Client.cpp', | ||
'src/Message.cpp', | ||
'src/Server.cpp' | ||
] | ||
|
||
ipc_inc = include_directories( | ||
'src' | ||
) | ||
|
||
ipc_lib = static_library( | ||
'Ipc', | ||
format_first, | ||
ipc_src, | ||
include_directories: ipc_inc, | ||
) | ||
|
||
ipc_dep = declare_dependency( | ||
link_with : ipc_lib, | ||
include_directories : ipc_inc | ||
) | ||
|
||
# Add tests | ||
|
||
subdir('tests') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@echo off | ||
|
||
cd %~dp0.. | ||
|
||
call :processDir | ||
goto :finish | ||
|
||
:processDir | ||
for %%f in ("*.cpp", "*.h") do ( | ||
clang-format --style=file --verbose -i %%f | ||
) | ||
|
||
for /D %%d in (*) do ( | ||
cd %%d | ||
if not %%d==subprojects call :processDir | ||
cd .. | ||
) | ||
|
||
exit /b | ||
|
||
:finish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" | ||
cd "$DIR/.." | ||
|
||
find . -iname *.h -o -iname *.cpp | grep -v subprojects | xargs clang-format --style=file --verbose -i |
Oops, something went wrong.