🎉 C++ meson project.

main
bog 2023-11-10 23:50:20 +01:00
parent aecc22bcba
commit ae91f57f93
6 changed files with 71 additions and 0 deletions

4
.gitignore vendored Normal file
View File

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

14
Makefile Normal file
View File

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

31
meson.build Normal file
View File

@ -0,0 +1,31 @@
project('bloody-gun',
'cpp',
version: '0.0.0',
default_options: [
'warning_level=3',
'cpp_std=c++17'
])
datadir = get_option('prefix') / get_option('datadir') / 'bloody_gun'
conf = configuration_data()
conf.set('version', meson.project_version())
conf.set('datadir', datadir)
configure_file(
input: 'src/conf.in.hpp',
output: 'conf.hpp',
configuration: conf
)
executable(
'bloody-gun',
sources: [
'src/main.cpp',
],
dependencies: [
],
install: true
)
install_subdir('assets', install_dir: datadir)

7
src/commons.hpp Normal file
View File

@ -0,0 +1,7 @@
#ifndef bg_COMMONS_HPP
#define bg_COMMONS_HPP
#include <filesystem>
#include "conf.hpp"
#endif

7
src/conf.in.hpp Normal file
View File

@ -0,0 +1,7 @@
#ifndef bg_CONF_HPP
#define bg_CONF_HPP
#define BG_VERSION std::string("@version@")
#define BG_DATADIR std::filesystem::path("@datadir@")
#endif

8
src/main.cpp Normal file
View File

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