Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexStocks committed Oct 18, 2023
0 parents commit 879d2ad
Show file tree
Hide file tree
Showing 55 changed files with 20,608 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# vim temp files
*.swp
# Compiled Object files
*.slo
*.lo
*.o
*.obj
*pb.cc
*pb.h
build
cmake-build-debug
cmake-build-release

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll


# Compiled Static libraries
*.lai *.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# Log path
make_config.mk
log/
lib/
output/

# DB
db/
dump/
src/dbsync/

# third party
gdb.txt
tags

# IDE
.vscode

# generate
make_config.mk
src/*.d
src/build_version.cc

#cache
.cache

.idea/


#build
build/
buildtrees
deps

#develop container
.devcontainer

# include codis fe javascript lib files
!codis/cmd/fe/assets/**

tests/tmp
32 changes: 32 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)

OPTION(BUILD_SHARED_LIBS "Build shared libraries" OFF)
OPTION(DISABLE_TESTS "If tests should be compiled or not" OFF)

PROJECT(rediscache LANGUAGES "C" VERSION 4.0.14)

AUX_SOURCE_DIRECTORY(. LIB_SOURCES)

SET(CMAKE_C_FLAGS "-std=c99 -O2 -pedantic -DREDIS_STATIC='' -Wall -W -Wno-missing-field-initializers -Wno-uninitialized -fPIC -Wcpp")

FILE(GLOB_RECURSE H_FILES "*.h")
ADD_LIBRARY(rediscache STATIC ${LIB_SOURCES})

#SET_TARGET_PROPERTIES(rediscache PROPERTIES PUBLIC_HEADER "${H_FILES}")
# SET({CMAKE_INSTALL_INCLUDEDIR} "include")
# INSTALL(TARGETS rediscache
# PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/rediscache"
# LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
# )
# INSTALL(TARGETS rediscache
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_PREFIX}
# LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}
# )

# message(STATUS "CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}")
# message(STATUS "CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}")
# message(STATUS "H_FILES ${H_FILES}")

INSTALL(FILES ${H_FILES} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/rediscache")
INSTALL(TARGETS rediscache DESTINATION "${CMAKE_INSTALL_LIBDIR}")

34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# gcc setting
CC=gcc
STD=-std=c99 -pedantic -DREDIS_STATIC=''
WARN=-Wall -W -Wno-missing-field-initializers -Wno-uninitialized
OPT=-O2
DEBUG=-g
CFLAGS=-fPIC -Wcpp
FINAL_CFLAGS=$(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS)

# ar setting
AR=ar
ARFLAGS=rs

# build proj setting
LIB_SOURCES := $(wildcard *.c)
LIB_OBJECTS = $(LIB_SOURCES:.c=.o)
LIB_NAME=libredisdb
LIBRARY=${LIB_NAME}.a

# target
.PHONY: all clean

all: $(LIBRARY)

$(LIB_OBJECTS): $(LIB_SOURCES)
$(CC) $(FINAL_CFLAGS) -c $(LIB_SOURCES)

$(LIBRARY): $(LIB_OBJECTS)
rm -f $@
$(AR) $(ARFLAGS) $@ $(LIB_OBJECTS)

clean:
rm -f $(LIBRARY)
rm -f *.o
Loading

0 comments on commit 879d2ad

Please sign in to comment.