Selaa lähdekoodia

Some SCE compilation fixes

wip/image-kernel
Sam Hocevar 11 kuukautta sitten
vanhempi
commit
e26f6cb2ee
2 muutettua tiedostoa jossa 28 lisäystä ja 15 poistoa
  1. +22
    -4
      include/lol/format
  2. +6
    -11
      include/lol/private/base/env.h

+ 22
- 4
include/lol/format Näytä tiedosto

@@ -12,11 +12,29 @@

#pragma once

#include <version>
#if defined _LIBCPP_HAS_NO_INCOMPLETE_FORMAT
#define LOL_HAS_STD_FORMAT 1

#if !defined __SCE__
# include <version> // Provide _LIBCPP_HAS_NO_INCOMPLETE_FORMAT if relevant
# if defined _LIBCPP_HAS_NO_INCOMPLETE_FORMAT
# undef LOL_HAS_STD_FORMAT
# endif
#endif

#if defined __SCE__
# undef LOL_HAS_STD_FORMAT
# include <cstdio>
// These functions are used unconditionally in libfmt
static inline void flockfile(FILE* f) { }
static inline void funlockfile(FILE* f) { }
static inline int getc_unlocked(FILE*) { return 0; }
static inline int putc_unlocked(int, FILE*) { return 0; }
#endif

#if defined LOL_HAS_STD_FORMAT
# include <format>
#else
# define FMT_HEADER_ONLY
# include "3rdparty/fmt/include/fmt/format.h"
namespace std { using fmt::format; }
#else
# include <format>
#endif

+ 6
- 11
include/lol/private/base/env.h Näytä tiedosto

@@ -1,7 +1,7 @@
//
// Lol Engine
//
// Copyright © 2010—2020 Sam Hocevar <sam@hocevar.net>
// Copyright © 2010–2024 Sam Hocevar <sam@hocevar.net>
//
// Lol Engine is free software. It comes without any warranty, to
// the extent permitted by applicable law. You can redistribute it
@@ -12,13 +12,10 @@

#pragma once

#include <string> // std::string
#include <cstdlib> // _dupenv_s / std::getenv
#include <cstdlib> // _dupenv_s / std::getenv
#include <string> // std::string

namespace lol
{

namespace sys
namespace lol::sys
{

static inline std::string getenv(std::string const &var)
@@ -32,13 +29,11 @@ static inline std::string getenv(std::string const &var)
free(buf);
return ret;
}
#else
#elif !__SCE__
if (auto val = std::getenv(var.c_str()))
return std::string(val);
#endif
return std::string();
}

} // namespace os

} // namespace lol
} // namespace sys::lol

Ladataan…
Peruuta
Tallenna