CMakeLists.txt error during "make bpy"

I am trying to install Blender as a Python Module on Windows.
Currently I am following this guide: https://github.com/BenRoullier/PyBlender/blob/master/installing_blender_for_python.md

Everything went perfect until the step 9:
" Go back to the command prompt and use the following command to build the blender python module: make bpy"

I am getting the following error:

C:\blender_repo\blender>make bpy
    No explicit msvc version requested, autodetecting version.
    **********************************************************************
    ** Visual Studio 2019 Developer Command Prompt v16.4.2
    ** Copyright (c) 2019 Microsoft Corporation
    **********************************************************************
    [vcvarsall.bat] Environment initialized for: 'x64'
    Compiler Detection successful, detected VS2019
    Building blender with VS2019 for x64 in C:\blender_repo\blender\..\build_windows_Bpy_x64_vc16_Release
    loading initial cache file C:\blender_repo\blender\\build_files\cmake\config\bpy_module.cmake
    -- 64 bit compiler detected.
    -- Visual Studio 2019 detected.
    CMake Error at CMakeLists.txt:863 (message):
      WITH_MOD_OCEANSIM requires WITH_FFTW3 to be ON
    -- Configuring incomplete, errors occurred!
    See also "C:/blender_repo/build_windows_Bpy_x64_vc16_Release/CMakeFiles/CMakeOutput.log".
    "Configuration Failed"

Does anyone knows how to fix this problem? I checked the CMakeOutput.log and CMakeLists.txt, but I still don’t known what should I do.

For now i’d just do what it says and turn the WITH_FFTW3 option on in your cmakecache.txt and running cmake . (the dot important, don’t skip it) in your build folder.

I’ll have to check with the python guys what the proper defaults ought to be.

Thanks for your reply, LazyDodo!

I didn’t quite understand. The steps that I should do are:

  1. In C:\blender_repo\build_windows_Bpy_x64_vc16_Release, I should change and save the file
    //Enable FFTW3 support (Used for smoke, ocean sim, and audio effects)
    WITH_FFTW3:BOOL=ON
  2. In the cmd type C:\blender_repo\blender cmake .

It gave me the another error:

C:\blender_repo\blender>cmake .
-- Building for: Visual Studio 16 2019
CMake Error at CMakeLists.txt:29 (message):
  CMake generation for blender is not allowed within the source directory!
   Remove "C:/blender_repo/blender/CMakeCache.txt" and try again from another folder, e.g.:
   rm CMakeCache.txt
   cd ..
   mkdir cmake-make
   cd cmake-make
   cmake ../blender
   Alternately define WITH_IN_SOURCE_BUILD to force this option (not recommended!)
-- Configuring incomplete, errors occurred!

you ran cmake . in your source folder (C:/blender_repo/blender) not your build folder (C:\blender_repo\build_windows_Bpy_x64_vc16_Release) and now you have to clean that up first (toss the CMakeCache.txt file from C:/blender_repo/blender) and do it in the correct folder.

1 Like

I had to delete all build_windows_Bpy_x64_vc16_Release folder and do what you told me.

Thank you!