mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 02:47:56 +08:00
Use cmake files.
This commit is contained in:
parent
f2c6b54dba
commit
f3f0b60f81
109
app/wizard_demo/pkv/CMakeLists.txt
Normal file
109
app/wizard_demo/pkv/CMakeLists.txt
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
cmake_minimum_required(VERSION 2.8)
|
||||||
|
project(pkv)
|
||||||
|
|
||||||
|
if (${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
message(FATAL_ERROR "Please into another dir to build!")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
message(FATAL_ERROR "Please into another dir to build!")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_BUILD_TYPE STREQUAL "RELEASE")
|
||||||
|
message(STATUS "build pkv for release version")
|
||||||
|
elseif (CMAKE_BUILD_TYPE STREQUAL "DEBUG")
|
||||||
|
message(STATUS "build pkv for debug version")
|
||||||
|
else()
|
||||||
|
message(STATUS "build pkv for default version")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
add_definitions("-Wno-invalid-source-encoding")
|
||||||
|
include_directories("/usr/local/include")
|
||||||
|
SET(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
|
||||||
|
SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
|
||||||
|
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "unknown CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
set(home_path ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
|
||||||
|
set(acl_path ${home_path}/lib_acl)
|
||||||
|
set(acl_cpp_path ${home_path}/lib_acl_cpp)
|
||||||
|
set(fiber_path ${home_path}/lib_fiber/c)
|
||||||
|
set(fiber_cpp_path ${home_path}/lib_fiber/cpp)
|
||||||
|
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${acl_path}/include
|
||||||
|
${acl_cpp_path}/include
|
||||||
|
${fiber_path}/include
|
||||||
|
${fiber_cpp_path}/include
|
||||||
|
)
|
||||||
|
|
||||||
|
set(base_path ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
set(src_paths
|
||||||
|
${base_path}
|
||||||
|
${base_path}/db
|
||||||
|
${base_path}/db/rocksdb
|
||||||
|
${base_path}/db/wt
|
||||||
|
${base_path}/proto
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach(iter ${src_paths})
|
||||||
|
aux_source_directory(${iter} src_files)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
#SET(CMAKE_VERBOSE_MAKEFILE on)
|
||||||
|
|
||||||
|
add_definitions(
|
||||||
|
"-g"
|
||||||
|
"-W"
|
||||||
|
"-Wall"
|
||||||
|
"-Werror"
|
||||||
|
"-Wshadow"
|
||||||
|
"-Wformat"
|
||||||
|
"-Wpointer-arith"
|
||||||
|
"-D_REENTRANT"
|
||||||
|
"-Wno-long-long"
|
||||||
|
"-Wuninitialized"
|
||||||
|
"-D_POSIX_PTHREAD_SEMANTICS"
|
||||||
|
"-fexceptions"
|
||||||
|
"-Wno-unused-parameter"
|
||||||
|
"-Wno-error=deprecated-declarations"
|
||||||
|
"-Wno-deprecated-declarations"
|
||||||
|
"-fPIC"
|
||||||
|
"-std=c++17"
|
||||||
|
)
|
||||||
|
|
||||||
|
#find_library(acl_lib acl_all PATHS /usr/lib /usr/local/lib)
|
||||||
|
#find_library(fiber_cpp_lib fiber_cpp PATHS /usr/lib /usr/local/lib)
|
||||||
|
#find_library(fiber_lib fiber PATHS /usr/lib /usr/local/lib)
|
||||||
|
|
||||||
|
find_library(rocksdb_lib rocksdb PATHS /usr/lib /usr/local/lib)
|
||||||
|
|
||||||
|
set(acl_all ${home_path}/lib_fiber/lib/libfiber_cpp.a ${home_path}/libacl_all.a ${home_path}/lib_fiber/lib/libfiber.a)
|
||||||
|
|
||||||
|
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
# set(lib_all ${lib_global} ${lib_rpc} ${fiber_cpp_lib} ${acl_lib} ${fiber_lib}
|
||||||
|
set(lib_all ${acl_all}
|
||||||
|
${rocksdb_lib} -Wl,-rpath,/usr/local/lib -liconv -lz -lpthread -ldl)
|
||||||
|
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
|
# set(lib_all ${lib_global} ${lib_rpc} ${fiber_cpp_lib} ${acl_lib} ${fiber_lib}
|
||||||
|
set(lib_all ${acl_all}
|
||||||
|
-lrocksdb -Wl,-rpath,/usr/local/lib -liconv -lz -lpthread -ldl)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(output_path ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${output_path})
|
||||||
|
link_directories(${output_path})
|
||||||
|
|
||||||
|
add_executable(pkv ${src_files})
|
||||||
|
target_link_libraries(pkv ${lib_all})
|
||||||
|
|
||||||
|
###############################################################################
|
@ -1,3 +1,7 @@
|
|||||||
include ./Makefile.in
|
all:
|
||||||
EXTLIBS = -lrocksdb -Wl,-rpath,/usr/local/lib
|
@(mkdir -p build; cd build; cmake ..; make -j 4)
|
||||||
PROG = pkv
|
|
||||||
|
clean cl:
|
||||||
|
@(rm -rf build pkv)
|
||||||
|
|
||||||
|
rebuild rb: cl all
|
||||||
|
@ -12,6 +12,7 @@ CFLAGS = -c -g -W \
|
|||||||
-D_REENTRANT \
|
-D_REENTRANT \
|
||||||
-D_POSIX_PTHREAD_SEMANTICS \
|
-D_POSIX_PTHREAD_SEMANTICS \
|
||||||
-D_USE_FAST_MACRO
|
-D_USE_FAST_MACRO
|
||||||
|
CFLAGS += --std=c++17
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
#Check system:
|
#Check system:
|
||||||
@ -45,9 +46,6 @@ ifeq ($(findstring g++, $(CC)), g++)
|
|||||||
GCC_MINOR:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f2)
|
GCC_MINOR:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f2)
|
||||||
GCC_SUB:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f3)
|
GCC_SUB:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f3)
|
||||||
GCC_VER:=$(shell [ $(GCC_MAJOR) -gt 4 -o \( $(GCC_MAJOR) -eq 4 -a $(GCC_MINOR) -gt 7 \) ] && echo true)
|
GCC_VER:=$(shell [ $(GCC_MAJOR) -gt 4 -o \( $(GCC_MAJOR) -eq 4 -a $(GCC_MINOR) -gt 7 \) ] && echo true)
|
||||||
ifeq ($(GCC_VER), true)
|
|
||||||
CFLAGS += --std=c++17
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# For FreeBSD
|
# For FreeBSD
|
||||||
@ -64,7 +62,8 @@ endif
|
|||||||
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
||||||
# CC += -arch x86_64 -arch arm64
|
# CC += -arch x86_64 -arch arm64
|
||||||
CFLAGS += -DMACOSX -Wno-invalid-source-encoding \
|
CFLAGS += -DMACOSX -Wno-invalid-source-encoding \
|
||||||
-Wno-invalid-offsetof
|
-Wno-invalid-offsetof \
|
||||||
|
-DHAS_ROCKSDB
|
||||||
UNIXTYPE = MACOSX
|
UNIXTYPE = MACOSX
|
||||||
SYSLIB += -liconv -rdynamic -lz
|
SYSLIB += -liconv -rdynamic -lz
|
||||||
RPATH = macos
|
RPATH = macos
|
||||||
@ -86,7 +85,7 @@ ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
|
|||||||
SYSLIB += -luring-ffi
|
SYSLIB += -luring-ffi
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DLINUX2 -D_REENTRANT
|
CFLAGS += -DLINUX2 -D_REENTRANT -DHAS_ROCKSDB
|
||||||
SYSLIB += -lcrypt -lz -lunwind -lunwind-generic
|
SYSLIB += -lcrypt -lz -lunwind -lunwind-generic
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -152,6 +151,7 @@ LDFLAGS = -L$(ACL_PATH)/lib_fiber/lib -lfiber_cpp \
|
|||||||
-L$(ACL_PATH)/lib_acl_cpp/lib -lacl_cpp \
|
-L$(ACL_PATH)/lib_acl_cpp/lib -lacl_cpp \
|
||||||
-L$(ACL_PATH)/lib_protocol/lib -lprotocol \
|
-L$(ACL_PATH)/lib_protocol/lib -lprotocol \
|
||||||
-L$(ACL_PATH)/lib_acl/lib -lacl -lfiber \
|
-L$(ACL_PATH)/lib_acl/lib -lacl -lfiber \
|
||||||
|
-lrocksdb -Wl,-rpath,/usr/local/lib \
|
||||||
$(EXTLIBS) $(SYSLIB)
|
$(EXTLIBS) $(SYSLIB)
|
||||||
|
|
||||||
COMPILE = $(CC) $(CFLAGS)
|
COMPILE = $(CC) $(CFLAGS)
|
||||||
|
@ -58,7 +58,8 @@ endif
|
|||||||
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
||||||
# CC += -arch x86_64 -arch arm64
|
# CC += -arch x86_64 -arch arm64
|
||||||
CFLAGS += -DMACOSX -Wno-invalid-source-encoding \
|
CFLAGS += -DMACOSX -Wno-invalid-source-encoding \
|
||||||
-Wno-invalid-offsetof
|
-Wno-invalid-offsetof \
|
||||||
|
-Wno-deprecated-declarations
|
||||||
SYSLIB += -liconv -rdynamic
|
SYSLIB += -liconv -rdynamic
|
||||||
UNIXTYPE = MACOSX
|
UNIXTYPE = MACOSX
|
||||||
RPATH = macos
|
RPATH = macos
|
||||||
|
Loading…
Reference in New Issue
Block a user