Skip to content

windows_setup

guoling edited this page Sep 2, 2020 · 5 revisions

MMKV for Win32

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, Win32 and POSIX.

Getting Started

Prerequisites

  • Windows XP and above are supported.
  • Visual Studio 2015 and above. (Other versions of Visual Studio should work as well, but not tested yet.)

Installation

  • Via Source

    1. Getting source code from git repository:

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

    3. Add MMKV 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 2017, 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 git repository:

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

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

    4. Open the target folder (Win32/MMKV/Release or Win32/MMKV/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 2017, 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