add more files msgs

This commit is contained in:
2025-12-04 15:11:15 +07:00
parent a78034191c
commit 2c40e67e32
91 changed files with 3548 additions and 42 deletions

32
utils/CMakeLists.txt Normal file
View File

@@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 3.10)
# --- Project riêng cho utils ---
project(utils LANGUAGES CXX)
# --- Tạo INTERFACE library (header-only) ---
add_library(utils INTERFACE)
# --- Include directories ---
target_include_directories(utils
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> # build nội bộ
$<INSTALL_INTERFACE:include/utils> # dùng khi install/export
)
# --- Cài đặt header files ---
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION include/utils
FILES_MATCHING PATTERN "*.h"
)
# --- Cài đặt target INTERFACE để export ---
install(TARGETS utils
EXPORT utils-targets
)
# --- Export target file ---
install(EXPORT utils-targets
FILE utils-targets.cmake
NAMESPACE utils::
DESTINATION lib/cmake/utils
)

11
utils/utils.h Normal file
View File

@@ -0,0 +1,11 @@
#ifndef UTILIS_MSGS_H
#define UTILIS_MSGS_H
#include <cmath>
template <typename T>
bool isEqual(const T& a, const T& b, double eps = 1e-5)
{
return std::fabs(a - b) < eps;
}
#endif // UTILIS_MSGS_H