mirror of
https://github.com/gwm17/implot.git
synced 2024-11-22 10:18:52 -05:00
Remove support for IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES (#402)
This commit is contained in:
parent
f719a180ff
commit
98c76edbb4
29
.github/CMakeLists.txt
vendored
29
.github/CMakeLists.txt
vendored
|
@ -71,22 +71,21 @@ if (UNIX)
|
|||
target_link_libraries(implot PUBLIC m stdc++)
|
||||
endif()
|
||||
|
||||
# Switch between several sets of numeric types (by adding `-DIMPLOT_NUMERIC_SET=default|custom|all`)
|
||||
if (DEFINED IMPLOT_NUMERIC_SET)
|
||||
if ("${IMPLOT_NUMERIC_SET}" STREQUAL "default")
|
||||
message(STATUS "Compiling for default types")
|
||||
elseif("${IMPLOT_NUMERIC_SET}" STREQUAL "custom")
|
||||
message(STATUS "Compiling for custom types (float and double)")
|
||||
target_compile_definitions(implot PRIVATE "IMPLOT_CUSTOM_NUMERIC_TYPES=(float)(double)")
|
||||
elseif("${IMPLOT_NUMERIC_SET}" STREQUAL "all")
|
||||
message(STATUS "Compiling for all types")
|
||||
target_compile_definitions(implot PRIVATE "IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES=1")
|
||||
else()
|
||||
message(FATAL_ERROR "unhandled IMPLOT_NUMERIC_SET=${IMPLOT_NUMERIC_SET}")
|
||||
endif()
|
||||
# Define supported types via command line:
|
||||
# - With no choice all types are supported (so that the CI provides support for all known types)
|
||||
# - with -DIMPLOT_CUSTOM_NUMERIC_TYPES="default" the default set defined in implot_items.cpp is used
|
||||
# - with -DIMPLOT_CUSTOM_NUMERIC_TYPES="(int)(float)(double)" only int, float and double are supported
|
||||
if (NOT DEFINED IMPLOT_CUSTOM_NUMERIC_TYPES)
|
||||
set(IMPLOT_CUSTOM_NUMERIC_TYPES "all")
|
||||
endif()
|
||||
if ("${IMPLOT_CUSTOM_NUMERIC_TYPES}" STREQUAL "default")
|
||||
message("==== Compiling for default types ====")
|
||||
elseif("${IMPLOT_CUSTOM_NUMERIC_TYPES}" STREQUAL "all")
|
||||
message("==== Compiling for all types ====")
|
||||
target_compile_definitions(implot PRIVATE "IMPLOT_CUSTOM_NUMERIC_TYPES=(signed char)(unsigned char)(signed short)(unsigned short)(signed int)(unsigned int)(signed long)(unsigned long)(signed long long)(unsigned long long)(float)(double)(long double)")
|
||||
else()
|
||||
# By default, the CI provides support for all known types
|
||||
target_compile_definitions(implot PRIVATE IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES)
|
||||
message("==== Compiling for custom types: ${IMPLOT_CUSTOM_NUMERIC_TYPES} ====")
|
||||
target_compile_definitions(implot PRIVATE "IMPLOT_CUSTOM_NUMERIC_TYPES=${IMPLOT_CUSTOM_NUMERIC_TYPES}")
|
||||
endif()
|
||||
|
||||
#
|
||||
|
|
|
@ -123,7 +123,7 @@ A: Yes, within reason. You can plot tens to hundreds of thousands of points with
|
|||
**Q: What data types can I plot?**
|
||||
|
||||
A: ImPlot plotting functions accept most scalar types:
|
||||
`float`, `double`, `int8`, `uint8`, `int16`, `uint16`, `int32`, `uint32`, `int64`, `uint64`. Arrays of custom structs or classes (e.g. `Vector2f` or similar) are easily passed to ImPlot functions using the built-in striding features (see `implot.h` for documentation), and many plotters provide a "getter" overload which accepts data generating callbacks. Additional support for `long`, `unsigned long` and `long double` can be added by defining `IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES` at compile-time. Also, you can fully customize the list of accepted types: see doc in `implot_items.cpp`.
|
||||
`float`, `double`, `int8`, `uint8`, `int16`, `uint16`, `int32`, `uint32`, `int64`, `uint64`. Arrays of custom structs or classes (e.g. `Vector2f` or similar) are easily passed to ImPlot functions using the built-in striding features (see `implot.h` for documentation), and many plotters provide a "getter" overload which accepts data generating callbacks. You can fully customize the list of accepted types by defining `IMPLOT_CUSTOM_NUMERIC_TYPES` at compile time: see doc in `implot_items.cpp`.
|
||||
|
||||
**Q: Can plot styles be modified?**
|
||||
|
||||
|
|
|
@ -83,13 +83,14 @@ static IMPLOT_INLINE float ImInvSqrt(float x) { return 1.0f / sqrtf(x); }
|
|||
//
|
||||
// You can customize the supported types in two ways:
|
||||
// 1. Define IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES at compile time to add support for all known types.
|
||||
// 2. Or, define IMPLOT_CUSTOM_NUMERIC_TYPES at compile time to define your own type list. As an example, you could use the compile time define given by the line below in order to support only float and double.
|
||||
// 2. Or, define IMPLOT_CUSTOM_NUMERIC_TYPES at compile time to define your own type list.
|
||||
// As an example, you could use the compile time define given by the line below in order to support only float and double.
|
||||
// -DIMPLOT_CUSTOM_NUMERIC_TYPES="(float)(double)"
|
||||
// In order to support all known C++ types, use:
|
||||
// -DIMPLOT_CUSTOM_NUMERIC_TYPES="(signed char)(unsigned char)(signed short)(unsigned short)(signed int)(unsigned int)(signed long)(unsigned long)(signed long long)(unsigned long long)(float)(double)(long double)"
|
||||
|
||||
#ifdef IMPLOT_CUSTOM_NUMERIC_TYPES
|
||||
#define IMPLOT_NUMERIC_TYPES IMPLOT_CUSTOM_NUMERIC_TYPES
|
||||
#elif defined(IMPLOT_INSTANTIATE_ALL_NUMERIC_TYPES)
|
||||
#define IMPLOT_NUMERIC_TYPES (signed char)(unsigned char)(signed short)(unsigned short)(signed int)(unsigned int)(signed long)(unsigned long)(signed long long)(unsigned long long)(float)(double)(long double)
|
||||
#else
|
||||
#define IMPLOT_NUMERIC_TYPES (ImS8)(ImU8)(ImS16)(ImU16)(ImS32)(ImU32)(ImS64)(ImU64)(float)(double)
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user