Improve compilation times by removing some includes and avoiding heavy dependencies

This commit is contained in:
Vittorio Romeo 2021-12-19 17:34:49 +01:00
parent 569a7549d4
commit 18bb892625
38 changed files with 54 additions and 52 deletions

View File

@ -5,7 +5,6 @@
#include <SFML/Graphics.hpp>
#include <algorithm>
#include <sstream>
#include <iomanip>
#include <string>
#include <unordered_map>

View File

@ -5,7 +5,6 @@
#include <SFML/Audio.hpp>
#include <SFML/Network.hpp>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <mutex>

View File

@ -2,7 +2,6 @@
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <iomanip>
#include <iostream>
#include <cstdlib>

View File

@ -28,7 +28,7 @@
#ifndef SF_GLAD_WGL_H_
#define SF_GLAD_WGL_H_
#include <windows.h>
#include <SFML/System/Win32/WindowsHeader.hpp>
#include <glad/gl.h>
#define SF_GLAD_WGL

View File

@ -29,7 +29,6 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.hpp>
#include <string>
namespace sf

View File

@ -32,7 +32,6 @@
#include <SFML/Graphics/RenderTarget.hpp>
#include <SFML/Graphics/Image.hpp>
#include <SFML/Window/Window.hpp>
#include <string>
namespace sf

View File

@ -30,8 +30,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Network/Export.hpp>
#include <SFML/System/Time.hpp>
#include <istream>
#include <ostream>
#include <iosfwd>
#include <string>

View File

@ -29,7 +29,6 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
#include <algorithm>
#include <locale>
#include <string>
#include <cstdlib>
@ -37,6 +36,12 @@
namespace sf
{
namespace priv
{
template<class InputIt, class OutputIt>
OutputIt copy(InputIt first, InputIt last, OutputIt d_first);
}
template <unsigned int N>
class Utf;

View File

@ -35,6 +35,15 @@
////////////////////////////////////////////////////////////
template <typename InputIt, typename OutputIt>
OutputIt priv::copy(InputIt first, InputIt last, OutputIt d_first)
{
while (first != last)
*d_first++ = *first++;
return d_first;
}
template <typename In>
In Utf<8>::decode(In begin, In end, Uint32& output, Uint32 replacement)
{
@ -121,7 +130,7 @@ Out Utf<8>::encode(Uint32 input, Out output, Uint8 replacement)
}
// Add them to the output
output = std::copy(bytes, bytes + bytestoWrite, output);
output = priv::copy(bytes, bytes + bytestoWrite, output);
}
return output;
@ -244,7 +253,7 @@ Out Utf<8>::toLatin1(In begin, In end, Out output, char replacement)
template <typename In, typename Out>
Out Utf<8>::toUtf8(In begin, In end, Out output)
{
return std::copy(begin, end, output);
return priv::copy(begin, end, output);
}
@ -413,7 +422,7 @@ Out Utf<16>::fromLatin1(In begin, In end, Out output)
{
// Latin-1 is directly compatible with Unicode encodings,
// and can thus be treated as (a sub-range of) UTF-32
return std::copy(begin, end, output);
return priv::copy(begin, end, output);
}
@ -482,7 +491,7 @@ Out Utf<16>::toUtf8(In begin, In end, Out output)
template <typename In, typename Out>
Out Utf<16>::toUtf16(In begin, In end, Out output)
{
return std::copy(begin, end, output);
return priv::copy(begin, end, output);
}
@ -563,7 +572,7 @@ Out Utf<32>::fromLatin1(In begin, In end, Out output)
{
// Latin-1 is directly compatible with Unicode encodings,
// and can thus be treated as (a sub-range of) UTF-32
return std::copy(begin, end, output);
return priv::copy(begin, end, output);
}
@ -630,7 +639,7 @@ Out Utf<32>::toUtf16(In begin, In end, Out output)
template <typename In, typename Out>
Out Utf<32>::toUtf32(In begin, In end, Out output)
{
return std::copy(begin, end, output);
return priv::copy(begin, end, output);
}

View File

@ -29,11 +29,12 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/Export.hpp>
#include <SFML/System/String.hpp>
namespace sf
{
class String;
////////////////////////////////////////////////////////////
/// \brief Give access to the system clipboard
///

View File

@ -35,12 +35,13 @@
#include <SFML/Window/WindowHandle.hpp>
#include <SFML/Window/WindowStyle.hpp>
#include <SFML/System/Clock.hpp>
#include <SFML/System/String.hpp>
#include <SFML/System/Vector2.hpp>
namespace sf
{
class String;
namespace priv
{
class WindowImpl;

View File

@ -29,7 +29,6 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/Vector3.hpp>
#include <set>
#include <string>

View File

@ -30,7 +30,6 @@
////////////////////////////////////////////////////////////
#include <SFML/Audio/SoundFileReader.hpp>
#include <FLAC/stream_decoder.h>
#include <string>
#include <vector>

View File

@ -28,7 +28,6 @@
#include <SFML/Audio/SoundFileReaderOgg.hpp>
#include <SFML/System/MemoryInputStream.hpp>
#include <SFML/System/Err.hpp>
#include <algorithm>
#include <cctype>
#include <cassert>

View File

@ -29,7 +29,6 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Audio/SoundFileReader.hpp>
#include <string>
namespace sf

View File

@ -28,6 +28,7 @@
#include <SFML/Graphics/Text.hpp>
#include <SFML/Graphics/Texture.hpp>
#include <SFML/Graphics/RenderTarget.hpp>
#include <algorithm>
#include <cmath>

View File

@ -28,7 +28,6 @@
#include <SFML/Network/Http.hpp>
#include <SFML/System/Err.hpp>
#include <cctype>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <limits>
@ -204,7 +203,7 @@ void Http::Response::parse(const std::string& data)
{
if ((version.size() >= 8) && (version[6] == '.') &&
(toLower(version.substr(0, 5)) == "http/") &&
isdigit(version[5]) && isdigit(version[7]))
std::isdigit(version[5]) && std::isdigit(version[7]))
{
m_majorVersion = static_cast<unsigned int>(version[5] - '0');
m_minorVersion = static_cast<unsigned int>(version[7] - '0');

View File

@ -28,6 +28,8 @@
#include <SFML/Network/IpAddress.hpp>
#include <SFML/Network/Http.hpp>
#include <SFML/Network/SocketImpl.hpp>
#include <istream>
#include <ostream>
#include <cstring>
#include <utility>

View File

@ -30,7 +30,7 @@
#include <SFML/Network/Packet.hpp>
#include <SFML/Network/SocketImpl.hpp>
#include <SFML/System/Err.hpp>
#include <algorithm>
#include <cstddef>
namespace sf

View File

@ -26,6 +26,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/Err.hpp>
#include <iostream>
#include <streambuf>
#include <cstdio>

View File

@ -27,6 +27,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Window/Android/ClipboardImpl.hpp>
#include <SFML/System/Err.hpp>
#include <SFML/System/String.hpp>
namespace sf

View File

@ -25,14 +25,11 @@
#ifndef SFML_CLIPBOARDIMPLANDROID_HPP
#define SFML_CLIPBOARDIMPLANDROID_HPP
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/String.hpp>
namespace sf
{
class String;
namespace priv
{
////////////////////////////////////////////////////////////

View File

@ -29,6 +29,7 @@
#include <SFML/Window/EGLCheck.hpp>
#include <SFML/System/Err.hpp>
#include <glad/egl.h>
#include <string>
namespace sf

View File

@ -29,7 +29,6 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
#include <string>
namespace sf

View File

@ -25,14 +25,11 @@
#ifndef SFML_CLIPBOARDIMPLCOCOA_HPP
#define SFML_CLIPBOARDIMPLCOCOA_HPP
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/String.hpp>
namespace sf
{
class String;
namespace priv
{

View File

@ -27,6 +27,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Window/OSX/AutoreleasePoolWrapper.hpp>
#include <SFML/Window/OSX/ClipboardImpl.hpp>
#include <SFML/System/String.hpp>
#import <AppKit/AppKit.h>

View File

@ -30,7 +30,6 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/JoystickImpl.hpp>
#include <SFML/System/String.hpp>
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/hid/IOHIDDevice.h>
#include <IOKit/hid/IOHIDKeys.h>

View File

@ -31,7 +31,6 @@
////////////////////////////////////////////////////////////
#include <SFML/Window/Event.hpp>
#include <SFML/Window/WindowImpl.hpp>
#include <SFML/System/String.hpp>
////////////////////////////////////////////////////////////
/// Predefine OBJ-C classes
@ -55,6 +54,8 @@ using NSOpenGLContextRef = void*;
namespace sf
{
class String;
namespace priv
{
////////////////////////////////////////////////////////////

View File

@ -29,6 +29,7 @@
#include <SFML/Window/OSX/AutoreleasePoolWrapper.hpp>
#include <SFML/Window/OSX/WindowImplCocoa.hpp>
#include <SFML/System/Err.hpp>
#include <SFML/System/String.hpp>
#import <SFML/Window/OSX/cpp_objc_conversion.h>
#import <SFML/Window/OSX/Scaling.h>

View File

@ -29,6 +29,7 @@
#include <SFML/Window/Unix/ClipboardImpl.hpp>
#include <SFML/Window/Unix/Display.hpp>
#include <SFML/Window/Unix/InputImpl.hpp>
#include <SFML/System/String.hpp>
#include <SFML/System/Utf.hpp>
#include <SFML/System/Err.hpp>
#include <SFML/System/Sleep.hpp>

View File

@ -30,7 +30,6 @@
////////////////////////////////////////////////////////////
#include <SFML/Window/Event.hpp>
#include <SFML/Window/WindowImpl.hpp>
#include <SFML/System/String.hpp>
#include <SFML/Window/WindowStyle.hpp> // Prevent conflict with macro None from Xlib
#include <X11/Xlib.h>
#include <deque>

View File

@ -25,14 +25,11 @@
#ifndef SFML_CLIPBOARDIMPLWIN32_HPP
#define SFML_CLIPBOARDIMPLWIN32_HPP
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/String.hpp>
namespace sf
{
class String;
namespace priv
{
////////////////////////////////////////////////////////////

View File

@ -31,7 +31,6 @@
#include <SFML/System/Err.hpp>
#include <tchar.h>
#include <regstr.h>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <sstream>

View File

@ -29,6 +29,7 @@
#include <SFML/Window/WindowStyle.hpp>
#include <SFML/Window/JoystickImpl.hpp>
#include <SFML/System/Err.hpp>
#include <SFML/System/String.hpp>
#include <SFML/System/Utf.hpp>
// dbt.h is lowercase here, as a cross-compile on linux with mingw-w64
// expects lowercase, and a native compile on windows, whether via msvc

View File

@ -31,11 +31,12 @@
#include <SFML/Window/Event.hpp>
#include <SFML/Window/WindowImpl.hpp>
#include <SFML/System/Win32/WindowsHeader.hpp>
#include <SFML/System/String.hpp>
namespace sf
{
class String;
namespace priv
{
////////////////////////////////////////////////////////////

View File

@ -29,7 +29,6 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>
#include <SFML/System/String.hpp>
#include <SFML/Window/ContextSettings.hpp>
#include <SFML/Window/CursorImpl.hpp>
#include <SFML/Window/Event.hpp>
@ -37,13 +36,14 @@
#include <SFML/Window/Sensor.hpp>
#include <SFML/Window/SensorImpl.hpp>
#include <SFML/Window/VideoMode.hpp>
#include <SFML/Window/Vulkan.hpp>
#include <SFML/Window/WindowHandle.hpp>
#include <SFML/Window/Window.hpp>
#include <queue>
#include <set>
namespace sf
{
class String;
class WindowListener;
namespace priv

View File

@ -25,14 +25,11 @@
#ifndef SFML_CLIPBOARDIMPLIOS_HPP
#define SFML_CLIPBOARDIMPLIOS_HPP
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/System/String.hpp>
namespace sf
{
class String;
namespace priv
{

View File

@ -26,6 +26,7 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/iOS/ClipboardImpl.hpp>
#include <SFML/System/String.hpp>
#import <UIKit/UIKit.h>