Skip to content

Building from the command line

Volker Enderlein edited this page Jan 12, 2020 · 2 revisions

As an alternative to building with Visual Studio project files, you can use the same build method as on other platforms, which gives you the same configuration options. This has been the preferred method at Kongsberg.

This has been confirmed to work on the following setup:

  • Windows 7 64 bit
  • Microsoft Visual Studio Express 2012

Cygwin

Installation

Install the 32 bit version of Cygwin (I had problems calling the compiler using 64 bit Cygwin). Select at least the following packages:

  • Base/bash
  • Devel/binutils
  • Devel/make
  • Editors/nano
  • Utils/diffutils

Configuration

Locate the file Cygwin.bat in the installation directory, and create a new file alongside called Cygwin_vs2012.bat, with the following contents

 @echo off
 
 :: Load the Visual Studio environment:
 call "%VS110COMNTOOLS%\vsvars32.bat"
 
 :: Start Cygwin
 call Cygwin.bat

Start Cygwin using Cygwin_vs2012.bat, and make sure that Microsoft link.exe is found before any homonyms that may be installed by Cygwin, by editing your Bash startup script

nano ~/.bashrc

Add the line

PATH=`cygpath -p "$VCINSTALLDIR/BIN:$PATH"`

Save with Ctrl+X and close the Cygwin window.

Coin

We are going to have the repository, build directories and installation directory side by side in the following layout:

C:
  \
   Coin3D
     |\
     | Coin_Git             (repository)
     |\
     | coin_build           (debug build)
     |\
     | coin_build_release   (release build)
     |
      \Coin                 (installation)

Get the source

Make sure to have installed a Git client, for example TortoiseGit. Start Cygwin_vs2012.bat and do

mkdir /cygdrive/c/Coin3D
cd /cygdrive/c/Coin3D
git clone --recurse-submodules https://github.com/coin3d/coin Coin_Git

Create the installation directory and define COINDIR

mkdir Coin
COINDIR=C:\\Coin3D\\Coin

Leave the window open and continue with configuration.

Configure and build the debugging version

cd /cygdrive/c/Coin3D
mkdir coin_build
cd coin_build

Run ../Coin_Git/configure --help and write down the options that match your requirements. Then configure the sources for debugging, for example:

../Coin_Git/configure --with-msvcrt=mdd --prefix=/cygdrive/c/Coin3D/Coin --disable-sound --enable-threadsafe --with-alternate=debug --with-suffix=d --with-glu=/cygdrive/c/Coin3D/GLU_DLLs/GLU_Debug_msvc9/Debug

The above illustrates the use of the improved GLU from the Superglu repository, installed in the GLU_DLLs subdirectory.

Then build and install.

make
make install

Configure and build the release version

cd /cygdrive/c/Coin3D
mkdir coin_build_release
cd coin_build_release

Adjust the configure options for release, for example:

../Coin_Git/configure --with-msvcrt=md --prefix=/cygdrive/c/Coin3D/Coin --disable-sound --enable-threadsafe --disable-debug --disable-symbols --with-glu=/cygdrive/c/Coin3D/GLU_DLLs/GLU_Release_msvc9/Release

Then build and install.

make
make install
Clone this wiki locally