Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added configurations for different modules #14

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion flux-config/flux/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
#include <flux/config/macro.hpp>

#include <flux/config/assert.hpp>
#include <flux/config/features_support.hpp>
#include <flux/config/compiler.hpp>
#include <flux/config/features.hpp>
#include <flux/config/graphics.hpp>
#include <flux/config/memory.hpp>
#include <flux/config/platform.hpp>
#include <flux/config/warnings.hpp>
13 changes: 13 additions & 0 deletions flux-config/flux/config/compiler.hpp
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions flux-config/flux/config/graphics.hpp
Original file line number Diff line number Diff line change
@@ -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
47 changes: 47 additions & 0 deletions flux-config/flux/config/memory.hpp
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions flux-config/flux/config/platform.hpp
Original file line number Diff line number Diff line change
@@ -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 <TargetConditionals.h>
# 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)
23 changes: 23 additions & 0 deletions flux-config/flux/config/warnings.hpp
Original file line number Diff line number Diff line change
@@ -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