- 新增了一个名为 ArgumentParser 的类来处理命令行参数,其中包括用于显示帮助、显示版本和显示许可证的标志。 - 更新了 main.cpp 以使用 ArgumentParser 来改进命令行界面。 - 创建了 Entry.cpp 和 Entry.hpp 来封装虚拟机执行逻辑,从而实现更好的关注点分离。 - 调整了 xmake.lua 以包含 ArgumentParser 和 Entry 组件的新源文件。 - 强化了命令行使用的错误处理和用户反馈。
143 lines
5.4 KiB
C++
143 lines
5.4 KiB
C++
/*!
|
|
@file src/Core/CoreInfos.hpp
|
|
@brief 核心系统信息
|
|
@author PuqiAR (im@puqiar.top)
|
|
@date 2026-02-14
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <Deps/String/String.hpp>
|
|
#include <cstdint>
|
|
#include <string_view>
|
|
|
|
#define __FCORE_VERSION "0.5.0-alpha"
|
|
|
|
#if defined(_WIN32)
|
|
#define __FCORE_PLATFORM "Windows"
|
|
#elif defined(__APPLE__)
|
|
#define __FCORE_PLATFORM "Apple"
|
|
#elif defined(__linux__)
|
|
#define __FCORE_PLATFORM "Linux"
|
|
#elif defined(__unix__)
|
|
#define __FCORE_PLATFORM "Unix"
|
|
#else
|
|
#define __FCORE_PLATFORM "Unknown"
|
|
#endif
|
|
|
|
#if defined(__GNUC__)
|
|
#if defined(_WIN32)
|
|
#if defined(__clang__)
|
|
#define __FCORE_COMPILER "llvm-mingw"
|
|
#else
|
|
#define __FCORE_COMPILER "MinGW"
|
|
#endif
|
|
|
|
#else
|
|
#define __FCORE_COMPILER "GCC"
|
|
#endif
|
|
#elif defined(__clang__)
|
|
#define __FCORE_COMPILER "Clang"
|
|
#elif defined(_MSC_VER)
|
|
#define __FCORE_COMPILER "MSVC"
|
|
#else
|
|
#define __FCORE_COMPILER "Unknown"
|
|
#endif
|
|
|
|
#if SIZE_MAX == 18446744073709551615ull
|
|
#define __FCORE_ARCH "64"
|
|
#else
|
|
#define __FCORE_ARCH "86"
|
|
#endif
|
|
|
|
#define __FCORE_LINK_DEPS
|
|
|
|
namespace Fig
|
|
{
|
|
namespace Core
|
|
{
|
|
inline constexpr std::string_view VERSION = __FCORE_VERSION;
|
|
inline constexpr std::string_view LICENSE = "MIT";
|
|
inline constexpr std::string_view AUTHOR = "PuqiAR";
|
|
inline constexpr std::string_view PLATFORM = __FCORE_PLATFORM;
|
|
inline constexpr std::string_view COMPILER = __FCORE_COMPILER;
|
|
inline constexpr std::string_view COMPILE_TIME = __FCORE_COMPILE_TIME;
|
|
inline constexpr std::string_view ARCH = __FCORE_ARCH;
|
|
|
|
const std::string LOGO =
|
|
R"(
|
|
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
|
|
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
|
|
▒▒▒▒▒██████████▓▒▒▒▒
|
|
▒▒▒▒▒██████████▓▒▒▒▒
|
|
▒▒▒▒▒███▓▒▒▒▒▒▒▒▒▒▒▒
|
|
▒▒▒▒▒█████████▒▒▒▒▒▒
|
|
▒▒▒▒▒█████████▒▒▒▒▒▒
|
|
▒▒▒▒▒███▓▒▒▒▒▒▒▒▒▒▒▒
|
|
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
|
|
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
|
|
)";
|
|
|
|
const std::string LICENSE_TEXT =
|
|
R"(
|
|
MIT License (Fig)
|
|
|
|
Copyright (c) 2026 PuqiAR <im@puqiar.top>
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
1. The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
2. This project includes code from the following projects with their respective licenses:
|
|
- magic_enum (MIT License)
|
|
Copyright (c) 2019 - 2024 Daniil Goncharov
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
|
|
- json (MIT LICENSE) (for LSP Server JSON-RPC)
|
|
Copyright (c) 2013-2026 Niels Lohmann
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
|
|
)";
|
|
|
|
}; // namespace Core
|
|
}; // namespace Fig
|