Added template file generated by meson.
This commit is contained in:
parent
710e6b743e
commit
9a75e083ee
4 changed files with 36 additions and 0 deletions
10
gen/host.cpp.template
Normal file
10
gen/host.cpp.template
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include "host.h"
|
||||
|
||||
const std::string _uname = "@UNAME@";
|
||||
const std::string _gcc = "@GCC_VERSION@";
|
||||
const std::string _ninja = "@NINJA_VERSION@";
|
||||
|
||||
std::string get_host_info()
|
||||
{
|
||||
return "[ OS]: "+_uname+"\n[ GCC]: "+_gcc+"\n[NINJ]: Ninja v"+_ninja;
|
||||
}
|
8
include/host.h
Normal file
8
include/host.h
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifndef _HEADER_MESONTEST_HOST
|
||||
#define _HEADER_MESONTEST_HOST
|
||||
|
||||
#include <string>
|
||||
|
||||
std::string get_host_info();
|
||||
|
||||
#endif // _HEADER_MESONTEST_HOST
|
16
meson.build
16
meson.build
|
@ -26,8 +26,24 @@ poco_dep_util = poco_proj.dependency(['Util'])
|
|||
# Include directories
|
||||
incdir = include_directories('include')
|
||||
|
||||
# Meson template
|
||||
uname = run_command('sh', '-c', 'echo "$(uname -o) $(uname -r)"').stdout().strip()
|
||||
gcc_version = meson.get_compiler('c').version()
|
||||
ninja_version = run_command('ninja', '--version').stdout().strip()
|
||||
|
||||
host_template = configure_file(
|
||||
input: 'gen/host.cpp.template',
|
||||
output: 'host.cpp',
|
||||
configuration: {
|
||||
'UNAME': '@0@'.format(uname),
|
||||
'GCC_VERSION': '@0@'.format(gcc_version),
|
||||
'NINJA_VERSION': '@0@'.format(ninja_version)
|
||||
}
|
||||
)
|
||||
|
||||
# Executable
|
||||
executable('mesontest',
|
||||
host_template,
|
||||
'src/libxml_meson.cpp',
|
||||
'src/poco.cpp',
|
||||
'src/main.cpp',
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "poco.h"
|
||||
#include "libxml_meson.h"
|
||||
#include "host.h"
|
||||
|
||||
void info_poco(void);
|
||||
|
||||
|
@ -10,6 +11,7 @@ int main(void)
|
|||
{
|
||||
try
|
||||
{
|
||||
std::cout << "Compiled under:\n" << get_host_info() << "\n" << std::endl;
|
||||
std::cout << "Poco Test..." << std::endl;
|
||||
info_poco();
|
||||
std::cout << "Libxml2 Test..." << std::endl;
|
||||
|
|
Loading…
Add table
Reference in a new issue