From 2cdf5db037de20ca4b9d3428f88f50632e2a38e8 Mon Sep 17 00:00:00 2001 From: ninemine <106434473+NINEMINEsigma@users.noreply.github.com> Date: Thu, 12 Jun 2025 14:59:06 +0800 Subject: [PATCH] BS 0.0.1 [Runtime]/Generics --- CMakeLists.txt | 1 + Convention/CMakeLists.txt | 12 +-- .../Config.h => [Runtime]/Config.hpp} | 8 +- Convention/[Runtime]/Generics/NTree.hpp | 16 ++++ Convention/[Runtime]/Generics/Sequence.hpp | 21 +++++ Convention/src/CMakeLists.txt | 85 ------------------- [Test]/CMakeLists.txt | 4 + [Test]/test.cpp | 6 ++ 8 files changed, 56 insertions(+), 97 deletions(-) rename Convention/{include/Config.h => [Runtime]/Config.hpp} (99%) create mode 100644 Convention/[Runtime]/Generics/NTree.hpp create mode 100644 Convention/[Runtime]/Generics/Sequence.hpp delete mode 100644 Convention/src/CMakeLists.txt create mode 100644 [Test]/CMakeLists.txt create mode 100644 [Test]/test.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 55b18c9..3d3c24f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,7 @@ endif() # Project add_subdirectory("Convention") +add_subdirectory("[Test]") message("Root: CMAKE_CXX_STANDARD = ${CMAKE_CXX_STANDARD}" ) message("Root: CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}") diff --git a/Convention/CMakeLists.txt b/Convention/CMakeLists.txt index 2f58ba0..1b1bb4b 100644 --- a/Convention/CMakeLists.txt +++ b/Convention/CMakeLists.txt @@ -1,12 +1,8 @@ message("Convention: --- ----- ----- ----- ----- --") -# 设置CMake版本要求和项目名称 -cmake_minimum_required(VERSION 3.17) -project(ConventionLibrary VERSION 0.1.1) - -# 引入GNUInstallDirs以获取标准安装路径 -include(GNUInstallDirs) - -add_subdirectory(src) +install(DIRECTORY [Runtime] + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + FILES_MATCHING PATTERN "*.*" + PATTERN "*.cpp" EXCLUDE) message("Convention: ----- ----- ----- ----- -----") \ No newline at end of file diff --git a/Convention/include/Config.h b/Convention/[Runtime]/Config.hpp similarity index 99% rename from Convention/include/Config.h rename to Convention/[Runtime]/Config.hpp index eb360ef..b2fda12 100644 --- a/Convention/include/Config.h +++ b/Convention/[Runtime]/Config.hpp @@ -1,6 +1,6 @@ #pragma once -#ifndef CONVENTION_KIT_CONFIG_H -#define CONVENTION_KIT_CONFIG_H +#ifndef Convention_Runtime_Config_hpp +#define Convention_Runtime_Config_hpp #pragma warning(disable : 4267) #pragma warning(disable : 4244) #pragma warning(disable : 4996) @@ -1645,7 +1645,7 @@ namespace Convention #pragma endregion -#pragma region Tree +#pragma region ElementTuple namespace Convention { @@ -1753,4 +1753,4 @@ namespace Convention #pragma endregion -#endif // !CONVENTION_KIT_CONFIG_H +#endif // !Convention_Runtime_Config_hpp diff --git a/Convention/[Runtime]/Generics/NTree.hpp b/Convention/[Runtime]/Generics/NTree.hpp new file mode 100644 index 0000000..fc777a9 --- /dev/null +++ b/Convention/[Runtime]/Generics/NTree.hpp @@ -0,0 +1,16 @@ +#pragma once +#ifndef Convention_Runtime_Generics_NTree_hpp +#define Convention_Runtime_Generics_NTree_hpp + +#include"Config.hpp" + +namespace Convention +{ + namespace Generics + { + + + } +} + +#endif Convention_Runtime_Generics_NTree_hpp \ No newline at end of file diff --git a/Convention/[Runtime]/Generics/Sequence.hpp b/Convention/[Runtime]/Generics/Sequence.hpp new file mode 100644 index 0000000..a12ddd9 --- /dev/null +++ b/Convention/[Runtime]/Generics/Sequence.hpp @@ -0,0 +1,21 @@ +#pragma once +#ifndef Convention_Runtime_Generics_Sequence_hpp +#define Convention_Runtime_Generics_Sequence_hpp + +#include"Config.hpp" + +namespace Convention +{ + namespace Generics + { + + template + using Array = std::array; + + template class Allocator> + using Vector = std::vector>; + + } +} + +#endif Convention_Runtime_Generics_Sequence_hpp \ No newline at end of file diff --git a/Convention/src/CMakeLists.txt b/Convention/src/CMakeLists.txt deleted file mode 100644 index 9ae9e02..0000000 --- a/Convention/src/CMakeLists.txt +++ /dev/null @@ -1,85 +0,0 @@ -aux_source_directory(./src cpps) - -# 创建库 -add_library(Convention-Static STATIC ${cpps}) -add_library(Convention-Shared SHARED ${cpps}) - -# 设置别名,使得在本项目中可以使用命名空间版本 -add_library(Convention::Static ALIAS Convention-Static) -add_library(Convention::Shared ALIAS Convention-Shared) - -# 为库设置属性 -set_target_properties(Convention-Static PROPERTIES - OUTPUT_NAME "Convention-Static" - EXPORT_NAME "Static" - POSITION_INDEPENDENT_CODE ON -) - -set_target_properties(Convention-Shared PROPERTIES - OUTPUT_NAME "Convention-Shared" - EXPORT_NAME "Shared" - POSITION_INDEPENDENT_CODE ON - WINDOWS_EXPORT_ALL_SYMBOLS ON - ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Convention" - LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Convention" - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Convention" -) - -# 设置包含目录 -target_include_directories(Convention-Static PUBLIC - $ - $ -) - -target_include_directories(Convention-Shared PUBLIC - $ - $ -) - -# 安装头文件 -install(FILES ${Root_Headers} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Convention) - -# 安装库文件并生成导出目标 -install(TARGETS Convention-Static - EXPORT ConventionTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install(TARGETS Convention-Shared - EXPORT ConventionTargets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - -# 安装导出目标文件 -install(EXPORT ConventionTargets - FILE ConventionTargets.cmake - NAMESPACE Convention:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Convention) - -# 生成配置文件 -include(CMakePackageConfigHelpers) - -# 生成版本文件 -write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/ConventionConfigVersion.cmake" - VERSION ${PROJECT_VERSION} - COMPATIBILITY SameMajorVersion -) - -# 配置并安装Config文件 -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ConventionConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/ConventionConfig.cmake - @ONLY -) - -# 安装配置文件 -install(FILES - "${CMAKE_CURRENT_BINARY_DIR}/ConventionConfig.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/ConventionConfigVersion.cmake" - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Convention -) - -message("Convention: ----- ----- ----- ----- -----") \ No newline at end of file diff --git a/[Test]/CMakeLists.txt b/[Test]/CMakeLists.txt new file mode 100644 index 0000000..90416b0 --- /dev/null +++ b/[Test]/CMakeLists.txt @@ -0,0 +1,4 @@ +add_executable(TEST test.cpp) +include_directories(${PROJECT_SOURCE_DIR}/Convention/[Runtime]) +install(TARGETS TEST + RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) \ No newline at end of file diff --git a/[Test]/test.cpp b/[Test]/test.cpp new file mode 100644 index 0000000..a80d648 --- /dev/null +++ b/[Test]/test.cpp @@ -0,0 +1,6 @@ +#include"Config.hpp" + +int main() +{ + +} \ No newline at end of file