diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d27ba9f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*~* +*\#* +.cache +build \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e1a37ce --- /dev/null +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index 65f264b..db55bd0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,43 @@ -# snake +# Snake Build System +Yet another language agnostic build system. -Snake build system \ No newline at end of file +## 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. \ No newline at end of file diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..fab025b --- /dev/null +++ b/meson.build @@ -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') + ]) diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..e0871d8 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,8 @@ +#include +#include "snake.hpp" + +int main(int, char**) +{ + std::cout << "snake v" << SNAKE_VERSION << std::endl; + return 0; +} diff --git a/src/snake.in.hpp b/src/snake.in.hpp new file mode 100644 index 0000000..d1f72ee --- /dev/null +++ b/src/snake.in.hpp @@ -0,0 +1,6 @@ +#ifndef sn_SNAKE_IN_HPP +#define sn_SNAKE_IN_HPP + +#define SNAKE_VERSION std::string("@version@") + +#endif diff --git a/tests/main.cpp b/tests/main.cpp new file mode 100644 index 0000000..4ed06df --- /dev/null +++ b/tests/main.cpp @@ -0,0 +1,2 @@ +#define CATCH_CONFIG_MAIN +#include