Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r2001 - in trunk: CMake Image


Chronological Thread 
  • From: boulos@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r2001 - in trunk: CMake Image
  • Date: Wed, 23 Jan 2008 20:17:51 -0700 (MST)

Author: boulos
Date: Wed Jan 23 20:17:50 2008
New Revision: 2001

Modified:
   trunk/CMake/ConfigCompilerFlags.cmake
   trunk/Image/CoreGraphicsFile.cc
Log:
CMake/ConfigCompilerFlags.cmake

 Putting a lot of Apple stuff into an IF(APPLE) check so you can be
 sure you're not messing with people's stuff on Linux and Win32.

 Adding start of code for MANTA_TARGET_LEOPARD which is different from
 whether or not you're actual system is Leopard. If you are building
 on a Leopard system, this will be set to true by default. However,
 you can change this flag and in the future it'll compile against the
 10.4 sdk. Problem is that currently, setting the CMAKE_OSX_SYSROOT
 variable doesn't actually work (I think our flags stuff eats it up).

 I have tested a manual usage of adding -isysroot before any other
 flags for g++ and it fixes the previous Leopard issues
 (Thread_pthreads.cc not compiling, etc)

Image/CoreGraphicsFile.cc

 It turns out that apple feels that someone on 64-bits should have
 double precision. Nobody currently builds 64-bit on leopard (right?
 ImageMagick?) and we don't have a cross compilation story.


Modified: trunk/CMake/ConfigCompilerFlags.cmake
==============================================================================
--- trunk/CMake/ConfigCompilerFlags.cmake       (original)
+++ trunk/CMake/ConfigCompilerFlags.cmake       Wed Jan 23 20:17:50 2008
@@ -134,42 +134,54 @@
 ##############################################################
 ## Apple
 ##############################################################
