Building blender in Visual Studio

0

I am building blender on Windows in Visual Studio 2017.

I have pulled the source for blender via Git and I have pulled the libs via svn I downloaded and installed CUDA support.

I'm getting the following output from running build.bat release.

CMake Error: Could not create named generator Visual Studio 12 2013 Win64

Generators
  Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 9 2008 [arch]  = Generates Visual Studio 2008 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 8 2005 [arch]  = Deprecated.  Generates Visual Studio 2005
                                 project files.  Optional [arch] can be
                                 "Win64".
  Borland Makefiles            = Generates Borland makefiles.
  NMake Makefiles              = Generates NMake makefiles.
  NMake Makefiles JOM          = Generates JOM makefiles.
  Green Hills MULTI            = Generates Green Hills MULTI files
                                 (experimental, work-in-progress).
  MSYS Makefiles               = Generates MSYS makefiles.
  MinGW Makefiles              = Generates a make file for use with
                                 mingw32-make.
  Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  Watcom WMake                 = Generates Watcom WMake makefiles.
  CodeBlocks - MinGW Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles JOM
                               = Generates CodeBlocks project files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - MinGW Makefiles   = Generates CodeLite project files.
  CodeLite - NMake Makefiles   = Generates CodeLite project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Sublime Text 2 - MinGW Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - NMake Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.
  Kate - MinGW Makefiles       = Generates Kate project files.
  Kate - NMake Makefiles       = Generates Kate project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Eclipse CDT4 - NMake Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - MinGW Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.

CMake Error: Could not create named generator Visual Studio 14 2013 Win64

Generators
  Visual Studio 15 2017 [arch] = Generates Visual Studio 2017 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
                                 Optional [arch] can be "Win64" or "ARM".
  Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 9 2008 [arch]  = Generates Visual Studio 2008 project files.
                                 Optional [arch] can be "Win64" or "IA64".
  Visual Studio 8 2005 [arch]  = Deprecated.  Generates Visual Studio 2005
                                 project files.  Optional [arch] can be
                                 "Win64".
  Borland Makefiles            = Generates Borland makefiles.
  NMake Makefiles              = Generates NMake makefiles.
  NMake Makefiles JOM          = Generates JOM makefiles.
  Green Hills MULTI            = Generates Green Hills MULTI files
                                 (experimental, work-in-progress).
  MSYS Makefiles               = Generates MSYS makefiles.
  MinGW Makefiles              = Generates a make file for use with
                                 mingw32-make.
  Unix Makefiles               = Generates standard UNIX makefiles.
  Ninja                        = Generates build.ninja files.
  Watcom WMake                 = Generates Watcom WMake makefiles.
  CodeBlocks - MinGW Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles = Generates CodeBlocks project files.
  CodeBlocks - NMake Makefiles JOM
                               = Generates CodeBlocks project files.
  CodeBlocks - Ninja           = Generates CodeBlocks project files.
  CodeBlocks - Unix Makefiles  = Generates CodeBlocks project files.
  CodeLite - MinGW Makefiles   = Generates CodeLite project files.
  CodeLite - NMake Makefiles   = Generates CodeLite project files.
  CodeLite - Ninja             = Generates CodeLite project files.
  CodeLite - Unix Makefiles    = Generates CodeLite project files.
  Sublime Text 2 - MinGW Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - NMake Makefiles
                               = Generates Sublime Text 2 project files.
  Sublime Text 2 - Ninja       = Generates Sublime Text 2 project files.
  Sublime Text 2 - Unix Makefiles
                               = Generates Sublime Text 2 project files.
  Kate - MinGW Makefiles       = Generates Kate project files.
  Kate - NMake Makefiles       = Generates Kate project files.
  Kate - Ninja                 = Generates Kate project files.
  Kate - Unix Makefiles        = Generates Kate project files.
  Eclipse CDT4 - NMake Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - MinGW Makefiles
                               = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Ninja         = Generates Eclipse CDT 4.0 project files.
  Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.

