File indexing completed on 2025-01-18 10:18:15
0001 #include <iostream>
0002 #include "getopt.h"
0003 #include <math.h>
0004 #include "NPDetConfig.h"
0005
0006 #define no_argument 0
0007 #define required_argument 1
0008 #define optional_argument 2
0009
0010 void print_usage();
0011 void print_libs();
0012 void print_cflags();
0013 void print_ldflags();
0014 void print_inc();
0015 void print_version();
0016 void print_grid();
0017 void print_prefix();
0018
0019 int main(int argc, char * argv[]) {
0020
0021 if( argc < 2 ){
0022 print_usage();
0023 std::cout << std::endl;
0024 return 0;
0025 }
0026 const struct option longopts[] =
0027 {
0028 {"version", no_argument, 0, 'v'},
0029 {"help", no_argument, 0, 'h'},
0030 {"libs", no_argument, 0, 'l'},
0031 {"cflags", no_argument, 0, 'c'},
0032 {"ldflags", no_argument, 0, 'd'},
0033 {"inc", no_argument, 0, 'i'},
0034 {"grid", no_argument, 0, 'g'},
0035 {"prefix", no_argument, 0, 'p'},
0036 {0,0,0,0}
0037 };
0038
0039 int index = 0;
0040 int iarg = 0;
0041
0042
0043 opterr=1;
0044
0045 while(iarg != -1)
0046 {
0047 iarg = getopt_long(argc, argv, "vhlcpd", longopts, &index);
0048
0049 switch (iarg)
0050 {
0051 case 'h':
0052 print_usage();
0053 break;
0054
0055 case 'v':
0056 print_version();
0057 break;
0058
0059 case 'l':
0060 print_libs();
0061 break;
0062
0063 case 'c':
0064 print_cflags();
0065 break;
0066
0067 case 'i':
0068 print_inc();
0069 break;
0070
0071 case 'd':
0072 print_ldflags();
0073 break;
0074
0075 case 'p':
0076 print_prefix();
0077 break;
0078
0079 case 'g':
0080 print_grid();
0081 break;
0082
0083
0084 }
0085 }
0086
0087 std::cout << std::endl;
0088
0089 return 0;
0090 }
0091
0092 void print_version(){
0093 std::cout << "NPDet Version "
0094 << NPDet_VERSION_MAJOR << "."
0095 << NPDet_VERSION_MINOR << "."
0096 << NPDet_VERSION_PATCH << " ";
0097 }
0098
0099 void print_usage(){
0100 std::cout << "NPDet-config --libs --cflags --ldflags --inc --grid" << " ";
0101 }
0102
0103 void print_libs(){
0104 std::cout << NPDet_CXX_LIBS << " ";
0105 }
0106
0107 void print_inc(){
0108 std::cout << NPDet_CXX_INC_DIR << " ";
0109 }
0110
0111 void print_cflags(){
0112 std::cout << NPDet_CXX_CFLAGS << " ";
0113 }
0114
0115 void print_ldflags(){
0116 std::cout << NPDet_CXX_LDFLAGS << " ";
0117 }
0118
0119 void print_grid(){
0120 std::cout << NPDet_DATA_DIR << " ";
0121 }
0122
0123 void print_prefix(){
0124 std::cout << NPDet_PREFIX << " ";
0125 }
0126