BS 0.0.1 [Runtime]/Generics
This commit is contained in:
@@ -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}")
|
||||
|
@@ -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: ----- ----- ----- ----- -----")
|
@@ -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
|
16
Convention/[Runtime]/Generics/NTree.hpp
Normal file
16
Convention/[Runtime]/Generics/NTree.hpp
Normal file
@@ -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
|
21
Convention/[Runtime]/Generics/Sequence.hpp
Normal file
21
Convention/[Runtime]/Generics/Sequence.hpp
Normal file
@@ -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<typename Element, size_t size>
|
||||
using Array = std::array<Element, size>;
|
||||
|
||||
template<typename Element, template<typename> class Allocator>
|
||||
using Vector = std::vector<Element, Allocator<Element>>;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif Convention_Runtime_Generics_Sequence_hpp
|
@@ -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
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
target_include_directories(Convention-Shared PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
# 安装头文件
|
||||
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: ----- ----- ----- ----- -----")
|
4
[Test]/CMakeLists.txt
Normal file
4
[Test]/CMakeLists.txt
Normal file
@@ -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)
|
6
[Test]/test.cpp
Normal file
6
[Test]/test.cpp
Normal file
@@ -0,0 +1,6 @@
|
||||
#include"Config.hpp"
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user