Microsoft (R) Build Engine version 15.4.8.50001 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1009: Project file does not exist.
Switch: D:\Users\brazg\Documents\GitHub\blender\..\build_windows_Release_x64_vc14_Release\Blender.sln
"Build Failed"

It does not like using anything above vc12 which I am trying to make it do.

Am I missing something?

There is code referencing vc 2017 in make.bat too:

else if "%1" == "x64" (
    set BUILD_ARCH=x64
) else if "%1" == "2017" (

set BUILD_VS_VER=15
set BUILD_VS_YEAR=2017
set BUILD_VS_LIBDIRPOST=vc14

Whitequill Riclo

Posted 2017-11-29T17:43:54.630

Reputation: 101

It is working now! I'm very green with Visual Studio batch scripts. I'm more familiar with GCC.

Thank you! :) – Whitequill Riclo – 2017-11-30T13:26:50.090

Answers

0

There was more the one file that needed to be edited.

First, platform_win32.cmake had errors.

I changed: set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc14) to set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/${LIBDIR_BASE}_vc15) on lines 147 and 150. That fixed the error about win32_vc14 not existing. Lines 147 and 150 are in regards to detecting VS2017 so they should have said win32_vc15.

Next make.bat did need some editing, but not as much. The sanity check block I commented out lines 187 to 202;

:sanity_checks REM Sanity Checks ::where /Q msbuild ::if %ERRORLEVEL% NEQ 0 ( :: if "%BUILD_VS_VER%"=="12" ( :: rem vs12 not found, try vs14 :: echo Visual Studio 2013 not found, trying Visual Studio 2015. :: set BUILD_VS_VER=15 :: set BUILD_VS_YEAR=2017 :: set BUILD_VS_LIBDIRPOST=vc15 :: goto DetectMSVC :: ) else ( ::"" echo Error: "MSBuild" command not in the PATH. :: echo You must have MSVC installed and run this from the "Developer Command ::Prompt" :: echo ^(available from Visual Studio's Start menu entry^), aborting! :: goto EOF :: ) ::)

and lines 83 to 87:

::set BUILD_VS_VER=14 ::set BUILD_VS_YEAR=2015 ::set BUILD_VS_LIBDIRPOST=vc14 ::) else if "%1" == "2013" ( ::set BUILD_VS_VER=12 ::set BUILD_VS_YEAR=2013 ::set BUILD_VS_LIBDIRPOST=vc12

otherwise, it still looks for vc12.

Line 81 also should be edited from: set BUILD_VS_LIBDIRPOST=vc14 to set BUILD_VS_LIBDIRPOST=vc15 Line 81 is also in regards to finding VS2017 so I'm not sure why it was set to vc14.

Edit: Line 162: if DEFINED VisualStudioVersion goto msvc_detect_finally needs to be changed to say: if DEFINED VisualStudioVersion goto msvc_detect_finally_2017

After that, the compile ran just fine for 01:29:42.49, but still failed probably because it can't find pthread.h or zlib.h or a few other header files.

Thank you for you all your help @Ramhound. I'll be happy to chat with you soon, if you have more information. I am including a link to my Build.log below in case there is something there.

Build.log

Whitequill Riclo

Posted 2017-11-29T17:43:54.630

Reputation: 101

I have tried with Visual Studio 2013 x64 (vc12) and had the same result as 2017 x64 (vc15). They both failed to build... Here is the log from the vc12 build: build.log vc12

– Whitequill Riclo – 2017-12-03T08:50:35.107

I will add I changed the /maxcpucount to 8 to better represent my system. it is set to 2 by default. In my option, a compiler should check the number of cores or logical processors and optimise for a CPU when compiling. – Whitequill Riclo – 2017-12-03T09:08:03.340

does /maxcpucount mean: cpu cores; logical processors; threads or physical processors? – Whitequill Riclo – 2017-12-03T09:55:07.397