Building on OSX - LuxRender Wiki
Luxrender GPL Physically Based Renderer

Building on OSX

Personal tools

From LuxRender Wiki

Jump to: navigation, search

This page describes the process of compiling LuxRender on OSX. If you just want to use the program, you can download the program using the links on the download page instead.

On this page, the installation process generating a universal application for Intel-Mac using Cmake and Xcode is explained. The procedure should work on OSX 10.6 and 10.7

Contents

Prerequisites

  • Install mercurial for checking out the source code
  • Install CMake (2.6-4 or newer, 2.8 series preferred). Use the GUI.app for convenience.
  • Install QT (4.7.3 works best, newer versions have issues) (make sure to get the cocoa-version if you plan to create a 64bit version of LuxRender)

Get cl.hpp at khronos.org and place it in: /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers (note: obviously, that is /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers if you are using the 10.7 SDK. Don't forget to place it in the SDK you will be using, or just toss it in both if you want)

All other needed dependencies are located in the "macos" repository and will be downloaded in the next step.

get the source

Create a folder that will contain the source of LuxRender, LuxRays and macos, then open a terminal, navigate to that folder and type:

hg clone http://bitbucket.org/luxrender/lux

hg clone http://bitbucket.org/luxrender/luxrays

hg clone http://bitbucket.org/luxrender/macos

Alternatively, you could use http://src.luxrender.net/lux (and /luxrays, /macos) but some problems have been reported with that server.

NOTE: Cloning luxrays is only required if you are building luxrays separately, see below:

Compile LuxRays (optional, and only possible for OS X 10.6+)

Note: You can skip this point and go on to compiling LuxRender as LuxRays headers and lib are now in macos dependency directory. Compiling LuxRays separately is only necessary if you would like the latest version of the library for some other reason (such as having the latest smallluxgpu)

Important cmake-note: With Xcode 4.3 the default location changed and breakes cmake finding the location and version (Xcode.app/Contents/version.plist), so if you have updated, use this patched cmake: http://www.jensverwiebe.de/LuxRender/Lux_dev_builds/CMake%202.8-7.zip For more information about Xcode 4.3 changes read here: http://www.luxrender.net/forum/viewtopic.php?f=22&t=4624&start=20#p77887

Open cmake and go through the following steps:

1. fill in the "Where is the source code" field, using the folder where you put the LuxRays source code

2. fill in the "Where to build the binaries" field

3. press "configure", select xcode from the dropdown menu and select the "Specify options for cross-compliling" option

4. set the following crosscompile options:

  • Name = darwin
  • version = 10.6
  • Processor = i386, x86_64
  • c = gcc
  • c++ = g++
  • Target Root t(Xcode < 4.3 = /Developer/SDKs/MacOSX10.6.sdk
  • Target Root(Xcode >= 4.3) = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk ( or 10.7 accordingly )

5. set Library Mode, Program Mode and Include Mode to "Search in Target Root, then native system".

6. press configure once more; boost should now be found

7. press generate

8. open the XCode.project that has been generated by CMake

9. set your preferred architecture by going to the Project menu -> Edit Project Settings -> Architectures (cmake 2.6 sets default = two architectures, universal Intel, cmake 2.8 sets" active architecture only"by default, uncheck for universal builds)

10. build "Release" (make sure not to use Debug)

Compile LuxRender(OSX 10.6/10.7)

Open cmake and go through the following steps:

1. fill in the "Where is the source code" field, using the folder where you put the Lux source code

2. fill in the "Where to build the binaries" field ( can be in source or a dedicated build_dir )

3. configure -> xcode-crosscompile

4. set the following crosscompile options:

   * Name = darwin
   * version = 10.6 or 10.7, depending on your Mac OS X version
   * Processor = i386, x86_64
   * c = gcc
   * c++ = g++
   * Target Root(Xcode < 4.3) = /Developer/SDKs/MacOSX10.6.sdk or /Developer/SDKs/MacOSX10.7.sdk, depending on the version you are building for and set above under "version"
   * Target Root(Xcode >= 4.3) = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk ( or 10.7 accordingly )

5. set Library Mode, Program Mode and Include Mode to "Search in Target Root, then native system". Press return

6. From the OSX_options choose how you want to compile, options are ( default ):

  • option(OSX_OPTION_PYLUX "Build a blender compatible pylux" ON)
  • option(OSX_OPTION_CLANG "Build with CLANG compiler ( XCODE4 )" ON) --> good with Xcode 4 or higher
  • option(OSX_OPTION_LTO "Build with LINK TIME OPTIMISATION ( MAY BREAK NON-SSE4 MACS COMPATIBILITY )" ON) --> performs LTO on all binaries except LuxRender ( due Qt )
  • option(OSX_OPTION_UNIVERSAL "Force compile universal" OFF)
  • option(OSX_OPTION_LION "BUILD for OSX 10.7, else 10.6 would be deployment-target" OFF) This should be enabled if you selected 10.7 and the 10.7 SDK in the step 4
  • option(OSX_OPTION_USE_MAX_SSE ""Build with highest SSE available on machine" OFF) --> checks for max sse-type available on machine and uses it

7. press configure once more

8. press generate; an Xcode project file will be created

9. open the XCode project file in Xcode

10. build target DYNAMIC_BUILD" (set to Release or Debug ). If you are using Xcode 4, you can quickly launch a debug build by selecting Product > Build. The proper target will most likely not be the active target when you open the Xcode project, so select in manually.


Hint: If you want to deploy LuxRender complete "dependency-less", use macdeployqt for bundling used Qt-frameworks into the app-bundle. You can find this option in cmake/macosx_bundle.cmake file