mirror of
https://github.com/simdjson/simdjson
synced 2026-06-08 17:27:07 +00:00
6d978c383a
- Allow user to specify SIMDJSON_BUILTIN_IMPLEMENTATION - Make cmake -DSIMDJSON_IMPLEMENTATION=haswell *only* specify haswell - Move negative implementation selection to -DSIMDJSON_EXCLUDE_IMPLEMENTATION - Automatically select SIMDJSON_BUILTIN_IMPLEMENTATION if SIMDJSON_IMPLEMENTATION is set - Move implementation enablement mostly to implementation files - Make implementation enablement and selection simpler and more robust - Fix bug where programs linked against simdjson were not passed SIMDJSON_XXX_IMPLEMENTATION or SIMDJSON_EXCEPTIONS
35 lines
1.3 KiB
C++
35 lines
1.3 KiB
C++
#ifndef SIMDJSON_BUILTIN_H
|
|
#define SIMDJSON_BUILTIN_H
|
|
|
|
#include "simdjson/portability.h"
|
|
|
|
#ifndef SIMDJSON_BUILTIN_IMPLEMENTATION
|
|
#if SIMDJSON_CAN_ALWAYS_RUN_HASWELL
|
|
#define SIMDJSON_BUILTIN_IMPLEMENTATION haswell
|
|
#elif SIMDJSON_CAN_ALWAYS_RUN_WESTMERE
|
|
#define SIMDJSON_BUILTIN_IMPLEMENTATION westmere
|
|
#elif SIMDJSON_CAN_ALWAYS_RUN_ARM64
|
|
#define SIMDJSON_BUILTIN_IMPLEMENTATION arm64
|
|
#elif SIMDJSON_CAN_ALWAYS_RUN_FALLBACK
|
|
#define SIMDJSON_BUILTIN_IMPLEMENTATION fallback
|
|
#else
|
|
#error "All possible implementations (including fallback) have been disabled! simdjson will not run."
|
|
#endif
|
|
#endif // SIMDJSON_BUILTIN_IMPLEMENTATION
|
|
|
|
namespace simdjson {
|
|
/**
|
|
* Represents the best statically linked simdjson implementation that can be used by the compiling
|
|
* program.
|
|
*
|
|
* Detects what options the program is compiled against, and picks the minimum implementation that
|
|
* will work on any computer that can run the program. For example, if you compile with g++
|
|
* -march=westmere, it will pick the westmere implementation. The haswell implementation will
|
|
* still be available, and can be selected at runtime, but the builtin implementation (and any
|
|
* code that uses it) will use westmere.
|
|
*/
|
|
namespace builtin = SIMDJSON_BUILTIN_IMPLEMENTATION;
|
|
} // namespace simdjson
|
|
|
|
#endif // SIMDJSON_BUILTIN_H
|