mirror of
https://github.com/libretro/parallel-gx2.git
synced 2026-11-07 04:25:58 -10:00
The core builds with a static Makefile (Makefile + Makefile.common) in the manner of the other ParaLLEl cores, for every target .gitlab-ci.yml has: Linux x86_64/aarch64, Windows (MinGW, native or cross), macOS, iOS, tvOS, Android arm64/x86_64 and webOS. CMake, vcpkg and their overlay ports are gone; the libraries the core needs are submodules built with it (fmt 12.1.0, glm 1.0.1, glslang 15.1.0, libusb 1.0.29, pugixml 1.15, zlib 1.3.1, zstd 1.5.7), with the generated files and the graphic packs produced by the Makefile itself (tools/pack_graphic_packs.c), and a precompiled header for gcc and clang. The core is renamed parallel_gx2 (parallel_gx2_libretro.info, library name "ParaLLEl GX2"). HTTP and TLS go through RetroArch's libretro-common (net_http with the per-request TLS settings, the built-in TLS client, x509, the hashes and the KDF) in place of libcurl, OpenSSL and mbedTLS: dependencies/curl-compat is the small libcurl API nlibcurl and napi use, on one transfer thread with lock-free submission and per-handle event queues, with its own tests against local HTTP and TLS servers, plain and under ASan/UBSan and TSan, in both CIs. The libretro-common files are plain copies from RetroArch. boost is replaced by the few headers the core uses (boost-compat), and the CI files build with the Makefile.
154 lines
5.3 KiB
C
154 lines
5.3 KiB
C
/* Copyright (C) 2010-2020 The RetroArch team
|
|
*
|
|
* ---------------------------------------------------------------------------------------
|
|
* The following license statement only applies to this file (retro_common_api.h).
|
|
* ---------------------------------------------------------------------------------------
|
|
*
|
|
* Permission is hereby granted, free of charge,
|
|
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
|
|
* to deal in the Software without restriction, including without limitation the rights to
|
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
|
|
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
*/
|
|
|
|
#ifndef _LIBRETRO_COMMON_RETRO_COMMON_API_H
|
|
#define _LIBRETRO_COMMON_RETRO_COMMON_API_H
|
|
|
|
/*
|
|
This file is designed to normalize the libretro-common compiling environment
|
|
for public API headers. This should be leaner than a normal compiling environment,
|
|
since it gets #included into other project's sources.
|
|
*/
|
|
|
|
/* ------------------------------------ */
|
|
|
|
/*
|
|
Ordinarily we want to put #ifdef __cplusplus extern "C" in C library
|
|
headers to enable them to get used by c++ sources.
|
|
However, we want to support building this library as C++ as well, so a
|
|
special technique is called for.
|
|
*/
|
|
|
|
#define RETRO_BEGIN_DECLS
|
|
#define RETRO_END_DECLS
|
|
#define RETRO_BEGIN_DECLS_CXX
|
|
#define RETRO_END_DECLS_CXX
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#ifdef CXX_BUILD
|
|
/* build wants everything to be built as c++, so no extern "C" */
|
|
#else
|
|
#undef RETRO_BEGIN_DECLS
|
|
#undef RETRO_END_DECLS
|
|
#define RETRO_BEGIN_DECLS extern "C" {
|
|
#define RETRO_END_DECLS }
|
|
/* Force C++ linkage for a region inside a header that may be included
|
|
* from within a caller's extern "C" { ... } block -- needed when the
|
|
* region pulls in a C++ standard library header (e.g. <atomic>). */
|
|
#undef RETRO_BEGIN_DECLS_CXX
|
|
#undef RETRO_END_DECLS_CXX
|
|
#define RETRO_BEGIN_DECLS_CXX extern "C++" {
|
|
#define RETRO_END_DECLS_CXX }
|
|
#endif
|
|
|
|
#else
|
|
|
|
/* header is included by a C source file, so no extern "C" */
|
|
|
|
#endif
|
|
|
|
/*
|
|
IMO, this non-standard ssize_t should not be used.
|
|
However, it's a good example of how to handle something like this.
|
|
*/
|
|
#ifdef _MSC_VER
|
|
#ifndef HAVE_SSIZE_T
|
|
#define HAVE_SSIZE_T
|
|
#if defined(_WIN64)
|
|
typedef __int64 ssize_t;
|
|
#elif defined(_WIN32)
|
|
typedef int ssize_t;
|
|
#endif
|
|
#endif
|
|
#elif defined(__unix__) || (defined(__MACH__) && defined(__APPLE__)) \
|
|
|| defined(__HAIKU__)
|
|
/* POSIX home of ssize_t; <stdio.h> carries it only for a profile asking
|
|
* for the BSD or POSIX.1-2008 set. Console toolchains keep the arms
|
|
* above, as they do not define __unix__. */
|
|
#include <sys/types.h>
|
|
#endif
|
|
|
|
#ifdef _MSC_VER
|
|
#if _MSC_VER >= 1800
|
|
#include <inttypes.h>
|
|
#else
|
|
#ifndef PRId64
|
|
#define PRId64 "I64d"
|
|
#define PRIu64 "I64u"
|
|
#define PRIx64 "I64x"
|
|
#define PRIuPTR "Iu"
|
|
#endif
|
|
#endif
|
|
#else
|
|
/* C++11 says this one isn't needed, but apparently (some versions of) mingw require it anyways */
|
|
/* https://stackoverflow.com/questions/8132399/how-to-printf-uint64-t-fails-with-spurious-trailing-in-format */
|
|
/* https://github.com/libretro/RetroArch/issues/6009 */
|
|
#ifndef __STDC_FORMAT_MACROS
|
|
#define __STDC_FORMAT_MACROS 1
|
|
#endif
|
|
#include <inttypes.h>
|
|
#endif
|
|
#ifndef PRId64
|
|
#error "inttypes.h is being screwy"
|
|
#endif
|
|
#define STRING_REP_INT64 "%" PRId64
|
|
#define STRING_REP_UINT64 "%" PRIu64
|
|
#define STRING_REP_USIZE "%" PRIuPTR
|
|
|
|
/* Wrap a declaration in RETRO_DEPRECATED() to produce a compiler warning when
|
|
it's used. This is intended for developer machines, so it won't work on ancient
|
|
or obscure compilers */
|
|
#if defined(_MSC_VER)
|
|
#if _MSC_VER >= 1400 /* Visual C 2005 or later */
|
|
#define RETRO_DEPRECATED(decl) __declspec(deprecated) decl
|
|
#endif
|
|
#elif defined(__GNUC__)
|
|
#if __GNUC__ >= 3 /* GCC 3 or later */
|
|
#define RETRO_DEPRECATED(decl) decl __attribute__((deprecated))
|
|
#endif
|
|
#elif defined(__clang__)
|
|
#if __clang_major__ >= 3 /* clang 3 or later */
|
|
#define RETRO_DEPRECATED(decl) decl __attribute__((deprecated))
|
|
#endif
|
|
#endif
|
|
#ifndef RETRO_DEPRECATED /* Unsupported compilers */
|
|
#define RETRO_DEPRECATED(decl) decl
|
|
#endif
|
|
|
|
/*
|
|
I would like to see retro_inline.h moved in here; possibly boolean too.
|
|
|
|
rationale: these are used in public APIs, and it is easier to find problems
|
|
and write code that works the first time portably when they are included uniformly
|
|
than to do the analysis from scratch each time you think you need it, for each feature.
|
|
|
|
Moreover it helps force you to make hard decisions: if you EVER bring in boolean.h,
|
|
then you should pay the price everywhere, so you can see how much grief it will cause.
|
|
|
|
Of course, another school of thought is that you should do as little damage as possible
|
|
in as few places as possible...
|
|
*/
|
|
|
|
/* _LIBRETRO_COMMON_RETRO_COMMON_API_H */
|
|
#endif
|