From 15d2226427ad9c8a2b7b8a53b0031fef117b7bb9 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 7 May 2012 10:27:54 +0200 Subject: [PATCH] Changed: Use only static libraries under Mac OS X if WITH_STATIC_EXTERNAL is used Changed: Strip binaries under Mac OS X by default in Release (use WITH_SYMBOLS if you don't want) --- code/CMakeModules/nel.cmake | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/code/CMakeModules/nel.cmake b/code/CMakeModules/nel.cmake index e6bf57101..331764d70 100644 --- a/code/CMakeModules/nel.cmake +++ b/code/CMakeModules/nel.cmake @@ -355,7 +355,7 @@ MACRO(NL_SETUP_BUILD) ENDIF(CMAKE_BUILD_TYPE MATCHES "Release") ENDIF(CMAKE_BUILD_TYPE MATCHES "Debug") - SET(HOST_CPU ${CMAKE_SYSTEM_PROCESSOR}) + SET(HOST_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR}) IF(HOST_CPU MATCHES "amd64") SET(HOST_CPU "x86_64") @@ -382,6 +382,11 @@ MACRO(NL_SETUP_BUILD) # DEB_HOST_ARCH_ENDIAN is 'little' or 'big' # DEB_HOST_ARCH_BITS is '32' or '64' + IF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") + SET(CLANG ON) + MESSAGE(STATUS "Using Clang compiler") + ENDIF(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") + # If target and host CPU are the same IF("${HOST_CPU}" STREQUAL "${TARGET_CPU}") # x86-compatible CPU @@ -397,8 +402,13 @@ MACRO(NL_SETUP_BUILD) ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(TARGET_CPU "x86") ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 8) + ELSEIF(HOST_CPU MATCHES "arm") + SET(TARGET_CPU "arm") + ELSE(HOST_CPU MATCHES "x86") + SET(TARGET_CPU "unknown") + MESSAGE(STATUS "Unknown architecture: ${HOST_CPU}") ENDIF(HOST_CPU MATCHES "x86") - # TODO: add checks for ARM and PPC + # TODO: add checks for PPC ELSE("${HOST_CPU}" STREQUAL "${TARGET_CPU}") MESSAGE(STATUS "Compiling on ${HOST_CPU} for ${TARGET_CPU}") ENDIF("${HOST_CPU}" STREQUAL "${TARGET_CPU}") @@ -409,6 +419,9 @@ MACRO(NL_SETUP_BUILD) ELSEIF(TARGET_CPU STREQUAL "x86") SET(TARGET_X86 1) SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_X86") + ELSEIF(TARGET_CPU STREQUAL "arm") + SET(TARGET_ARM 1) + SET(PLATFORM_CFLAGS "${PLATFORM_CFLAGS} -DHAVE_ARM") ENDIF(TARGET_CPU STREQUAL "x86_64") # Fix library paths suffixes for Debian MultiArch @@ -514,12 +527,14 @@ MACRO(NL_SETUP_BUILD) IF(WITH_SYMBOLS) SET(NL_RELEASE_CFLAGS "${NL_RELEASE_CFLAGS} -g") ELSE(WITH_SYMBOLS) - IF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + IF(APPLE) + SET(NL_RELEASE_LINKFLAGS "-Wl,-dead_strip -Wl,-x ${NL_RELEASE_LINKFLAGS}") + ELSE(APPLE) SET(NL_RELEASE_LINKFLAGS "-Wl,-s ${NL_RELEASE_LINKFLAGS}") - ENDIF(NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + ENDIF(APPLE) ENDIF(WITH_SYMBOLS) - SET(NL_DEBUG_CFLAGS "-DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}") + SET(NL_DEBUG_CFLAGS "-g -DNL_DEBUG -D_DEBUG ${NL_DEBUG_CFLAGS}") SET(NL_RELEASE_CFLAGS "-DNL_RELEASE -DNDEBUG -O3 ${NL_RELEASE_CFLAGS}") ENDIF(MSVC) ENDMACRO(NL_SETUP_BUILD) @@ -710,7 +725,7 @@ MACRO(SETUP_EXTERNAL) ELSE(WIN32) IF(APPLE) IF(WITH_STATIC_EXTERNAL) - SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .dylib .so) + SET(CMAKE_FIND_LIBRARY_SUFFIXES .a) ELSE(WITH_STATIC_EXTERNAL) SET(CMAKE_FIND_LIBRARY_SUFFIXES .dylib .so .a) ENDIF(WITH_STATIC_EXTERNAL)