feat: add various detector.
- add endian and compiler detector, and modify os detector. - now we use CMake to add detector-used macro, instead of using some C++ features to detect them. - change Windows environment detection according to the change of os detector.
This commit is contained in:
5
src/yycc/macro/compiler_detector.hpp
Normal file
5
src/yycc/macro/compiler_detector.hpp
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#if (defined(YYCC_CC_MSVC) + defined(YYCC_CC_GCC) + defined(YYCC_CC_CLANG)) != 1
|
||||
#error "Current compiler is not supported!"
|
||||
#endif
|
7
src/yycc/macro/endian_detector.hpp
Normal file
7
src/yycc/macro/endian_detector.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
// Check endian
|
||||
#if (defined(YYCC_ENDIAN_LITTLE) + defined(YYCC_ENDIAN_BIG)) != 1
|
||||
#error "Current system endian (byte order) is not supported!"
|
||||
#endif
|
||||
|
@ -1,11 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
// Define operating system macros
|
||||
#define YYCC_OS_WINDOWS 2
|
||||
#define YYCC_OS_LINUX 3
|
||||
// Check current operating system.
|
||||
#if defined(_WIN32)
|
||||
#define YYCC_OS YYCC_OS_WINDOWS
|
||||
#else
|
||||
#define YYCC_OS YYCC_OS_LINUX
|
||||
// Check OS macro
|
||||
#if (defined(YYCC_OS_WINDOWS) + defined(YYCC_OS_LINUX)) != 1
|
||||
#error "Current operating system is not supported!"
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user