Line data Source code
1 : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 : Copyright (c) 2011-2020 The plumed team 3 : (see the PEOPLE file at the root of the distribution for a list of names) 4 : 5 : See http://www.plumed.org for more information. 6 : 7 : This file is part of plumed, version 2. 8 : 9 : plumed is free software: you can redistribute it and/or modify 10 : it under the terms of the GNU Lesser General Public License as published by 11 : the Free Software Foundation, either version 3 of the License, or 12 : (at your option) any later version. 13 : 14 : plumed is distributed in the hope that it will be useful, 15 : but WITHOUT ANY WARRANTY; without even the implied warranty of 16 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 : GNU Lesser General Public License for more details. 18 : 19 : You should have received a copy of the GNU Lesser General Public License 20 : along with plumed. If not, see <http://www.gnu.org/licenses/>. 21 : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ 22 : 23 : #include "Config.h" 24 : #include "version.h" 25 : #include <cstdlib> 26 : #include <cstring> 27 : 28 : namespace PLMD { 29 : namespace config { 30 : 31 : // This is a fix to allow conda to correctly replace paths in binary files. 32 : // These functions should not be static or they will be optimized away! 33 3895 : const char* plumed_root() {return "/home/runner/opt/lib/plumed";} 34 16 : const char* plumed_soext() {return "so";} 35 387 : const char* plumed_htmldir() {return "/home/runner/opt/share/doc/plumed";} 36 387 : const char* plumed_includedir() {return "/home/runner/opt/include";} 37 387 : const char* plumed_program_name() {return "plumed";} 38 : 39 16 : std::string getSoExt() { 40 16 : return plumed_soext(); 41 : } 42 : 43 1189 : bool isInstalled() { 44 1189 : return true; 45 : } 46 : 47 3895 : std::string getPlumedRoot() { 48 3895 : char *env = std::getenv("PLUMED_ROOT"); 49 : std::string ss; 50 3895 : if( env == NULL) { 51 3895 : ss=plumed_root(); 52 : } else { 53 0 : ss=std::string( env ); 54 : } 55 3895 : return ss; 56 : } 57 : 58 387 : std::string getPlumedHtmldir() { 59 387 : if(!isInstalled()) return getPlumedRoot(); 60 387 : char *env = std::getenv("PLUMED_HTMLDIR"); 61 : std::string ss; 62 387 : if( env == NULL) { 63 387 : ss=plumed_htmldir(); 64 : } else { 65 0 : ss=std::string( env ); 66 : } 67 : return ss; 68 : } 69 : 70 387 : std::string getPlumedIncludedir() { 71 387 : if(!isInstalled()) return getPlumedRoot()+"/src/include"; 72 387 : char *env = std::getenv("PLUMED_INCLUDEDIR"); 73 : std::string ss; 74 387 : if( env == NULL) { 75 387 : ss=plumed_includedir(); 76 : } else { 77 0 : ss=std::string( env ); 78 : } 79 : return ss; 80 : } 81 : 82 387 : std::string getPlumedProgramName() { 83 387 : if(!isInstalled()) return "plumed"; 84 387 : char *env = std::getenv("PLUMED_PROGRAM_NAME"); 85 : std::string ss; 86 387 : if( env == NULL) { 87 387 : ss=plumed_program_name(); 88 : } else { 89 0 : ss=std::string( env ); 90 : } 91 : return ss; 92 : } 93 : 94 387 : std::string getEnvCommand() { 95 1935 : return "env PLUMED_ROOT=\""+getPlumedRoot()+"\""+ 96 2322 : " env PLUMED_HTMLDIR=\""+getPlumedHtmldir()+"\""+ 97 2322 : " env PLUMED_INCLUDEDIR=\""+getPlumedIncludedir()+"\""+ 98 2322 : " env PLUMED_PROGRAM_NAME=\""+getPlumedProgramName()+"\""+ 99 1161 : " env PLUMED_IS_INSTALLED=\""+(true?"yes":"no")+"\""; 100 : } 101 : 102 0 : std::string getVersion() { 103 0 : return PLUMED_VERSION_SHORT; 104 : } 105 : 106 737 : std::string getVersionLong() { 107 737 : return PLUMED_VERSION_LONG; 108 : } 109 : 110 737 : std::string getVersionGit() { 111 737 : return PLUMED_VERSION_GIT; 112 : } 113 : 114 28 : std::string getMakefile() { 115 : static const char conf [] = { 116 : #include "Makefile.conf.xxd" 117 : , 0x00 118 : }; 119 56 : return std::string(conf,conf+std::strlen(conf)); 120 : } 121 : 122 0 : bool hasMatheval() { 123 : #if __PLUMED_HAS_MATHEVAL 124 : return true; 125 : #else 126 0 : return false; 127 : #endif 128 : } 129 : 130 0 : bool hasDlopen() { 131 : #if __PLUMED_HAS_DLOPEN 132 0 : return true; 133 : #else 134 : return false; 135 : #endif 136 : } 137 : 138 0 : bool hasCregex() { 139 : #if __PLUMED_HAS_CREGEX 140 0 : return true; 141 : #else 142 : return false; 143 : #endif 144 : } 145 : 146 0 : bool hasMolfile() { 147 : #if __PLUMED_HAS_MOLFILE_PLUGINS 148 0 : return true; 149 : #else 150 : return false; 151 : #endif 152 : } 153 : 154 0 : bool hasExternalMolfile() { 155 : #if __PLUMED_HAS_EXTERNAL_MOLFILE_PLUGINS 156 : return true; 157 : #else 158 0 : return false; 159 : #endif 160 : } 161 : 162 0 : bool hasZlib() { 163 : #if __PLUMED_HAS_ZLIB 164 0 : return true; 165 : #else 166 : return false; 167 : #endif 168 : } 169 : 170 0 : bool hasXdrfile() { 171 : #if __PLUMED_HAS_XDRFILE 172 0 : return true; 173 : #else 174 : return false; 175 : #endif 176 : } 177 : 178 737 : std::string getCompilationDate() { 179 737 : return __DATE__; 180 : } 181 : 182 737 : std::string getCompilationTime() { 183 737 : return __TIME__; 184 : } 185 : 186 : 187 : } 188 : } 189 :