diff --git a/flux-config/flux/config.hpp b/flux-config/flux/config.hpp index b497c18..b38b115 100644 --- a/flux-config/flux/config.hpp +++ b/flux-config/flux/config.hpp @@ -3,4 +3,9 @@ #include #include -#include \ No newline at end of file +#include +#include +#include +#include +#include +#include \ No newline at end of file diff --git a/flux-config/flux/config/compiler.hpp b/flux-config/flux/config/compiler.hpp new file mode 100644 index 0000000..b5bf02e --- /dev/null +++ b/flux-config/flux/config/compiler.hpp @@ -0,0 +1,13 @@ +#pragma once + +#if defined(__clang__) +# define FLUX_CLANG_FULL_VERSION \ + (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) +// For compatibility with existing code that compiles with MSVC, +// clang defines the _MSC_VER and _MSC_FULL_VER macros. +# if defined(_MSC_VER) +# define FLUX_MSC_FULL_VERSION (_MSC_FULL_VER) +# endif +#else +# error "Compiler not supported." +#endif \ No newline at end of file diff --git a/flux-config/flux/config/features_support.hpp b/flux-config/flux/config/features.hpp similarity index 100% rename from flux-config/flux/config/features_support.hpp rename to flux-config/flux/config/features.hpp diff --git a/flux-config/flux/config/graphics.hpp b/flux-config/flux/config/graphics.hpp new file mode 100644 index 0000000..cb3b55f --- /dev/null +++ b/flux-config/flux/config/graphics.hpp @@ -0,0 +1,7 @@ +#pragma once + +#ifdef FLUX_TARGET_OPENGL +# define FLUX_OPENGL_FULL_VERSION \ + FLUX_JOIN(FLUX_OPENGL_VERSION_MAJOR, FLUX_JOIN(FLUX_OPENGL_VERSION_MINOR, 0)) +# define FLUX_GLSL_VERSION "#version " FLUX_TO_STRING(FLUX_OPENGL_FULL_VERSION) +#endif \ No newline at end of file diff --git a/flux-config/flux/config/memory.hpp b/flux-config/flux/config/memory.hpp new file mode 100644 index 0000000..281ef25 --- /dev/null +++ b/flux-config/flux/config/memory.hpp @@ -0,0 +1,47 @@ +#pragma once + +// Whether or not the allocation size will be checked. +#define FLUX_MEMORY_CHECK_ALLOCATION_SIZE (1) + +// Whether or not allocated memory will be filled with special values. +#define FLUX_MEMORY_DEBUG_FILL (1) + +// The size of the fence memory, it has no effect if FLUX_MEMORY_DEBUG_FILL is disabled. +#define FLUX_MEMORY_DEBUG_FENCE (1) + +// Whether or not leak checking is enabled. +#define FLUX_MEMORY_DEBUG_LEAK (1) + +// Whether or not the deallocation functions will check for pointers that were never allocated by an +// allocator. +#define FLUX_MEMORY_DEBUG_POINTER (1) + +// Whether or not the deallocation functions will check for double free errors. +#define FLUX_MEMORY_DEBUG_DOUBLE_FREE (1) + +// Whether or not the `temporary_allocator` will use a `temporary_stack` for its allocation. This +// option controls how and if a global, per-thread instance of it is managed. If 2 it is +// automatically managed and created on-demand, if 1 you need explicit lifetime control through the +// `temporary_stack_initializer` class and if 0 there is no stack created automatically. Mode 2 has +// a slight runtime overhead. +#define FLUX_MEMORY_TEMPORARY_STACK_MODE (2) + +#ifdef NDEBUG +# undef FLUX_MEMORY_CHECK_ALLOCATION_SIZE +# define FLUX_MEMORY_CHECK_ALLOCATION_SIZE (0) + +# undef FLUX_MEMORY_DEBUG_FILL +# define FLUX_MEMORY_DEBUG_FILL (0) + +# undef FLUX_MEMORY_DEBUG_FENCE +# define FLUX_MEMORY_DEBUG_FENCE (0) + +# undef FLUX_MEMORY_DEBUG_LEAK +# define FLUX_MEMORY_DEBUG_LEAK (0) + +# undef FLUX_MEMORY_DEBUG_POINTER +# define FLUX_MEMORY_DEBUG_POINTER (0) + +# undef FLUX_MEMORY_DEBUG_DOUBLE_FREE +# define FLUX_MEMORY_DEBUG_DOUBLE_FREE (0) +#endif \ No newline at end of file diff --git a/flux-config/flux/config/platform.hpp b/flux-config/flux/config/platform.hpp new file mode 100644 index 0000000..fdf96e2 --- /dev/null +++ b/flux-config/flux/config/platform.hpp @@ -0,0 +1,26 @@ +#pragma once + +#define FLUX_TARGET_APPLE (0) +#define FLUX_TARGET_MACOSX (0) +#define FLUX_TARGET_WINDOWS (0) +#define FLUX_TARGET_LINUX (0) + +// clang-format off +#if defined(_WIN64) && !defined(__WINE__) +# undef FLUX_TARGET_WINDOWS +# define FLUX_TARGET_WINDOWS (1) +#elif defined(__APPLE__) +# undef FLUX_TARGET_APPLE +# define FLUX_TARGET_APPLE (1) +# include +# if defined(TARGET_OS_MAC) +# undef FLUX_TARGET_MACOSX +# define FLUX_TARGET_MACOSX (1) +# endif +#elif defined(__linux__) +# undef FLUX_TARGET_LINUX +# define FLUX_TARGET_LINUX (1) +#endif +// clang-format on + +#define FLUX_TARGET(X) FLUX_JOIN(FLUX_TARGET_, X) \ No newline at end of file diff --git a/flux-config/flux/config/warnings.hpp b/flux-config/flux/config/warnings.hpp new file mode 100644 index 0000000..a3aa7a2 --- /dev/null +++ b/flux-config/flux/config/warnings.hpp @@ -0,0 +1,23 @@ +#pragma once + +// clang-format off +#if defined(FLUX_CLANG) +# define _FLUX_PRAGMA(diagnostic) _Pragma(FLUX_TO_STRING(diagnostic)) +# define FLUX_DISABLE_WARNING_PUSH _FLUX_PRAGMA(clang diagnostic push) +# define FLUX_DISABLE_WARNING_POP _FLUX_PRAGMA(clang diagnostic pop) +# define FLUX_DISABLE_WARNING(warning) _FLUX_PRAGMA(clang diagnostic ignored #warning) +# define FLUX_DISABLE_WARNING_BLOCK(warning, ...) \ + FLUX_DISABLE_WARNING_PUSH \ + FLUX_DISABLE_WARNING(warning) \ + __VA_ARGS__ \ + FLUX_DISABLE_WARNING_POP +// Warnings you want to deactivate: +# define FLUX_DISABLE_WARNING_DEPRECATED_DECLARATIONS FLUX_DISABLE_WARNING(-Wdeprecated-declarations) +#else +# define FLUX_DISABLE_WARNING_PUSH /* nothing */ +# define FLUX_DISABLE_WARNING_POP /* nothing */ +# define FLUX_DISABLE_WARNING(warning) /* nothing */ +# define FLUX_DISABLE_WARNING_BLOCK(warning, ...) /* nothing */ +# define FLUX_DISABLE_WARNING_DEPRECATED_DECLARATIONS /* nothing */ +#endif +// clang-format on \ No newline at end of file