Building on OSX
From LuxRender Wiki
The procedure works on OS X 10.6+ for IntelMacs ( updated nov. 20th 2013 )
- Install Xcode
- Install mercurial for checking out the source code
- Install CMake (2.8-8 or newer). Use the GUI.app for convenience. Important: Use cmake <= 2.8-9 or >= 2.8-12.2 with OSX 10.9/Xcode 5.1.1 to avoid a bug not finding pthreads.
- Install QT (4.7.3 still best for universal builds ( 32 and/or 64bit, make sure to get the cocoa-version ), 4.8.5 is also o.k. for 64bit only, never versions are not yet tested.
Get cl.hpp at khronos.org and place it in:
Xcode < 4.3
Mac OS X <Version>: /Developer/SDKs/MacOSX <Version>.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers
Mac OS X <Version>: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX <Version>.sdk/System/Library/Frameworks/OpenCL.framework/Versions/A/Headers
Don't forget to place it in the SDK you will be using, or just toss it at all if you want. !!! Updating Xcode may need a repetition of this precedure
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" (OS X build dependencies), then open a terminal, navigate to that folder and type:
hg clone https://bitbucket.org/luxrender/lux
As per january 31th completely moved to bitbucket
NOTE: Cloning luxrays is only required if you are building luxrays separately, see below:
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 CMake 2.8-8 or higher. For more information about Xcode 4.3 changes read here: http://www.luxrender.net/forum/viewtopic.php?f=22&t=4624&start=20#p77887
If you prefer to use the GUI, the following steps show how to build LuxRays interactively.
Open the CMake gui and go through the following steps:
- Fill in the "Where is the source code" field, using the folder where you put the LuxRays source code
- Fill in the "Where to build the binaries" field
- Click the "Configure" button, select Xcode from the dropdown menu and select the "Use default compiler" option
- Click the "Configure" button once more; boost should now be found
- Click the "Generate" button
- Launch Xcode, open the XCode project, LuxRays.xcodeproj, that has been generated by CMake
- Set your preferred architecture by going to the Project menu (Xcode <4.3) or Scheme "ALL_BUILD"( Xcode <=4.3 ), also set "Release" or "Debug" there.
- Start build (Cmd-B)
If you prefer to use the command-line or you want to automate the build using a build system here are the necessary steps:
- Inside Terminal go to the luxray directory. This is where you cloned the LuxRays repository.
- Create a build subdirectory:
- Go into that directory:
- Execute CMake with:
cmake -G Xcode -DOSX_UPDATE_LUXRAYS_REPO=TRUE ..
Please note the "..". The command generates an XCode project
- Build LuxRays with:
cmake --build . --config Release --target ALL_BUILD
If you want to use the interactive tools then use the following procedure, another section describes how to automate this process.
Launch CMake's GUI 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" -"Use default compiler"
4. 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_USE_MAX_SSE ""Build with highest SSE available on machine" OFF) --> checks for max sse-type available on machine and uses it
5. press configure once more
6. press generate; an Xcode project file will be created
7. open the XCode project file in Xcode
8. 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
From the Terminal execute the following commands:
- cd to where you have the LuxRender codebase
cmake -G Xcode -DQT_QMAKE_EXECUTABLE=[Full path of qmake] ..
cmake --build . --config Release --target ALL_BUILD
- You will need to package the executable with the Qt libs. This is done by running:
- Please note that you might need to prefix macdeployqt with the full path where you have Qt installed.
You can download the "testsuite" in http://src.luxrender.net/ to have a render.