Line data Source code
1 : /* 2 : * Copyright (C) 2004-2024 Savoir-faire Linux Inc. 3 : * 4 : * Author: Guillaume Roguez <Guillaume.Roguez@savoirfairelinux.com> 5 : * 6 : * This program is free software; you can redistribute it and/or modify 7 : * it under the terms of the GNU General Public License as published by 8 : * the Free Software Foundation; either version 3 of the License, or 9 : * (at your option) any later version. 10 : * 11 : * This program is distributed in the hope that it will be useful, 12 : * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 : * GNU General Public License for more details. 15 : * 16 : * You should have received a copy of the GNU General Public License 17 : * along with this program; if not, write to the Free Software 18 : * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 19 : */ 20 : 21 : #ifdef HAVE_CONFIG_H 22 : #include "config.h" 23 : #endif 24 : 25 : #include "jami.h" 26 : #include <string> 27 : 28 : #include <ciso646> // fix windows compiler bug 29 : 30 : #ifndef JAMI_REVISION 31 : #define JAMI_REVISION "" 32 : #endif 33 : 34 : #ifndef JAMI_DIRTY_REPO 35 : #define JAMI_DIRTY_REPO "" 36 : #endif 37 : 38 : #ifndef PACKAGE_VERSION 39 : #define PACKAGE_VERSION "unknown" 40 : #endif 41 : 42 : namespace libjami { 43 : 44 : const char* 45 42 : version() noexcept 46 : { 47 42 : return JAMI_REVISION[0] and JAMI_DIRTY_REPO[0] 48 84 : ? PACKAGE_VERSION "-" JAMI_REVISION "-" JAMI_DIRTY_REPO 49 42 : : (JAMI_REVISION[0] ? PACKAGE_VERSION "-" JAMI_REVISION : PACKAGE_VERSION); 50 : } 51 : 52 : const char* 53 42 : platform() noexcept 54 : { 55 : #ifdef __linux__ 56 : #if defined(__ANDROID__) 57 : return "android"; 58 : #else 59 42 : return "linux"; 60 : #endif 61 : #elif defined(_WIN32) 62 : return "win32"; 63 : #elif defined(__APPLE__) 64 : #ifdef TARGET_OS_IOS 65 : return "iOS"; 66 : #else 67 : return "macOS"; 68 : #endif 69 : #else 70 : #error "Unknown OS" 71 : #endif 72 : } 73 : } // namespace libjami