diff --git a/CMakeLists.txt b/CMakeLists.txt index 36ad073..39e9e7b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,21 @@ -add_executable(GetCpuInfo GetCpuInfo.cpp) -target_link_libraries(GetCpuInfo CMCore CMPlatform) +macro(cm_example_project project_name) + target_link_libraries(${project_name} PRIVATE CMCore CMPlatform) + + if(UNIX) + target_link_libraries(${project_name} PRIVATE dl) + endif() + + IF(WIN32) + set_debugger_directory(${project_name} ${CMAKE_CURRENT_SOURCE_DIR}) + ENDIF() + + set_property(TARGET ${project_name} PROPERTY FOLDER "CM/Examples") +endmacro() + + +add_executable(GetCpuInfo GetCpuInfo.cpp) +cm_example_project(GetCpuInfo) + +add_executable(CollectionTest CollectionTest.cpp) +cm_example_project(CollectionTest) diff --git a/CollectionTest.cpp b/CollectionTest.cpp new file mode 100644 index 0000000..a072898 --- /dev/null +++ b/CollectionTest.cpp @@ -0,0 +1,38 @@ +#include +#include + +using namespace hgl; +using namespace std; + +template class NewList:public Collection +{ + +public: + + NewList(MemoryBlock *amb=new MemoryBlock(new MemoryAllocator)):Collection(amb) + { + } + + virtual ~NewList()=default; + + +};// + +void main(int,char **) +{ + { + MemoryAllocator *ma=new MemoryAllocator; + + ma->Alloc(1024); + + MemoryBlock mb(ma); + } + + { + cout<<"Collection"< ulist; + + ulist.Add(1); + } +}