Todd Rovito  committed 82f30dc

Made sure scikit-image was working with OS X....

  • Participants
  • Parent commits a8dbfb1
  • Branches master

Comments (0)

Files changed (3)

File FreeImageMakeFileOSX.rpd

+# -*- Makefile -*-
+# Mac OSX makefile for FreeImage
+# This make file came from the following Stackoverflow post:
+# This file can be generated by ./
+include Makefile.srcs
+# General configuration variables:
+CC_X86_64 = gcc -4.2
+CPP_X86_64 = g++ -4.2
+COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS
+COMPILERFLAGS_X86_64 = -arch x86_64
+COMPILERPPFLAGS = -Wno-ctor-dtor-privacy
+INCLUDE_X86_64 = -isysroot /Applications/
+LIBRARIES_X86_64 = -Wl,-syslibroot /Applications/
+LIBTOOL = libtool
+LIPO = lipo
+TARGET = freeimage
+LIBNAME = lib$(TARGET).$(VER_MAJOR).dylib
+HEADER = Source/FreeImage.h
+.SUFFIXES: .o-x86_64
+MODULES_X86_64 = $(SRCS:.c=.o-x86_64)
+MODULES_X86_64 := $(MODULES_X86_64:.cpp=.o-x86_64)
+PREFIX = /Volumes/RenegadePythonDistribution
+INCDIR = $(PREFIX)/include
+default: all
+all: dist
+dist:	FreeImage
+		cp *.a Dist
+		cp *.dylib Dist
+		cp Source/FreeImage.h Dist
+				$(LIPO) -create $(STATICLIB)-x86_64 -output $(STATICLIB)
+$(STATICLIB)-x86_64:	$(MODULES_X86_64)
+						$(LIBTOOL) -arch_only x86_64 -o $@ $(MODULES_X86_64)
+$(SHAREDLIB):			$(SHAREDLIB)-x86_64
+						$(LIPO) -create $(SHAREDLIB)-x86_64 -output $(SHAREDLIB)
+$(SHAREDLIB)-x86_64:	$(MODULES_X86_64)
+						$(CPP_X86_64) -arch x86_64 -dynamiclib $(LIBRARIES_X86_64) -o $@ $(MODULES_X86_64)
+						$(CC_X86_64) $(CFLAGS_X86_64) -c $< -o $@
+						$(CPP_X86_64) $(CPPFLAGS_X86_64) -c $< -o $@
+	install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)
+	install -m 644 -o root -g wheel $(HEADER) $(INCDIR)
+	install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR)
+	ranlib -sf $(INSTALLDIR)/$(STATICLIB)
+	rm -f core Dist/*.* u2dtmp* $(MODULES_X86_64) $(STATICLIB) $(SHAREDLIB) $(SHAREDLIB)-x86_64

File setupOperatingSystem.rst

     $ export CC=gcc
     $ export CXX=g++
     $ export FFLAGS=-ff2c
+    $ sudo ln -s /usr/bin/gfortran-4.2 /usr/bin/gfortran
 Directory Setup

File softwareBuilds.rst

-.. warning:: This step is only required on Linux.
+.. warning:: This step is only required on Linux.  Apple ships their own accelerate framework.
 ATLAS is Automatically Tuned Linear Algebra Software which is a software
 library for linear algebra.  Since ATLAS has been around for some time it 
         cd ~/PythonBuild/builds
         tar xvfz ../SoftwareTarballs/Python-2.7.6.tgz
         cd Python-2.7.6
-        ./configure --prefix=$HOME/PythonBuild/
+        ./configure --enable-shared --prefix=$HOME/PythonBuild/
         make install
 support. To install FreeImage first download `FreeImage 3154
 <>`_ then move the
 files into the directory *~/PythonBuild/SoftwareTarballs*.  FreeImage uses a
-non standard build process, first copy two make files with the following
+non standard build process, for Linux first copy the make file with the
+following commands::
         cd ~/PythonBuild/builds
         unzip ../SoftwareTarballs/
         cd FreeImage
         cp Makefile.gnu Makefile.rpd
-        cp Makefile.fip Makefilefip.rpd
-Now edit both make files and change and change the general configuration
+Now edit the make files and change the general configuration
 variables at the top of each make file to look like below::
         DESTDIR ?= /home/rovitotv/PythonBuild
         INCDIR ?= $(DESTDIR)/include
         INSTALLDIR ?= $(DESTDIR)/lib
-Where /home/rovitotv is your home directory. Now execute the following
+Where /home/rovitotv is your home directory on Linux.
+For Mac OS X the make file is outdated so use the make file provided from this
+guide.  first copy two make files with the following commands::
+        cd /Volumes/RenegadePythonDistribution/builds/
+        unzip ../SoftwareTarballs/
+        cd FreeImage
+        cp /Volumes/RenegadePythonDistribution/source/FreeImageMakefileOSX.rpd Makefile.rpd
+Now edit Makefile.rpd change the prefix on line 49 to
+Now execute the following commands::
         make -f Makefile.rpd
         sudo make -f Makefile.rpd install
-        make -f Makefilefip.rpd
-        sudo make -f Makefilefip.rpd install
 .. todo:: Why the sudo command on the make install above?  We should be
           able to setup permissions the correct way so this is not required.
     'Software')].startswith('I')" then rerun the test and everything should
+OpenCV is a set of popular computer vision algorithms which have excellet python
+bindings.  OpenCV requires cmake to be used in the build process, I recommend
+using the CMake GUI as the search feature is better.  Use the following
+commands to extract the archive::
+        cd ~/PythonBuild/builds
+        unzip ../SoftwareTarballs/
+        cd opencv-2.4.8
+        mkdir build
+Now run the CMake GUI and set the source directory to ~/PythonBuild/builds/opencv-2.4.8 and
+the build directory to ~/PythonBuild/builds/opencv-2.4.8/build. 
+.. warning:: Run the cmake GUI from the terminal with the evnironment variables for CC
+     and CXX set to gcc and g++ respectively.  Otherwise cmake will use the clang 
+     compiler on Mac OS X.
+Next click on the "Configure" button, I generally use standard makefiles on
+both Linux and Mac OS X.  After the configure process is complete type "python"
+in the search field and set the following variables::
+    PYTHON_EXECUTABLE: /home/rovitotv/PythonBuild/bin/python
+    PYTHON_INCLUDE_DIR: /home/rovitotv/PythonBuild/include/python2.7
+    PYTHON_LIBRARY: /home/rovitotv/PythonBuild/lib/libpython2.7.a
+    PYTHON_NUMPY_INCLUDE_DIR: /home/rovitotv/PythonBuild/lib/python2.7/site-packages/numpy/core/include
+    PYTHON_PACKAGES_PATH: /home/rovitotv/PythonBuild/lib/python2.7/site-packages
+Then using the search field set the following additional values::
+    CMAKE_INSTALL_PREFIX: /home/rovitotv/PythonBuild
+    EXECUTABLE_OUTPUT_PATH: /home/rovitotv/PythoinbBuild/bin
+To build the OpenCV software click on the "Generate" button then execute the
+command "make".  After the make is complete you should see output that includes
+"BUILD SUCCESSFUL".  Then as typical with Unix software run "make install".
+For Python and OpenCV to work together several paths have to be set correctly. To
+set these paths I use a shell script called
+        # Sets environment variables
+        # use source on this file
+        export PATH=/Volumes/RenegadePythonDistribution/bin:$PATH
+        export DYLD_LIBRARY_PATH=/Volumes/RenegadePythonDistribution/lib:/Volumes/RenegadePythonDistribution/lib/python2.7/site-packages:$DYLD_LIBRARY_PATH
+        export PYTHONPATH=/Volumes/RenegadePythonDistribution/lib/python2.7/site-packages/:/Volumes/RenegadePythonDistribution/lib:$PYTHONPATH
+Execute the file with the source command "source".