@
lixile @
ecnelises 感谢 2 位老总。对 mac 实在是不熟悉。cmake 乱加一通算是搞定了,虽然有些参数还不太理解:
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
SET(CMAKE_CXX_FLAGS "-g -w -O2")
LINK_FLAGS "-Wl,-F/Library/Frameworks"
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -g0 -Wl,--strip-all -s -flto -fomit-frame-pointer -fvisibility=hidden")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -dead_strip -Wl,-strip-all -flto -s -fvisibility=hidden -Xlinker")
set(MACOSX_RPATH TRUE)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
set(CMAKE_INSTALL_RPATH "@loader_path")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
编译完再 strip 。基本没有冗余了