NovaSVG 0.11.5
An SVG library
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1#ifndef NOVA_CONFIG_H
2#define NOVA_CONFIG_H
3#pragma once
4
5#include <stb/export.hpp> // STB_MIN / STB_MAX
6
7// Build configuration shared by every novasvg header: linkage/export macros and the small
8// min/max helpers. Kept in its own header so internal headers (and the compiled sources in src/)
9// can use them without pulling in the whole public API.
10
11// Linkage: NOVA_API marks what the compiled library exports. Same scheme as STB_API in libstb:
12//
13// building the library NOVA_BUILDING_LIBRARY is defined: dllexport on Windows, default
14// visibility elsewhere.
15// using the library dllimport on Windows, default visibility elsewhere.
16// static library NOVA_STATIC_DEFINE is defined (CMake does it for a static build):
17// NOVA_API is empty.
18#if defined(NOVA_STATIC_DEFINE)
19#define NOVA_API
20#elif defined(_WIN32) || defined(__CYGWIN__)
21#if defined(NOVA_BUILDING_LIBRARY)
22#define NOVA_API __declspec(dllexport)
23#else
24#define NOVA_API __declspec(dllimport)
25#endif
26#elif defined(__GNUC__) || defined(__clang__)
27#define NOVA_API __attribute__((visibility("default")))
28#else
29#define NOVA_API
30#endif
31
32// Plain ternary macros instead of std::max/std::min. A uniquely-prefixed
33// macro can never collide with anything, which a bare `std::max`/
34// `std::min` call genuinely can: <windows.h> (pulled in transitively by
35// Python.h and friends on a Windows build) `#define`s `max`/`min` as
36// object-like macros unless NOMINMAX is defined first, and since that's
37// a build-system concern novasvg can't force on every consumer of the
38// library, this codebase calls these instead of std::max/
39// std::min directly wherever it needs a two-argument max/min. Same
40// pattern libstb uses for its own internals (STB_MIN/STB_MAX in
41// stb/export.hpp), just
42// under this project's own prefix for general-purpose call sites.
43
44#endif // NOVA_CONFIG_H