Skip to content

Commit

Permalink
Refactors cmake out and uses make in its stead
Browse files Browse the repository at this point in the history
This replaces the previously-used build system with something that
is supposed to play nicer with Mac OSX.
  • Loading branch information
itamarhaber committed May 9, 2017
2 parents 8e11106 + d88e552 commit c68e8ea
Show file tree
Hide file tree
Showing 40 changed files with 642 additions and 543 deletions.
33 changes: 20 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,36 @@
language: c
compiler: gcc
dist: trusty

os:
- linux
- osx

compiler:
- gcc
- clang

matrix:
allow_failures:
- os: osx
include:
- os: linux
dist: trusty
sudo: required
- os: osx
osx_image: xcode8.3

branches:
only:
- master

addons:
packages:
- cmake
- cmake-data

before_install:
- sudo apt-get install cmake
- git clone --depth 1 https://github.com/antirez/redis.git
- cd redis
- make
- cd ..
- pip install redis rmtest

install:
- ./bootstrap.sh
- cmake -DREDIS_SERVER_PATH:FILEPATH=$PWD/redis/src/redis-server --build build
- cmake --build build --target all --config Release
- make all

script:
- cd build
- ctest -VV
- make test
47 changes: 0 additions & 47 deletions CMakeLists.txt

This file was deleted.

10 changes: 10 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
all:
$(MAKE) -C ./src all

test:
$(MAKE) -C ./test all
.PHONY: test

clean:
find ./ -name "*.[oa]" -exec rm {} \; -print
find ./ -name "*.so" -exec rm {} \; -print
3 changes: 0 additions & 3 deletions bootstrap.sh

This file was deleted.

12 changes: 9 additions & 3 deletions deps/RedisModuleSDK/rmutil/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ ifndef RM_INCLUDE_DIR
RM_INCLUDE_DIR=../
endif

CFLAGS = -g -fPIC -lc -lm -O3 -std=gnu99 -I$(RM_INCLUDE_DIR) -Wall -Wno-unused-function
CC=gcc
CFLAGS ?= -g -fPIC -lc -lm -O3 -std=gnu99 -I$(RM_INCLUDE_DIR) -Wall -Wno-unused-function
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
ifneq ($(uname_S),Linux)
CFLAGS += -mmacosx-version-min=10.6
endif
export CFLAGS

CC:=$(shell sh -c 'type $(CC) >/dev/null 2>/dev/null && echo $(CC) || echo gcc')

OBJS=util.o strings.o sds.o vector.o heap.o priority_queue.o
OBJS=util.o strings.o sds.o vector.o heap.o priority_queue.o alloc.o

all: librmutil.a

Expand Down
2 changes: 1 addition & 1 deletion deps/RedisModuleSDK/rmutil/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ char *rmalloc_strndup(const char *s, size_t n) {
* replaces all malloc functions in redis with the RM_Alloc family of functions,
* when running that code outside of redis, your app will crash. This function
* patches the RM_Alloc functions back to the original mallocs. */
void RMUTil_InitAlloc() {
void RMUtil_InitAlloc() {

RedisModule_Alloc = malloc;
RedisModule_Realloc = realloc;
Expand Down
7 changes: 4 additions & 3 deletions deps/RedisModuleSDK/rmutil/alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ char *rmalloc_strndup(const char *s, size_t n);
#define calloc(count, size) RedisModule_Calloc(count, size)
#define realloc(ptr, size) RedisModule_Realloc(ptr, size)
#define free(ptr) RedisModule_Free(ptr)

#ifdef strdup
#undef strdup
#endif
#define strdup(ptr) RedisModule_Strdup(ptr)

// /* More overriding */
// // needed to avoid calling strndup->malloc
/* More overriding */
// needed to avoid calling strndup->malloc
#ifdef strndup
#undef strndup
#endif
Expand All @@ -43,7 +44,7 @@ char *rmalloc_strndup(const char *s, size_t n);
/* This function shold be called if you are working with malloc-patched code
* ouside of redis, usually for unit tests. Call it once when entering your unit
* tests' main() */
void RMUTil_InitAlloc();
void RMUtil_InitAlloc();
#endif /* REDIS_MODULE_TARGET */

#endif /* __RMUTIL_ALLOC__ */
Loading

0 comments on commit c68e8ea

Please sign in to comment.