setup
This commit is contained in:
parent
1105c9b8d3
commit
4aa57c5bd0
8
.clang-format
Normal file
8
.clang-format
Normal file
@ -0,0 +1,8 @@
|
||||
BasedOnStyle: WebKit
|
||||
IndentWidth: 4
|
||||
ColumnLimit: 80
|
||||
IndentCaseLabels: true
|
||||
BreakBeforeBraces: Custom
|
||||
BraceWrapping:
|
||||
AfterFunction: true
|
||||
SplitEmptyFunction: false
|
40
.clangd
Normal file
40
.clangd
Normal file
@ -0,0 +1,40 @@
|
||||
CompileFlags:
|
||||
CompilationDatabase: ./builddir
|
||||
Diagnostics:
|
||||
ClangTidy:
|
||||
Add:
|
||||
- bugprone-*
|
||||
- clang-analyzer-*
|
||||
- cppcoreguidelines-*
|
||||
- modernize-*
|
||||
- readability-*
|
||||
Remove:
|
||||
- readability-braces-around-statements
|
||||
- cppcoreguidelines-avoid-magic-numbers
|
||||
- readability-magic-numbers
|
||||
- readability-identifier-length
|
||||
- bugprone-easily-swappable-parameters
|
||||
|
||||
CheckOptions:
|
||||
UnusedIncludes: Strict
|
||||
|
||||
# typecase rules
|
||||
readability-identifier-naming.ClassCase: CamelCase
|
||||
readability-identifier-naming.ConstantCase: lower_case
|
||||
readability-identifier-naming.EnumCase: CamelCase
|
||||
readability-identifier-naming.EnumConstantCase: CamelCase
|
||||
readability-identifier-naming.FunctionCase: lower_case
|
||||
readability-identifier-naming.InlineNamespaceCase: lower_case
|
||||
readability-identifier-naming.MacroDefinitionCase: UPPER_CASE
|
||||
readability-identifier-naming.MemberCase: lower_case
|
||||
readability-identifier-naming.MethodCase: lower_case
|
||||
readability-identifier-naming.NamespaceCase: lower_case
|
||||
readability-identifier-naming.ScopedEnumConstantCase: CamelCase
|
||||
readability-identifier-naming.StructCase: CamelCase
|
||||
readability-identifier-naming.TemplateParameterCase: CamelCase
|
||||
readability-identifier-naming.TemplateTemplateParameterCase: CamelCase
|
||||
readability-identifier-naming.TypeAliasCase: CamelCase
|
||||
readability-identifier-naming.TypedefCase: CamelCase
|
||||
readability-identifier-naming.UnionCase: CamelCase
|
||||
readability-identifier-naming.ValueTemplateParameterCase: lower_case
|
||||
readability-identifier-naming.VariableCase: lower_case
|
32
README.md
32
README.md
@ -1 +1,33 @@
|
||||
|
||||
# web-stack-project
|
||||
|
||||
## Build project
|
||||
|
||||
- Open project in terminal
|
||||
- Run `meson setup builddir`, or `CXX=clang-<version> meson setup builddir` if clang and clang-version is different
|
||||
- Navigate into builddir, `cd builddir`
|
||||
- Compile `meson compile`
|
||||
- Run, `./browser` or `./server`
|
||||
|
||||
## VS Code development setup
|
||||
|
||||
### Install
|
||||
- `clang-15` recommended, `clang-15` based, check with `clang --version`
|
||||
- [Meson](https://mesonbuild.com/), build system
|
||||
- [Meson VS Code extension](https://marketplace.visualstudio.com/items?itemName=mesonbuild.mesonbuild)
|
||||
- [VSCode - clangd](https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd), linter
|
||||
- [VSCode - CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb), debugger
|
||||
- [VSCode - Better C++ Syntax](https://marketplace.visualstudio.com/items?itemName=jeff-hykin.better-cpp-syntax), syntax higlighting
|
||||
|
||||
### Config
|
||||
|
||||
Add these to `settings.json` if necessary
|
||||
```json
|
||||
{
|
||||
// probably necessary
|
||||
"clangd.onConfigChanged": "restart",
|
||||
|
||||
// only necessary if default `/usr/bin/clangd` isn't the correct version
|
||||
"clangd.path": "/usr/bin/clangd-<version>", // <version> is a place holder, eg, `clangd-15`
|
||||
}
|
||||
```
|
||||
|
3
browser/main.cpp
Normal file
3
browser/main.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include <fmt/core.h>
|
||||
|
||||
int main() { fmt::print("browser: hello world!\n"); }
|
3
browser/meson.build
Normal file
3
browser/meson.build
Normal file
@ -0,0 +1,3 @@
|
||||
browser_sources += files(
|
||||
'main.cpp',
|
||||
)
|
43
meson.build
Normal file
43
meson.build
Normal file
@ -0,0 +1,43 @@
|
||||
project(
|
||||
'web-stack-project',
|
||||
'cpp',
|
||||
version: '0.1',
|
||||
default_options: [
|
||||
'warning_level=3',
|
||||
'werror=true',
|
||||
'cpp_std=c++20',
|
||||
],
|
||||
)
|
||||
|
||||
fmt_dep = dependency('fmt')
|
||||
sdl2_dep = dependency('sdl2')
|
||||
|
||||
server_sources = []
|
||||
subdir('server')
|
||||
server_exe = executable(
|
||||
'web-server',
|
||||
server_sources,
|
||||
win_subsystem: 'console',
|
||||
include_directories: [
|
||||
include_directories('server'),
|
||||
],
|
||||
dependencies: [
|
||||
fmt_dep,
|
||||
sdl2_dep,
|
||||
],
|
||||
)
|
||||
|
||||
browser_sources = []
|
||||
subdir('browser')
|
||||
browser_exe = executable(
|
||||
'web-browser',
|
||||
browser_sources,
|
||||
win_subsystem: 'console',
|
||||
include_directories: [
|
||||
include_directories('browser'),
|
||||
],
|
||||
dependencies: [
|
||||
fmt_dep,
|
||||
sdl2_dep,
|
||||
],
|
||||
)
|
3
server/main.cpp
Normal file
3
server/main.cpp
Normal file
@ -0,0 +1,3 @@
|
||||
#include <fmt/core.h>
|
||||
|
||||
int main() { fmt::print("server: hello world!\n"); }
|
3
server/meson.build
Normal file
3
server/meson.build
Normal file
@ -0,0 +1,3 @@
|
||||
server_sources += files(
|
||||
'main.cpp',
|
||||
)
|
3
subprojects/.gitignore
vendored
Normal file
3
subprojects/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
packagecache/
|
||||
fmt-*
|
||||
SDL2-*
|
12
subprojects/fmt.wrap
Normal file
12
subprojects/fmt.wrap
Normal file
@ -0,0 +1,12 @@
|
||||
[wrap-file]
|
||||
directory = fmt-9.1.0
|
||||
source_url = https://github.com/fmtlib/fmt/archive/9.1.0.tar.gz
|
||||
source_filename = fmt-9.1.0.tar.gz
|
||||
source_hash = 5dea48d1fcddc3ec571ce2058e13910a0d4a6bab4cc09a809d8b1dd1c88ae6f2
|
||||
patch_filename = fmt_9.1.0-1_patch.zip
|
||||
patch_url = https://wrapdb.mesonbuild.com/v2/fmt_9.1.0-1/get_patch
|
||||
patch_hash = 4557b9ba87b3eb63694ed9b21d1a2117d4a97ca56b91085b10288e9a5294adf8
|
||||
wrapdb_version = 9.1.0-1
|
||||
|
||||
[provide]
|
||||
fmt = fmt_dep
|
12
subprojects/sdl2.wrap
Normal file
12
subprojects/sdl2.wrap
Normal file
@ -0,0 +1,12 @@
|
||||
[wrap-file]
|
||||
directory = SDL2-2.26.0
|
||||
source_url = https://github.com/libsdl-org/SDL/releases/download/release-2.26.0/SDL2-2.26.0.tar.gz
|
||||
source_filename = SDL2-2.26.0.tar.gz
|
||||
source_hash = 8000d7169febce93c84b6bdf376631f8179132fd69f7015d4dadb8b9c2bdb295
|
||||
patch_filename = sdl2_2.26.0-1_patch.zip
|
||||
patch_url = https://wrapdb.mesonbuild.com/v2/sdl2_2.26.0-1/get_patch
|
||||
patch_hash = 6fcfd727d71cf7837332723518d5e47ffd64f1e7630681cf4b50e99f2bf7676f
|
||||
wrapdb_version = 2.26.0-1
|
||||
|
||||
[provide]
|
||||
sdl2 = sdl2_dep
|
Loading…
Reference in New Issue
Block a user