From 1a5bac87e8e6dcd717851ae69d7c2c64a020e5f9 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 11 Jul 2018 13:10:40 -0700 Subject: [PATCH] build: switched from make to cmake --- .gitignore | 1 + CMakeLists.txt | 11 +++++++++++ test/CMakeLists.txt | 10 ++++++++++ test/Makefile | 22 ---------------------- test/hashmap_test.c | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 test/CMakeLists.txt delete mode 100644 test/Makefile diff --git a/.gitignore b/.gitignore index c6127b3..89d48e2 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,4 @@ modules.order Module.symvers Mkfile.old dkms.conf +/build/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..122c754 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 2.8) + +project(hashmap) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wunused -Werror") + +file(GLOB SOURCES src/*.c) + +# Shared library +add_library(hashmap SHARED ${SOURCES}) +target_include_directories(hashmap PUBLIC src) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..864438c --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.8) + +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wunused -Werror") + +# Build hashmap library with metrics enabled +add_definitions(-DHASHMAP_METRICS) + +include_directories(../src) + +add_executable(hashmap_test ../src/hashmap.c hashmap_test.c) diff --git a/test/Makefile b/test/Makefile deleted file mode 100644 index fcd61d6..0000000 --- a/test/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -TOP_DIR := $(CURDIR)/.. -SRC_DIR := $(TOP_DIR)/src - -TARGET_EXEC := hashmap_test - -SOURCES := $(SRC_DIR)/hashmap.c hashmap_test.c - -CFLAGS += -O0 -g -ggdb -Wall -Wunused -Werror -I$(SRC_DIR) -DHASHMAP_METRICS - -OBJS := $(SOURCES:%.c=%.o) - - -test: $(TARGET_EXEC) - -$(TARGET_EXEC): $(OBJS) - @echo EXEC $@ ; \ - $(CC) -o $@ $(OBJS) - -clean: - rm -f $(OBJS) $(TARGET_EXEC) - -.PHONY: test clean diff --git a/test/hashmap_test.c b/test/hashmap_test.c index 1ab618e..6235edb 100644 --- a/test/hashmap_test.c +++ b/test/hashmap_test.c @@ -485,7 +485,7 @@ bool test_reset(struct hashmap *map, void **keys) return true; } -const struct test const tests[] = { +const struct test tests[] = { { .name = "put performance", .description = "put new hash keys",