forked from gnuradio/volk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvolk-config-info.cc
86 lines (76 loc) · 3.08 KB
/
volk-config-info.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* -*- c++ -*- */
/*
* Copyright 2013, 2016, 2018 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* GNU Radio is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* GNU Radio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#if HAVE_CONFIG_H
#include <config.h>
#endif
#include <volk/constants.h> // for volk_available_machines, volk_c_com...
#include <iostream> // for operator<<, endl, cout, ostream
#include <string> // for string
#include "volk/volk.h" // for volk_get_alignment, volk_get_machine
#include "volk_option_helpers.h" // for option_list, option_t
void print_alignment()
{
std::cout << "Alignment in bytes: " << volk_get_alignment() << std::endl;
}
void print_malloc()
{
// You don't want to change the volk_malloc code, so just copy the if/else
// structure from there and give an explanation for the implementations
std::cout << "Used malloc implementation: ";
#if HAVE_POSIX_MEMALIGN
std::cout << "posix_memalign" << std::endl;
#elif defined(_MSC_VER)
std::cout << "_aligned_malloc" << std::endl;
#else
std::cout << "C11 aligned_alloc" << std::endl;
#endif
}
int main(int argc, char** argv)
{
option_list our_options("volk-config-info");
our_options.add(
option_t("prefix", "", "print the VOLK installation prefix", volk_prefix()));
our_options.add(
option_t("cc", "", "print the VOLK C compiler version", volk_c_compiler()));
our_options.add(
option_t("cflags", "", "print the VOLK CFLAGS", volk_compiler_flags()));
our_options.add(option_t(
"all-machines", "", "print VOLK machines built", volk_available_machines()));
our_options.add(option_t("avail-machines",
"",
"print VOLK machines on the current "
"platform",
volk_list_machines));
our_options.add(option_t("machine",
"",
"print the current VOLK machine that will be used",
volk_get_machine()));
our_options.add(
option_t("alignment", "", "print the memory alignment", print_alignment));
our_options.add(option_t("malloc",
"",
"print the malloc implementation used in volk_malloc",
print_malloc));
our_options.add(option_t("version", "v", "print the VOLK version", volk_version()));
our_options.parse(argc, argv);
return 0;
}