This commit is contained in:
郑树新 2019-10-08 09:01:20 +08:00
commit fd7abba2e2
16 changed files with 190 additions and 100 deletions

View File

@ -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")

View File

@ -10,7 +10,7 @@
</facet>
<facet type="native-android-gradle" name="Native-Android-Gradle">
<configuration>
<option name="SELECTED_BUILD_VARIANT" value="debug-arm64-v8a" />
<option name="SELECTED_BUILD_VARIANT" value="debug-x86" />
</configuration>
</facet>
<facet type="android" name="Android">
@ -24,7 +24,7 @@
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/src/main/res" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/rs/debug" />
<option name="RES_FOLDERS_RELATIVE_PATH" value="file://$MODULE_DIR$/src/main/res;file://$MODULE_DIR$/build/generated/res/rs/debug;file://$MODULE_DIR$/build/generated/res/resValues/debug" />
<option name="TEST_RES_FOLDERS_RELATIVE_PATH" value="" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/src/main/assets" />
<option name="PROJECT_TYPE" value="1" />

View File

@ -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'
}
}
}

View File

@ -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

View File

@ -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)

View File

@ -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")
set(lib_output_path ${PROJECT_BINARY_DIR}/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})
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})

View File

@ -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

View File

@ -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;

View File

@ -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);
}

View File

@ -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,39 +187,35 @@ 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")
if (CMAKE_SYSTEM_NAME MATCHES "Android")
set(lib_output_path ${CMAKE_CURRENT_SOURCE_DIR}/../android/lib/${ANDROID_ABI})
else()
set(lib_output_path ${PROJECT_BINARY_DIR}/lib)
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 (${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
"-shared -Wl,-rpath,. -L${lib_output_path} -lprotocol -lacl -liconv -lz -lpthread")
"${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
"-shared -Wl,-rpath,. -L${lib_output_path} -lprotocol -lacl -lz -lpthread")
elseif (${WIN_OS})
set(CMAKE_SHARED_LINKER_FLAGS "/DYNAMICBASE ws2_32.lib")
"${lib_output_path}/libprotocol.a ${lib_output_path}/libacl.a -lz -lpthread")
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()
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
add_library(acl_cpp SHARED ${lib_src})

View File

@ -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

View File

@ -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;

View File

@ -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:

View File

@ -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)
endif()
set(LIBRARY_OUTPUT_PATH ${lib_output_path})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_output_path})
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()
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)

View File

@ -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

View File

@ -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;