refactor: refactor project layout

- move header files into an individual directory to prevent the possibility that file name is conflict in Linux include directory.
- update build script generator. use jinja2 template engine to get better view, rather than python code written by hand.
- add version number and version comparation macros in core library.
This commit is contained in:
2024-11-03 14:51:18 +08:00
parent 2206825223
commit 0cd9582757
38 changed files with 293 additions and 329 deletions

View File

@ -4,17 +4,17 @@ add_library(YYCCommonplace STATIC "")
target_sources(YYCCommonplace
PRIVATE
# Sources
COMHelper.cpp
ArgParser.cpp
ConfigManager.cpp
ConsoleHelper.cpp
DialogHelper.cpp
EncodingHelper.cpp
ExceptionHelper.cpp
StdPatch.cpp
IOHelper.cpp
StringHelper.cpp
WinFctHelper.cpp
YYCC/COMHelper.cpp
YYCC/ArgParser.cpp
YYCC/ConfigManager.cpp
YYCC/ConsoleHelper.cpp
YYCC/DialogHelper.cpp
YYCC/EncodingHelper.cpp
YYCC/ExceptionHelper.cpp
YYCC/StdPatch.cpp
YYCC/IOHelper.cpp
YYCC/StringHelper.cpp
YYCC/WinFctHelper.cpp
# Natvis (only for MSVC)
$<$<CXX_COMPILER_ID:MSVC>:YYCC.natvis>
)
@ -24,25 +24,26 @@ FILE_SET HEADERS
FILES
# Headers
# Common headers
Constraints.hpp
COMHelper.hpp
ArgParser.hpp
ConfigManager.hpp
ConsoleHelper.hpp
DialogHelper.hpp
EncodingHelper.hpp
EnumHelper.hpp
ExceptionHelper.hpp
StdPatch.hpp
IOHelper.hpp
ParserHelper.hpp
StringHelper.hpp
WinFctHelper.hpp
YYCC/Constraints.hpp
YYCC/COMHelper.hpp
YYCC/ArgParser.hpp
YYCC/ConfigManager.hpp
YYCC/ConsoleHelper.hpp
YYCC/DialogHelper.hpp
YYCC/EncodingHelper.hpp
YYCC/EnumHelper.hpp
YYCC/ExceptionHelper.hpp
YYCC/StdPatch.hpp
YYCC/IOHelper.hpp
YYCC/ParserHelper.hpp
YYCC/StringHelper.hpp
YYCC/WinFctHelper.hpp
# Windows including guard pair
WinImportPrefix.hpp
WinImportSuffix.hpp
# Misc
YYCCInternal.hpp
YYCC/WinImportPrefix.hpp
YYCC/WinImportSuffix.hpp
# Internal
YYCC/YYCCInternal.hpp
# Exposed
YYCCommonplace.hpp
)
# Setup header infomations

View File

@ -1,5 +1,38 @@
#pragma once
#pragma region Library Version and Comparation Macros
#define YYCC_VER_MAJOR 1
#define YYCC_VER_MINOR 3
#define YYCC_VER_PATCH 0
/// @brief Return true if left version number is equal to right version number, otherwise false.
#define YYCC_VERCMP_E(av1, av2, av3, bv1, bv2, bv3) ((av1) == (bv1) && (av2) == (bv2) && (av3) == (bv3))
/// @brief Return true if left version number is not equal to right version number, otherwise false.
#define YYCC_VERCMP_NE(av1, av2, av3, bv1, bv2, bv3) (!YYCC_VERCMP_E(av1, av2, av3, bv1, bv2, bv3))
/// @brief Return true if left version number is greater than right version number, otherwise false.
#define YYCC_VERCMP_G(av1, av2, av3, bv1, bv2, bv3) ( \
((av1) > (bv1)) || \
((av1) == (bv1) && (av2) > (bv2)) || \
((av1) == (bv1) && (av2) == (bv2) && (av3) > (bv3)) \
)
/// @brief Return true if left version number is greater than or equal to right version number, otherwise false.
#define YYCC_VERCMP_GE(av1, av2, av3, bv1, bv2, bv3) (YYCC_VERCMP_G(av1, av2, av3, bv1, bv2, bv3) || YYCC_VERCMP_E(av1, av2, av3, bv1, bv2, bv3))
/// @brief Return true if left version number is not lower than right version number, otherwise false.
#define YYCC_VERCMP_NL(av1, av2, av3, bv1, bv2, bv3) YYCC_VERCMP_GE(av1, av2, av3, bv1, bv2, bv3)
/// @brief Return true if left version number is lower than right version number, otherwise false.
#define YYCC_VERCMP_L(av1, av2, av3, bv1, bv2, bv3) ( \
((av1) < (bv1)) || \
((av1) == (bv1) && (av2) < (bv2)) || \
((av1) == (bv1) && (av2) == (bv2) && (av3) < (bv3)) \
)
/// @brief Return true if left version number is lower than or equal to right version number, otherwise false.
#define YYCC_VERCMP_LE(av1, av2, av3, bv1, bv2, bv3) (YYCC_VERCMP_L(av1, av2, av3, bv1, bv2, bv3) || YYCC_VERCMP_E(av1, av2, av3, bv1, bv2, bv3))
/// @brief Return true if left version number is not greater than right version number, otherwise false.
#define YYCC_VERCMP_NG(av1, av2, av3, bv1, bv2, bv3) YYCC_VERCMP_LE(av1, av2, av3, bv1, bv2, bv3)
#pragma endregion
#pragma region Operating System Identifier Macros
// Define operating system macros

View File

@ -1,18 +1,18 @@
#pragma once
#include "YYCCInternal.hpp"
#include "YYCC/YYCCInternal.hpp"
#include "EncodingHelper.hpp"
#include "StringHelper.hpp"
#include "ConsoleHelper.hpp"
#include "COMHelper.hpp"
#include "DialogHelper.hpp"
#include "ParserHelper.hpp"
#include "IOHelper.hpp"
#include "WinFctHelper.hpp"
#include "StdPatch.hpp"
#include "EnumHelper.hpp"
#include "ExceptionHelper.hpp"
#include "YYCC/EncodingHelper.hpp"
#include "YYCC/StringHelper.hpp"
#include "YYCC/ConsoleHelper.hpp"
#include "YYCC/COMHelper.hpp"
#include "YYCC/DialogHelper.hpp"
#include "YYCC/ParserHelper.hpp"
#include "YYCC/IOHelper.hpp"
#include "YYCC/WinFctHelper.hpp"
#include "YYCC/StdPatch.hpp"
#include "YYCC/EnumHelper.hpp"
#include "YYCC/ExceptionHelper.hpp"
#include "ConfigManager.hpp"
#include "ArgParser.hpp"
#include "YYCC/ConfigManager.hpp"
#include "YYCC/ArgParser.hpp"