-IF (APPLE_G4)
-  APPEND_TO_STRING(GCC_OPT "-falign-loops=16 -falign-jumps=16 
-falign-functions=16 -falign-jumps-max-skip=15 -falign-loops-max-skip=15 
-force_cpusubtype_ALL -mtune=G4 -mcpu=G4 -faltivec -mabi=altivec 
-mpowerpc-gfxopt")
-ENDIF (APPLE_G4)
-
-# G5 Workstation.
-IF (APPLE_G5)
-  APPEND_TO_STRING(GCC_OPT "-falign-loops=16 -falign-jumps=16 
-falign-functions=16 -falign-jumps-max-skip=15 -falign-loops-max-skip=15 
-mpowerpc-gpopt -force_cpusubtype_ALL -mtune=G5 -mcpu=G5 -mpowerpc64 
-faltivec -mabi=altivec -mpowerpc-gfxopt" STRING "G5 Optimized Flags")
-ENDIF (APPLE_G5)
-
-# Macintel
-IF (APPLE_X86)
-  APPEND_TO_STRING(GCC_ARCH "nocona")
-  APPEND_TO_STRING(GCC_ARCH "prescott")
-  APPEND_TO_STRING(GCC_OPT "-msse -msse2 -msse3 -mfpmath=sse")
-ENDIF (APPLE_X86)
-
-
-IF (APPLE_LEOPARD)
-  ADD_DEFINITIONS(-DAPPLE_LEOPARD)
-
-  # Check for broken LD on Leopard.
-  # Note: In leopard the ld version string is:
-  # @(#)PROGRAM:ld  PROJECT:ld64-77
-  # while in previous versions it is:
-  # Apple Computer, Inc. version cctools-622.5.obj~13
-
-  EXEC_PROGRAM("/usr/bin/ld" ARGS "-v" OUTPUT_VARIABLE APPLE_LD_VERSION)
-
-  IF (APPLE_LD_VERSION MATCHES "ld64-77")
-    # Set a cmake variable that may be used during subsequent configuration
-    # to work around bugs with ld and X11 libraries.
-    # (e.g. FindX11andGL.cmake)
-    SET(APPLE_LEOPARD_LD TRUE)
-  ENDIF(APPLE_LD_VERSION MATCHES "ld64-77")
-  
-ENDIF(APPLE_LEOPARD)
+IF(APPLE)
+  IF (APPLE_G4)
+    APPEND_TO_STRING(GCC_OPT "-falign-loops=16 -falign-jumps=16 
-falign-functions=16 -falign-jumps-max-skip=15 -falign-loops-max-skip=15 
-force_cpusubtype_ALL -mtune=G4 -mcpu=G4 -faltivec -mabi=altivec 
-mpowerpc-gfxopt")
+  ENDIF (APPLE_G4)
+
+  # G5 Workstation.
+  IF (APPLE_G5)
+    APPEND_TO_STRING(GCC_OPT "-falign-loops=16 -falign-jumps=16 
-falign-functions=16 -falign-jumps-max-skip=15 -falign-loops-max-skip=15 
-mpowerpc-gpopt -force_cpusubtype_ALL -mtune=G5 -mcpu=G5 -mpowerpc64 
-faltivec -mabi=altivec -mpowerpc-gfxopt" STRING "G5 Optimized Flags")
+  ENDIF (APPLE_G5)
+
+  # Macintel
+  IF (APPLE_X86)
+    APPEND_TO_STRING(GCC_ARCH "nocona")
+    APPEND_TO_STRING(GCC_ARCH "prescott")
+    APPEND_TO_STRING(GCC_OPT "-msse -msse2 -msse3 -mfpmath=sse")
+  ENDIF (APPLE_X86)
+
+  FIRST_TIME_SET(MANTA_TARGET_LEOPARD ${APPLE_LEOPARD} BOOL "Target Leopard")
+
+  IF(MANTA_TARGET_LEOPARD)
+    ADD_DEFINITIONS(-DAPPLE_LEOPARD)
+    SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.5.sdk" CACHE STRING "OS 
X Sysroot" FORCE)
+  ELSE(MANTA_TARGET_LEOPARD)
+   SET(CMAKE_OSX_SYSROOT "/Develeper/SDKs/MacOSX10.4u.sdk" CACHE STRING "OS 
X Sysroot" FORCE)
+  ENDIF(MANTA_TARGET_LEOPARD)
+
+  # NOTE(boulos): We need to make sure we don't block the
+  # CMAKE_OSX_SYSROOT code. If the user changes MANTA_TARGET_LEOPARD
+  # to false, the sysroot will change and it'd be nice for our flags
+  # to change and reflect that.
+
+  IF (APPLE_LEOPARD)
+    # Check for broken LD on Leopard.
+    # Note: In leopard the ld version string is:
+    # @(#)PROGRAM:ld  PROJECT:ld64-77
+    # while in previous versions it is:
+    # Apple Computer, Inc. version cctools-622.5.obj~13
+
+    EXEC_PROGRAM("/usr/bin/ld" ARGS "-v" OUTPUT_VARIABLE APPLE_LD_VERSION)
+
+    IF (APPLE_LD_VERSION MATCHES "ld64-77")
+      # Set a cmake variable that may be used during subsequent configuration
+      # to work around bugs with ld and X11 libraries.
+      # (e.g. FindX11andGL.cmake)
+      SET(APPLE_LEOPARD_LD TRUE)
+    ENDIF(APPLE_LD_VERSION MATCHES "ld64-77")  
+  ENDIF(APPLE_LEOPARD)
+ENDIF(APPLE)
 
 ##############################################################
 ## X86

Modified: trunk/Image/CoreGraphicsFile.cc
==============================================================================
--- trunk/Image/CoreGraphicsFile.cc     (original)
+++ trunk/Image/CoreGraphicsFile.cc     Wed Jan 23 20:17:50 2008
@@ -69,7 +69,20 @@
                                      
CFSTR("/System/Library/ColorSync/Profiles/sRGB Profile.icc"),
                                      kCFURLPOSIXPathStyle, false);
     CGDataProviderRef icc_profile = 
CGDataProviderCreateWithURL(icc_profile_path);
-    const float range[] = {0,1.f,0,1.f,0,1.f}; // min/max of the three 
components
+
+    // NOTE(boulos): According to this page
+    // http://developer.apple.com/releasenotes/Cocoa/Foundation.html
+    // apple has wisely decided to introduce CGFloat as a wrapper that
+    // switches between float and double between 32-bit and 64-bit
+    // applications. Because naturally, 64-bit builds want to use
+    // doubles for everything...
+#ifdef APPLE_LEOPARD
+    typedef CGFloat MantaCGFloat;
+#else
+    typedef float  MantaCGFloat;
+#endif
+
+    const MantaCGFloat range[] = {0,1,0,1,0,1}; // min/max of the three 
components
     color_space = CGColorSpaceCreateICCBased( 3, range, icc_profile, 
alternate );
 
     if(color_space == NULL) {




  • [Manta] r2001 - in trunk: CMake Image, boulos, 01/23/2008

Archive powered by MHonArc 2.6.16.

Top of page