BUILD-MINGW32.txt 5.07 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
BUILDING SIGIL FROM SOURCE USING MINGW32 IN WINDOWS
---------------------------------------------------

If you haven't already, it's probaby a good idea to download the CodeBlocks IDE. This guide assumes that you'll be using the MinGW compiler provided by CodeBlocks to compile your code, and that you'll be using CodeBlocks to build your SIGIL applications. If this is not the case, some of the instructions and directories in this guide will need to be changed to reflect your approach.

Download the "codeblocks-XX.XXmingw-setup.exe" binary release from:

	http://codeblocks.org/downloads/26

Make sure you download the correct version; there are non-admin and non-mingw version available, but you probably don't want any of those.

SIGIL uses CMake, which is a cross-platform build tool. You will need to download and run the CMake "Windows Installer" (.msi). When the installer asks, make sure you add CMake to your PATH variable. You can download the installer from:

	https://cmake.org/download/

Next, download SIGIL. If you have git, you can use a command prompt:

18
	git clone https://gitlab.com/geoff-nagy/sigil.git
19 20 21 22 23

Otherwise, you can download the source code as a .zip file from:

	https://gitlab.com/geoff-nagy/sigil

Geoff committed
24 25 26 27 28 29 30
Navigate to SIGIL's root directory, and enter the "deps" folder. This is where CMake-based dependencies of SIGIL are located. We will use Git to acquire GLFW and Freetype2. (You can ignore the "pigu" folder---it is used for Raspberry Pi builds.)

Type the following:

    git clone https://github.com/glfw/glfw.git
    git clone http://git.savannah.gnu.org/cgit/freetype/freetype2.git

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
SIGIL depends on the OpenGL Extension Wrangler (GLEW) library. Headers and pre-compiled libs are included with SIGIL in the /glew folder. Copy and paste the following files into the appropriate locations as below:

	sigil/glew/lib/mingw32/libglew32.dll.a    ---> C:/Program Files (x86)/CodeBlocks/MinGW/lib/libglew32.dll.a
	sigil/glew/include/GL/*.h                 ---> C:/Program Files (x86)/CodeBlocks/MinGW/include/GL/*.h

We need OpenAL for audio. Download the "OpenAL 1.1 Core SDK (zip)" file from

	https://www.openal.org/downloads/

and extract and run the installer. When prompted, you should also run the OpenAL redistributable, which will place the OpenAL DLLs into your system folder. After all of this, copy the OpenAL header files into the proper location:

	C:\Program Files (x86)\OpenAL 1.1 SDK\include\*.h    ---> C:\Program Files (x86)\CodeBlocks\MinGW\include\*.h

Next, we can start building SIGIL. Enter the directory "sigil" and create a folder called "build-mingw32".

Open CMake-GUI. For "Where is the source code", browse to the root directory "sigil". For "Where to build the binaries", browse to the directory "build-mingw32" that you created in the previous step.

Click "Configure". When prompted, select the "MinGW Makefiles" generator from the drop-down list. Select "Use default native compilers", and click "Finish".

50
Depending on your system configuration, CMake may have trouble finding the required dependencies. For your reference, these are the values that I use to compile SIGIL.
51

52
CMAKE_BUILD_TYPE:               Release
53 54 55 56 57 58
GLEW_INCLUDE_DIR:               C:/Program Files (x86)/CodeBlocks/MinGW/include
GLEW_LIBRARY:                   C:/Program Files (x86)/CodeBlocks/MinGW/lib/libglew32.dll.a
OPENAL_INCLUDE_DIR:             C:/Program Files (x86)/CodeBlocks/MinGW/include/AL
OPENAL_LIBRARY:                 C:/Windows/System32/OpenAL32.dll

If errors occur, not all of the above variables may be immediately present. You'll need to fix any existing errors and click "Configure" again for the remaining variables to appear. Repeat this process until the configuration completes without errors---you should only have to do this once or twice if you've set everything up correctly. (It's also possible that CMake will assign the correct values to all of these variables on the first try; it depends on your system configuration.)
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83

If no errors occurred during configuration (a message box will appear if there are errors), you can click "Generate". This will generate a Makefile that we will use to compile SIGIL.

Make sure the CodeBlocks MinGW compiler is in your PATH variable. The path to your CodeBlocks MinGW compiler is probably

	C:/Program Files (x86)/CodeBlocks/MinGW/bin

but it may vary depending on where you've installed CodeBlocks.

Open a terminal in the "build-mingw32" directory. Type

	mingw32-make

This will create the files

	sigil/build-mingw32/libsigil.dll
	sigil/build-mingw32/libsigil.dll.a

It's probably now a good idea to put all of the necessary SIGIL files in a common location for you to copy into your SIGIL projects later on. This is the same process that I use when building and distributing SIGIL.

	C:/Windows/System32/OpenAL32.dll    ---> sigil/sigil-mingw32/OpenAL32.dll
	sigil/glew/lib/mingw32/glew32.dll   ---> sigil/sigil-mingw32/glew32.dll
	sigil/build-mingw32/libsigil.dll    ---> sigil/sigil-mingw32/libsigil.dll
	sigil/build-mingw32/libsigil.dll.a  ---> sigil/sigil-mingw32/lib/libsigil.dll.a

84
And you're done! Example projects for every supported compiler are provided in the "examples" folder.