]> git.lyx.org Git - lyx.git/blob - INSTALL.Win32
Describe cross-compilation with MXE
[lyx.git] / INSTALL.Win32
1 Compiling LyX 2.2 for Win32 and creating Windows installer
2 ==========================================================
3
4 It's recommended to compile LyX using Microsoft Visual C++ 2010 and CMake.
5 Pre-compiled packages with dependencies are provided for this environment.
6
7
8 Compiling with Microsoft Visual C++
9 ===================================
10
11         These instructions assume the LyX source code is in C:\LyX\lyx-21
12         You can also use another directory if you prefer.
13
14 1       Install MSVC 2010
15
16         If you don't have Visual C++ 2010 installed, get the free Express edition from
17         http://www.microsoft.com/express/Downloads/
18
19         (All dependencies are linked against the MSVC 2010 runtime and won't work in
20         combination with MSVC 2008. You'll get crashes and other unexpected issues.)
21
22 2       Install Qt
23
24         Download the latest Qt for Open Source C++ development on Windows (VS2010)
25         from http://qt-project.org/downloads
26
27 3       Install Python
28
29         Install the latest Python 2.x version (not Python 3.x !) from
30         http://www.python.org/download/
31
32 4       Install CMake
33
34         Install the latest CMake from http://www.cmake.org
35
36 5       Configure
37
38         - Run the CMake GUI.
39          
40         - Set the source code path to C:\LyX\lyx-21
41           Set the build path to C:\LyX\lyx-21-build
42           Click Configure and set the generator to Visual Studio 10.
43
44         - Enable LYX_DEPENDENCIES_DOWNLOAD and click Configure.
45           Pre-compiled dependencies will automatically be downloaded.
46         
47         - Set QT_QMAKE_EXECUTABLE to e.g.
48           C:\Qt\qt-everywhere-opensource-src-4.8.4\bin\qmake.exe
49           and Configure again.
50
51         - Enable the LYX_INSTALL option, set CMAKE_INSTALL_PREFIX to
52           C:\LyX\lyx-21-install and click Configure.
53
54         - Check the Advanced checkbox.
55           Set GETTEXT_MSGFMT_EXECUTABLE to
56           C:\LyX\lyx-21-build\msvc2010-deps\deps20\gettext-tools\msgfmt.exe,
57           and do the same for the other gettext tools.
58
59         - Click Generate.
60
61 6       Compile
62
63         A Microsoft Visual C++ solution should have been generated at
64         C:\LyX\lyx-21-build\lyx.sln
65         Compile the INSTALL project to get a LyX installation in
66         C:\LyX\lyx-21-install
67
68 7       Copy dependencies
69
70         Copy
71         - C:\LyX\lyx-21-build\msvc2010-deps\deps20\bin
72         - C:\LyX\lyx-21-build\msvc2010-deps\deps20\imagemagick
73         - C:\LyX\lyx-21-build\msvc2010-deps\deps20\python
74         - C:\LyX\lyx-21-build\msvc2010-deps\deps20\ghostscript
75         - C:\LyX\lyx-21-build\msvc2010-deps\deps20\Resources
76         to C:\LyX\lyx-21-install
77
78         And copy from the Qt bin directory
79         (e.g. C:\Qt\bin)
80         QtCore4.dll
81         QtGui4.dll
82         QtCore4d.dll (if compiling Debug version)
83         QtGui4d.dll (if compiling Debug version)
84         to C:\LyX\lyx-21-install\bin
85
86 8       Define path prefix
87
88         Add the following line to C:\LyX\lyx-21-install\Resources\lyxrc.dist,
89         so LyX will find the bundled tools such as Python, ImageMagick
90         and Ghostscript:
91
92         \path_prefix "$LyXDir\bin;$LyXDir\python;$LyXDir\imagemagick;$LyXDir\ghostscript"
93
94         You may also add the location of your LaTeX installation if it's not on the
95         system PATH, and the location of JabRef.
96
97 9       Start LyX
98
99         C:\LyX\lyx-21-install\bin\lyx.exe
100
101
102 Creating the Installer
103 ======================
104
105         - Get NSIS from http://nsis.sourceforge.net
106         - In the LyX source directory, go to development\Win32\packaging\installer
107         - Copy the 3 dll-files from there to the DLL folder of the NSIS installation
108         - Check whether the file locations/paths in settings.nsh match your setup.
109         - Right-click on lyx.nsi and click "Compile NSIS Script".
110
111
112 Compiling with GCC with MinGW64 + MSYS2 Environment using autotools
113 ===================================================================
114 1       Install MSYS2, MINGW64, Qt5+
115         https://wiki.qt.io/MSYS2
116 2       Install bc (Bench calculater), which autotools uses for some reason to compile LyX
117         pacman -S bc
118 3       Run the standard autotools install (Adapt paths and arguments accordingly)
119         ./autogen.sh
120          ./configure --without-x --enable-qt5 --disable-debug --enable-optimization --prefix=/mingw64
121         make
122         make install
123
124
125 Cross-Compiling on unix with MXE using autotools
126 =================================================
127 1       Install MXE: http://mxe.cc
128         You can either install from sources, the generic .tar binaries or debian .deb packages.
129         Installing the following .deb packages will drag in all needed dependencies:
130                 mxe-x86-64-w64-mingw32.shared-file
131                 mxe-x86-64-w64-mingw32.shared-gcc
132                 mxe-x86-64-w64-mingw32.shared-libiconv
133                 mxe-x86-64-w64-mingw32.shared-qtimageformats
134                 mxe-x86-64-w64-mingw32.shared-qtsvg
135                 mxe-x86-64-w64-mingw32.shared-qtwinextras
136         Of course you can also use the static and/or 32bit versions.
137 2       Run the standard autotools install (Adapt paths and arguments accordingly)
138         ./autogen.sh
139         mkdir builddir-mingw
140         cd builddir-mingw
141         PATH="/usr/lib/mxe/usr/bin:$PATH" ../configure --host=x86-64-w64-mingw32.shared --with-qt-dir=/usr/lib/mxe/usr/x86_64-w64-mingw32.shared/qt5 --enable-qt5 --with-included-boost --with-included-hunspell --with-included-mythes --disable-debug --enable-optimization --prefix=/mingw64
142         PATH="/usr/lib/mxe/usr/bin:$PATH" make
143         PATH="/usr/lib/mxe/usr/bin:$PATH" DESTDIR=/tmp/lyxinstall make install
144         This uses the paths from the 64bit shared MXE version installed from .deb packages.
145 3       If you want to run the resulting lyx.exe from the build directory using wine,
146         create symlinks for all needed .dlls:
147         cd builddir-mingw/src
148         ln -s /usr/lib/mxe/usr/x86_64-w64-mingw32.shared/bin/*.dll .
149         ln -s /usr/lib/mxe/usr/x86_64-w64-mingw32.shared/qt5/bin/*.dll .
150         wine64 lyx.exe
151