🎉 create cpp project.

main
bog 2023-10-12 18:35:43 +02:00
parent 6d32245dd9
commit 15b2f612ac
7 changed files with 125 additions and 2 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*~*
*\#*
.cache
build

20
Makefile Normal file
View File

@ -0,0 +1,20 @@
.PHONY: build tests
build:
meson setup build
meson compile -C build
tests: build
build/snake-tests
install: tests force-install
force-install:
meson install -C build
check:
cppcheck --enable=all -q \
--language=c++ \
--suppress=missingIncludeSystem \
--suppress=missingInclude \
src tests

View File

@ -1,3 +1,43 @@
# snake # Snake Build System
Yet another language agnostic build system.
Snake build system ## Usage
None for now, but maybe one day...
## How to install
Snake relies on some libraries you must install in order to compile it.
- catch2 (for testing)
First, you need to compile Snake using the given Makefile:
```bash
make
```
Before installing, you can run the tests using the following commands:
To run the test suite:
```bash
make test
```
To run static tests:
```bash
make check
```
Then you can install Snake this way:
```bash
sudo make install
```
## How to contribute
Don't.
## License
Snake is released under the GPLv3.
See the LICENSE file at the project's root for more information.

43
meson.build Normal file
View File

@ -0,0 +1,43 @@
project('snake',
'cpp',
version: '0.0.0',
default_options: [
'prefix=/usr',
'warning_level=3',
'cpp_std=c++17'
])
conf = configuration_data()
conf.set('version', meson.project_version())
configure_file(input: 'src/snake.in.hpp',
output: 'snake.hpp',
configuration: conf)
snake_lib = static_library('snake',
sources: [
],
dependencies: [
])
snake_dep = declare_dependency(link_with: [
snake_lib
])
executable('snake',
sources: [
'src/main.cpp',
],
dependencies: [
snake_dep
],
install: true)
executable('snake-tests',
sources: [
'tests/main.cpp',
],
dependencies: [
snake_dep,
dependency('catch2')
])

8
src/main.cpp Normal file
View File

@ -0,0 +1,8 @@
#include <iostream>
#include "snake.hpp"
int main(int, char**)
{
std::cout << "snake v" << SNAKE_VERSION << std::endl;
return 0;
}

6
src/snake.in.hpp Normal file
View File

@ -0,0 +1,6 @@
#ifndef sn_SNAKE_IN_HPP
#define sn_SNAKE_IN_HPP
#define SNAKE_VERSION std::string("@version@")
#endif

2
tests/main.cpp Normal file
View File

@ -0,0 +1,2 @@
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>