User:157yagz5r48a5f1a1f/buildwindows: Difference between revisions

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Content deleted Content added
Created page with " __NOINDEX__ EXPERIMENTAL DO NOT USE I managed to compile OpenSCAD on 04.May.2011. I'll try to document the necessary steps. The build is as static as reasonable, with no ext..."
(No difference)

Revision as of 23:06, 18 July 2011



EXPERIMENTAL DO NOT USE


I managed to compile OpenSCAD on 04.May.2011. I'll try to document the necessary steps. The build is as static as reasonable, with no external DLL dependencies that are not shipped with Windows

Downloads

start by downloading:

Installing

  • Install Visual Studio
    • No need for siverlight or mssql express
    • You can use a virtual-CD program like MagicDisc to mount the ISO file and install without using a CD
  • Install QT
    • Install to default location C:\Qt\4.7.2\
  • Install Git
    • Install this fully integrated into the shell despite the big red letters warning you not to.
  • Install Cmake
    • Check the 'Add cmake to the system path for the current user' checkbox
    • Install to default location C:\Program Files\CMake 2.8
  • Install Boost
    • Select the VC++ 9.0 vs2008 radio
    • Check the 'multithreaded static runtime' checkbox only
    • Install into C:\boost_1_46_1\
  • Install GCAL
    • Note its not a binary distribution, just an installer that installs the source.
    • No need for CGAL Examples and Demos
    • Make sure mpfr and gmp precompiled libs is checked
    • The installer wants you to put this in C:\Program Files\CGAL-3.7\ I used C:\CGAL-3.7\
    • Make sure CGAL_DIR environment checked.
  • Install MinGW
    • Make sure you select the MSYS Basic System under components
  • Extract downloaded win32_gmp_mpfr.zip file to C:\win32_gmp_mpfr\
  • Replace the mpfr and gmp .h files in CGAL with the ones from win32_gmp_mpfr
    • Delete, or move to a temp folder, all files in CGAL-3.7\auxiliary\gmp\include folder
    • Copy all the .h files in C:\win32_gmp_mpfr\gmp\Win32\Release to CGAL-3.7\auxiliary\gmp\include
    • Copy all the .h files in C:\win32_gmp_mpfr\mpfr\Win32\Release to CGAL-3.7\auxiliary\gmp\include
  • Replace the mpfr and gmp libs in CGAL with the ones from win32_gmp_mpfr
    • Delete, or move to a temp folder, all (06/20/2011 libmpfr-4.lib is needed) files in CGAL-3.7\auxiliary\gmp\lib folder.
    • Copy C:\win32_gmp_mpfr\gmp\Win32\Release\gmp.lib to CGAL-3.7\auxiliary\gmp\lib
    • Copy C:\win32_gmp_mpfr\mpfr\Win32\Release\mpfr.lib to CGAL-3.7\auxiliary\gmp\lib

To get OpenSCAD source code:

  • Open "Git Bash" (the installer may have put a shortcut on your desktop). This launches a MinGW32 command line window.
  • Type cd c: to change the current directory.
  • Type git clone git://github.com/openscad/openscad.git This will put OpenSCAD source into C:\openscad\

Where to put other files:

I put all the dependencies in C:\ so for example, extract the various .zip and .tar.gz to:

  • C:\eigen2\
  • C:\glew-1.5.8\
  • C:\OpenCSG-1.3.1\

Windows tar.gz tools include 7-zip, or the MingW shell you just installed (tar -zxvf)

The other programs should have been installed like so:

  • C:\openscad\
  • C:\boost_1_46_1\
  • C:\CGAL-3.7\

Compiling Dependencies

For compilation I use the QT Development Command Prompt

Start->Program Files->Qt by Nokia v4.7.2 (VS2008 OpenSource)->QT 4.7.2 Command Prompt

Qt

Qt needs to be recompiled to get a static C runtime build. To do so, open the command prompt and do:

configure -static -platform win32-msvc2008 -no-webkit

Configure will take several minutes to finish processing. After it is done, open up the file Qt\4.7.2\mkspecs\win32-msvc2008\qmake.conf and replace every instance of -MD with -MT. Then:

