diff --git a/.gitignore b/.gitignore index 72d5489f..6407405d 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,4 @@ **/*.cmake **/CMakeFiles/** **/reflect-cpp-tests +**/build/** diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..6a86c810 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.4) + +project(reflectcpp) + +include_directories( + "include" +) + +add_library(reflectcpp SHARED "src/yyjson.c") +add_library(reflectcpp_static STATIC "src/yyjson.c") + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -O2") diff --git a/README.md b/README.md index ebe2724e..e4ed1310 100644 --- a/README.md +++ b/README.md @@ -146,12 +146,25 @@ At the moment, this is work-in-progress. Here are some things that are still mis ## Installation +### Option 1: Header-only + If you **do not** need JSON support, then reflect-cpp is header-only. Simply copy the contents of the folder `include` into your source repository or add it to your include path. -If you **do** need JSON support, then you should also add `src/yyjson.c` to your source files for compilation. Note that `yyjson.c` is written in ANSI C. +### Option 2: Include source files into your own build + +Simply copy the contents of the folder `include` into your source repository or add it to your include path and also add `src/yyjson.c` to your source files for compilation. If you need support for other serialization formats like XML or flexbuffers, you should also include and link the respective libraries, as listed in the previous section. +### Option 3: Compilation using cmake + +``` +mkdir build +cd build +cmake .. +make +``` + ## Compiling the tests To compile the tests, do the following: