How to compile PFBarrel for the newest release of Nuke
On 27, Jan 2015 | In Programming | By antiform
Outdated as of PFtrack 2016.06.10 – but kept for sentimental reasons.
– First of all. I don’t know what I’m doing. If you’re reading this, you most likeliy don’t either.
First of all we need to install quite a bit software. The steps must be done in the specified order, or it will fail. FAIL. F.A.I.L.
1. Uninstall the Microsoft Visual C++ 2010 redistributable packages (both x86 as well as x64) from “Control Panel” > “Programs and Features”. (Why? Because otherwise the step 2 will fail)
2. Install the Windows SDK 7.1. During installation, under the “Installation Options” menu, UNCHECK the “Visual C++ Compilers” and “Microsoft Visual C++ 2010” components. Here’s the installer:
3. Install Microsoft Visual C++ 2010 Service Pack 1 Compiler Update for the Windows SDK 7.1
4. Install MS VS 2010 Express C++;
5. Install Microsoft Visual Studio 2010 Service Pack 1;
Ok. Now for the complicated part.
1. Start vs2010, choose open project, navigate to C:Program FilesNuke9.0v3DocumentationNDKexamples and open ExamplePlugin.sln.
2. In the solutions explorer on the left hand side, right click and choose “add”. Navigate to the PFBarrel “source/nuke/PFBarrel.cpp”
3. Again, in the solutions explorer on the left hand side, right click and choose “add”. Navigate to the PFBarrel “source/common/ and add both files.
4. Rename the project to PFBarrel (by right clicking and choosing ‘Rename’)
5. The meat of the job;
a. Right click on the Project Name (PFBarrel in this case), and select ‘Properties’. Alternatively, you can select ‘Properties’ from the ‘Project’ menu at the top, or just press Alt-F7.
b. Select the Configuration (Debug/Release) and the Platform (32/64 bit) at the top of this dialog. Recommended practice is to use Release, and most of us will be on a 64-bit platform.
c. Expand the ‘Configuration Properties’ section if it is not already, and click on ‘General’
d. Change the ‘Configuration Type’ to ‘Dynamic Library (.dll)’
e. Change the ‘Character Set’ to ‘Use Unicode Character Set’
f. Change the ‘Whole Program Optimization’ to ‘Use Link Time Code Generation’
g. Next, select ‘Debugging’ from the left panel.
h. Set ‘Command’ to ‘C:Program FilesNukeXXNukeX.X.exe’ (note that this will probably not be necessary, since direct debugging using the IDE is ‘iffy’ at best using Nuke, but this permits us to launch Nuke in Debug mode in order to trace execution and look at variable values in the VS Debugger.
i. Click on ‘VC++ Directories’ in the left panel
j. Change ‘Include Directories’ to ‘C:Program FilesNukeXXinclude;$(IncludePath)’ (or wherever your nuke is installed). This gives the VC compiler access to the ‘.h’ files.
k. Expand the ‘Linker’ section in the left panel, and click on ‘General’
l. Change the ‘Enable Incremental Linking’ option to ‘No (/INCREMENTAL:NO)’
m. Set ‘Additional Library Directories’ to ‘C:Program FilesNuke6.2v2;%(AdditionalLibraryDirectories)’ (or wherever your version of Nuke is installed) This tells the VC2010 linker where the required .dll libraries are to be found.
n. Select ‘Input’ from the left panel, under ‘Linker’, and set ‘Additional Dependencies’ to ‘DDImage.lib;glew32.lib;%(AdditionalDependencies)’ (having just told VS2010 where the libraries are to be found, now we tell it what is to be referenced by the Operator)
o. Right click ‘PFBarrel’ in the left hand panel and choose Build Solution. (this failed for me the first time, ‘1>LINK : fatal error LNK1181: cannot open input file ‘kernel32.lib”, but I solved it by rightclicking on the project, “Project Properties -> VC++ Directories -> Library Directories” set to ‘C:Program FilesMicrosoft SDKsWindowsv7.1Libx64’)
Voila, you should now have a DLL file in the C:\Program Files\Nuke9.0v3\Documentation\NDK\vc10x64\Release\ folder called PFBarrel.dll which can be copied to your .nuke/gizmos folder.