mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-13 16:35:35 +08:00
Merge branch 'gitee-master' into gitlab-upstream
This commit is contained in:
commit
cc68db1a97
@ -88,12 +88,9 @@ if (ACL_BUILD_SHARED MATCHES "YES")
|
|||||||
add_dependencies(acl_cpp_shared protocol_shared acl_shared)
|
add_dependencies(acl_cpp_shared protocol_shared acl_shared)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Android")
|
add_subdirectory(lib_fiber/c fiber)
|
||||||
#if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
add_subdirectory(lib_fiber/cpp fiber_cpp)
|
||||||
add_subdirectory(lib_fiber/c fiber)
|
|
||||||
add_subdirectory(lib_fiber/cpp fiber_cpp)
|
|
||||||
|
|
||||||
if (ACL_BUILD_SHARED MATCHES "YES")
|
if (ACL_BUILD_SHARED MATCHES "YES")
|
||||||
add_dependencies(fiber_cpp_shared acl_cpp_shared protocol_shared acl_shared fiber_shared)
|
add_dependencies(fiber_cpp_shared acl_cpp_shared protocol_shared acl_shared fiber)
|
||||||
endif()
|
endif()
|
||||||
#endif()
|
|
||||||
|
@ -173,6 +173,8 @@ Acl not only wraps the system DNS API, such as getaddrinfo and gethostbyname, bu
|
|||||||
## 3.1. Compiling Acl on different platforms
|
## 3.1. Compiling Acl on different platforms
|
||||||
Acl project currently supports Linux, Windows, MacOS, FreeBSD, Solaris, Android, and iOS.
|
Acl project currently supports Linux, Windows, MacOS, FreeBSD, Solaris, Android, and iOS.
|
||||||
- **Linux/UNIX:** The compiler is gcc/clang, enter **`acl/`** directory and run **`make`**, then libacl_all.a and libacl_all.so will be generated in acl/ directory, libacl_all.a is consist of three libraries including lib_acl.a, lib_protocol.a and libacl_cpp.a;
|
- **Linux/UNIX:** The compiler is gcc/clang, enter **`acl/`** directory and run **`make`**, then libacl_all.a and libacl_all.so will be generated in acl/ directory, libacl_all.a is consist of three libraries including lib_acl.a, lib_protocol.a and libacl_cpp.a;
|
||||||
|
You can also use cmake to build and install Acl libs by running cmake-build.sh script in Acl directory;
|
||||||
|
And xmake can also compiling Acl when you run xmake in Acl directory.
|
||||||
- **Windows:** Can be compiled with VS2003/VS2008/VS2010/VS2012/VS2013/VS2015/VS2019. (If you need to compile with VS6/VS2005, you can refer to the compilation conditions of VS2003);
|
- **Windows:** Can be compiled with VS2003/VS2008/VS2010/VS2012/VS2013/VS2015/VS2019. (If you need to compile with VS6/VS2005, you can refer to the compilation conditions of VS2003);
|
||||||
- **MacOS/iOS:** Compiled with xcode;
|
- **MacOS/iOS:** Compiled with xcode;
|
||||||
- **Android:** Open Adnroid's project in **`acl/android/acl_c++_shared/`** with **`Android Studio`**;
|
- **Android:** Open Adnroid's project in **`acl/android/acl_c++_shared/`** with **`Android Studio`**;
|
||||||
|
@ -1 +0,0 @@
|
|||||||
keepme
|
|
7
cmake-build.sh
Executable file
7
cmake-build.sh
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
mkdir -p build
|
||||||
|
cd build
|
||||||
|
#cmake -DCMAKE_INSTALL_PREFIX=/opt/soft/acl -DACL_BUILD_SHARED=YES -DACL_BUILD_SHARED_ONE=YES ..
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=/opt/soft/acl -DACL_BUILD_SHARED=YES ..
|
||||||
|
make -j 4
|
||||||
|
make install
|
@ -8,7 +8,7 @@ project(acl)
|
|||||||
#message(project_dir=${PROJECT_SOURCE_DIR})
|
#message(project_dir=${PROJECT_SOURCE_DIR})
|
||||||
|
|
||||||
if (${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
|
if (${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
message(FATAL_ERROR "Please into another dir to build!")
|
message(FATAL_ERROR "Please into another dir to build! ${CMAKE_BINARY_DIR}, ${CMAKE_CURRENT_SOURCE_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||||
@ -206,7 +206,8 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
|
|||||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/acl-lib/acl/"
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/acl-lib/acl/"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED MATCHES "YES")
|
#if ((NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) AND ACL_BUILD_SHARED MATCHES "YES")
|
||||||
|
if (ACL_BUILD_SHARED MATCHES "YES")
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||||
if (ANDROID_STL MATCHES "gnustl_shared")
|
if (ANDROID_STL MATCHES "gnustl_shared")
|
||||||
set(sys_ldflags "-shared")
|
set(sys_ldflags "-shared")
|
||||||
@ -220,6 +221,10 @@ if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED
|
|||||||
elseif (${UNIX_OS})
|
elseif (${UNIX_OS})
|
||||||
set(sys_ldflags "-shared -lpthread -ldl")
|
set(sys_ldflags "-shared -lpthread -ldl")
|
||||||
target_compile_options(acl_static PRIVATE -fvisibility=hidden)
|
target_compile_options(acl_static PRIVATE -fvisibility=hidden)
|
||||||
|
|
||||||
|
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
set(CMAKE_MACOSX_RPATH 1)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${sys_ldflags}")
|
set(CMAKE_SHARED_LINKER_FLAGS "${sys_ldflags}")
|
||||||
|
@ -10,7 +10,12 @@ RANLIB = ${ENV_RANLIB}
|
|||||||
FLAGS = ${ENV_FLAGS}
|
FLAGS = ${ENV_FLAGS}
|
||||||
|
|
||||||
# default lib name
|
# default lib name
|
||||||
LIB_NAME = libacl.a
|
# LIB_NAME = libacl.a
|
||||||
|
|
||||||
|
STATIC_OLD_LIBNAME = lib_acl.a
|
||||||
|
SHARED_OLD_LIBNAME = lib_acl.so
|
||||||
|
STATIC_LIBNAME = libacl.a
|
||||||
|
SHARED_LIBNAME = libacl.so
|
||||||
|
|
||||||
#-fno-strict-aliasing \
|
#-fno-strict-aliasing \
|
||||||
#CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align
|
#CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align
|
||||||
@ -120,6 +125,8 @@ ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
|||||||
-Os
|
-Os
|
||||||
UNIXTYPE = MACOSX
|
UNIXTYPE = MACOSX
|
||||||
RPATH = macos
|
RPATH = macos
|
||||||
|
SHARED_LIBNAME = libacl.dylib
|
||||||
|
SHARED_OLD_LIBNAME = lib_acl.dylib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# For Linux
|
# For Linux
|
||||||
@ -324,11 +331,6 @@ OBJS_DEF = $(INIT_DEF) $(PRIV_DEF) $(STDLIB_DEF) \
|
|||||||
###########################################################
|
###########################################################
|
||||||
.PHONY = all static shared clean cl clean_lib rebuild rb
|
.PHONY = all static shared clean cl clean_lib rebuild rb
|
||||||
|
|
||||||
STATIC_OLD_LIBNAME = lib_acl.a
|
|
||||||
SHARED_OLD_LIBNAME = lib_acl.so
|
|
||||||
STATIC_LIBNAME = libacl.a
|
|
||||||
SHARED_LIBNAME = libacl.so
|
|
||||||
|
|
||||||
all: static shared
|
all: static shared
|
||||||
|
|
||||||
$(shell mkdir -p $(DEF_PATH_DST))
|
$(shell mkdir -p $(DEF_PATH_DST))
|
||||||
@ -359,31 +361,34 @@ static: $(OBJS_DST)
|
|||||||
ln -s $(STATIC_LIBNAME) $(STATIC_OLD_LIBNAME))
|
ln -s $(STATIC_LIBNAME) $(STATIC_OLD_LIBNAME))
|
||||||
@echo 'build $(LIB_PATH_DST)/$(STATIC_LIBNAME) ok!'
|
@echo 'build $(LIB_PATH_DST)/$(STATIC_LIBNAME) ok!'
|
||||||
|
|
||||||
#shared_ldflags = -lmysqlclient -lrt -lpthread -ldl
|
|
||||||
shared_ldflags = -lrt -lpthread -ldl
|
|
||||||
#shared: depends $(OBJS_DST)
|
#shared: depends $(OBJS_DST)
|
||||||
|
|
||||||
shared: $(OBJS_DST)
|
shared: $(OBJS_DST)
|
||||||
@echo ''
|
@echo ''
|
||||||
@echo 'creating $(SHARED_LIBNAME)'
|
@echo 'creating $(SHARED_LIBNAME)'
|
||||||
@if test -n "$(rpath)" && test "$(UNIXTYPE)" = "LINUX"; then \
|
@if test -n "$(rpath)" && test "$(UNIXTYPE)" = "LINUX"; then \
|
||||||
echo "building for linux"; \
|
echo "building for linux"; \
|
||||||
|
shared_ldflags=-lrt -lpthread -ldl; \
|
||||||
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJS_DST) \
|
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJS_DST) \
|
||||||
-L$(rpath) $(shared_ldflags) -Wl,-rpath,$(rpath); \
|
$(shared_ldflags) -Wl,-rpath,$(rpath); \
|
||||||
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
||||||
elif test -n "$(rpath)" && test "$(UNIXTYPE)" = "SUNOS5"; then \
|
elif test -n "$(rpath)" && test "$(UNIXTYPE)" = "SUNOS5"; then \
|
||||||
echo "building for sunos5"; \
|
echo "building for sunos5"; \
|
||||||
|
shared_ldflags=-lrt -lpthread -ldl; \
|
||||||
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJS_DST) \
|
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJS_DST) \
|
||||||
-L$(rpath) $(shared_ldflags); \
|
$(shared_ldflags); \
|
||||||
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
||||||
elif test -n "$(rpath)" && test "$(UNIXTYPE)" = "MACOSX"; then \
|
elif test -n "$(rpath)" && test "$(UNIXTYPE)" = "MACOSX"; then \
|
||||||
echo "building for Darwin"; \
|
echo "building for Darwin"; \
|
||||||
|
shared_ldflags=-lpthread; \
|
||||||
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJS_DST) \
|
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJS_DST) \
|
||||||
-L$(rpath) -lpthread; \
|
$(shared_ldflags); \
|
||||||
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
||||||
elif test -n "$(rpath)" && test "$(UNIXTYPE)" = "FREEBSD"; then \
|
elif test -n "$(rpath)" && test "$(UNIXTYPE)" = "FREEBSD"; then \
|
||||||
echo "building for FreeBSD"; \
|
echo "building for FreeBSD"; \
|
||||||
|
shared_ldflags=-lrt -lpthread -ldl; \
|
||||||
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJS_DST) \
|
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJS_DST) \
|
||||||
-L$(rpath) -lpthread; \
|
$(shared_ldflags); \
|
||||||
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
||||||
else \
|
else \
|
||||||
echo 'skip build $(SHARED_LIBNAME); usage: make shared rpath=xxx'; \
|
echo 'skip build $(SHARED_LIBNAME); usage: make shared rpath=xxx'; \
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
|
|
||||||
static char *version = "3.6.1-6 20240226-16:00";
|
static char *version = "3.6.1-6 20240404-14:00";
|
||||||
|
|
||||||
const char *acl_version(void)
|
const char *acl_version(void)
|
||||||
{
|
{
|
||||||
|
@ -268,7 +268,8 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/acl_cpp/
|
|||||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/acl-lib/acl_cpp/"
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/acl-lib/acl_cpp/"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED MATCHES "YES")
|
#if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED MATCHES "YES")
|
||||||
|
if (ACL_BUILD_SHARED MATCHES "YES")
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||||
if (ANDROID_STL MATCHES "gnustl_shared")
|
if (ANDROID_STL MATCHES "gnustl_shared")
|
||||||
set(sys_ldflags "-shared -lz")
|
set(sys_ldflags "-shared -lz")
|
||||||
@ -285,6 +286,7 @@ if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED
|
|||||||
set(sys_ldflags "-shared -lz -liconv -lpthread -ldl")
|
set(sys_ldflags "-shared -lz -liconv -lpthread -ldl")
|
||||||
target_compile_options(acl_cpp_static PRIVATE
|
target_compile_options(acl_cpp_static PRIVATE
|
||||||
-fvisibility=hidden -fvisibility-inlines-hidden)
|
-fvisibility=hidden -fvisibility-inlines-hidden)
|
||||||
|
set(CMAKE_MACOSX_RPATH 1)
|
||||||
elseif (${UNIX_OS})
|
elseif (${UNIX_OS})
|
||||||
set(sys_ldflags "-shared -lz -lpthread -ldl")
|
set(sys_ldflags "-shared -lz -lpthread -ldl")
|
||||||
target_compile_options(acl_cpp_static PRIVATE
|
target_compile_options(acl_cpp_static PRIVATE
|
||||||
@ -296,10 +298,10 @@ if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED
|
|||||||
set(CMAKE_SHARED_LINKER_FLAGS "${lc_flags} ${sys_ldflags}")
|
set(CMAKE_SHARED_LINKER_FLAGS "${lc_flags} ${sys_ldflags}")
|
||||||
add_library(acl_cpp_shared SHARED ${lib_src})
|
add_library(acl_cpp_shared SHARED ${lib_src})
|
||||||
else()
|
else()
|
||||||
set(lc_flags "-Wl,-rpath,. -L${lib_output_path} -lprotocol -lacl")
|
set(lc_flags "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib -L${CMAKE_INSTALL_PREFIX}/lib -lprotocol -lacl")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${lc_flags} ${sys_ldflags}")
|
set(CMAKE_SHARED_LINKER_FLAGS "${lc_flags} ${sys_ldflags}")
|
||||||
add_library(acl_cpp_shared SHARED ${lib_src})
|
add_library(acl_cpp_shared SHARED ${lib_src})
|
||||||
target_link_libraries(acl_cpp_shared protocol acl)
|
# target_link_libraries(acl_cpp_shared protocol acl)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(acl_cpp_shared PROPERTIES OUTPUT_NAME "acl_cpp")
|
SET_TARGET_PROPERTIES(acl_cpp_shared PROPERTIES OUTPUT_NAME "acl_cpp")
|
||||||
|
@ -36,6 +36,9 @@ CFLAGS += -I/usr/local/include
|
|||||||
|
|
||||||
shared_ldflags = -lprotocol -lacl -lz -lpthread
|
shared_ldflags = -lprotocol -lacl -lz -lpthread
|
||||||
|
|
||||||
|
STATIC_LIBNAME = libacl_cpp.a
|
||||||
|
SHARED_LIBNAME = libacl_cpp.so
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
#Check system:
|
#Check system:
|
||||||
# Linux, SunOS, Solaris, BSD variants, AIX, HP-UX
|
# Linux, SunOS, Solaris, BSD variants, AIX, HP-UX
|
||||||
@ -144,6 +147,7 @@ ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
shared_ldflags = -lprotocol -lacl -L/usr/lib -liconv -lz -lpthread
|
shared_ldflags = -lprotocol -lacl -L/usr/lib -liconv -lz -lpthread
|
||||||
|
SHARED_LIBNAME = libacl_cpp.dylib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# For Linux
|
# For Linux
|
||||||
@ -300,8 +304,6 @@ OBJS_DEF = $(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/*.cp
|
|||||||
VERSION = 1.1.1.2
|
VERSION = 1.1.1.2
|
||||||
DATE_NOW = 20`date +%y`.`date +%m`.`date +%d`
|
DATE_NOW = 20`date +%y`.`date +%m`.`date +%d`
|
||||||
|
|
||||||
STATIC_LIBNAME = libacl_cpp.a
|
|
||||||
SHARED_LIBNAME = libacl_cpp.so
|
|
||||||
PCH = src/acl_stdafx.hpp.gch
|
PCH = src/acl_stdafx.hpp.gch
|
||||||
|
|
||||||
lib: static
|
lib: static
|
||||||
|
@ -168,7 +168,8 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/fiber/
|
|||||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/acl-lib/fiber"
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/acl-lib/fiber"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED MATCHES "YES")
|
#if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED MATCHES "YES")
|
||||||
|
if (ACL_BUILD_SHARED MATCHES "YES")
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||||
if (ANDROID_STL MATCHES "gnustl_shared")
|
if (ANDROID_STL MATCHES "gnustl_shared")
|
||||||
set(sys_ldflags "-shared -O3")
|
set(sys_ldflags "-shared -O3")
|
||||||
@ -179,6 +180,10 @@ if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED
|
|||||||
elseif (${UNIX_OS})
|
elseif (${UNIX_OS})
|
||||||
set(sys_ldflags "-shared -O3")
|
set(sys_ldflags "-shared -O3")
|
||||||
target_compile_options(fiber_static PRIVATE -fvisibility=hidden)
|
target_compile_options(fiber_static PRIVATE -fvisibility=hidden)
|
||||||
|
|
||||||
|
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
set(CMAKE_MACOSX_RPATH 1)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${sys_ldflags}")
|
set(CMAKE_SHARED_LINKER_FLAGS "${sys_ldflags}")
|
||||||
|
@ -50,6 +50,13 @@ CHECKSYSRES = @echo "Unknow system type!";exit 1
|
|||||||
UNIXNAME = $(shell uname -sm)
|
UNIXNAME = $(shell uname -sm)
|
||||||
UNIXTYPE = LINUX
|
UNIXTYPE = LINUX
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
|
||||||
|
STATIC_LIBNAME = libfiber.a
|
||||||
|
SHARED_LIBNAME = libfiber.so
|
||||||
|
STATIC_OLD_LIBNAME = lib_fiber.a
|
||||||
|
SHARED_OLD_LIBNAME = lib_fiber.so
|
||||||
|
|
||||||
ifeq ($(CC),)
|
ifeq ($(CC),)
|
||||||
CC = gcc
|
CC = gcc
|
||||||
endif
|
endif
|
||||||
@ -117,10 +124,13 @@ endif
|
|||||||
|
|
||||||
# For Darwin
|
# For Darwin
|
||||||
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
||||||
|
UNIXTYPE = MACOSX
|
||||||
# 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
|
-Wno-deprecated-declarations
|
||||||
|
SHARED_LIBNAME = libfiber.dylib
|
||||||
|
SHARED_OLD_LIBNAME = lib_fiber.dylib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# For Linux
|
# For Linux
|
||||||
@ -236,13 +246,6 @@ OBJ = $(patsubst %.c, $(OBJ_PATH_DST)/%.o, $(notdir $(SRC))) $(ASM_OBJ)
|
|||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
STATIC_LIBNAME = libfiber.a
|
|
||||||
SHARED_LIBNAME = libfiber.so
|
|
||||||
STATIC_OLD_LIBNAME = lib_fiber.a
|
|
||||||
SHARED_OLD_LIBNAME = lib_fiber.so
|
|
||||||
|
|
||||||
###########################################################
|
|
||||||
|
|
||||||
.PHONY = static shared clean
|
.PHONY = static shared clean
|
||||||
COMPILE = $(CC) $(CFLAGS) -O3
|
COMPILE = $(CC) $(CFLAGS) -O3
|
||||||
COMPILE_FIBER = $(CC) $(CFLAGS)
|
COMPILE_FIBER = $(CC) $(CFLAGS)
|
||||||
@ -275,6 +278,7 @@ shared: $(OBJ)
|
|||||||
-R$(rpath) -L$(rpath) $(shared_ldflags); \
|
-R$(rpath) -L$(rpath) $(shared_ldflags); \
|
||||||
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
||||||
elif test -n "$(rpath)" && test "$(UNIXTYPE)" = "MACOSX"; then \
|
elif test -n "$(rpath)" && test "$(UNIXTYPE)" = "MACOSX"; then \
|
||||||
|
shared_ldflags = -lpthread; \
|
||||||
echo "building for Darwin"; \
|
echo "building for Darwin"; \
|
||||||
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJ) \
|
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJ) \
|
||||||
-R$(rpath) -L$(rpath) -lpthread; \
|
-R$(rpath) -L$(rpath) -lpthread; \
|
||||||
|
@ -154,7 +154,8 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/fiber/
|
|||||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/acl-lib/fiber_cpp"
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/acl-lib/fiber_cpp"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED MATCHES "YES")
|
#if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED MATCHES "YES")
|
||||||
|
if (ACL_BUILD_SHARED MATCHES "YES")
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||||
if (ANDROID_STL MATCHES "gnustl_shared")
|
if (ANDROID_STL MATCHES "gnustl_shared")
|
||||||
set(sys_ldflags "-shared -lz")
|
set(sys_ldflags "-shared -lz")
|
||||||
@ -167,6 +168,7 @@ if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED
|
|||||||
set(sys_ldflags "-shared -liconv -lz -lpthread -ldl")
|
set(sys_ldflags "-shared -liconv -lz -lpthread -ldl")
|
||||||
target_compile_options(fiber_cpp_static PRIVATE
|
target_compile_options(fiber_cpp_static PRIVATE
|
||||||
-fvisibility=hidden -fvisibility-inlines-hidden)
|
-fvisibility=hidden -fvisibility-inlines-hidden)
|
||||||
|
set(CMAKE_MACOSX_RPATH 1)
|
||||||
elseif (${UNIX_OS})
|
elseif (${UNIX_OS})
|
||||||
set(sys_ldflags "-shared -lz -lpthread -ldl")
|
set(sys_ldflags "-shared -lz -lpthread -ldl")
|
||||||
target_compile_options(fiber_cpp_static PRIVATE
|
target_compile_options(fiber_cpp_static PRIVATE
|
||||||
@ -178,10 +180,10 @@ if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED
|
|||||||
set(CMAKE_SHARED_LINKER_FLAGS "${lc_ldflags} ${sys_ldflags}")
|
set(CMAKE_SHARED_LINKER_FLAGS "${lc_ldflags} ${sys_ldflags}")
|
||||||
add_library(fiber_cpp_shared SHARED ${lib_src})
|
add_library(fiber_cpp_shared SHARED ${lib_src})
|
||||||
else()
|
else()
|
||||||
set(lc_ldflags "-Wl,-rpath,. -L${lib_output_path} -lacl_cpp -lprotocol -lacl -lfiber")
|
set(lc_ldflags "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib -L${CMAKE_INSTALL_PREFIX}/lib -lacl_cpp -lprotocol -lacl -lfiber")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${lc_ldflags} ${sys_ldflags}")
|
set(CMAKE_SHARED_LINKER_FLAGS "${lc_ldflags} ${sys_ldflags}")
|
||||||
add_library(fiber_cpp_shared SHARED ${lib_src})
|
add_library(fiber_cpp_shared SHARED ${lib_src})
|
||||||
target_link_libraries(fiber_cpp_shared acl_cpp protocol acl fiber)
|
# target_link_libraries(fiber_cpp_shared acl_cpp protocol acl fiber)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(fiber_cpp_shared PROPERTIES OUTPUT_NAME "fiber_cpp")
|
SET_TARGET_PROPERTIES(fiber_cpp_shared PROPERTIES OUTPUT_NAME "fiber_cpp")
|
||||||
|
@ -29,7 +29,12 @@ CFLAGS = -c -g -W \
|
|||||||
#just for freebsd's iconv.h
|
#just for freebsd's iconv.h
|
||||||
CFLAGS += -I/usr/local/include -I../../lib_acl/src/master
|
CFLAGS += -I/usr/local/include -I../../lib_acl/src/master
|
||||||
|
|
||||||
shared_ldflags = -lacl_cpp -lprotocol -lacl -lz -lpthread
|
shared_ldflags = -lacl_cpp -lprotocol -lacl -lfiber -lz -lpthread
|
||||||
|
|
||||||
|
STATIC_LIBNAME = libfiber_cpp.a
|
||||||
|
SHARED_LIBNAME = libfiber_cpp.so
|
||||||
|
STATIC_OLD_LIBNAME = lib_fiber_cpp.a
|
||||||
|
SHARED_OLD_LIBNAME = lib_fiber_cpp.so
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
#Check system:
|
#Check system:
|
||||||
@ -71,7 +76,7 @@ endif
|
|||||||
# For FreeBSD
|
# For FreeBSD
|
||||||
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
|
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
|
||||||
UNIXTYPE = FREEBSD
|
UNIXTYPE = FREEBSD
|
||||||
shared_ldflags = -lacl_cpp -lprotocol -lacl -L/usr/local/lib -liconv -lz -lpthread
|
shared_ldflags = -lacl_cpp -lprotocol -lacl -lfiber -L/usr/local/lib -liconv -lz -lpthread
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# For Darwin
|
# For Darwin
|
||||||
@ -81,13 +86,15 @@ ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
|||||||
-Wno-invalid-offsetof \
|
-Wno-invalid-offsetof \
|
||||||
-Wno-unused-private-field
|
-Wno-unused-private-field
|
||||||
UNIXTYPE = MACOSX
|
UNIXTYPE = MACOSX
|
||||||
shared_ldflags = -lacl_cpp -lprotocol -lacl -L/usr/lib -liconv -lz -lpthread
|
shared_ldflags = -lacl_cpp -lprotocol -lacl -lfiber -L/usr/lib -liconv -lz -lpthread
|
||||||
|
SHARED_LIBNAME = libfiber_cpp.dylib
|
||||||
|
SHARED_OLD_LIBNAME = lib_fiber_cpp.dylib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# For Linux
|
# For Linux
|
||||||
ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
|
ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
|
||||||
UNIXTYPE = LINUX
|
UNIXTYPE = LINUX
|
||||||
shared_ldflags = -lacl_cpp -lprotocol -lacl -lrt -lpthread -lz -ldl
|
shared_ldflags = -lacl_cpp -lprotocol -lacl -lfiber -lrt -lpthread -lz -ldl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# For CYGWIN
|
# For CYGWIN
|
||||||
@ -147,11 +154,6 @@ OBJ = $(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(SRC)))
|
|||||||
VERSION = 0.9
|
VERSION = 0.9
|
||||||
DATE_NOW = 20`date +%y`.`date +%m`.`date +%d`
|
DATE_NOW = 20`date +%y`.`date +%m`.`date +%d`
|
||||||
|
|
||||||
STATIC_LIBNAME = libfiber_cpp.a
|
|
||||||
SHARED_LIBNAME = libfiber_cpp.so
|
|
||||||
STATIC_OLD_LIBNAME = lib_fiber_cpp.a
|
|
||||||
SHARED_OLD_LIBNAME = lib_fiber_cpp.so
|
|
||||||
|
|
||||||
lib: static
|
lib: static
|
||||||
all: static shared sample
|
all: static shared sample
|
||||||
|
|
||||||
|
@ -154,7 +154,8 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
|
|||||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/acl-lib/protocol/"
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/acl-lib/protocol/"
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED MATCHES "YES")
|
#if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED MATCHES "YES")
|
||||||
|
if (ACL_BUILD_SHARED MATCHES "YES")
|
||||||
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||||
if (ANDROID_STL MATCHES "gnustl_shared")
|
if (ANDROID_STL MATCHES "gnustl_shared")
|
||||||
set(sys_ldflags "-shared -lz")
|
set(sys_ldflags "-shared -lz")
|
||||||
@ -168,6 +169,10 @@ if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED
|
|||||||
elseif (${UNIX_OS})
|
elseif (${UNIX_OS})
|
||||||
set(sys_ldflags "-shared -lz -lpthread -ldl")
|
set(sys_ldflags "-shared -lz -lpthread -ldl")
|
||||||
target_compile_options(protocol_static PRIVATE -fvisibility=hidden)
|
target_compile_options(protocol_static PRIVATE -fvisibility=hidden)
|
||||||
|
|
||||||
|
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
set(CMAKE_MACOSX_RPATH 1)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (ACL_BUILD_SHARED_ONE MATCHES "YES")
|
if (ACL_BUILD_SHARED_ONE MATCHES "YES")
|
||||||
@ -175,10 +180,10 @@ if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR AND ACL_BUILD_SHARED
|
|||||||
set(CMAKE_SHARED_LINKER_FLAGS "${lc_flags} ${sys_ldflags}")
|
set(CMAKE_SHARED_LINKER_FLAGS "${lc_flags} ${sys_ldflags}")
|
||||||
add_library(protocol_shared SHARED ${lib_src})
|
add_library(protocol_shared SHARED ${lib_src})
|
||||||
else()
|
else()
|
||||||
set(lc_flags "-Wl,-rpath,. -L${lib_output_path} -lacl")
|
set(lc_flags "-Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib -L${CMAKE_INSTALL_PREFIX}/lib -lacl")
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS "${lc_flags} ${sys_ldflags}")
|
set(CMAKE_SHARED_LINKER_FLAGS "${lc_flags} ${sys_ldflags}")
|
||||||
add_library(protocol_shared SHARED ${lib_src})
|
add_library(protocol_shared SHARED ${lib_src})
|
||||||
target_link_libraries(protocol_shared acl)
|
# target_link_libraries(protocol_shared acl)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(protocol_shared PROPERTIES OUTPUT_NAME "protocol")
|
SET_TARGET_PROPERTIES(protocol_shared PROPERTIES OUTPUT_NAME "protocol")
|
||||||
|
@ -35,6 +35,9 @@ CHECKSYSRES = @echo "Unknow system type!";exit 1
|
|||||||
UNIXNAME = $(shell uname -sm)
|
UNIXNAME = $(shell uname -sm)
|
||||||
UNIXTYPE = LINUX
|
UNIXTYPE = LINUX
|
||||||
|
|
||||||
|
STATIC_LIBNAME = libprotocol.a
|
||||||
|
SHARED_LIBNAME = libprotocol.so
|
||||||
|
|
||||||
ifeq ($(CC),)
|
ifeq ($(CC),)
|
||||||
CC = gcc
|
CC = gcc
|
||||||
endif
|
endif
|
||||||
@ -86,6 +89,7 @@ ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
|||||||
-flto \
|
-flto \
|
||||||
-Os
|
-Os
|
||||||
UNIXTYPE = MACOSX
|
UNIXTYPE = MACOSX
|
||||||
|
SHARED_LIBNAME = libprotocol.dylib
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# For Linux
|
# For Linux
|
||||||
@ -169,9 +173,6 @@ OBJS_DST = $(BASE_OBJ) $(HTTP_OBJ) $(ICMP_OBJ) $(SMTP_OBJ)
|
|||||||
LIB_ACL_PATH = ../lib_acl
|
LIB_ACL_PATH = ../lib_acl
|
||||||
CFLAGS += -I $(LIB_ACL_PATH)/include
|
CFLAGS += -I $(LIB_ACL_PATH)/include
|
||||||
|
|
||||||
STATIC_LIBNAME = libprotocol.a
|
|
||||||
SHARED_LIBNAME = libprotocol.so
|
|
||||||
|
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
.PHONY = static shared clean
|
.PHONY = static shared clean
|
||||||
|
Loading…
Reference in New Issue
Block a user