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