Support Mac OSX Debug build type

master
Ryan Lee 2016-06-25 13:59:56 +09:00
parent e5d09a458f
commit 28e5037946
2 changed files with 16 additions and 9 deletions

View File

@ -53,7 +53,7 @@ if (MSVC)
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
elseif (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fvisibility=hidden")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++11")
elseif (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
@ -143,7 +143,7 @@ if (TN_WITH_STATIC)
elseif (APPLE)
MERGE_STATIC_LIBRARIES(throughnet
"${WEBRTC_LIBRARIES_INTERNAL_RELEASE}"
"${WEBRTC_LIBRARIES_INTERNAL_DEBUG}")
"${WEBRTC_LIBRARIES_INTERNAL_DEBUG}")
elseif (UNIX)
MERGE_STATIC_LIBRARIES(throughnet
"${WEBRTC_LIBRARIES_INTERNAL_RELEASE}"

View File

@ -39,14 +39,21 @@ macro (MERGE_STATIC_LIBRARIES TARGET_LIB LIBRARIES LIBRARIES_DEBUG)
set(outfile $<TARGET_FILE:${TARGET_LIB}>)
set(target_temp_file "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/lib${TARGET_LIB}_temp.a")
string(TOUPPER "${CMAKE_BUILD_TYPE}" _CMAKE_BUILD_TYPE)
if (_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
set(_LIBRARIES ${LIBRARIES_DEBUG})
else()
set(_LIBRARIES ${LIBRARIES})
endif()
add_custom_command(TARGET ${TARGET_LIB} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${outfile}"
"${target_temp_file}"
COMMAND rm "${outfile}"
COMMAND /usr/bin/libtool -no_warning_for_no_symbols -static -o "${outfile}"
${LIBRARIES} "${target_temp_file}"
COMMAND rm "${target_temp_file}"
)
COMMAND ${CMAKE_COMMAND} -E copy "${outfile}"
"${target_temp_file}"
COMMAND rm "${outfile}"
COMMAND /usr/bin/libtool -no_warning_for_no_symbols -static -o "${outfile}"
${_LIBRARIES} "${target_temp_file}"
COMMAND rm "${target_temp_file}"
)
endif (WIN32)
endmacro (MERGE_STATIC_LIBRARIES)