To install API you need GNU make, G++ compiler and GIT installed on your operating system. Once latter are installed, just run following console commands in YOUR_PROJECTS_FOLDER:
git clone https://github.com/aherne/c-data-structures-api.git
cd c-data-structures-api
make
This will create a dynamic library called libcds ready to be linked by any other projects.
To link above dynamic library to ANOTHER_PROJECT @ YOUR_PROJECTS_FOLDER, follow this example:
cd ../ANOTHER_PROJECT
make LIB="YOUR_PROJECTS_FOLDER/c-data-structures-api"
Where above makefile will need to include sources and link dynamic library, like in this example:
CC = g++
CFLAGS = -O2 -g3 -Wall -c
all:
$(CC) $(CFLAGS) -I$(LIB)/src "src/benchmarks/ListBenchmark.cpp"
$(CC) $(CFLAGS) -I$(LIB)/src "src/benchmarks/MapBenchmark.cpp"
$(CC) $(CFLAGS) -I$(LIB)/src "src/benchmarks/SetBenchmark.cpp"
$(CC) $(CFLAGS) -I$(LIB)/src "src/benchmark.cpp"
$(CC) -L$(LIB) -lcds -o "benchmark" ListBenchmark.o MapBenchmark.o SetBenchmark.o benchmark.o
clean:
rm -rf *.o
rm benchmark
To run API unit tests, go back to YOUR_PROJECTS_FOLDER/c-data-structures-api and run:
make tests