Added poco (cmake) dependency.
This commit is contained in:
parent
e9607e1411
commit
40fbd3b046
7 changed files with 66 additions and 4 deletions
9
include/poco.h
Normal file
9
include/poco.h
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#ifndef _HEADER_MESONTEST_POCO
|
||||||
|
#define _HEADER_MESONTEST_POCO
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
std::string get_date_time();
|
||||||
|
std::string format_poco_version();
|
||||||
|
|
||||||
|
#endif // _HEADER_MESONTEST__POCO
|
12
meson.build
12
meson.build
|
@ -4,16 +4,24 @@ project('meson-test', 'cpp',
|
||||||
)
|
)
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
|
# libxml2
|
||||||
libxml2_proj = subproject('libxml2', default_options: ['python=false', 'default_library=static'])
|
libxml2_proj = subproject('libxml2', default_options: ['python=false', 'default_library=static'])
|
||||||
libxml2_dep = libxml2_proj.get_variable('xml_dep')
|
libxml2_dep = libxml2_proj.get_variable('xml_dep')
|
||||||
|
# poco
|
||||||
|
cmake = import('cmake')
|
||||||
|
poco_proj = cmake.subproject('poco')
|
||||||
|
poco_dep_foundation = poco_proj.dependency(['Foundation'])
|
||||||
|
poco_dep_util = poco_proj.dependency(['Util'])
|
||||||
|
|
||||||
|
|
||||||
# Include directories
|
# Include directories
|
||||||
incdir = include_directories('include')
|
incdir = include_directories('include')
|
||||||
|
|
||||||
# Executable
|
# Executable
|
||||||
executable('mesontest',
|
executable('mesontest',
|
||||||
'src/libxml.cpp',
|
'src/libxml_meson.cpp',
|
||||||
|
'src/poco.cpp',
|
||||||
'src/main.cpp',
|
'src/main.cpp',
|
||||||
dependencies: libxml2_dep,
|
dependencies: [libxml2_dep, poco_dep_foundation, poco_dep_util],
|
||||||
include_directories : incdir
|
include_directories : incdir
|
||||||
)
|
)
|
|
@ -1,4 +1,4 @@
|
||||||
#include "libxml.h"
|
#include "libxml_meson.h"
|
||||||
|
|
||||||
#include <libxml/xmlversion.h>
|
#include <libxml/xmlversion.h>
|
||||||
#include <libxml/parser.h>
|
#include <libxml/parser.h>
|
19
src/main.cpp
19
src/main.cpp
|
@ -1,11 +1,17 @@
|
||||||
|
#include <Poco/Environment.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "libxml.h"
|
#include "poco.h"
|
||||||
|
#include "libxml_meson.h"
|
||||||
|
|
||||||
|
void info_poco(void);
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
std::cout << "Poco Test..." << std::endl;
|
||||||
|
info_poco();
|
||||||
std::cout << "Libxml2 Test..." << std::endl;
|
std::cout << "Libxml2 Test..." << std::endl;
|
||||||
info_libxml();
|
info_libxml();
|
||||||
create_xml();
|
create_xml();
|
||||||
|
@ -18,3 +24,14 @@ int main(void)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void info_poco(void)
|
||||||
|
{
|
||||||
|
std::cout << "\n";
|
||||||
|
std::cout << "[TIME]:\t" << get_date_time() << "\n";
|
||||||
|
std::cout << "[ OS]:\t" << Poco::Environment::osDisplayName() << " v" << Poco::Environment::osVersion() << "\n";
|
||||||
|
std::cout << "[ARCH]:\t" << Poco::Environment::osArchitecture() << "\n";
|
||||||
|
std::cout << "[POCO]:\tPoco C++ Library v" << format_poco_version() << "\n";
|
||||||
|
std::cout << "\n"
|
||||||
|
<< std::flush;
|
||||||
|
}
|
||||||
|
|
21
src/poco.cpp
Normal file
21
src/poco.cpp
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#include "poco.h"
|
||||||
|
|
||||||
|
#include <Poco/LocalDateTime.h>
|
||||||
|
#include <Poco/DateTimeFormatter.h>
|
||||||
|
#include <Poco/Environment.h>
|
||||||
|
#include <Poco/Format.h>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
std::string get_date_time()
|
||||||
|
{
|
||||||
|
Poco::LocalDateTime dateTime;
|
||||||
|
return Poco::DateTimeFormatter::format(
|
||||||
|
dateTime,
|
||||||
|
"%W %d %B %Y at %H:%M:%S");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string format_poco_version()
|
||||||
|
{
|
||||||
|
uint32_t full_version = Poco::Environment::libraryVersion();
|
||||||
|
return Poco::format("%u.%u.%u", (full_version >> 24), ((full_version >> 16) & 0xff), ((full_version >> 8) & 0xff));
|
||||||
|
}
|
7
subprojects/poco.wrap
Normal file
7
subprojects/poco.wrap
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[wrap-file]
|
||||||
|
directory = poco-poco-1.9.4-release
|
||||||
|
source_url = https://github.com/pocoproject/poco/archive/refs/tags/poco-1.9.4-release.tar.gz
|
||||||
|
source_filename = poco-1.9.4-release.tar.gz
|
||||||
|
source_hash = 367014cdbcfe9df8f1d746239902149d2398af9b49ba2c1aaaa88616fd538f61
|
||||||
|
method = cmake
|
||||||
|
wrapdb_version = 1.9.4
|
Loading…
Add table
Reference in a new issue