r19233 by craig - Add better OSX version detection
scribus-commit
scribus-commit at lists.scribus.net
Sun Jun 15 06:53:31 UTC 2014
Author: craig
Date: Sun Jun 15 06:53:30 2014
New Revision: 19233
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19233
Log:
Add better OSX version detection
Modified:
trunk/Scribus/CMakeLists.txt
Modified: trunk/Scribus/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19233&path=/trunk/Scribus/CMakeLists.txt
==============================================================================
--- trunk/Scribus/CMakeLists.txt (original)
+++ trunk/Scribus/CMakeLists.txt Sun Jun 15 06:53:30 2014
@@ -72,23 +72,48 @@
OUTPUT_STRIP_TRAILING_WHITESPACE
)
MESSAGE(STATUS "Machine: ${MACHINE}, void pointer size: ${CMAKE_SIZEOF_VOID_P}")
-STRING(REGEX MATCH "(i?86-*)|(athlon-*)|(pentium-*)" _machine_x86 "${MACHINE}")
+STRING(REGEX MATCH "(i[0-9]86-*)|(athlon-*)|(pentium-*)" _machine_x86 "${MACHINE}")
IF (_machine_x86)
MESSAGE(STATUS "Found target X86")
SET(ARCH_X86 1)
ENDIF (_machine_x86)
-IF (APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND ARCH_X86 EQUAL 1)
- MESSAGE(STATUS "Found Snow Leopard Target: Apple, 64 bit, X86")
- UNSET(ARCH_X86)
- SET(ARCH_X86_64 1)
- SET(APPLE_10_6_X 1 CACHE TYPE BOOL)
-ENDIF (APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND ARCH_X86 EQUAL 1)
STRING(REGEX MATCH "(x86_64-*)|(X86_64-*)|(AMD64-*)|(amd64-*)" _machine_x86_64 "${MACHINE}")
IF (_machine_x86_64)
- MESSAGE(STATUS "Found target X86_64")
- SET(ARCH_X86_64 1)
+ MESSAGE(STATUS "Found target X86_64")
+ SET(ARCH_X86_64 1)
ENDIF (_machine_x86_64)
+
+IF (APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND (ARCH_X86 EQUAL 1 OR ARCH_X86_64 EQUAL 1))
+ STRING(REGEX REPLACE ".*-darwin([0-9]+).*" "\\1" _apple_ver "${MACHINE}")
+ IF (_apple_ver EQUAL "14")
+ MESSAGE(STATUS "Found OSX Yosemite Target: Apple, 64 bit, X86")
+ SET(APPLE_10_10_X 1 CACHE TYPE BOOL)
+ ENDIF (_apple_ver EQUAL "14")
+ IF (_apple_ver EQUAL "13")
+ MESSAGE(STATUS "Found OSX Mavericks Target: Apple, 64 bit, X86")
+ SET(APPLE_10_9_X 1 CACHE TYPE BOOL)
+ ENDIF (_apple_ver EQUAL "13")
+ IF (_apple_ver EQUAL "12")
+ MESSAGE(STATUS "Found OSX Mountain Lion Target: Apple, 64 bit, X86")
+ SET(APPLE_10_8_X 1 CACHE TYPE BOOL)
+ ENDIF (_apple_ver EQUAL "12")
+ IF (_apple_ver EQUAL "11")
+ MESSAGE(STATUS "Found OSX Lion Target: Apple, 64 bit, X86")
+ SET(APPLE_10_7_X 1 CACHE TYPE BOOL)
+ ENDIF (_apple_ver EQUAL "11")
+ IF (_apple_ver EQUAL "10")
+ MESSAGE(STATUS "Found OSX Snow Leopard Target: Apple, 64 bit, X86")
+ SET(APPLE_10_6_X 1 CACHE TYPE BOOL)
+ ENDIF (_apple_ver EQUAL "10")
+ IF (_apple_ver EQUAL "9")
+ MESSAGE(STATUS "Found OSX Leoard Target: Apple, 32 bit, X86")
+ SET(APPLE_10_9_X 1 CACHE TYPE BOOL)
+ ENDIF (_apple_ver EQUAL "9")
+ UNSET(ARCH_X86)
+ENDIF (APPLE AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND (ARCH_X86 EQUAL 1 OR ARCH_X86_64 EQUAL 1))
+
+
STRING(REGEX MATCH "(sparc64-*)|(SPARC64-*)" _machine_sparc_64 "${MACHINE}")
IF (_machine_sparc_64)
@@ -357,72 +382,70 @@
IF(APPLE_10_4_X)
SET(OSXMINVER "10.4" CACHE TYPE STRING)
ENDIF(APPLE_10_4_X)
- # gcc/mac
- IF(WANT_UNIVERSAL_BUNDLE)
- MESSAGE("Setting Universal (PPC/i386) Architecture for OSX Build/Bundle")
- SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" )
- SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc;i386" )
- SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk")
- SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.4")
- ELSE(WANT_UNIVERSAL_BUNDLE)
- IF(ARCH_PPC OR ARCH_PPC_64)
- MESSAGE("Setting PPC Architecture for OSX Build/Bundle")
- SET(CMAKE_OSX_ARCHITECTURES "ppc" )
- SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc" )
- ELSE(ARCH_PPC OR ARCH_PPC_64)
- IF(APPLE_10_6_X OR APPLE_10_7_X OR APPLE_10_8_X OR APPLE_10_9_X OR APPLE_10_10_X)
- MESSAGE("Setting x86_64 Architecture for OSX Build/Bundle")
- SET(CMAKE_OSX_ARCHITECTURES "x86_64" )
- SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "x86_64" )
- ELSE(APPLE_10_6_X OR APPLE_10_7_X OR APPLE_10_8_X OR APPLE_10_9_X OR APPLE_10_10_X)
- MESSAGE("Setting i386 Architecture for OSX Build/Bundle")
- SET(CMAKE_OSX_ARCHITECTURES "i386" )
- SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "i386" )
- ENDIF(APPLE_10_6_X OR APPLE_10_7_X OR APPLE_10_8_X OR APPLE_10_9_X OR APPLE_10_10_X)
- ENDIF(ARCH_PPC OR ARCH_PPC_64)
- ENDIF(WANT_UNIVERSAL_BUNDLE)
- MESSAGE(STATUS "${CMAKE_OSX_ARCHITECTURES} ${CMAKE_OSX_SYSROOT}")
- SET(ENV{MACOSX_DEPLOYMENT_TARGET} ${OSXMINVER} )
- SET( ENV{LD_PREBIND} 1 )
- SET( ENV{LD_PREBIND_ALLOW_OVERLAP} 1 )
- IF (WANT_DEBUG)
- SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
- SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
- ENDIF (WANT_DEBUG)
- IF (WANT_RELEASEWITHDEBUG)
- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
- SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
- ENDIF (WANT_RELEASEWITHDEBUG)
- IF (NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
- SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
- SET(CMAKE_C_FLAGS_RELEASE "-O2 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
- ENDIF (NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
+ # gcc/mac
+ IF(WANT_UNIVERSAL_BUNDLE)
+ MESSAGE("Setting Universal (PPC/i386) Architecture for OSX Build/Bundle")
+ SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" )
+ SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc;i386" )
+ SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.4u.sdk")
+ SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.4")
+ ELSE(WANT_UNIVERSAL_BUNDLE)
+ IF(ARCH_PPC OR ARCH_PPC_64)
+ MESSAGE("Setting PPC Architecture for OSX Build/Bundle")
+ SET(CMAKE_OSX_ARCHITECTURES "ppc" )
+ SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "ppc" )
+ ELSE(ARCH_PPC OR ARCH_PPC_64)
+ IF(APPLE_10_6_X OR APPLE_10_7_X OR APPLE_10_8_X OR APPLE_10_9_X OR APPLE_10_10_X)
+ MESSAGE("Setting x86_64 Architecture for OSX Build/Bundle")
+ SET(CMAKE_OSX_ARCHITECTURES "x86_64" )
+ SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "x86_64" )
+ ELSE(APPLE_10_6_X OR APPLE_10_7_X OR APPLE_10_8_X OR APPLE_10_9_X OR APPLE_10_10_X)
+ MESSAGE("Setting i386 Architecture for OSX Build/Bundle")
+ SET(CMAKE_OSX_ARCHITECTURES "i386" )
+ SET(CMAKE_TRY_COMPILE_OSX_ARCHITECTURES "i386" )
+ ENDIF(APPLE_10_6_X OR APPLE_10_7_X OR APPLE_10_8_X OR APPLE_10_9_X OR APPLE_10_10_X)
+ ENDIF(ARCH_PPC OR ARCH_PPC_64)
+ ENDIF(WANT_UNIVERSAL_BUNDLE)
+ MESSAGE(STATUS "${CMAKE_OSX_ARCHITECTURES} ${CMAKE_OSX_SYSROOT}")
+ SET(ENV{MACOSX_DEPLOYMENT_TARGET} ${OSXMINVER} )
+ SET(ENV{LD_PREBIND} 1 )
+ SET(ENV{LD_PREBIND_ALLOW_OVERLAP} 1 )
+ IF (WANT_DEBUG)
+ SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
+ SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
+ ENDIF (WANT_DEBUG)
+ IF (WANT_RELEASEWITHDEBUG)
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
+ SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g3 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
+ ENDIF (WANT_RELEASEWITHDEBUG)
+ IF (NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
+ SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
+ SET(CMAKE_C_FLAGS_RELEASE "-O2 -fno-inline-functions -Wall -mmacosx-version-min=${OSXMINVER}")
+ ENDIF (NOT WANT_DEBUG AND NOT WANT_RELEASEWITHDEBUG)
ELSE(APPLE)
- IF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
- # Windows build with Visual Studio
- # Surely there's a better way to identify the compiler?
- SET(CMAKE_CXX_FLAGS_DEBUG)
- SET(CMAKE_C_FLAGS_DEBUG)
- ELSE(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
- # vanilla gcc
- SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -Wall -fstrict-aliasing")
- SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -Wall -fstrict-aliasing")
-
- IF (_machine_x86 OR _machine_x86_64)
- SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC")
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fPIC")
- ENDIF (_machine_x86 OR _machine_x86_64)
-
- ENDIF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
+ IF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
+ # Windows build with Visual Studio
+ # Surely there's a better way to identify the compiler?
+ SET(CMAKE_CXX_FLAGS_DEBUG)
+ SET(CMAKE_C_FLAGS_DEBUG)
+ ELSE(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
+ # vanilla gcc
+ SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -Wall -fstrict-aliasing")
+ SET(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -Wall -fstrict-aliasing")
+ IF (_machine_x86 OR _machine_x86_64)
+ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fPIC")
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -fPIC")
+ ENDIF (_machine_x86 OR _machine_x86_64)
+ ENDIF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
ENDIF(APPLE)
IF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
- SET(CMAKE_CXX_FLAGS_RELEASE)
- SET(CMAKE_C_FLAGS_RELEASE)
+ SET(CMAKE_CXX_FLAGS_RELEASE)
+ SET(CMAKE_C_FLAGS_RELEASE)
ELSE(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
- SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall -fPIC")
- SET(CMAKE_C_FLAGS_RELEASE "-O2 -Wall -fPIC")
- ADD_DEFINITIONS(-DNDEBUG)
+ SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -Wall -fPIC")
+ SET(CMAKE_C_FLAGS_RELEASE "-O2 -Wall -fPIC")
+ ADD_DEFINITIONS(-DNDEBUG)
ENDIF(${CMAKE_GENERATOR} MATCHES "^(Visual Studio|NMake).*")
IF(WIN32)
More information about the scribus-commit
mailing list