mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-12-01 19:37:45 +08:00
Optimize project's building.
This commit is contained in:
parent
84327cacb7
commit
af28e0a6ce
@ -88,12 +88,9 @@ if (ACL_BUILD_SHARED MATCHES "YES")
|
||||
add_dependencies(acl_cpp_shared protocol_shared acl_shared)
|
||||
endif()
|
||||
|
||||
#if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||
#if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
add_subdirectory(lib_fiber/c fiber)
|
||||
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")
|
||||
add_dependencies(fiber_cpp_shared acl_cpp_shared protocol_shared acl_shared fiber_shared)
|
||||
endif()
|
||||
#endif()
|
||||
if (ACL_BUILD_SHARED MATCHES "YES")
|
||||
add_dependencies(fiber_cpp_shared acl_cpp_shared protocol_shared acl_shared fiber)
|
||||
endif()
|
||||
|
@ -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/zsx -DACL_BUILD_SHARED=YES -DACL_BUILD_SHARED_ONE=YES ..
|
||||
cmake -DCMAKE_INSTALL_PREFIX=/opt/soft/zsx -DACL_BUILD_SHARED=YES ..
|
||||
make -j 4
|
||||
make install
|
@ -8,7 +8,7 @@ project(acl)
|
||||
#message(project_dir=${PROJECT_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()
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Android")
|
||||
@ -206,7 +206,8 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
|
||||
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 (ANDROID_STL MATCHES "gnustl_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})
|
||||
set(sys_ldflags "-shared -lpthread -ldl")
|
||||
target_compile_options(acl_static PRIVATE -fvisibility=hidden)
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
set(CMAKE_MACOSX_RPATH 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${sys_ldflags}")
|
||||
|
@ -10,7 +10,12 @@ RANLIB = ${ENV_RANLIB}
|
||||
FLAGS = ${ENV_FLAGS}
|
||||
|
||||
# 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 \
|
||||
#CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align
|
||||
@ -120,6 +125,8 @@ ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
||||
-Os
|
||||
UNIXTYPE = MACOSX
|
||||
RPATH = macos
|
||||
SHARED_LIBNAME = libacl.dylib
|
||||
SHARED_OLD_LIBNAME = lib_acl.dylib
|
||||
endif
|
||||
|
||||
# For Linux
|
||||
@ -324,11 +331,6 @@ OBJS_DEF = $(INIT_DEF) $(PRIV_DEF) $(STDLIB_DEF) \
|
||||
###########################################################
|
||||
.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
|
||||
|
||||
$(shell mkdir -p $(DEF_PATH_DST))
|
||||
@ -359,31 +361,34 @@ static: $(OBJS_DST)
|
||||
ln -s $(STATIC_LIBNAME) $(STATIC_OLD_LIBNAME))
|
||||
@echo 'build $(LIB_PATH_DST)/$(STATIC_LIBNAME) ok!'
|
||||
|
||||
#shared_ldflags = -lmysqlclient -lrt -lpthread -ldl
|
||||
shared_ldflags = -lrt -lpthread -ldl
|
||||
#shared: depends $(OBJS_DST)
|
||||
|
||||
shared: $(OBJS_DST)
|
||||
@echo ''
|
||||
@echo 'creating $(SHARED_LIBNAME)'
|
||||
@if test -n "$(rpath)" && test "$(UNIXTYPE)" = "LINUX"; then \
|
||||
echo "building for linux"; \
|
||||
shared_ldflags=-lrt -lpthread -ldl; \
|
||||
$(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!'; \
|
||||
elif test -n "$(rpath)" && test "$(UNIXTYPE)" = "SUNOS5"; then \
|
||||
echo "building for sunos5"; \
|
||||
shared_ldflags=-lrt -lpthread -ldl; \
|
||||
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJS_DST) \
|
||||
-L$(rpath) $(shared_ldflags); \
|
||||
$(shared_ldflags); \
|
||||
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
||||
elif test -n "$(rpath)" && test "$(UNIXTYPE)" = "MACOSX"; then \
|
||||
echo "building for Darwin"; \
|
||||
shared_ldflags=-lpthread; \
|
||||
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJS_DST) \
|
||||
-L$(rpath) -lpthread; \
|
||||
$(shared_ldflags); \
|
||||
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
||||
elif test -n "$(rpath)" && test "$(UNIXTYPE)" = "FREEBSD"; then \
|
||||
echo "building for FreeBSD"; \
|
||||
shared_ldflags=-lrt -lpthread -ldl; \
|
||||
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJS_DST) \
|
||||
-L$(rpath) -lpthread; \
|
||||
$(shared_ldflags); \
|
||||
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
||||
else \
|
||||
echo 'skip build $(SHARED_LIBNAME); usage: make shared rpath=xxx'; \
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#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)
|
||||
{
|
||||
|
@ -268,7 +268,8 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/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 (ANDROID_STL MATCHES "gnustl_shared")
|
||||
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")
|
||||
target_compile_options(acl_cpp_static PRIVATE
|
||||
-fvisibility=hidden -fvisibility-inlines-hidden)
|
||||
set(CMAKE_MACOSX_RPATH 1)
|
||||
elseif (${UNIX_OS})
|
||||
set(sys_ldflags "-shared -lz -lpthread -ldl")
|
||||
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}")
|
||||
add_library(acl_cpp_shared SHARED ${lib_src})
|
||||
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}")
|
||||
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()
|
||||
|
||||
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
|
||||
|
||||
STATIC_LIBNAME = libacl_cpp.a
|
||||
SHARED_LIBNAME = libacl_cpp.so
|
||||
|
||||
###########################################################
|
||||
#Check system:
|
||||
# Linux, SunOS, Solaris, BSD variants, AIX, HP-UX
|
||||
@ -144,6 +147,7 @@ ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
||||
endif
|
||||
|
||||
shared_ldflags = -lprotocol -lacl -L/usr/lib -liconv -lz -lpthread
|
||||
SHARED_LIBNAME = libacl_cpp.dylib
|
||||
endif
|
||||
|
||||
# For Linux
|
||||
@ -300,8 +304,6 @@ OBJS_DEF = $(patsubst %.cpp, $(DEF_PATH_DST)/%.inc, $(notdir $(wildcard src/*.cp
|
||||
VERSION = 1.1.1.2
|
||||
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
|
||||
|
||||
lib: static
|
||||
|
@ -168,7 +168,8 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/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 (ANDROID_STL MATCHES "gnustl_shared")
|
||||
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})
|
||||
set(sys_ldflags "-shared -O3")
|
||||
target_compile_options(fiber_static PRIVATE -fvisibility=hidden)
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
set(CMAKE_MACOSX_RPATH 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${sys_ldflags}")
|
||||
|
@ -50,6 +50,13 @@ CHECKSYSRES = @echo "Unknow system type!";exit 1
|
||||
UNIXNAME = $(shell uname -sm)
|
||||
UNIXTYPE = LINUX
|
||||
|
||||
###########################################################
|
||||
|
||||
STATIC_LIBNAME = libfiber.a
|
||||
SHARED_LIBNAME = libfiber.so
|
||||
STATIC_OLD_LIBNAME = lib_fiber.a
|
||||
SHARED_OLD_LIBNAME = lib_fiber.so
|
||||
|
||||
ifeq ($(CC),)
|
||||
CC = gcc
|
||||
endif
|
||||
@ -117,10 +124,13 @@ endif
|
||||
|
||||
# For Darwin
|
||||
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
||||
UNIXTYPE = MACOSX
|
||||
# CC += -arch x86_64 -arch arm64
|
||||
CFLAGS += -DMACOSX -Wno-invalid-source-encoding \
|
||||
-Wno-invalid-offsetof \
|
||||
-Wno-deprecated-declarations
|
||||
SHARED_LIBNAME = libfiber.dylib
|
||||
SHARED_OLD_LIBNAME = lib_fiber.dylib
|
||||
endif
|
||||
|
||||
# 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
|
||||
COMPILE = $(CC) $(CFLAGS) -O3
|
||||
COMPILE_FIBER = $(CC) $(CFLAGS)
|
||||
@ -275,6 +278,7 @@ shared: $(OBJ)
|
||||
-R$(rpath) -L$(rpath) $(shared_ldflags); \
|
||||
echo 'build $(rpath)/$(SHARED_LIBNAME) ok!'; \
|
||||
elif test -n "$(rpath)" && test "$(UNIXTYPE)" = "MACOSX"; then \
|
||||
shared_ldflags = -lpthread; \
|
||||
echo "building for Darwin"; \
|
||||
$(CC) -shared -o $(rpath)/$(SHARED_LIBNAME) $(OBJ) \
|
||||
-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"
|
||||
)
|
||||
|
||||
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 (ANDROID_STL MATCHES "gnustl_shared")
|
||||
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")
|
||||
target_compile_options(fiber_cpp_static PRIVATE
|
||||
-fvisibility=hidden -fvisibility-inlines-hidden)
|
||||
set(CMAKE_MACOSX_RPATH 1)
|
||||
elseif (${UNIX_OS})
|
||||
set(sys_ldflags "-shared -lz -lpthread -ldl")
|
||||
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}")
|
||||
add_library(fiber_cpp_shared SHARED ${lib_src})
|
||||
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}")
|
||||
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()
|
||||
|
||||
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
|
||||
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:
|
||||
@ -71,7 +76,7 @@ endif
|
||||
# For FreeBSD
|
||||
ifeq ($(findstring FreeBSD, $(UNIXNAME)), 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
|
||||
|
||||
# For Darwin
|
||||
@ -81,13 +86,15 @@ ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
||||
-Wno-invalid-offsetof \
|
||||
-Wno-unused-private-field
|
||||
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
|
||||
|
||||
# For Linux
|
||||
ifeq ($(findstring Linux, $(UNIXNAME)), 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
|
||||
|
||||
# For CYGWIN
|
||||
@ -147,11 +154,6 @@ OBJ = $(patsubst %.cpp, $(OBJ_PATH_DST)/%.o, $(notdir $(SRC)))
|
||||
VERSION = 0.9
|
||||
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
|
||||
all: static shared sample
|
||||
|
||||
|
@ -154,7 +154,8 @@ install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
|
||||
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 (ANDROID_STL MATCHES "gnustl_shared")
|
||||
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})
|
||||
set(sys_ldflags "-shared -lz -lpthread -ldl")
|
||||
target_compile_options(protocol_static PRIVATE -fvisibility=hidden)
|
||||
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
set(CMAKE_MACOSX_RPATH 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
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}")
|
||||
add_library(protocol_shared SHARED ${lib_src})
|
||||
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}")
|
||||
add_library(protocol_shared SHARED ${lib_src})
|
||||
target_link_libraries(protocol_shared acl)
|
||||
# target_link_libraries(protocol_shared acl)
|
||||
endif()
|
||||
|
||||
SET_TARGET_PROPERTIES(protocol_shared PROPERTIES OUTPUT_NAME "protocol")
|
||||
|
@ -35,6 +35,9 @@ CHECKSYSRES = @echo "Unknow system type!";exit 1
|
||||
UNIXNAME = $(shell uname -sm)
|
||||
UNIXTYPE = LINUX
|
||||
|
||||
STATIC_LIBNAME = libprotocol.a
|
||||
SHARED_LIBNAME = libprotocol.so
|
||||
|
||||
ifeq ($(CC),)
|
||||
CC = gcc
|
||||
endif
|
||||
@ -86,6 +89,7 @@ ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
||||
-flto \
|
||||
-Os
|
||||
UNIXTYPE = MACOSX
|
||||
SHARED_LIBNAME = libprotocol.dylib
|
||||
endif
|
||||
|
||||
# For Linux
|
||||
@ -169,9 +173,6 @@ OBJS_DST = $(BASE_OBJ) $(HTTP_OBJ) $(ICMP_OBJ) $(SMTP_OBJ)
|
||||
LIB_ACL_PATH = ../lib_acl
|
||||
CFLAGS += -I $(LIB_ACL_PATH)/include
|
||||
|
||||
STATIC_LIBNAME = libprotocol.a
|
||||
SHARED_LIBNAME = libprotocol.so
|
||||
|
||||
###########################################################
|
||||
|
||||
.PHONY = static shared clean
|
||||
|
Loading…
Reference in New Issue
Block a user