From e16b406e6e3b800e16f58b40a0c3bd26bc012f87 Mon Sep 17 00:00:00 2001 From: bog Date: Tue, 24 Oct 2023 23:09:38 +0200 Subject: [PATCH] :tada: meson c++ project. --- .gitignore | 38 ++++---------------------------------- Makefile | 8 ++++++++ meson.build | 27 +++++++++++++++++++++++++++ src/conf.in.hpp | 6 ++++++ src/main.cpp | 8 ++++++++ 5 files changed, 53 insertions(+), 34 deletions(-) create mode 100644 Makefile create mode 100644 meson.build create mode 100644 src/conf.in.hpp create mode 100644 src/main.cpp diff --git a/.gitignore b/.gitignore index e257658..4fa4337 100644 --- a/.gitignore +++ b/.gitignore @@ -1,34 +1,4 @@ -# ---> C++ -# Prerequisites -*.d - -# Compiled Object files -*.slo -*.lo -*.o -*.obj - -# Precompiled Headers -*.gch -*.pch - -# Compiled Dynamic libraries -*.so -*.dylib -*.dll - -# Fortran module files -*.mod -*.smod - -# Compiled Static libraries -*.lai -*.la -*.a -*.lib - -# Executables -*.exe -*.out -*.app - +build +.cache +*~* +*\#* \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..492dfa5 --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +.PHONY: build + +build: + meson setup build + meson compile -C build + +install: build + meson install -C build diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..18fc352 --- /dev/null +++ b/meson.build @@ -0,0 +1,27 @@ +project('mornelune', + 'cpp', + version: '0.0.0', + default_options: [ + 'prefix=/usr', + 'warning_level=3', + 'cpp_stdd=c++17' + ]) + +conf = configuration_data() +conf.set('version', meson.project_version()) + +configure_file( + input: 'src/conf.in.hpp', + output: 'conf.hpp', + configuration: conf +) + +executable( + 'mornelune', + sources: [ + 'src/main.cpp', + ], + dependencies: [ + ], + install: true +) diff --git a/src/conf.in.hpp b/src/conf.in.hpp new file mode 100644 index 0000000..66ee0d9 --- /dev/null +++ b/src/conf.in.hpp @@ -0,0 +1,6 @@ +#ifndef ml_CONF_HPP +#define ml_CONF_HPP + +#define ML_VERSION std::string("@version@") + +#endif diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..433956e --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,8 @@ +#include +#include "conf.hpp" + +int main(int, char**) +{ + std::cout << "Mornelune v" << ML_VERSION << std::endl; + return 0; +}