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