mirror of
https://gitee.com/acl-dev/acl.git
synced 2024-11-30 02:47:56 +08:00
optimize libs size for IOS/Macos
This commit is contained in:
parent
518e2ad896
commit
7a411a53dd
@ -26,6 +26,11 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
add_definitions("-O3")
|
||||
add_definitions("-Wno-invalid-source-encoding")
|
||||
add_definitions("-fvisibility=hidden")
|
||||
add_definitions("-fvisibility-inlines-hidden")
|
||||
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")
|
||||
|
@ -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 \
|
||||
@ -101,7 +100,13 @@ endif
|
||||
# For Darwin
|
||||
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
||||
CFLAGS += -Wno-invalid-source-encoding \
|
||||
-Wno-invalid-offsetof
|
||||
-Wno-invalid-offsetof \
|
||||
-fvisibility=hidden \
|
||||
-fvisibility-inlines-hidden \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
-flto \
|
||||
-Os
|
||||
UNIXTYPE = MACOSX
|
||||
RPATH = macos
|
||||
endif
|
||||
@ -117,6 +122,7 @@ ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
|
||||
# CFLAGS += -m64
|
||||
RPATH = linux64
|
||||
endif
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
ifeq ($(findstring HAS_TRACE, $(FLAGS)), HAS_TRACE)
|
||||
|
@ -26,6 +26,10 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
set(UNIX_OS true)
|
||||
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
add_definitions("-Wno-invalid-source-encoding")
|
||||
add_definitions("-fvisibility=hidden")
|
||||
add_definitions("-fvisibility-inlines-hidden")
|
||||
add_definitions("-fdata-sections -ffunction-sections")
|
||||
add_definitions("-flto")
|
||||
add_definitions("-Os")
|
||||
set(UNIX_OS true)
|
||||
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
|
@ -9,7 +9,6 @@ RANLIB = ${ENV_RANLIB}
|
||||
FLAGS = ${ENV_FLAGS}
|
||||
|
||||
CFLAGS = -c -g -W \
|
||||
-O3 \
|
||||
-fPIC \
|
||||
-Wall \
|
||||
-Werror \
|
||||
@ -94,7 +93,13 @@ endif
|
||||
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
||||
CFLAGS += -Wno-invalid-source-encoding \
|
||||
-Wno-invalid-offsetof \
|
||||
-Wno-unused-private-field
|
||||
-Wno-unused-private-field \
|
||||
-fvisibility=hidden \
|
||||
-fvisibility-inlines-hidden \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
-flto \
|
||||
-Os
|
||||
CFLAGS += -Wshadow
|
||||
UNIXTYPE = MACOSX
|
||||
shared_ldflags = -lprotocol -lacl -L/usr/lib -liconv -lz -lpthread
|
||||
@ -104,6 +109,7 @@ endif
|
||||
ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
|
||||
UNIXTYPE = LINUX
|
||||
CFLAGS += -Wshadow
|
||||
CFLAGS += -O3
|
||||
shared_ldflags = -lprotocol -lacl -lrt -lpthread -lz -ldl
|
||||
endif
|
||||
|
||||
|
@ -25,6 +25,10 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
set(UNIX_OS true)
|
||||
elseif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
add_definitions("-Wno-invalid-source-encoding")
|
||||
add_definitions("-fvisibility=hidden")
|
||||
add_definitions("-fvisibility-inlines-hidden")
|
||||
add_definitions("-fdata-sections -ffunction-sections")
|
||||
add_definitions("-flto")
|
||||
add_definitions("-Os")
|
||||
set(UNIX_OS true)
|
||||
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
|
||||
|
@ -8,7 +8,6 @@ ARFL = rv
|
||||
RANLIB = ${ENV_RANLIB}
|
||||
|
||||
CFLAGS = -c -g -W \
|
||||
-O3 \
|
||||
-fPIC \
|
||||
-Wall \
|
||||
-Werror \
|
||||
@ -71,13 +70,20 @@ endif
|
||||
# For Darwin
|
||||
ifeq ($(findstring Darwin, $(UNIXNAME)), Darwin)
|
||||
CFLAGS += -Wno-invalid-source-encoding \
|
||||
-Wno-invalid-offsetof
|
||||
-Wno-invalid-offsetof \
|
||||
-fvisibility=hidden \
|
||||
-fvisibility-inlines-hidden \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
-flto \
|
||||
-Os
|
||||
UNIXTYPE = MACOSX
|
||||
endif
|
||||
|
||||
# For Linux
|
||||
ifeq ($(findstring Linux, $(UNIXNAME)), Linux)
|
||||
UNIXTYPE = LINUX
|
||||
CFLAGS += -O3
|
||||
endif
|
||||
|
||||
# For MINGW
|
||||
|
Loading…
Reference in New Issue
Block a user