diff --git a/CMakeLists.txt b/CMakeLists.txt
index ed2c2bfd3..8d6c76dda 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 2.8.0)
-project(acl)
+project(Acl)
#message(${CMAKE_SYSTEM_NAME})
#if(COMMAND CMAKE_POLICY)
@@ -78,7 +78,9 @@ endif()
add_subdirectory(lib_acl acl)
add_subdirectory(lib_protocol protocol)
+add_dependencies(protocol acl)
add_subdirectory(lib_acl_cpp acl_cpp)
+add_dependencies(acl_cpp protocol acl)
#if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Android")
if (CMAKE_SYSTEM_NAME MATCHES "Linux")
diff --git a/android/acl/acl.iml b/android/acl/acl.iml
index dd39bce87..d7e4d2961 100644
--- a/android/acl/acl.iml
+++ b/android/acl/acl.iml
@@ -10,7 +10,7 @@
-
+
@@ -24,7 +24,7 @@
-
+
diff --git a/android/acl/build.gradle b/android/acl/build.gradle
index fab829574..6dc933ee5 100644
--- a/android/acl/build.gradle
+++ b/android/acl/build.gradle
@@ -33,6 +33,7 @@ android {
arguments "-DCMAKE_BUILD_TYPE=RELEASE"
arguments "-DCMAKE_CXX_FLAGS_RELEASE=-O3"
arguments "-DCMAKE_C_FLAGS_RELEASE=-O3"
+ arguments "-DACL_CLIENT_ONLY=YES"
//cppFlags "-fexceptions"
//abiFilters 'armeabi', 'arm64-v8a', 'armeabi-v7a', 'x86'
//abiFilters 'x86', 'arm64-v8a'
@@ -44,6 +45,7 @@ android {
cmake {
//arguments '-DANDROID_PLATFORM=android-14','-DANDROID_TOOLCHAIN=clang'
targets 'acl_static', 'protocol_static', 'acl_cpp_static', 'acl', 'protocol', 'acl_cpp'
+ //targets 'acl_static', 'protocol_static', 'acl_cpp_static'
}
}
}
diff --git a/android/acl/local.properties b/android/acl/local.properties
index 229fea226..1f5d7d6f3 100644
--- a/android/acl/local.properties
+++ b/android/acl/local.properties
@@ -4,6 +4,6 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
-#Mon May 20 09:16:13 CST 2019
-ndk.dir=E:\\tools\\android\\Sdk\\ndk-bundle
-sdk.dir=E:\\tools\\android\\Sdk
+#Wed Sep 18 17:20:23 CST 2019
+#ndk.dir=E\:\\tools\\android\\Sdk\\ndk-bundle
+sdk.dir=/Users/shuxinzheng/Library/Android/sdk
diff --git a/app/master/tools/lib_global/Makefile b/app/master/tools/lib_global/Makefile
index 313127f89..9dbc2a616 100644
--- a/app/master/tools/lib_global/Makefile
+++ b/app/master/tools/lib_global/Makefile
@@ -134,7 +134,9 @@ static: $(OBJS_DST)
@echo 'create $(LIB_PATH_DST)/$(STATIC_LIBNAME) ok!'
# src
-$(OBJ_PATH_DST)/%.o: ./*/%.cpp
+$(OBJ_PATH_DST)/%.o: ./src/%.cpp
+ $(COMPILE_OBJ)
+$(OBJ_PATH_DST)/%.o: ./json/%.cpp
$(COMPILE_OBJ)
clean cl:
rm -f $(LIB_PATH_DST)/$(STATIC_LIBNAME)
diff --git a/lib_acl/CMakeLists.txt b/lib_acl/CMakeLists.txt
index 9ed767b99..8ca53844c 100644
--- a/lib_acl/CMakeLists.txt
+++ b/lib_acl/CMakeLists.txt
@@ -14,23 +14,25 @@ if (CMAKE_SYSTEM_NAME MATCHES "Android")
add_definitions("-DANDROID")
add_definitions("-DACL_CLIENT_ONLY")
add_definitions("-Wno-invalid-source-encoding")
- add_definitions("-fvisibility=hidden")
- add_definitions("-fvisibility-inlines-hidden")
+ add_definitions("-fdata-sections -ffunction-sections")
add_definitions("-Wno-unused-command-line-argument")
string(APPEND CMAKE_C_FLAGS " -Qunused-arguments")
set(UNIX_OS true)
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions("-O2")
- add_definitions("-Wno-invalid-source-encoding")
set(UNIX_OS true)
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_definitions("-O3")
add_definitions("-Wno-invalid-source-encoding")
+ add_definitions("-fdata-sections -ffunction-sections")
+ add_definitions("-flto")
+ add_definitions("-Os")
set(UNIX_OS true)
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_definitions("-O2")
set(UNIX_OS true)
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
+ set(CMAKE_SHARED_LINKER_FLAGS "/DYNAMICBASE ws2_32.lib IPHlpApi.lib")
set(WIN_OS true)
else()
message(FATAL_ERROR "unknown CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}")
@@ -145,27 +147,22 @@ if (ACL_CLIENT_ONLY MATCHES "YES")
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Android")
- set(CMAKE_SHARED_LINKER_FLAGS "-shared -flto")
-
set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../android/lib/${ANDROID_ABI})
- set(LIBRARY_OUTPUT_PATH ${lib_output_path})
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
-
- add_library(acl_static STATIC ${lib_src})
- SET_TARGET_PROPERTIES(acl_static PROPERTIES OUTPUT_NAME "acl")
- link_directories(${lib_output_path})
else()
- if (${WIN_OS})
- set(CMAKE_SHARED_LINKER_FLAGS "/DYNAMICBASE ws2_32.lib IPHlpApi.lib")
- endif()
-
set(lib_output_path ${PROJECT_BINARY_DIR}/lib)
- set(LIBRARY_OUTPUT_PATH ${lib_output_path})
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
+endif()
- add_library(acl_static STATIC ${lib_src})
- SET_TARGET_PROPERTIES(acl_static PROPERTIES OUTPUT_NAME "acl")
- link_directories(${lib_output_path})
+set(LIBRARY_OUTPUT_PATH ${lib_output_path})
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
+
+add_library(acl_static STATIC ${lib_src})
+SET_TARGET_PROPERTIES(acl_static PROPERTIES OUTPUT_NAME "acl")
+link_directories(${lib_output_path})
+
+if (${UNIX_OS})
+ set(CMAKE_SHARED_LINKER_FLAGS "-shared -flto")
+ target_compile_options(acl_static PRIVATE
+ -fvisibility=hidden)
endif()
add_library(acl SHARED ${lib_src})
diff --git a/lib_acl/Makefile b/lib_acl/Makefile
index 9b3e9427b..97bdebf2a 100644
--- a/lib_acl/Makefile
+++ b/lib_acl/Makefile
@@ -16,7 +16,6 @@ LIB_NAME = libacl.a
#CFLAGS = -c -g -W -Wall -Wcast-qual -Wcast-align
CFLAGS = -c -g -W \
--O3 \
-fPIC \
-Wall \
-Werror \
@@ -96,12 +95,16 @@ endif
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
UNIXTYPE = FREEBSD
RPATH = freebsd
+ CFLAGS += -O3
endif
# For Darwin
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
CFLAGS += -Wno-invalid-source-encoding \
- -Wno-invalid-offsetof
+ -Wno-invalid-offsetof \
+ -ffunction-sections \
+ -flto \
+ -Os
UNIXTYPE = MACOSX
RPATH = macos
endif
@@ -117,6 +120,7 @@ ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
# CFLAGS += -m64
RPATH = linux64
endif
+ CFLAGS += -O3
endif
ifeq ($(findstring HAS_TRACE, $(FLAGS)), HAS_TRACE)
@@ -134,6 +138,7 @@ endif
# For MINGW
ifeq ($(findstring MINGW, $(UNIXNAME)), MINGW)
CFLAGS += -DLINUX2 -DMINGW
+ CFLAGS += -O3
UNIXTYPE = LINUX
SYSLIB = -lpthread-2
RPATH = mingw
@@ -142,6 +147,7 @@ endif
# For MSYS
ifeq ($(findstring MSYS, $(UNIXNAME)), MSYS)
CFLAGS += -DLINUX2 -DMINGW
+ CFLAGS += -O3
UNIXTYPE = LINUX
SYSLIB = -lpthread-2
RPATH = mingw
@@ -156,6 +162,7 @@ ifeq ($(findstring SunOS, $(UNIXNAME)), SunOS)
SYSLIB += -lsocket -lnsl -lrt
endif
CFLAGS += -DSUNOS5 -fPIC -Werror
+ CFLAGS += -O3
UNIXTYPE = SUNOS5
RPATH = sunos5_x86
endif
@@ -163,6 +170,7 @@ endif
# For HP-UX
ifeq ($(findstring HP-UX, $(UNIXNAME)), HP-UX)
CFLAGS += -DHP_UX -DHPUX11 -fPIC -Werror
+ CFLAGS += -O3
UNIXTYPE = HPUX
RPATH = hpux
endif
diff --git a/lib_acl/acl.xcodeproj/project.pbxproj b/lib_acl/acl.xcodeproj/project.pbxproj
index 2f9dad0cd..2da997727 100644
--- a/lib_acl/acl.xcodeproj/project.pbxproj
+++ b/lib_acl/acl.xcodeproj/project.pbxproj
@@ -1913,6 +1913,14 @@
../lib_acl/include,
../lib_acl,
);
+ OTHER_CFLAGS = (
+ "-fvisibility=hidden",
+ "-fvisibility-inlines-hidden",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-flto",
+ "-Os",
+ );
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@@ -1922,10 +1930,22 @@
0779D3391DBE054C00449438 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ ACL_PREPARE_COMPILE,
+ ACL_CLIENT_ONLY,
+ );
HEADER_SEARCH_PATHS = (
../lib_acl/include,
../lib_acl,
);
+ OTHER_CFLAGS = (
+ "-fvisibility=hidden",
+ "-fvisibility-inlines-hidden",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-flto",
+ "-Os",
+ );
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
diff --git a/lib_acl/src/aio/acl_aio.c b/lib_acl/src/aio/acl_aio.c
index 0daba6068..889bdf1d6 100644
--- a/lib_acl/src/aio/acl_aio.c
+++ b/lib_acl/src/aio/acl_aio.c
@@ -53,6 +53,7 @@ ACL_AIO *acl_aio_create(int event_mode)
ACL_AIO *acl_aio_create2(int event_mode, unsigned int nMsg)
{
+#if defined(ACL_CLIENT_ONLY)
const char *myname = "acl_aio_create";
ACL_EVENT *event;
@@ -75,7 +76,11 @@ ACL_AIO *acl_aio_create2(int event_mode, unsigned int nMsg)
event = NULL; /* avoid compiling warning */
break;
}
-
+#else
+ ACL_EVENT *event = acl_event_new_poll(1, 0);
+ (void) event_mode;
+ (void) nMsg;
+#endif
return acl_aio_create3(event);
}
diff --git a/lib_acl_cpp/CMakeLists.txt b/lib_acl_cpp/CMakeLists.txt
index 3114d80c6..0c3f8a704 100644
--- a/lib_acl_cpp/CMakeLists.txt
+++ b/lib_acl_cpp/CMakeLists.txt
@@ -10,11 +10,8 @@ endif()
if(CMAKE_SYSTEM_NAME MATCHES "Android")
add_definitions("-flto")
add_definitions("-DANDROID")
- add_definitions("-DACL_CLIENT_ONLY")
add_definitions("-Wno-unused-command-line-argument")
add_definitions("-Wno-invalid-source-encoding")
- add_definitions("-fvisibility=hidden")
- add_definitions("-fvisibility-inlines-hidden")
string(APPEND CMAKE_CXX_FLAGS " -Qunused-arguments")
set(UNIX_OS true)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
@@ -26,14 +23,22 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(UNIX_OS true)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_definitions("-Wno-invalid-source-encoding")
+ add_definitions("-fdata-sections -ffunction-sections")
+ add_definitions("-flto")
add_definitions("-Os")
set(UNIX_OS true)
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
+ set(CMAKE_SHARED_LINKER_FLAGS "/DYNAMICBASE ws2_32.lib")
set(WIN_OS true)
else()
message(FATAL_ERROR "unknown CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}")
endif()
+if (ACL_CLIENT_ONLY MATCHES "YES")
+ message(STATUS "acl_cpp: ACL_CLIENT_ONLY been set")
+ add_definitions("-DACL_CLIENT_ONLY")
+endif()
+
##############################################################################
set(acl_path ${CMAKE_CURRENT_SOURCE_DIR}/../lib_acl)
@@ -118,12 +123,6 @@ if (${UNIX_OS})
)
endif()
-# if (CMAKE_BUILD_TYPE STREQUAL "")
-# set(CMAKE_BUILD_TYPE "DEBUG")
-# else()
-# string(TOUPPER CMAKE_BUILD_TYPE CMAKE_BUILD_TYPE)
-# endif()
-
if (!CMAKE_BUILD_TYPE STREQUAL "RELEASE")
add_definitions("-g")
endif()
@@ -188,40 +187,36 @@ elseif (${WIN_OS})
aux_source_directory(${src}/stdlib/internal lib_src)
endif()
-if (ACL_CLIENT_ONLY MATCHES "YES")
- message(STATUS "acl_cpp: ACL_CLIENT_ONLY been set")
-endif()
-
if (CMAKE_SYSTEM_NAME MATCHES "Android")
- set(CMAKE_SHARED_LINKER_FLAGS "-shared -lz -flto")
-
set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../android/lib/${ANDROID_ABI})
- set(LIBRARY_OUTPUT_PATH ${lib_output_path})
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
-
- add_library(acl_cpp_static STATIC ${lib_src})
- SET_TARGET_PROPERTIES(acl_cpp_static PROPERTIES OUTPUT_NAME "acl_cpp")
- link_directories(${lib_output_path})
else()
set(lib_output_path ${PROJECT_BINARY_DIR}/lib)
- set(LIBRARY_OUTPUT_PATH ${lib_output_path})
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
-
- if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
- set(CMAKE_SHARED_LINKER_FLAGS
- "-shared -Wl,-rpath,. -L${lib_output_path} -lprotocol -lacl -liconv -lz -lpthread")
- elseif (${UNIX_OS})
- set(CMAKE_SHARED_LINKER_FLAGS
- "-shared -Wl,-rpath,. -L${lib_output_path} -lprotocol -lacl -lz -lpthread")
- elseif (${WIN_OS})
- set(CMAKE_SHARED_LINKER_FLAGS "/DYNAMICBASE ws2_32.lib")
- endif()
-
- add_library(acl_cpp_static STATIC ${lib_src})
- SET_TARGET_PROPERTIES(acl_cpp_static PROPERTIES OUTPUT_NAME "acl_cpp")
- link_directories(${lib_output_path})
endif()
+set(LIBRARY_OUTPUT_PATH ${lib_output_path})
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
+
+add_library(acl_cpp_static STATIC ${lib_src})
+SET_TARGET_PROPERTIES(acl_cpp_static PROPERTIES OUTPUT_NAME "acl_cpp")
+link_directories(${lib_output_path})
+
+if (${UNIX_OS})
+ set(CMAKE_SHARED_LINKER_FLAGS "-shared -lz -flto")
+ target_compile_options(acl_cpp_static PRIVATE
+ -fvisibility=hidden
+ -fvisibility-inlines-hidden)
+endif()
+
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ set(CMAKE_SHARED_LINKER_FLAGS
+ "${lib_output_path}/libprotocol.a ${lib_output_path}/libacl.a -liconv -lz -lpthread")
+elseif (CMAKE_SYSTEM_NAME MATCHES "Android")
+elseif (${UNIX_OS})
+ set(CMAKE_SHARED_LINKER_FLAGS
+ "${lib_output_path}/libprotocol.a ${lib_output_path}/libacl.a -lz -lpthread")
+endif()
+
+
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
add_library(acl_cpp SHARED ${lib_src})
target_link_libraries(acl_cpp protocol acl)
diff --git a/lib_acl_cpp/Makefile b/lib_acl_cpp/Makefile
index f3553a539..7b5614c98 100644
--- a/lib_acl_cpp/Makefile
+++ b/lib_acl_cpp/Makefile
@@ -9,7 +9,6 @@ RANLIB = ${ENV_RANLIB}
FLAGS = ${ENV_FLAGS}
CFLAGS = -c -g -W \
--O3 \
-fPIC \
-Wall \
-Werror \
@@ -87,6 +86,7 @@ endif
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
UNIXTYPE = FREEBSD
CFLAGS += -Wshadow
+ CFLAGS += -O3
shared_ldflags = -lprotocol -lacl -L/usr/local/lib -liconv -lz -lpthread
endif
@@ -94,7 +94,11 @@ endif
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
CFLAGS += -Wno-invalid-source-encoding \
-Wno-invalid-offsetof \
- -Wno-unused-private-field
+ -Wno-unused-private-field \
+ -fdata-sections \
+ -ffunction-sections \
+ -flto \
+ -Os
CFLAGS += -Wshadow
UNIXTYPE = MACOSX
shared_ldflags = -lprotocol -lacl -L/usr/lib -liconv -lz -lpthread
@@ -104,6 +108,7 @@ endif
ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
UNIXTYPE = LINUX
CFLAGS += -Wshadow
+ CFLAGS += -O3
shared_ldflags = -lprotocol -lacl -lrt -lpthread -lz -ldl
endif
@@ -111,6 +116,7 @@ endif
ifeq ($(findstring MINGW, $(UNIXNAME)), MINGW)
CFLAGS += -DLINUX2 -DMINGW
CFLAGS += -Wshadow
+ CFLAGS += -O3
UNIXTYPE = LINUX
endif
@@ -118,6 +124,7 @@ endif
ifeq ($(findstring MSYS, $(UNIXNAME)), MSYS)
CFLAGS += -DLINUX2 -DMINGW
CFLAGS += -Wshadow
+ CFLAGS += -O3
UNIXTYPE = LINUX
endif
@@ -130,6 +137,7 @@ ifeq ($(findstring SunOS, $(UNIXNAME)), SunOS)
SYSLIB = -lsocket -lnsl -lrt
endif
CFLAGS += -DSUNOS5
+ CFLAGS += -O3
UNIXTYPE = SUNOS5
endif
@@ -137,6 +145,7 @@ endif
ifeq ($(findstring HP-UX, $(UNIXNAME)), HP-UX)
CFLAGS += -DHP_UX -DHPUX11
CFLAGS += -Wshadow
+ CFLAGS += -O3
UNIXTYPE = HPUX
endif
diff --git a/lib_acl_cpp/acl_cpp.xcodeproj/project.pbxproj b/lib_acl_cpp/acl_cpp.xcodeproj/project.pbxproj
index 58d88a94d..f2bcd83ad 100644
--- a/lib_acl_cpp/acl_cpp.xcodeproj/project.pbxproj
+++ b/lib_acl_cpp/acl_cpp.xcodeproj/project.pbxproj
@@ -1926,10 +1926,8 @@
isa = XCBuildConfiguration;
buildSettings = {
GCC_PREPROCESSOR_DEFINITIONS = (
+ ACL_CLIENT_ONLY,
"$(inherited)",
- HAS_MYSQL,
- HAS_PGSQL,
- HAS_SQLITE,
);
HEADER_SEARCH_PATHS = (
../lib_acl/include,
@@ -1946,6 +1944,15 @@
/Users/zsx/work/github/acl/test/url_coder,
);
MACOSX_DEPLOYMENT_TARGET = 10.10;
+ OTHER_CFLAGS = "";
+ OTHER_CPLUSPLUSFLAGS = (
+ "-fvisibility=hidden",
+ "-fvisibility-inlines-hidden",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-flto",
+ "-Os",
+ );
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@@ -1956,10 +1963,8 @@
isa = XCBuildConfiguration;
buildSettings = {
GCC_PREPROCESSOR_DEFINITIONS = (
+ ACL_CLIENT_ONLY,
"$(inherited)",
- HAS_MYSQL,
- HAS_PGSQL,
- HAS_SQLITE,
);
HEADER_SEARCH_PATHS = (
../lib_acl/include,
@@ -1976,6 +1981,16 @@
/Users/zsx/work/github/acl/test/url_coder,
);
MACOSX_DEPLOYMENT_TARGET = 10.10;
+ ONLY_ACTIVE_ARCH = NO;
+ OTHER_CFLAGS = "";
+ OTHER_CPLUSPLUSFLAGS = (
+ "-fvisibility=hidden",
+ "-fvisibility-inlines-hidden",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-flto",
+ "-Os",
+ );
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
diff --git a/lib_fiber/cpp/Makefile b/lib_fiber/cpp/Makefile
index d874402b9..ed8887b1a 100644
--- a/lib_fiber/cpp/Makefile
+++ b/lib_fiber/cpp/Makefile
@@ -193,7 +193,7 @@ shared: $(OBJ)
# src
$(OBJ_PATH_DST)/%.o: ./src/%.cpp
$(COMPILE_OBJ)
-$(OBJ_PATH_DST)/%.o: ./src/*/%.cpp
+$(OBJ_PATH_DST)/%.o: ./src/keeper/%.cpp
$(COMPILE_OBJ)
clean cl:
diff --git a/lib_protocol/CMakeLists.txt b/lib_protocol/CMakeLists.txt
index 9b6df1d39..8b4a1a89f 100644
--- a/lib_protocol/CMakeLists.txt
+++ b/lib_protocol/CMakeLists.txt
@@ -12,12 +12,10 @@ if (CMAKE_SYSTEM_NAME MATCHES "Android")
add_definitions("-DANDROID")
add_definitions("-Wno-invalid-source-encoding")
add_definitions("-Wno-unused-command-line-argument")
- add_definitions("-fvisibility=hidden")
- add_definitions("-fvisibility-inlines-hidden")
+ add_definitions("-fdata-sections -ffunction-sections")
string(APPEND CMAKE_C_FLAGS " -Qunused-arguments")
set(UNIX_OS true)
elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
- add_definitions("-Wno-invalid-source-encoding")
add_definitions("-O2")
set(UNIX_OS true)
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
@@ -25,14 +23,22 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(UNIX_OS true)
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_definitions("-Wno-invalid-source-encoding")
+ add_definitions("-fdata-sections -ffunction-sections")
+ add_definitions("-flto")
add_definitions("-Os")
set(UNIX_OS true)
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
+ set(CMAKE_SHARED_LINKER_FLAGS "/DYNAMICBASE ws2_32.lib")
set(WIN_OS true)
else()
message(FATAL_ERROR "unknown CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}")
endif()
+if (ACL_CLIENT_ONLY MATCHES "YES")
+ add_definitions("-DACL_CLIENT_ONLY")
+ message(STATUS "protocol: ACL_CLIENT_ONLY been set")
+endif()
+
##############################################################################
set(acl_path ${CMAKE_CURRENT_SOURCE_DIR}/../lib_acl)
@@ -97,29 +103,27 @@ elseif (${WIN_OS})
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Android")
- set(CMAKE_SHARED_LINKER_FLAGS "-shared -flto")
-
set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../android/lib/${ANDROID_ABI})
- set(LIBRARY_OUTPUT_PATH ${lib_output_path})
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
-
- add_library(protocol_static STATIC ${lib_src})
- SET_TARGET_PROPERTIES(protocol_static PROPERTIES OUTPUT_NAME "protocol")
- link_directories(${lib_output_path})
else()
set(lib_output_path ${PROJECT_BINARY_DIR}/lib)
- set(LIBRARY_OUTPUT_PATH ${lib_output_path})
- set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
+endif()
- if (${UNIX_OS})
- set(CMAKE_SHARED_LINKER_FLAGS "-shared -Wl,-rpath,. -L${lib_output_path} -lacl")
- elseif (${WIN_OS})
- set(CMAKE_SHARED_LINKER_FLAGS "/DYNAMICBASE ws2_32.lib")
- endif()
+set(LIBRARY_OUTPUT_PATH ${lib_output_path})
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
- add_library(protocol_static STATIC ${lib_src})
- SET_TARGET_PROPERTIES(protocol_static PROPERTIES OUTPUT_NAME "protocol")
- link_directories(${lib_output_path})
+add_library(protocol_static STATIC ${lib_src})
+SET_TARGET_PROPERTIES(protocol_static PROPERTIES OUTPUT_NAME "protocol")
+link_directories(${lib_output_path})
+
+if (CMAKE_SYSTEM_NAME MATCHES "Android")
+ set(CMAKE_SHARED_LINKER_FLAGS "-shared -flto")
+ target_compile_options(protocol_static PRIVATE
+ -fvisibility=hidden)
+elseif (${UNIX_OS})
+ set(CMAKE_SHARED_LINKER_FLAGS "-shared -flto")
+ set(CMAKE_SHARED_LINKER_FLAGS "${lib_output_path}/libacl.a")
+ target_compile_options(protocol_static PRIVATE
+ -fvisibility=hidden)
endif()
if (NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
diff --git a/lib_protocol/Makefile b/lib_protocol/Makefile
index fc9891112..856117b32 100644
--- a/lib_protocol/Makefile
+++ b/lib_protocol/Makefile
@@ -8,7 +8,6 @@ ARFL = rv
RANLIB = ${ENV_RANLIB}
CFLAGS = -c -g -W \
--O3 \
-fPIC \
-Wall \
-Werror \
@@ -66,30 +65,38 @@ endif
# For FreeBSD
ifeq ($(findstring FreeBSD, $(UNIXNAME)), FreeBSD)
UNIXTYPE = FREEBSD
+ CFLAGS += -O3
endif
# For Darwin
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
CFLAGS += -Wno-invalid-source-encoding \
- -Wno-invalid-offsetof
+ -Wno-invalid-offsetof \
+ -fdata-sections \
+ -ffunction-sections \
+ -flto \
+ -Os
UNIXTYPE = MACOSX
endif
# For Linux
ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
UNIXTYPE = LINUX
+ CFLAGS += -O3
endif
# For MINGW
ifeq ($(findstring MINGW, $(UNIXNAME)), MINGW)
CFLAGS += -DLINUX2 -DMINGW
UNIXTYPE = LINUX
+ CFLAGS += -O3
endif
# For MSYS
ifeq ($(findstring MSYS, $(UNIXNAME)), MSYS)
CFLAGS += -DLINUX2 -DMINGW
UNIXTYPE = LINUX
+ CFLAGS += -O3
endif
# For SunOS
@@ -101,12 +108,14 @@ ifeq ($(findstring SunOS, $(UNIXNAME)), SunOS)
SYSLIB = -lsocket -lnsl -lrt
endif
CFLAGS += -DSUNOS5
+ CFLAGS += -O3
UNIXTYPE = SUNOS5
endif
# For HP-UX
ifeq ($(findstring HP-UX, $(UNIXNAME)), HP-UX)
CFLAGS += -DHP_UX -DHPUX11
+ CFLAGS += -O3
UNIXTYPE = HPUX
endif
diff --git a/lib_protocol/protocol.xcodeproj/project.pbxproj b/lib_protocol/protocol.xcodeproj/project.pbxproj
index 4bab4135a..3e72c229f 100644
--- a/lib_protocol/protocol.xcodeproj/project.pbxproj
+++ b/lib_protocol/protocol.xcodeproj/project.pbxproj
@@ -420,13 +420,25 @@
07A457141E6FC3D3002C9B3C /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- GCC_PREPROCESSOR_DEFINITIONS = "$(inherited) ";
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "$(inherited)",
+ ACL_CLIENT_ONLY,
+ );
HEADER_SEARCH_PATHS = (
../lib_acl/include,
../lib_protocol/src,
../lib_protocol/include,
);
MACOSX_DEPLOYMENT_TARGET = 10.10;
+ OTHER_CFLAGS = (
+ "-fvisibility=hidden",
+ "-fvisibility-inlines-hidden",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-flto",
+ "-Os",
+ );
+ OTHER_CPLUSPLUSFLAGS = "";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
@@ -436,12 +448,22 @@
07A457151E6FC3D3002C9B3C /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ GCC_PREPROCESSOR_DEFINITIONS = ACL_CLIENT_ONLY;
HEADER_SEARCH_PATHS = (
../lib_acl/include,
../lib_protocol/src,
../lib_protocol/include,
);
MACOSX_DEPLOYMENT_TARGET = 10.10;
+ OTHER_CFLAGS = (
+ "-fvisibility=hidden",
+ "-fvisibility-inlines-hidden",
+ "-fdata-sections",
+ "-ffunction-sections",
+ "-flto",
+ "-Os",
+ );
+ OTHER_CPLUSPLUSFLAGS = "";
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;