Building on Windows

From BibleTime
Jump to: navigation, search

Contents

How to build With Visual Studio 2012

What follows is how BibleTime can be built on Windows using the free version of Visual Studio Express 2012.

Install Build Tools and Binary Libraries

Visual Studio

Install Visual Studio Express 2012 for Windows Desktop(C++ version).

Visual Studio Downloads

Install Visual Studio Update 4

http://www.microsoft.com/en-us/download/details.aspx?id=30679

Download and place inttypes.h into C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include

http://code.google.com/p/msinttypes/

NOTE: Use v110_xp option in each project for compatibility with Windows XP. Set instructions below.

CMake

CMake is a build tool used by both BibleTime and some of the libraries below. Make sure you have version 2.8.12 or later.

Download

Qt

Qt is a library needed by BibleTime. I installed Qt 5.2 for Visual Studio 2012.

Download

NSIS

If you want to be able to build an installable version of BibleTime, install NSIS. I installed version 2.46.

Download

Git

Downloading git

http://msysgit.github.io

There are several git tools available for Windows. I choose to use "gitextensions".

Download

7 zip

Download and install 7 zip.

Download

pkg-config

Download pkg-config-lite from:

http://sourceforge.net/projects/pkgconfiglite/

Unzip and copy the directory into c:\Program Files (x86)\

In the Control Panel, search for "env" and add "C:\Program Files (x86)\pkg-config-lite-0.28-1\bin" to the PATH

Also add the env variable PKG_CONFIG_PATH with the value "C:\bt".

Install Source Libraries

The C:\bt directory will be used as the parent directory for these libraries. Choose another directory if desired.


zlib

  1. Download and unpack zlib to C:\bt from http://www.zlib.net/. I used zlib.1.2.8.
  2. Rename the directory to C:\bt\zlib
  3. Open cmake-gui
    1. Point its source directory to C:\bt\zlib
    2. Point its binary directory to C:\bt\zlib
    3. Click Configure and choose Visual Studio 11.
    4. Click Configure again.
    5. Click Generate on the main CMake window.
  4. Open the c:\bt\zlib\zlib.sln project in Visual Studio
    1. Right click on zlibstatic -> Properties
      1. Set the Configuration to All
      2. Under Configuration Properties -> General
      3. Set the Character Set to Unicode
      4. Set the Platform Toolset property to Visual Studio 2012 – Windows XP (v110_xp).
    2. Set "Release" in the toolbar as the build type
      1. Compile the zlibstatic project by right clicking on zlibstatic and "Build"
    3. Set "Debug" in the toolbar as the build type (optional)
      1. Compile the zlibstatic project by right clicking on zlibstatic and "Build"

Clucene

  1. Download and unpack clucene-core to C:\bt from https://sourceforge.net/projects/clucene/. I used clucene-core.2.3.3.4.
  2. Rename the directory to C:\bt\clucene-core
  3. Open cmake-gui
    1. Point its source directory to C:\bt\clucene-core
    2. Point its binary directory to C:\bt\clucene-core
    3. Add Entry for ZLIB_INCLUDE_DIR=C:\bt\zlib
    4. Add Entry for ZLIB_LIBRARY=C:\bt\zlib\Release\zlibstatic.lib
    5. Click Configure and choose Visual Studio 11.
    6. Click Configure again.
    7. Click Generate on the main CMake window.
  4. Compile clucene
    1. Open the c:\bt\clucene-core\clucene.sln in Visual Studio
    2. Right click on clucene-core -> Properties
      1. Set the Configuration to All
      2. Under Configuration Properties -> General
      3. Set the Platform Toolset property to Visual Studio 2012 – Windows XP (v110_xp).
    3. Set "Release" in the toolbar as the build type
      1. Compile the clucene-core project by right clicking on ALL_BUILD and "Build"
    4. Set "Debug" in the toolbar as the build type (optional)
      1. Compile the clucene-core project by right clicking on ALL_BUILD and "Build"

Curl

  1. Download and unpack curl into C:\bt from http://curl.haxx.se/download/ I used 7.33.0.tar.gz
  2. Rename the directory to C:\bt\curl
  3. Open cmake-gui
    1. Point to the Source Code in C:\bt\curl
    2. Build the binaries in C:\bt\curl
    3. Click Configure and select Visual Studio 11 project files. Ignore the warnings.
    4. After the configure finishes:
      1. turn off BUILD_CURL_EXE
      2. turn off BUILD_CURL_TESTS
    5. Click Configure again.
    6. Click Generate on the main CMake window.
  4. Open Visual Studio
    1. Open solution c:/bt/curl/CURL.sln
    2. Ensure "Using Unicode Character Set" and "v110_xp" on libcurl project set as in projects above.
    3. Right click libcurl and open properties
    4. Set to "Release" and build the libcurl project.
    5. Set to "Debug" and build the libcurl project. (optional)

