mirror of
https://gitee.com/apaki/unicstl.git
synced 2025-05-18 03:51:35 +08:00
想着把工程更新下,以后用cmake管理
This commit is contained in:
parent
c3927befbc
commit
5e7d07c7de
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
# chm
|
# cmake
|
||||||
*.chm
|
build/
|
||||||
|
|
||||||
# SI4
|
# SI4
|
||||||
SIP.si4project/
|
SIP.si4project/
|
||||||
|
24
CMakelists.txt
Normal file
24
CMakelists.txt
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
# 0. cmake 最低版本号要求
|
||||||
|
cmake_minimum_required(VERSION 3.8)
|
||||||
|
|
||||||
|
# 0. 项目信息
|
||||||
|
project(demo)
|
||||||
|
|
||||||
|
# 0. 查找当前目录下的所有文件,并将名称保存在DIR_SRC中
|
||||||
|
# aux_source_directory(. DIR_SRC)
|
||||||
|
|
||||||
|
# 1. 添加头文件路径
|
||||||
|
include_directories(include)
|
||||||
|
|
||||||
|
# 1. 添加子目录
|
||||||
|
add_subdirectory(src)
|
||||||
|
add_subdirectory(test)
|
||||||
|
|
||||||
|
# 2. 支持GDB
|
||||||
|
set(CMAKE_BUILD_TYPE "Debug")
|
||||||
|
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
|
||||||
|
|
||||||
|
# install
|
||||||
|
set(CMAKE_INSTALL_PREFIX "./release")
|
@ -1,31 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio 15
|
|
||||||
VisualStudioVersion = 15.0.28307.757
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "datastruct", "datastruct\datastruct.vcxproj", "{3990515A-48AA-4CFF-9014-C35B11F02C87}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|x64 = Debug|x64
|
|
||||||
Debug|x86 = Debug|x86
|
|
||||||
Release|x64 = Release|x64
|
|
||||||
Release|x86 = Release|x86
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{3990515A-48AA-4CFF-9014-C35B11F02C87}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{3990515A-48AA-4CFF-9014-C35B11F02C87}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{3990515A-48AA-4CFF-9014-C35B11F02C87}.Debug|x86.ActiveCfg = Debug|Win32
|
|
||||||
{3990515A-48AA-4CFF-9014-C35B11F02C87}.Debug|x86.Build.0 = Debug|Win32
|
|
||||||
{3990515A-48AA-4CFF-9014-C35B11F02C87}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{3990515A-48AA-4CFF-9014-C35B11F02C87}.Release|x64.Build.0 = Release|x64
|
|
||||||
{3990515A-48AA-4CFF-9014-C35B11F02C87}.Release|x86.ActiveCfg = Release|Win32
|
|
||||||
{3990515A-48AA-4CFF-9014-C35B11F02C87}.Release|x86.Build.0 = Release|Win32
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {65951581-EEEC-4CFD-AC52-2B52711979E5}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
@ -1,175 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<VCProjectVersion>15.0</VCProjectVersion>
|
|
||||||
<ProjectGuid>{3990515A-48AA-4CFF-9014-C35B11F02C87}</ProjectGuid>
|
|
||||||
<Keyword>Win32Proj</Keyword>
|
|
||||||
<RootNamespace>datastruct</RootNamespace>
|
|
||||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v143</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<ImportGroup Label="ExtensionSettings">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="Shared">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<LinkIncremental>true</LinkIncremental>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<LinkIncremental>true</LinkIncremental>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<LinkIncremental>false</LinkIncremental>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<LinkIncremental>false</LinkIncremental>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<ConformanceMode>true</ConformanceMode>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<ConformanceMode>true</ConformanceMode>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<ConformanceMode>true</ConformanceMode>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<SDLCheck>true</SDLCheck>
|
|
||||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<ConformanceMode>true</ConformanceMode>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="deque.c" />
|
|
||||||
<ClCompile Include="deque_test.c" />
|
|
||||||
<ClCompile Include="list.c" />
|
|
||||||
<ClCompile Include="list_test.c" />
|
|
||||||
<ClCompile Include="main.c" />
|
|
||||||
<ClCompile Include="queue.c" />
|
|
||||||
<ClCompile Include="queue_test.c" />
|
|
||||||
<ClCompile Include="rbtree.c" />
|
|
||||||
<ClCompile Include="rbtree_test.c" />
|
|
||||||
<ClCompile Include="stack.c" />
|
|
||||||
<ClCompile Include="stack_test.c" />
|
|
||||||
<ClCompile Include="tree.c" />
|
|
||||||
<ClCompile Include="tree_test.c" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="common.h" />
|
|
||||||
<ClInclude Include="config.h" />
|
|
||||||
<ClInclude Include="demo.h" />
|
|
||||||
<ClInclude Include="deque.h" />
|
|
||||||
<ClInclude Include="list.h" />
|
|
||||||
<ClInclude Include="queue.h" />
|
|
||||||
<ClInclude Include="rbtree.h" />
|
|
||||||
<ClInclude Include="stack.h" />
|
|
||||||
<ClInclude Include="test.h" />
|
|
||||||
<ClInclude Include="tree.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
</ImportGroup>
|
|
||||||
</Project>
|
|
@ -1,96 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="源文件">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="头文件">
|
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="资源文件">
|
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="测试">
|
|
||||||
<UniqueIdentifier>{03f28c38-31fa-4cef-97f5-67fbe3b4a2e2}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="示例">
|
|
||||||
<UniqueIdentifier>{9b4f0950-addb-4047-9212-61b574e2b25d}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="list.c">
|
|
||||||
<Filter>源文件</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="main.c">
|
|
||||||
<Filter>源文件</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="queue.c">
|
|
||||||
<Filter>源文件</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="stack.c">
|
|
||||||
<Filter>源文件</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="tree.c">
|
|
||||||
<Filter>源文件</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="rbtree.c">
|
|
||||||
<Filter>源文件</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="tree_test.c">
|
|
||||||
<Filter>测试</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="stack_test.c">
|
|
||||||
<Filter>测试</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="queue_test.c">
|
|
||||||
<Filter>测试</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="rbtree_test.c">
|
|
||||||
<Filter>测试</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="list_test.c">
|
|
||||||
<Filter>测试</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="deque.c">
|
|
||||||
<Filter>源文件</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="deque_test.c">
|
|
||||||
<Filter>测试</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="list.h">
|
|
||||||
<Filter>头文件</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="queue.h">
|
|
||||||
<Filter>头文件</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="stack.h">
|
|
||||||
<Filter>头文件</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="tree.h">
|
|
||||||
<Filter>头文件</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="rbtree.h">
|
|
||||||
<Filter>头文件</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="demo.h">
|
|
||||||
<Filter>示例</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="test.h">
|
|
||||||
<Filter>测试</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="common.h">
|
|
||||||
<Filter>头文件</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="config.h">
|
|
||||||
<Filter>头文件</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="deque.h">
|
|
||||||
<Filter>头文件</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup />
|
|
||||||
</Project>
|
|
4
example/CMakelists.txt
Normal file
4
example/CMakelists.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
aux_source_directory(. DIR_LIB_SRC)
|
||||||
|
|
||||||
|
add_library(unicstl STATIC ${DIR_LIB_SRC})
|
@ -2,7 +2,7 @@
|
|||||||
#ifndef _DEQUE_H_
|
#ifndef _DEQUE_H_
|
||||||
#define _DEQUE_H_
|
#define _DEQUE_H_
|
||||||
|
|
||||||
#include "common.h"
|
#include "unicstl.h"
|
||||||
|
|
||||||
struct _deque_node
|
struct _deque_node
|
||||||
{
|
{
|
||||||
@ -48,7 +48,7 @@ struct _deque
|
|||||||
|
|
||||||
// compare
|
// compare
|
||||||
int (*cmp)(void* obj, void* obj2);
|
int (*cmp)(void* obj, void* obj2);
|
||||||
bool (*sort)(struct _list* self, uint8_t reserve);
|
bool (*sort)(struct _deque* self, uint8_t reserve);
|
||||||
|
|
||||||
// print
|
// print
|
||||||
void (*print)(struct _deque* self);
|
void (*print)(struct _deque* self);
|
@ -1,9 +1,7 @@
|
|||||||
#ifndef _LIST_H_
|
#ifndef _LIST_H_
|
||||||
#define _LIST_H_
|
#define _LIST_H_
|
||||||
|
|
||||||
#include "common.h"
|
#include "unicstl.h"
|
||||||
|
|
||||||
#ifdef LIST
|
|
||||||
|
|
||||||
struct _list
|
struct _list
|
||||||
{
|
{
|
||||||
@ -52,6 +50,4 @@ struct _list
|
|||||||
|
|
||||||
bool list_init(struct _list* list, uint32_t obj_size);
|
bool list_init(struct _list* list, uint32_t obj_size);
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // _LIST_H_
|
#endif // _LIST_H_
|
29
include/unicstl.h
Normal file
29
include/unicstl.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
#ifndef _DEMO_H_
|
||||||
|
#define _DEMO_H_
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#if RBTREE == 1
|
||||||
|
#include "rbtree.h"
|
||||||
|
typedef prbtree_node_t stack_data_t;
|
||||||
|
typedef prbtree_node_t queue_data_t;
|
||||||
|
|
||||||
|
typedef int list_data_t;
|
||||||
|
#elif AVLTREE == 1
|
||||||
|
#include "tree.h"
|
||||||
|
typedef ptree_node_t stack_data_t;
|
||||||
|
typedef ptree_node_t queue_data_t;
|
||||||
|
#else
|
||||||
|
typedef int stack_data_t;
|
||||||
|
typedef int queue_data_t;
|
||||||
|
typedef int list_data_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _DEMO_H_
|
||||||
|
|
7
mk.bat
Normal file
7
mk.bat
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
@REM D:\Lang\cmake-3.27.5-windows-x86_64\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=D:\Software\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=D:\Software\mingw64\bin\g++.exe -SF:/OpenDemo/1_vsc_cmake -Bf:/OpenDemo/1_vsc_cmake/build -G "MinGW Makefiles"
|
||||||
|
@REM cmake -Bbuild -G "Visual Studio 17 2022"
|
||||||
|
|
||||||
|
cmake -B build -G "MinGW Makefiles"
|
||||||
|
|
||||||
|
make -C build
|
||||||
|
make -C install
|
7
src/CMakelists.txt
Normal file
7
src/CMakelists.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
aux_source_directory(. LIB_SRC)
|
||||||
|
|
||||||
|
add_library(unicstl STATIC ${LIB_SRC})
|
||||||
|
|
||||||
|
# install
|
||||||
|
install(TARGETS unicstl DESTINATION bin)
|
2
src/unicstl.c
Normal file
2
src/unicstl.c
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
#include "unicstl.h"
|
12
test/CMakelists.txt
Normal file
12
test/CMakelists.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
aux_source_directory(. DIR_TEST)
|
||||||
|
|
||||||
|
include_directories(.)
|
||||||
|
|
||||||
|
# generate target
|
||||||
|
add_executable(${PROJECT_NAME} test.c)
|
||||||
|
# link libary
|
||||||
|
target_link_libraries(${PROJECT_NAME} unicstl)
|
||||||
|
|
||||||
|
# install
|
||||||
|
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
|
@ -1,4 +1,4 @@
|
|||||||
#include "common.h"
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
@ -2,9 +2,6 @@
|
|||||||
#ifndef _TEST_H_
|
#ifndef _TEST_H_
|
||||||
#define _TEST_H_
|
#define _TEST_H_
|
||||||
|
|
||||||
#include <Windows.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
// It is recommended to keep one at the same time
|
// It is recommended to keep one at the same time
|
||||||
@ -22,9 +19,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define SYSTEM_PAUSE() (system("pause"))
|
|
||||||
|
|
||||||
void stack_test(void);
|
void stack_test(void);
|
||||||
void queue_test(void);
|
void queue_test(void);
|
||||||
void list_test(void);
|
void list_test(void);
|
Loading…
Reference in New Issue
Block a user