This page is currently under development - the goal is to describe how to set up a functional development environment for OpenSCAD on Windows.
Download the "msys2 installer" matching your Windows system (32bit or 64bit). The following description follows the 64bit installation, so if you have a 32bit Windows, some of the package names need to be changed for the 32bit versions of the packages (usually that's i686 instead of x86_64).
Start by installing MYSYS2 following the documentation on the download page.
After installation, a bash window appears. The following steps are done from inside this MSYS console window.
Install packages with needed dependencies and the QtCreator IDE:
pacman -Sy pacman -S mingw-w64-x86_64-qt-creator pacman -S mingw-w64-x86_64-gdb pacman -S mingw-w64-x86_64-boost pacman -S mingw-w64-x86_64-cgal pacman -S mingw-w64-x86_64-eigen3 pacman -S mingw-w64-x86_64-glew pacman -S mingw-w64-x86_64-qscintilla pacman -S mingw-w64-x86_64-opencsg pacman -S mingw-w64-x86_64-libzip pacman -S mingw-w64-x86_64-pkg-config pacman -S bison pacman -S flex pacman -S git
or for those who have trouble copy and pasting:
pacman -Sy; a="mingw-w64-x86_64-"; pacman -S ${a}qt-creator ${a}gdb ${a}boost ${a}cgal \ ${a}eigen3 ${a}glew ${a}qscintilla ${a}opencsg ${a}libzip ${a}pkg-config \ bison flex git
If you want to start the MSYS2 environment later, use the MinGW-32 (for 32bit Systems) or MinGW-64 links in the start menu to open the console window.
Note that MSYS2 also provides a precompiled OpenSCAD package. This can be installed using
pacman -S mingw-w64-x86_64-openscad
Update the packages to the latest version in the MSYS2 repository, follow the steps in the MSYS2 wiki. It's important to update the core packages first.
Get the OpenSCAD sourcecode using GIT:
git clone git://github.com/openscad/openscad.git
For some reason msys2 has qmake install in /mingw64/bin (cross compile issue maybe?), which is not in the path.
Grab a text editor such as nano and open .bashrc.
pacman -S nano nano ~/.bashrc
Append the following line to the end, then save and exit.
export PATH=/mingw64/bin:$PATH
Note you can git a list of editor with:
pacman -Ss editor
If you don't do this, you get 'command qmake not found' when you try to execute qmake as shown below.
Currently it isn't possible to use the debug build with the library provided by MSYS2, because linking release QScintilla and debug Qt causes OpenSCAD to crash. See "Building Debug Version" for how to manually build a debug version of QScintilla.
Change to the folder the OpenSCAD repository is cloned to and run qmake to create the Makefiles and compile using make.
qmake openscad.pro CONFIG-=debug mingw32-make.exe
The resource lookup does not yet work with the file layout created with that build. The easiest way is to move the compiled openscad.exe to the root folder of the OpenSCAD source code.
mv release/openscad.exe .
To accentually run the executable, you can then use:
./openscad.exe
qtcreator &
To compile and run OpenSCAD, just open the main project file openscad.pro, located in the top folder of the cloned github project.
The Build-Type must be changed to "Release".
Press Ctrl+B to build.
In some cases the build fails when generating the parser code using flex and bison. In that case disabling the "Shadow Build" (see Project tab / General Settings) can help.
Currently the QScintilla package provides only a release version of the library. Using this with a debug build of OpenSCAD is not possible (the resulting binary crashs with an assertion error inside Qt).
To create a working debug version of OpenSCAD, a debug version of QScintilla must be built manually.
- TARGET = qscintilla2 + TARGET = qscintilla2d
- CONFIG += qt warn_off release thread exceptions + CONFIG += qt warn_off debug thread exceptions
$ qmake $ mingw32-make
$ cp debug/libqscintilla2d.dll.a /mingw64/lib/ $ cp debug/qscintilla2d.dll /mingw64/bin/
OpenSCAD needs at least OpenGL version 2.0 to be able to correctly render the preview using OpenCSG. It's possible to run with older versions (e.g. the default provided by Windows, which is 1.4) but the display might differ from the expected output.
For systems that can't provide the needed OpenGL version (e.g. when running on a VM) it's still possible to get the a more recent OpenGL driver using the Mesa software renderer.
$ pacman -S mingw-w64-x86_64-mesa
After installing the mesa driver (default location is C:\msys64\mingw64\bin, the driver itself is opengl32.dll), it can be even activated by copying it into the same folder as the OpenSCAD.exe.
It's possible to enable it for the whole system by copying it to the Windows system32 folder, replacing the old system driver. (Warning: Do that only if you have a backup and enough knowledge how to restore files in a broken Windows installation!)