SFML - Simple and Fast Multimedia Library

SFML 3.1.0
Loading...
Searching...
No Matches
Config.hpp
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2026 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#pragma once
26
27
29// SFML version
31#define SFML_VERSION_MAJOR 3
32#define SFML_VERSION_MINOR 1
33#define SFML_VERSION_PATCH 0
34#define SFML_VERSION_IS_RELEASE true
35
36
38// Identify the operating system
39// see https://sourceforge.net/p/predef/wiki/Home/
41#if defined(_WIN32)
42
43// Windows
44#define SFML_SYSTEM_WINDOWS
45#ifndef NOMINMAX
46#define NOMINMAX
47#endif
48
49#elif defined(__APPLE__) && defined(__MACH__)
50
51// Apple platform, see which one it is
52#include "TargetConditionals.h"
53
54#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
55
56// iOS
57#define SFML_SYSTEM_IOS
58
59#elif TARGET_OS_MAC
60
61// macOS
62#define SFML_SYSTEM_MACOS
63
64#else
65
66// Unsupported Apple system
67#error This Apple operating system is not supported by SFML library
68
69#endif
70
71#elif defined(__unix__)
72
73// UNIX system, see which one it is
74#if defined(__ANDROID__)
75
76// Android
77#define SFML_SYSTEM_ANDROID
78
79#elif defined(__linux__)
80
81// Linux
82#define SFML_SYSTEM_LINUX
83
84#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
85
86// FreeBSD
87#define SFML_SYSTEM_FREEBSD
88
89#elif defined(__OpenBSD__)
90
91// OpenBSD
92#define SFML_SYSTEM_OPENBSD
93
94#elif defined(__NetBSD__)
95
96// NetBSD
97#define SFML_SYSTEM_NETBSD
98
99#else
100
101// Unsupported UNIX system
102#error This UNIX operating system is not supported by SFML library
103
104#endif
105
106#else
107
108// Unsupported system
109#error This operating system is not supported by SFML library
110
111#endif
112
113
115// Ensure minimum C++ language standard version is met
117#if (defined(_MSVC_LANG) && _MSVC_LANG < 201703L) || (!defined(_MSVC_LANG) && __cplusplus < 201703L)
118#error "Enable C++17 or newer for your compiler (e.g. -std=c++17 for GCC/Clang or /std:c++17 for MSVC)"
119#endif
120
121
123// Portable debug macro
125#if !defined(NDEBUG)
126
127#define SFML_DEBUG
128
129#endif
130
131
133// Helpers to create portable import / export macros for each module
135#if !defined(SFML_STATIC)
136
137#if defined(SFML_SYSTEM_WINDOWS)
138
139// Windows compilers need specific (and different) keywords for export and import
140#define SFML_API_EXPORT __declspec(dllexport)
141#define SFML_API_IMPORT __declspec(dllimport)
142
143// For Visual C++ compilers, we also need to turn off this annoying C4251 & C4275 warning
144#ifdef _MSC_VER
145
146#pragma warning(disable : 4251) // Using standard library types in our own exported types is okay
147#pragma warning(disable : 4275) // Exporting types derived from the standard library is okay
148
149#endif
150
151#else // Linux, FreeBSD, macOS
152
153#define SFML_API_EXPORT [[gnu::visibility("default")]]
154#define SFML_API_IMPORT [[gnu::visibility("default")]]
155
156#endif
157
158#else
159
160// Static build doesn't need import/export macros
161#define SFML_API_EXPORT
162#define SFML_API_IMPORT
163
164#endif