nmake

This takes a very, very long time. Have a nap. Get something to eat. On a Pentium 4, 2.8GHZ CPU with 1 Gigabyte RAM, Windows XP, it took more than 7 hours, (that was with -O2 turned off)

GLEW

go into the build/vc6 directory open up the project file it will ask if you want to 'update' it. say yes.

it should give you a list of 4 projects, one of them is glew static. build it.

it should dump glew32s.lib under lib\

CGAL

cd C:\CGAL-3.7\
set BOOST_ROOT=C:\boost_1_46_1\
cmake .

Now edit the CMakeCache.txt file. Replace every instance of /MD with /MT before the next step.

cmd /c vcexpress CGAL.sln /build
Substitute devenv for vcexpress if you are not using the express version.

OpenCSG

don't use the glew that came with openCSG. use the glew you downloaded instead.

how? 1. delete the glew that came with opencsg

2. in the project properties, go to c/c++ and there will be an option for 'include files'. click it and you can navigate to your glew/include directory.

Launch Visual Express.

cd C:\OpenCSG-1.3.1
vcexpress OpenCSG.sln
Substitute devenv for vcexpress if you are not using the express version
  • Manually step through project upgrade wizard
  • Make sure the runtime library setting for OpenCSG project is set to multi-threaded
    • Open the OpenCSG project properties by clicking menu item "Project->OpenCSG Properties" (might be just "Properties")
    • Click 'Configuration Properties'
    • Select "Release" from "Configuration:" drop down menu
    • Click C/C++ -> Code Generation
    • Make sure "Runtime Library" is set to "Multi-threaded (/MT)"
    • Click hit OK
  • Make sure the runtime library setting for glew_static project is set to multi-threaded
    • In "Solution Explorer - OpenCSG" pane click "glew_static" project
    • Open the OpenCSG project properties by clicking menu item "Project->OpenCSG Properties" (might be just "Properties")
    • Select "Release" from "Configuration:" drop down menu
    • Click C/C++ -> Code Generation
    • Make sure "Runtime Library" is set to "Multi-threaded (/MT)"
    • Click hit OK
  • Close Visual Express saving changes

click build.

OpenSCAD

In the openscad directory, edit the following files:

edit openscad.pro. it says version=date. remove that, put in version = "2011.7.1" or whatever.

now run this:

cd C:\openscad
set INCLUDE=%INCLUDE%C:\CGAL-3.7\include;C:\CGAL-3.7\auxiliary\gmp\include;
set INCLUDE=%INCLUDE%C:\boost_1_46_1;C:\glew-1.5.8\include;C:\OpenCSG-1.3.1\include;C:\eigen2
set LIB=%LIB%C:\CGAL-3.7\lib;C:\CGAL-3.7\auxiliary\gmp\lib;
set LIB=%LIB%C:\boost_1_46_1\lib;C:\glew-1.5.8\lib;C:\OpenCSG-1.3.1\lib
qmake

Ignore the warnings.

Now run

nmake -f Makefile.Release

While this is running, open up the src directory, open the file lexer.lexer.cpp (the first stage of the build generates this file) and find the line that says

b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;

Replace it with:

b->yy_is_interactive = 0;

Wait for the nmake to end. It will likely stop with an error if you took too long to edit the files. If there is an error, just run

nmake -f Makefile.Release

again. Ignore all warnings. There will be an openscad.exe file in the release folder. Enjoy.

Building an installer

  • Download and install NSIS from http://nsis.sourceforge.net/Download
  • Put the FileAssociation.nsh macro from http://nsis.sourceforge.net/File_Association in the NSIS Include directory
  • Copy the "libraries" and "examples" directory into the "release" directory
  • (Optional) copy the .scad files from the current version of mcad (https://github.com/elmom/MCAD) into a folder called "mcad" and put that folder into the "libraries folder"
  • Copy "scripts/installer.nsi" to the "release" directory.
  • Right-click on the file and compile it with NSIS. It will spit out a nice, easy installer. Enjoy.