1
// -*- mode: C++; tab-width: 2; -*-
4
// --------------------------------------------------------------------------
5
// OpenMS Mass Spectrometry Framework
6
// --------------------------------------------------------------------------
7
// Copyright (C) 2003-2011 -- Oliver Kohlbacher, Knut Reinert
9
// This library is free software; you can redistribute it and/or
10
// modify it under the terms of the GNU Lesser General Public
11
// License as published by the Free Software Foundation; either
12
// version 2.1 of the License, or (at your option) any later version.
14
// This library 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 GNU
17
// Lesser General Public License for more details.
19
// You should have received a copy of the GNU Lesser General Public
20
// License along with this library; if not, write to the Free Software
21
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1
// --------------------------------------------------------------------------
2
// OpenMS -- Open-Source Mass Spectrometry
3
// --------------------------------------------------------------------------
4
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5
// ETH Zurich, and Freie Universitaet Berlin 2002-2013.
7
// This software is released under a three-clause BSD license:
8
// * Redistributions of source code must retain the above copyright
9
// notice, this list of conditions and the following disclaimer.
10
// * Redistributions in binary form must reproduce the above copyright
11
// notice, this list of conditions and the following disclaimer in the
12
// documentation and/or other materials provided with the distribution.
13
// * Neither the name of any author or any participating institution
14
// may be used to endorse or promote products derived from this software
15
// without specific prior written permission.
16
// For a full list of authors, refer to the file AUTHORS.
17
// --------------------------------------------------------------------------
18
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
30
// --------------------------------------------------------------------------
24
31
// $Maintainer: Chris Bielow $
44
51
enum OpenMS_OS {OS_UNKNOWN, OS_MACOS, OS_WINDOWS, OS_LINUX};
45
std::string OpenMS_OSNames[] = {"unkown","MacOS","Windows","Linux"};
52
std::string OpenMS_OSNames[] = {"unkown", "MacOS", "Windows", "Linux"};
46
53
enum OpenMS_Architecture {ARCH_UNKOWN, ARCH_32BIT, ARCH_64BIT};
47
std::string OpenMS_ArchNames[] = {"unkown","32bit","64bit"};
54
std::string OpenMS_ArchNames[] = {"unkown", "32bit", "64bit"};
50
57
OpenMS_Architecture getArchOnWin();
68
75
return OpenMS_OSNames[os];
70
78
String getArchAsString() const
72
80
return OpenMS_ArchNames[arch];
76
85
static OpenMSOSInfo getOSInfo()
79
#if defined (WIN32) // Windows
88
#if defined(WIN32) // Windows
80
89
info.os = OS_WINDOWS;
81
90
info.arch = getArchOnWin();
82
91
info.os_version = getWinOSVersion();
83
92
#elif (defined(__MACH__) && defined(__APPLE__)) // MacOS
84
93
info.os = OS_MACOS;
86
// check if we can use QSysInfo
95
// check if we can use QSysInfo
87
96
#if defined(Q_WS_MAC)
89
switch (QSysInfo::MacintoshVersion)
91
case QSysInfo::MV_10_2:
93
info.os_version = "10.2";
96
case QSysInfo::MV_10_3:
98
info.os_version = "10.3";
101
case QSysInfo::MV_10_4:
103
info.os_version = "10.4";
106
case QSysInfo::MV_10_5:
108
info.os_version = "10.5";
111
case QSysInfo::MV_10_6:
113
info.os_version = "10.6";
118
info.os_version = "unsupported";
122
// identify architecture
123
if(QSysInfo::WordSize == 32)
125
info.arch = ARCH_32BIT;
129
info.arch = ARCH_64BIT;
98
switch (QSysInfo::MacintoshVersion)
100
case QSysInfo::MV_10_2:
102
info.os_version = "10.2";
106
case QSysInfo::MV_10_3:
108
info.os_version = "10.3";
112
case QSysInfo::MV_10_4:
114
info.os_version = "10.4";
118
case QSysInfo::MV_10_5:
120
info.os_version = "10.5";
124
case QSysInfo::MV_10_6:
126
info.os_version = "10.6";
132
info.os_version = "unsupported";
136
// identify architecture
137
if (QSysInfo::WordSize == 32)
139
info.arch = ARCH_32BIT;
143
info.arch = ARCH_64BIT;
134
148
info.os = OS_LINUX;
161
176
//and GetProcAddress to get a pointer to the function if available.
163
178
fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress(
164
GetModuleHandle(TEXT("kernel32")),"IsWow64Process");
179
GetModuleHandle(TEXT("kernel32")), "IsWow64Process");
166
if(NULL != fnIsWow64Process)
181
if (NULL != fnIsWow64Process)
168
if (!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
183
if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64))
198
214
// We do not want this class to show up in the docu:
199
215
/// @cond TOPPCLASSES
201
int main( int /*argc*/, const char** /*argv*/ )
217
int main(int /*argc*/, const char ** /*argv*/)
203
cout << "OpenMS Version:" << "\n";
204
cout << "==================" << "\n";
205
cout << "Version : " << VersionInfo::getVersion() << "\n";
206
cout << "Build time : " << VersionInfo::getTime() << "\n";
207
cout << "SVN revision : " << VersionInfo::getRevision() << "\n";
209
cout << "Installation information:" << "\n";
210
cout << "==================" << "\n";
219
cout << "OpenMS Version:" << "\n";
220
cout << "==================" << "\n";
221
cout << "Version : " << VersionInfo::getVersion() << "\n";
222
cout << "Build time : " << VersionInfo::getTime() << "\n";
223
cout << "SVN revision : " << VersionInfo::getRevision() << "\n";
225
cout << "Installation information:" << "\n";
226
cout << "==================" << "\n";
211
227
cout << "Data path : " << File::getOpenMSDataPath() << "\n";
212
228
cout << "Temp path : " << File::getTempDirectory() << "\n";
213
229
cout << "Userdata path: " << File::getUserDirectory() << "\n";
216
cout << "Build information:" << "\n";
217
cout << "==================" << "\n";
218
cout << "Source path : " << OPENMS_SOURCE_PATH << "\n";
219
cout << "Binary path : " << OPENMS_BINARY_PATH << "\n";
232
cout << "Build information:" << "\n";
233
cout << "==================" << "\n";
234
cout << "Source path : " << OPENMS_SOURCE_PATH << "\n";
235
cout << "Binary path : " << OPENMS_BINARY_PATH << "\n";
222
238
OpenMS::Internal::OpenMSOSInfo info = OpenMS::Internal::getOSInfo();
223
239
// experimental: OS information
224
240
cout << "OS Information:" << "\n";
225
cout << "==================" << "\n";
241
cout << "==================" << "\n";
226
242
cout << "Name: " << info.getOSAsString() << "\n";
227
243
cout << "Version: " << info.os_version << "\n";
228
244
cout << "Architecture: " << info.getArchAsString() << "\n";