-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnucdb-config.cxx
123 lines (95 loc) · 2.21 KB
/
nucdb-config.cxx
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#include <iostream>
#include "getopt.h"
#include <math.h>
#include "NucDBConfig.h"
#define no_argument 0
#define required_argument 1
#define optional_argument 2
void print_usage();
void print_libs();
void print_cflags();
void print_ldflags();
void print_inc();
void print_version();
void print_grid();
void print_prefix();
int main(int argc, char * argv[]) {
if( argc < 2 ){
print_usage();
std::cout << std::endl;
return 0;
}
const struct option longopts[] =
{
{"version", no_argument, 0, 'v'},
{"help", no_argument, 0, 'h'},
{"libs", no_argument, 0, 'l'},
{"cflags", no_argument, 0, 'c'},
{"ldflags", no_argument, 0, 'd'},
{"inc", no_argument, 0, 'i'},
{"grid", no_argument, 0, 'g'},
{"prefix", no_argument, 0, 'p'},
{0,0,0,0}
};
int index = 0;
int iarg = 0;
//turn off getopt error message
opterr=1;
while(iarg != -1)
{
iarg = getopt_long(argc, argv, "vhlcpd", longopts, &index);
switch (iarg)
{
case 'h':
print_usage();
break;
case 'v':
print_version();
break;
case 'l':
print_libs();
break;
case 'c':
print_cflags();
break;
case 'i':
print_inc();
break;
case 'd':
print_ldflags();
break;
case 'p':
print_prefix();
break;
case 'g':
print_grid();
break;
}
}
std::cout << std::endl;
return 0;
}
void print_version(){
std::cout << "NucDB Version " << NucDB_VERSION_MAJOR << "." << NucDB_VERSION_MINOR << " ";
}
void print_usage(){
std::cout << "nucdb-config --libs --cflags --ldflags --inc --grid" << " ";
}
void print_libs(){
std::cout << NucDB_CXX_LIBS << " ";
}
void print_inc(){
std::cout << NucDB_CXX_INC_DIR << " ";
}
void print_cflags(){
std::cout << NucDB_CXX_CFLAGS << " ";
}
void print_ldflags(){
std::cout << NucDB_CXX_LDFLAGS << " ";
}
void print_grid(){
std::cout << NucDB_DATA_DIR << " ";
}
void print_prefix(){
std::cout << NucDB_PREFIX << " ";
}