From e67a956ff53e04c9fbe8a88f654b4933fb65e3f7 Mon Sep 17 00:00:00 2001 From: Alwin Esch <alwin.esch@web.de> Date: Sat, 12 Sep 2020 10:20:19 +0200 Subject: [addons][platform][android] spearate "C" parts to own file This place the "C" parts about game to a new file on "kodi/c-api/platform/android/system.h". This done to allow also "C" language only (as base for other languages) and to confirm safe "C" ABI between addon and Kodi. --- .../kodi-dev-kit/include/kodi/c-api/CMakeLists.txt | 4 +++ .../include/kodi/c-api/platform/android/system.h | 34 ++++++++++++++++++++++ .../include/kodi/platform/android/System.h | 27 +++-------------- 3 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 xbmc/addons/kodi-dev-kit/include/kodi/c-api/platform/android/system.h diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/c-api/CMakeLists.txt b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/CMakeLists.txt index 5db93daa01..091e0fe5b8 100644 --- a/xbmc/addons/kodi-dev-kit/include/kodi/c-api/CMakeLists.txt +++ b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/CMakeLists.txt @@ -4,6 +4,10 @@ set(HEADERS addon_base.h general.h network.h) +if(CORE_SYSTEM_NAME STREQUAL android) + list(APPEND SOURCES platform/android/system.h) +endif() + if(NOT ENABLE_STATIC_LIBS) core_add_library(addons_kodi-dev-kit_include_kodi_c-api) endif() diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/c-api/platform/android/system.h b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/platform/android/system.h new file mode 100644 index 0000000000..e515d2c56b --- /dev/null +++ b/xbmc/addons/kodi-dev-kit/include/kodi/c-api/platform/android/system.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2005-2020 Team Kodi + * This file is part of Kodi - https://kodi.tv + * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. + */ + +#pragma once + +#ifndef C_API_PLATFORM_ANDROID_H +#define C_API_PLATFORM_ANDROID_H + +#define INTERFACE_ANDROID_SYSTEM_NAME "ANDROID_SYSTEM" +#define INTERFACE_ANDROID_SYSTEM_VERSION "1.0.1" +#define INTERFACE_ANDROID_SYSTEM_VERSION_MIN "1.0.1" + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + + struct AddonToKodiFuncTable_android_system + { + void* (*get_jni_env)(); + int (*get_sdk_version)(); + const char *(*get_class_name)(); + }; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* !C_API_PLATFORM_ANDROID_H */ diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/platform/android/System.h b/xbmc/addons/kodi-dev-kit/include/kodi/platform/android/System.h index ef2d728892..0520380a82 100644 --- a/xbmc/addons/kodi-dev-kit/include/kodi/platform/android/System.h +++ b/xbmc/addons/kodi-dev-kit/include/kodi/platform/android/System.h @@ -9,29 +9,7 @@ #pragma once #include "../../AddonBase.h" - -/* - * For interface between add-on and kodi. - * - * This structure defines the addresses of functions stored inside Kodi which - * are then available for the add-on to call - * - * All function pointers there are used by the C++ interface functions below. - * You find the set of them on xbmc/addons/interfaces/General.cpp - * - * Note: For add-on development itself this is not needed - */ - -static const char* INTERFACE_ANDROID_SYSTEM_NAME = "ANDROID_SYSTEM"; -static const char* INTERFACE_ANDROID_SYSTEM_VERSION = "1.0.1"; -static const char* INTERFACE_ANDROID_SYSTEM_VERSION_MIN = "1.0.1"; - -struct AddonToKodiFuncTable_android_system -{ - void* (*get_jni_env)(); - int (*get_sdk_version)(); - const char *(*get_class_name)(); -}; +#include "../../c-api/platform/android/system.h" //============================================================================== /// @@ -43,10 +21,12 @@ struct AddonToKodiFuncTable_android_system /// //------------------------------------------------------------------------------ +#ifdef __cplusplus namespace kodi { namespace platform { + class ATTRIBUTE_HIDDEN CInterfaceAndroidSystem { public: @@ -112,3 +92,4 @@ private: } /* namespace platform */ } /* namespace kodi */ +#endif /* __cplusplus */ -- cgit v1.2.3