Skip to content

windows_setup

guoling edited this page Apr 19, 2024 · 5 revisions

MMKV for Windows

MMKV is an efficient, small, easy-to-use mobile key-value storage framework used in the WeChat application. It's currently available on both Android, iOS/macOS, Windows and POSIX.

Getting Started

Prerequisites

  • Windows XP and above are supported.
  • Visual Studio 2019 and above.

Installation

  • Via Source

    1. Getting source code from the git repository:

      git clone https://github.com/Tencent/MMKV.git
    2. Add Core/core.vcxproj to your solution;

    3. Add core project to your project's dependencies;

    4. Add $(OutDir)include to your project's C/C++ -> General -> Additional Include Directories;

    5. Add $(OutDir) to your project's Linker -> General -> Additional Library Directories;

    6. Add mmkv.lib to your project's Linker -> Input -> Additional Dependencies;

    7. Add #include <MMKV/MMKV.h> to your source file and we are done.

    note:

    1. MMKV is compiled with MT/MTd runtime by default. If your project uses MD/MDd, you should change MMKV's setting to match your project's (C/C++ -> Code Generation -> Runtime Library), or wise versa.
    2. MMKV is developed with Visual Studio 2022, change the Platform Toolset if you use a different version of Visual Studio.
    3. If you are pretty sure that encryption is not needed, you can turn on the preprocess directive MMKV_DISABLE_CRYPT in Core/MMKVPredef.h to save some binary size.
  • Build library from Source

    1. Getting source code from the git repository:

      git clone https://github.com/Tencent/MMKV.git
    2. Open Core/core.vcxproj with Visual Studio;

    3. Build the project (with Release or Debug, x86 or x64);

    4. Open the target folder (Win32/MMKV/{x64}/Release or Win32/MMKV/{x64}/Debug);

    5. Copy static library mmkv.lib and symbol mmkv.pdb to your library folder;

    6. Copy header files include/MMKV to your header folder;

    7. Add mmkv.lib to your project's Linker -> Input -> Additional Dependencies;

    8. Add #include <MMKV/MMKV.h> to your source file and we are done.

    note:

    1. MMKV is compiled with MT/MTd runtime by default. If your project uses MD/MDd, you should change MMKV's setting to match your project's (C/C++ -> Code Generation -> Runtime Library), or wise versa.
    2. MMKV is developed with Visual Studio 2022, change the Platform Toolset if you use a different version of Visual Studio.
    3. If you are pretty sure that encryption is not needed, you can turn on the preprocess directive MMKV_DISABLE_CRYPT in Core/MMKVPredef.h to save some binary size.

What's next

Clone this wiki locally