Skip to content

Integration

victor edited this page Oct 24, 2025 · 14 revisions

How to integrate 🛍️Smart_Store.

Clone the repo and start coding, no setup required.
Use the following command to install Smart_Store in your root folder:

git clone https://github.com/gem870/Smart_Store.git

Create a CMakeLists.txt file in your root folder and set up your CMake file to look like this for new users:

cmake_minimum_required(VERSION 3.16)
project(MyProject LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Check if the C++ standard is set correctly
add_subdirectory(Smart_Store)

if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp")
    message(FATAL_ERROR " src/main.cpp not found!")
else()
    message(STATUS " Found src/main.cpp")
endif()

# Assuming Smart_Store builds a target named ItemManagerLib
add_executable(MyProject src/main.cpp)

target_link_libraries(MyProject PRIVATE ItemManagerLib)

In your root folder, create a src folder with a file named main.cpp and paste any of the following code:

#include "t_manager/ItemManager.h"

struct MyType {
    int value;
    // ...
};

int main() {
    ItemManager manager;
    manager.addItem(std::make_shared<MyType>(MyType{42}), "my_tag");
    manager.displayByTag("my_tag");
    manager.exportToFile_Json("data.json");
    manager.undo();
    return 0;
}
#include "t_manager/ItemManager.h"
//For global storage of objects
struct MyType {
    int value;
    // ...
};

int main() {
    GlobalItemManager& globalManager = GlobalItemManager::getInstance();
    ItemManager& gb_manager = globalManager.getItemManager();
    gb_manager.addItem(std::make_shared<MyType>(MyType{42}), "my_tag");
    gb_manager.displayByTag("my_tag");
    gb_manager.exportToFile_Json("data.json");
    gb_manager.undo();
    return 0;
}

File structure

file structure

If completely set up, use the Command Prompt, PowerShell, or WSL terminal to build with the following commands:

mkdir build
cd build
cmake ..
cmake --build .

To output on the console.

For PowerShell use:

.\MyProject.exe

On the Command Prompt terminal, use:

MyProject.exe

Output on console:

Output >> If having a build error or segmentation fault, please reach out via email or GitHub issues.

🛍️ Smart_Store

::| Development Guide |::

If you encounter any issues and bugs, please reach out via email or GitHub issues.

Clone this wiki locally