Sword

  1. Download Sword (v.1.7.0 or later) from ftp://ftp.crosswire.org/pub/sword/source/
  2. unpack it into C:\bt.
  3. Rename the directory to C:\bt\sword
  4. Copy c:/bt/sword/src/utilfuns/win32/dirent.h to c:/bt/sword/include
  1. Open cmake-gui
    1. Point to the Source Code in C:\bt\sword
    2. Build the binaries in C:\bt\sword-build
    3. Click Configure and select Visual Studio 11 project files. Ignore the warnings.
    4. If asked to create C:\bt\sword-build, say OK.
    5. If not already defined, define the following in cmake-gui.
      1. CLUCENE_INCLUDE_DIR:PATH=C:/bt/clucene-core/src/core
      2. CLUCENE_LIBRARY:FILEPATH=C:/bt/clucene-core/bin/Release/clucene-core.lib
      3. CLUCENE_LIBRARY_DIR:PATH=C:/bt/clucene-core/src/shared
      4. CURL_CONFIG:PATH:C:/bt/curl/lib/curl_config.h
      5. CURL_INCLUDE_DIR:PATH=C:/bt/curl/include
      6. CURL_LIBRARY:FILEPATH=C:/bt/curl/lib/Release/libcurl_imp.lib
      7. ZLIB_INCLUDE_DIR:PATH=C:/bt/zlib
      8. ZLIB_LIBRARY:FILEPATH=C:/bt/zlib/Release/zlibstatic.lib
    6. Add "/DUNICODE /D_UNICODE /DREGEX_MALLOC" to:
      1. CMAKE_CXX_FLAGS
      2. CMAKE_C_FLAGS
    7. Add LIBSWORD_LIBRARY_TYPE=Static
    8. Click Configure again.
    9. Click Generate on the main CMake window.
  2. Open Visual Studio
    1. Open solution c:/bt/sword-build/libsword.sln
    2. Add "v110_xp" to sword_static as in projects above.
    3. Set the build to "Release" in the toolbar of studio.
    4. Right click on the sword_static project and build it.

Create BibleTime, debug and release builds

Install Microsoft Redistributable Library

  1. Download the Visual C++ 2012 Redistributable Package from Microsoft Visual C++ 2012 (x86)
  2. Put the file in C:\bt\vcredist_x86.exe

Create BibleTime Solution

  1. Using git, clone the BibleTime project into c:\bt\bibletime and select the desired branch.
  2. Do the following procedure steps once for debug and separately for release.
    1. Add sword package config file
      1. Create text file C:\bt\sword.pc with the following lines
prefix=C:/bt
exec_prefix=${prefix}
libdir=${prefix}/sword-build/Release
includedir=${prefix}/sword/include
curllib=${prefix}/curl/lib/Release/libcurl_imp
zliblib=${prefix}/zlib/Release/zlibstatic

Name: SWORD
Description: Biblical Text Research Engine
Version: 1.7.1
Libs: ${libdir}/sword.lib ${curllib}.lib  ${zliblib}.lib
Libs.private: -L${libdir}/sword -L${curllib}
Cflags: -I${includedir}
    1. Open Cmake-gui
      1. Tell it the source is in the c:\bt\bibletime folder
      2. Tell it to build in c:\bt\bibletime-release (or bibletime-debug)
      3. Click Configure and select Visual Studio 11
      4. Tell it to create the build directory, if it asks
      5. Add an entry CMAKE_BUILD_TYPE with a value of "Release" (or Debug).
      6. Change the CMAKE_INSTALL_PREFIX variable to C:\bt\bibletime-release\install (or bibletime-debug\install)
      7. (Release only) Add an entry MSVC_REDIST with a value of "c:\bt\vcredist_x86.exe".
      8. If not already defined, define the following in cmake-gui.
        1. CLucene_INCLUDE_DIR:PATH=C:/bt/clucene-core/src/core
        2. CLucene_LIBRARY:FILEPATH=C:/b/clucene-core/bin/Release/clucene-core.lib
        3. CLucene_SHARED_LIB:FILEPATH=C:/b/clucene-core/bin/Release/clucene-shared.lib
        4. CLucene_LIBRARY_DIR:PATH=C:/bt/clucene-core/src/shared
        5. CURL_INCLUDE_DIR:PATH=C:/bt/curl/include
        6. CURL_LIBRARY:FILEPATH=C:/bt/curl/lib/Release/libcurl_imp.lib
        7. CURL_CONFIG:FILEPATH-C:/bt/curl/lib/curl_config.h
        8. ZLIB_INCLUDE_DIR:PATH=C:/bt/zlib
        9. ZLIB_LIBRARY:FILEPATH=C:/bt/zlib/Release/zlibstatic.lib
      9. Click Configure
      10. Click Generate on the main CMake window.
    2. Open Visual Studio
      1. Open c:/bt/bibletime-release/bibletime.sln (or bibletime-debug)
      2. Add "v110_xp" to the bibletime project as in projects above.
      3. Right click Bibletime project and build
      4. Right click INSTALL project and build
      5. (Release only) Right click PACKAGE and build