From fa49844c6f6fee98b9ae6a1313233f06acb25009 Mon Sep 17 00:00:00 2001 From: brianray Date: Sun, 28 Feb 2010 03:44:54 +0000 Subject: [PATCH] Changes to cmake script needed to get build on the mac with libpng build from sources. Will me making universal binary later. --- CMakeLists.txt | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ae6684b..e3ff2dab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,18 +30,33 @@ endif (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) IF(APPLE) - IF(NOT ZINT_HAS_BEEN_RUN_BEFORE) - IF(EXISTS /Developer/SDKs/MacOSX10.5.sdk OR EXISTS /SDKs/MacOSX10.5.sdk) - SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -Wl -single_module" CACHE STRING "Flags used by the compiler during all build types." FORCE) - ELSE(EXISTS /Developer/SDKs/MacOSX10.5.sdk OR EXISTS /SDKs/MacOSX10.5.sdk) - IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk OR EXISTS /SDKs/MacOSX10.4u.sdk) - SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -Wl -single_module" CACHE STRING "Flags used by the compiler during all build types." FORCE) - ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk OR EXISTS /SDKs/MacOSX10.4u.sdk) - ENDIF(EXISTS /Developer/SDKs/MacOSX10.5.sdk OR EXISTS /SDKs/MacOSX10.5.sdk) - message("Build architectures for OSX:${CMAKE_OSX_ARCHITECTURES}") - ENDIF(NOT ZINT_HAS_BEEN_RUN_BEFORE) + IF (UNIVERSAL) # TODO: make univeral binary + IF(NOT ZINT_HAS_BEEN_RUN_BEFORE and UNIVERAL) + IF(EXISTS /Developer/SDKs/MacOSX10.5.sdk OR EXISTS /SDKs/MacOSX10.5.sdk) + SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -Wl -single_module " CACHE STRING "Flags used by the compiler during all build types." FORCE) + ELSE(EXISTS /Developer/SDKs/MacOSX10.5.sdk OR EXISTS /SDKs/MacOSX10.5.sdk) + IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk OR EXISTS /SDKs/MacOSX10.4u.sdk) + SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden -Wl -single_module " CACHE STRING "Flags used by the compiler during all build types." FORCE) + ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk OR EXISTS /SDKs/MacOSX10.4u.sdk) + ENDIF(EXISTS /Developer/SDKs/MacOSX10.5.sdk OR EXISTS /SDKs/MacOSX10.5.sdk) + message("Build architectures for OSX:${CMAKE_OSX_ARCHITECTURES}") + ENDIF(NOT ZINT_HAS_BEEN_RUN_BEFORE) + + ELSE (UNIVERSAL) + SET(CMAKE_OSX_SYSROOT "/") + ENDIF (UNIVERSAL) + + IF (PNG_FOUND) + INCLUDE_DIRECTORIES( + "${PNG_INCLUDE_DIR}" + ) + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lpng") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -lpng") + SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -lpng") + ENDIF (PNG_FOUND) + ENDIF(APPLE) add_subdirectory(backend)