|
1 |
| -// Copyright (C) 2024 REMqb (remqb at remqb dot fr) |
2 |
| -// This file is part of the "Nazara Shading Language" project |
3 |
| -// For conditions of distribution and use, see copyright notice in Config.hpp |
| 1 | +/* |
| 2 | + Nazara Shading Language - C Binding (CNZSL) |
| 3 | +
|
| 4 | + Copyright (C) 2024 Jérôme "SirLynix" Leclercq ([email protected]) |
| 5 | + 2024 REMqb (remqb at remqb dot fr) |
| 6 | +
|
| 7 | + Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 8 | + this software and associated documentation files (the "Software"), to deal in |
| 9 | + the Software without restriction, including without limitation the rights to |
| 10 | + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies |
| 11 | + of the Software, and to permit persons to whom the Software is furnished to do |
| 12 | + so, subject to the following conditions: |
| 13 | +
|
| 14 | + The above copyright notice and this permission notice shall be included in all |
| 15 | + copies or substantial portions of the Software. |
| 16 | +
|
| 17 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 18 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 22 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 23 | + SOFTWARE. |
| 24 | +*/ |
4 | 25 |
|
5 | 26 | #pragma once
|
6 | 27 |
|
7 |
| -#ifndef CNZSL_CNZSL_H |
8 |
| -#define CNZSL_CNZSL_H |
| 28 | +#ifndef CNZSL_CONFIG_H |
| 29 | +#define CNZSL_CONFIG_H |
9 | 30 |
|
10 |
| -// #include <NazaraUtils/Prerequisites.hpp> // I don't want the C++ things |
| 31 | +/* CNZSL version macro */ |
| 32 | +#define CNZSL_VERSION_MAJOR 0 |
| 33 | +#define CNZSL_VERSION_MINOR 1 |
| 34 | +#define CNZSL_VERSION_PATCH 0 |
11 | 35 |
|
12 |
| -// Try to identify the compiler |
13 |
| -#if defined(__clang__) |
14 |
| -#define NAZARA_COMPILER_CLANG |
15 |
| - #define NAZARA_COMPILER_CLANG_VER (__clang_major__ * 100 + __clang_minor__) |
16 |
| - #define NAZARA_DEPRECATED(txt) __attribute__((__deprecated__(txt))) |
17 |
| - #define NAZARA_PRETTY_FUNCTION __PRETTY_FUNCTION__ |
18 |
| - |
19 |
| - #define NAZARA_CHECK_CLANG_VER(ver) (NAZARA_COMPILER_CLANG_VER >= ver) |
20 |
| - |
21 |
| - #define NAZARA_PRAGMA(x) _Pragma(#x) |
22 |
| - |
23 |
| - #define NAZARA_WARNING_CLANG_DISABLE(warn) NAZARA_PRAGMA(clang diagnostic ignored warn) |
24 |
| - #define NAZARA_WARNING_CLANG_GCC_DISABLE(warn) NAZARA_PRAGMA(clang diagnostic ignored warn) |
25 |
| - #define NAZARA_WARNING_POP() NAZARA_PRAGMA(clang diagnostic pop) |
26 |
| - #define NAZARA_WARNING_PUSH() NAZARA_PRAGMA(clang diagnostic push) |
27 |
| - |
28 |
| - #ifdef __MINGW32__ |
29 |
| - #define NAZARA_COMPILER_MINGW |
30 |
| - #ifdef __MINGW64_VERSION_MAJOR |
31 |
| - #define NAZARA_COMPILER_MINGW_W64 |
32 |
| - #endif |
33 |
| - #endif |
34 |
| -#elif defined(__GNUC__) || defined(__MINGW32__) |
35 |
| -#define NAZARA_COMPILER_GCC |
36 |
| -#define NAZARA_COMPILER_GCC_VER (__GNUC__ * 100 + __GNUC_MINOR__) |
37 |
| -#define NAZARA_DEPRECATED(txt) __attribute__((__deprecated__(txt))) |
38 |
| -#define NAZARA_PRETTY_FUNCTION __PRETTY_FUNCTION__ |
39 |
| - |
40 |
| -#define NAZARA_CHECK_GCC_VER(ver) (NAZARA_COMPILER_GCC_VER >= ver) |
41 |
| - |
42 |
| -#define NAZARA_PRAGMA(x) _Pragma(#x) |
43 |
| - |
44 |
| -#define NAZARA_WARNING_CLANG_GCC_DISABLE(warn) NAZARA_PRAGMA(GCC diagnostic ignored warn) |
45 |
| -#define NAZARA_WARNING_GCC_DISABLE(warn) NAZARA_PRAGMA(GCC diagnostic ignored warn) |
46 |
| -#define NAZARA_WARNING_POP() NAZARA_PRAGMA(GCC diagnostic pop) |
47 |
| -#define NAZARA_WARNING_PUSH() NAZARA_PRAGMA(GCC diagnostic push) |
48 |
| - |
49 |
| -#ifdef __MINGW32__ |
50 |
| -#define NAZARA_COMPILER_MINGW |
51 |
| - #ifdef __MINGW64_VERSION_MAJOR |
52 |
| - #define NAZARA_COMPILER_MINGW_W64 |
| 36 | +#if !defined(CNZSL_STATIC) |
| 37 | + #ifdef _WIN32 |
| 38 | + #ifdef CNZSL_BUILD |
| 39 | + #define CNZSL_API __declspec(dllexport) |
| 40 | + #else |
| 41 | + #define CNZSL_API __declspec(dllimport) |
53 | 42 | #endif
|
54 |
| -#endif |
55 |
| -#elif defined(__INTEL_COMPILER) || defined(__ICL) |
56 |
| -#define NAZARA_COMPILER_ICC |
57 |
| - #define NAZARA_COMPILER_ICC_VER __INTEL_COMPILER |
58 |
| - #define NAZARA_DEPRECATED(txt) [[deprecated(txt)]] |
59 |
| - #define NAZARA_PRETTY_FUNCTION __FUNCTION__ |
60 |
| - |
61 |
| - #define NAZARA_CHECK_ICC_VER(ver) (NAZARA_COMPILER_ICC_VER >= ver) |
62 |
| - |
63 |
| - #define NAZARA_PRAGMA(x) _Pragma(x) |
64 |
| - |
65 |
| - #define NAZARA_WARNING_ICC_DISABLE(...) NAZARA_PRAGMA(warning(disable: __VA_ARGS__)) |
66 |
| - #define NAZARA_WARNING_POP() NAZARA_PRAGMA(warning(pop)) |
67 |
| - #define NAZARA_WARNING_PUSH() NAZARA_PRAGMA(warning(push)) |
68 |
| -#elif defined(_MSC_VER) |
69 |
| - #define NAZARA_COMPILER_MSVC |
70 |
| - #define NAZARA_COMPILER_MSVC_VER _MSC_VER |
71 |
| - #define NAZARA_DEPRECATED(txt) __declspec(deprecated(txt)) |
72 |
| - #define NAZARA_PRETTY_FUNCTION __FUNCSIG__ |
73 |
| - |
74 |
| - #define NAZARA_CHECK_MSVC_VER(ver) (NAZARA_COMPILER_MSVC_VER >= ver) |
75 |
| - |
76 |
| - #define NAZARA_PRAGMA(x) __pragma(x) |
77 |
| - |
78 |
| - #define NAZARA_WARNING_MSVC_DISABLE(...) NAZARA_PRAGMA(warning(disable: __VA_ARGS__)) |
79 |
| - #define NAZARA_WARNING_POP() NAZARA_PRAGMA(warning(pop)) |
80 |
| - #define NAZARA_WARNING_PUSH() NAZARA_PRAGMA(warning(push)) |
81 |
| - |
82 |
| - // __cplusplus isn't respected on MSVC without /Zc:__cplusplus flag |
83 |
| - #define NAZARA_CPP_VER _MSVC_LANG |
84 |
| -#else |
85 |
| - #define NAZARA_COMPILER_UNKNOWN |
86 |
| - #define NAZARA_DEPRECATED(txt) |
87 |
| - #define NAZARA_PRETTY_FUNCTION __func__ // __func__ has been standardized in C++ 2011 |
88 |
| - |
89 |
| - #pragma message This compiler is not fully supported |
90 |
| -#endif |
91 |
| - |
92 |
| -// Nazara version macro |
93 |
| -#define NZSL_VERSION_MAJOR 0 |
94 |
| -#define NZSL_VERSION_MINOR 1 |
95 |
| -#define NZSL_VERSION_PATCH 0 |
96 |
| - |
97 |
| -#if !defined(NZSL_STATIC) |
98 |
| -#ifdef NZSL_BUILD |
99 |
| - #define NZSL_API NAZARA_EXPORT |
100 | 43 | #else
|
101 |
| - #define NZSL_API NAZARA_IMPORT |
| 44 | + #define CNZSL_API __attribute__((visibility("default"))) |
102 | 45 | #endif
|
103 | 46 | #else
|
104 |
| -#define NZSL_API |
| 47 | + #define CNZSL_API extern |
105 | 48 | #endif
|
106 | 49 |
|
107 |
| -#endif //CNZSL_CNZSL_H |
| 50 | +#endif /* CNZSL_CONFIG_H */ |
0 commit comments