CSFML 3.0.0
Loading...
Searching...
No Matches
Config.h
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2024 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
28// Headers
30
31#include <stdbool.h>
32#include <stdint.h>
33
34
36// Define the CSFML version
38#define CSFML_VERSION_MAJOR 3
39#define CSFML_VERSION_MINOR 0
40#define CSFML_VERSION_PATCH 0
41
42
44// Check if we need to mark functions as extern "C"
46#ifdef __cplusplus
47#define CSFML_EXTERN_C extern "C"
48#else
49#define CSFML_EXTERN_C extern
50#endif
51
52
54// Identify the operating system
56#if defined(_WIN32) || defined(__WIN32__)
57
58// Windows
59#define CSFML_SYSTEM_WINDOWS
60
61#elif defined(linux) || defined(__linux)
62
63// Linux
64#define CSFML_SYSTEM_LINUX
65
66#elif defined(__APPLE__) || defined(MACOSX) || defined(macintosh) || defined(Macintosh)
67
68// MacOS
69#define CSFML_SYSTEM_MACOS
70
71#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
72
73// FreeBSD
74#define CSFML_SYSTEM_FREEBSD
75
76#else
77
78// Unsupported system
79#error This operating system is not supported by SFML library
80
81#endif
82
83
85// Define helpers to create portable import / export macros for each module
87#if !defined(CSFML_STATIC)
88
89#if defined(CSFML_SYSTEM_WINDOWS)
90
91// Windows compilers need specific (and different) keywords for export and import
92#define CSFML_API_EXPORT extern "C" __declspec(dllexport)
93#define CSFML_API_IMPORT CSFML_EXTERN_C __declspec(dllimport)
94
95// For Visual C++ compilers, we also need to turn off this annoying C4251 warning
96#ifdef _MSC_VER
97
98#pragma warning(disable : 4251)
99
100#endif
101
102#else // Linux, FreeBSD, Mac OS X
103
104#define CSFML_API_EXPORT extern "C" __attribute__((__visibility__("default")))
105#define CSFML_API_IMPORT CSFML_EXTERN_C __attribute__((__visibility__("default")))
106
107#endif
108
109#else
110
111// Static build doesn't need import/export macros
112#define CSFML_API_EXPORT extern "C"
113#define CSFML_API_IMPORT CSFML_EXTERN_C
114
115#endif
116
118// Cross-platform warning for deprecated functions and classes
119//
120// Usage:
121// struct CSFML_DEPRECATED MyStruct
122// {
123// ...
124// };
125//
126// CSFML_DEPRECATED void globalFunc(void);
128#if defined(CSFML_NO_DEPRECATED_WARNINGS)
129
130// User explicitly requests to disable deprecation warnings
131#define CSFML_DEPRECATED
132
133#elif defined(_MSC_VER)
134
135// Microsoft C++ compiler
136// Note: On newer MSVC versions, using deprecated functions causes a compiler error. In order to
137// trigger a warning instead of an error, the compiler flag /sdl- (instead of /sdl) must be specified.
138#define CSFML_DEPRECATED __declspec(deprecated)
139
140#elif defined(__GNUC__)
141
142// g++ and Clang
143#define CSFML_DEPRECATED __attribute__((deprecated))
144
145#else
146
147// Other compilers are not supported, leave class or function as-is.
148// With a bit of luck, the #pragma directive works, otherwise users get a warning (no error!) for unrecognized #pragma.
149#pragma message("CSFML_DEPRECATED is not supported for your compiler, please contact the CSFML team")
150#define CSFML_DEPRECATED
151
152#endif
153
154
160#include <stdint.h>
161 typedef uint32_t sfChar32;
sfChar32
uint32_t sfChar32
Define sfChar32.
Definition Config.h:161