View Single Post
Old 09-29-2012, 06:06 AM   #9
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,733
Karma: 2197770
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@Man Eating Duck - I use VS 2010 to develop, so I can't give you a completely 100% list for what you need to do without that installed.

However I did a few days ago setup a cmake/nmake directory for building outside of VS to test something, so I can tell you what I did for that... (Windows builds only).

If John or anyone else spots any obvious errors, tell me and I will correct the post.

Preparation work:
Spoiler:
  • All directories in my example are based in D:\SigilDev but you can adjust to your preference.
  • Install the Windows SDK (or in my case VS 2010)
  • Install git (assuming you are working from a git repository of Sigil) to retrieve source code from trunk using:
  • git clone https://code.google.com/p/sigil/ D:\SigilDev\sigil-head
  • Install Inno Setup 5 (if you intend to build the nmake based MSI installer) to D:\SigilDev\Tools\Inno Setup 5
  • Install Qt 4.8.3 using the installer from the Qt website (no need to build yourself as a Windows user for 32-bit anyways). Get the right install for the type of build (e.g. VS2010 in my case). Install so the binaries for this example are put in D:\SigilDev\Qt\4.8.3\bin
  • Install cmake 2.8.8 and add the D:\SigilDev\Tools\cmake-2.8.8-win32-x86\bin directory to system path.


To create an nmake based debug build:
Spoiler:
  • Create an empty directory to do building from, e.g. D:\SigilDev\sigil-nmake-debug
  • Open a command prompt - in your case a Windows SDK command prompt (in my case a VS command prompt).
  • Switch directory to D:\SigilDev\sigil-nmake-debug
  • Ensure Qt is in your path:
  • SET PATH=D:\SigilDev\Qt\4.8.3\bin;%PATH%
  • Then run the cmake/name combination:
  • cmake -G "NMake Makefiles" D:\SigilDev\sigil-head
  • nmake
After running that (assuming no errors) you will have a D:\SigilDev\sigil-nmake-debug\bin folder containing Sigil.exe ( + debug symbols). Note that you cannot run it from there without all the supporting files.

Copy all the subfolders from your official Sigil beta install directory (codecs, examples, hunspell_dictionaries, etc) into your bin folder at D:\SigilDev\sigil-nmake-debug\bin

You will also want the Qt debug dlls. You can find those in the D:\SigilDev\Qt\4.8.3\bin folder. You want to copy a subset of them into your bin folder above too. Make sure they have the d4.dll suffixes - specifically: phonond4.dll, QtCored4.dll, QtGuid4.dll, QtNetworkd4.dll, QtSvgd4.dll, QtWebKitd4.dll, QtXmld4.dll, QtXmlPatternsd4.dll (the ones in your Sigil MSI installed folder are of course the release not the debug dlls).

Now you should be able to run the Sigil.exe If you edit the source code back in the D:\SigilDev\sigil-head folder, then just re-run the nmake step.


To create an nmake based release build / 32-bit MSI installer:
Spoiler:
  • Create an empty directory to do building from, e.g. D:\SigilDev\sigil-nmake-release
  • Open a command prompt - in your case a Windows SDK command prompt (in my case a VS command prompt).
  • Switch directory to D:\SigilDev\sigil-nmake-release
  • Ensure Qt is in your path:
  • SET PATH=D:\SigilDev\Qt\4.8.3\bin;D:\SigilDev\Tools\In no Setup 5;%PATH%
  • Then run the cmake/name combination:
  • cmake -G "NMake Makefiles" -D CMAKE_BUILD_TYPE=Release D:\SigilDev\sigil-head
  • nmake makeinstaller
The MSI installer will be located in: D:\SigilDev\sigil-nmake-release\installer

If you want to just run the Sigil.exe from the bin folder, you need the same trick I mentioned under debug of the supporting folders and Qt dlls (release versions). Probably easier just to run the MSI installer, then copy *all* the supporting files/folders from that install folder back into your D:\SigilDev\sigil-nmake-release\bin folder


To create a VS 2010 based build:
Spoiler:
  • Create an empty directory to do my building from, e.g. D:\SigilDev\sigil-vs2010
  • Open a command prompt - in your case a Windows SDK command prompt (in my case a VS command prompt).
  • Switch directory to D:\SigilDev\sigil-vs2010
  • Ensure Qt is in your path:
  • SET PATH=D:\SigilDev\Qt\4.8.3\bin;%PATH%
  • Then run cmake:
  • cmake -G "Visual Studio 10" D:\SigilDev\sigil-head
  • Open the Sigil.sln file in VS 2010 (which has Debug, Release, RelWithDebInfo and MinSizeRel solution configurations).
  • Set Sigil to be the startup project.
  • Build Sigil
After running that (assuming no errors) you will have a D:\SigilDev\sigil-vs2010\bin\Debug folder containing Sigil.exe (+ debug symbols). Note that you cannot run it from there without all the supporting files.

Copy all the subfolders from your official Sigil beta install directory (codecs, examples, hunspell_dictionaries, etc) into your bin folder at D:\SigilDev\sigil-nmake-debug\bin

You will also want the Qt debug dlls. You can find those in the D:\SigilDev\Qt\4.8.3\bin folder. You want to copy a subset of them into your bin folder above too. Make sure they have the d4.dll suffixes - specifically: phonond4.dll, QtCored4.dll, QtGuid4.dll, QtNetworkd4.dll, QtSvgd4.dll, QtWebKitd4.dll, QtXmld4.dll, QtXmlPatternsd4.dll (the ones in your Sigil MSI installed folder are of course the release not the debug dlls).

At this point you are set - you should be able to edit and run the Debug configuration in VS.Net 2010. If you build any of the Release solution configurations, remember to copy the appropriate set of Qt dlls and supporting folders as described in the above steps.


There are more complications if you want to build the 64-bit build/installer - not something I have done as yet. The instructions John gave me a long time ago are included below for completeness:
Spoiler:

Using the Visual Studio command shell (it sets up the environment
properly) I use Bin\SetEnv.exe /release. Then build Qt x64 using the Qt instructions on the build instructions Wiki. Then open a new shell and Bin\SetEnv.exe /release /x86 (I think it's x86) to put it into 32 bit build mode. Build Qt in a different directory for a 32 bit version.

Once Qt is built, open another command shell (I use a fresh one each time so the env is rest). Set it for release. Then set the path to have both Qt (the proper one for the build type) and Inno in the path.
cd to Sigil's directory,

$ cmake -DCMAKE_BUILD_TYPE=Release -DWIN_INSTALLER_USE_64BIT_CRT=1 $ make $ make makeinstaller

Then do it again with a new shell but with x86 set as the environment and don't use the 64BIT_CRT option when running cmake.

Right now Sigil only builds with Microsoft's compiler so don't try to use cygwin or mingw. The ability to use something other than Microsoft's compiler on Windows is a long term goal. So is using cpack to help with the installer building process.

Also, the WIN_INSTALLER_USE_64BIT_CRT is very important on x64 builds.
Sigil distributes the CRT instead of having you or automatically downloading and installing it. That directive tells the installer which one to put in the installer.

I'll also point out that I build using Windows x64. I don't know if it's possible or how to do so with a 32 bit install.

Last edited by kiwidude; 09-29-2012 at 06:28 AM.
kiwidude is offline   Reply With Quote