Skip to content

Instantly share code, notes, and snippets.

@Matioupi
Forked from vishal94c/ReadMe.md
Created May 8, 2019 14:22
Show Gist options
  • Save Matioupi/9aba99c79f2c840f610b84bb5cdf0f5d to your computer and use it in GitHub Desktop.
Save Matioupi/9aba99c79f2c840f610b84bb5cdf0f5d to your computer and use it in GitHub Desktop.
Build Cura on Windows (With all basic information)

Build Cura on Windows from scratch

Vishal Chaudhari

PEACE :)

Date (Edit-1):- 10/22/2018 (Oct 2018) //for future reference


Install Visual Studio 2015 with the required options as said by the tutorial.

NOTE:- Install the publishing option too

Add visual studio to your path (admin)

Install cmake and git they have straight forward installation.

make sure to check the correct path (admin path) as mentioned in the instructions

Eg:-

  • C:\Program Files\Git\cmd
  • C:\Program Files\CMake\bin

Install MinGW64

NOTE********


while installing all the dependecies be sure to install x64 version only and not 32bit (x86 or i686) this is the most important thing because this will for sure lead to many errors all those error will never point out the exact cause was running 32bit version of some dependecie. Please be carefull while doing this step expecially during mingw64 installation ...it will ask for i686 version or x86_64 ,if you are using 64bit windows go for x86_64 : if on 32bit windows install i686 version


MOST PEOPLE FACE DIFFERENT KIND'S OF ERROR BEACUSE THEY ARE USING 32-bit version of MinGW IF YOU HAVE MinGW installed in ProgramFiles(X86) folder that means you are using 32bit version (if you are on 64 bit machine please uninstall and reinstall for 64bit) IF YOU ARE ON 64BIT it is installed in Program files NOTE******** Add this to your path (Admin path) too

For all the commands we are going to use X64 Native command prompt (always use admin) --------------------------------+++++++++++++++++++------------------------------------------

			Building the environment

--------------------------------+++++++++++++++++++------------------------------------------

Clone the repo using gitclone command --------------------------------+++++++++++++++++++------------------------------------------

			Cura-Build-Environment

--------------------------------+++++++++++++++++++------------------------------------------

mkdir build
cd build
..\env_win64.bat
cmake .. -DCMAKE_INSTALL_PREFIX=C:\Cura-main\cbo -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles"
nmake

After building the environment add it to your path (admin path) Eg:- C:\Cura-main\cbo C:\Cura-main\cbo\bin


Now we need to compile Protobuf and Libarcus using MinGW compiler ...because in the script Protobuf is compiled using MSVC compiler

Install MSYS2 - follow the instructions as specified on their website and then add an enviroment varible in your user varibales

	`MSYS2_PATH_TYPE `	and set its value to 	`inherit`

Open MSYS2 terminal 64bit (if you are using 64 bit version windows) install all the dependcies for protobuf using

pacman -Sy make 
pacman -Sy autoconf 
etc.

After that build protobuf --------------------------------+++++++++++++++++++------------------------------------------

			PROTOBUF in MSYS terminal to build using MinGW32

--------------------------------+++++++++++++++++++------------------------------------------

git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git submodule update --init --recursive
git checkout 3.0.x
./autogen.sh
./configure
mkdir cbuild && cd cbuild
cmake -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=/c/mannual/proto -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_SH="CMAKE_SH-NOTFOUND" -Wno-narrowing ../cmake
mingw32-make
mingw32-make install

Once protobuf is built add it to your path and move it above cura-build-environment path so that the new built protobuf is used

Then build Libarcus --------------------------------+++++++++++++++++++------------------------------------------

			LibArcus in MSYS terminal to build using MinGW32

--------------------------------+++++++++++++++++++------------------------------------------

git clone https://github.com/Ultimaker/libArcus.git
cd libArcus
git submodule update --init --recursive
cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/c/mannual/liba -DCMAKE_SH="CMAKE_SH-NOTFOUND" -DBUILD_PYTHON=OFF
mingw32-make
mingw32-make install

Once LibArcus is built add it to your path and move it above cura-build-environment path so that the new built protobuf is used

Then build cura from x64 native command prompt --------------------------------+++++++++++++++++++------------------------------------------

			CURA MAIN BUILD

--------------------------------+++++++++++++++++++------------------------------------------

cd C:\cura\cura-build\build
REM 64
..\env_win64.bat
cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DSIGN_PACKAGE:BOOL=OFF -DCMAKE_PREFIX_PATH=C:\cura\cura-build 
mingw32-make
/////////////add arduino found in cura binary data (another repo in ultimaker) to the cura-build folder
mingw32-make package

--------------------------------+++++++++++++++++++------------------------------------------
Some important commands
--------------------------------+++++++++++++++++++------------------------------------------
-DCMAKE_INSTALL_PREFIX=C:\cura\main // To specify the output directory
-D__NO_INLINE__
-DSIGN_PACKAGE:BOOL=OFF // To disable signing the package or else it will lead to singing dir not found error
-DCMAKE_PREFIX_PATH=C:\cura\cura-build // while building cura with mingw32 in order to aviod error in making the cmake files
---------------------------------------------------------------------------------------------
--------------------------------+++++++++++++++++++------------------------------------------
Cura-Build-Environment
--------------------------------+++++++++++++++++++------------------------------------------
mkdir build
cd build
..\env_win64.bat
cmake .. -DCMAKE_INSTALL_PREFIX=C:\Cura-main\cbo -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles"
nmake
---------------------------------------------------------------------------------------------
--------------------------------+++++++++++++++++++------------------------------------------
MSYS terminal
--------------------------------+++++++++++++++++++------------------------------------------
-DCMAKE_SH="CMAKE_SH-NOTFOUND" -G "MinGW Makefiles" // In MSYS terminal when MinGW generator in order to avoid sh.exe error use this command
cmake -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=C:\mannual\proto -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_SH="CMAKE_SH-NOTFOUND" -Wno-narrowing ../cmake
---------------------------------------------------------------------------------------------
--------------------------------+++++++++++++++++++------------------------------------------
PROTOBUF in MSYS terminal to build using MinGW32
--------------------------------+++++++++++++++++++------------------------------------------
git clone https://github.com/protocolbuffers/protobuf.git
cd protobuf
git submodule update --init --recursive
git checkout 3.0.x
./autogen.sh
./configure
mkdir cbuild && cd cbuild
cmake -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=/c/mannual/proto -Dprotobuf_BUILD_TESTS=OFF -DCMAKE_SH="CMAKE_SH-NOTFOUND" -Wno-narrowing ../cmake
---------------------------------------------------------------------------------------------
--------------------------------+++++++++++++++++++------------------------------------------
LibArcus in MSYS terminal to build using MinGW32
--------------------------------+++++++++++++++++++------------------------------------------
git clone https://github.com/Ultimaker/libArcus.git
cd libArcus
git submodule update --init --recursive
cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/c/mannual/liba -DCMAKE_SH="CMAKE_SH-NOTFOUND" -DBUILD_PYTHON=OFF
---------------------------------------------------------------------------------------------
--------------------------------+++++++++++++++++++------------------------------------------
CURA MAIN BUILD
--------------------------------+++++++++++++++++++------------------------------------------
cd C:\cura\cura-build\build
REM 64
..\env_win64.bat
cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DSIGN_PACKAGE:BOOL=OFF -DCMAKE_PREFIX_PATH=C:\cura\cura-build
---------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment