]> git.lyx.org Git - lyx.git/blob - INSTALL.cmake
Update tex2lyx to format 420. Determine the default style
[lyx.git] / INSTALL.cmake
1 =========================
2 Building LyX with CMake
3 =========================
4
5     Install CMake from www.cmake.org or your distribution (version >= 2.6.4).
6
7
8
9 3rd party libraries
10 --------------------
11
12     Install Qt 4 and make sure qmake is found.
13         Add the folder with qmake to the environment variable PATH.
14         If you've compiled Qt by yourself or qmake is not found after
15         installing Qt fix PATH,
16         Linux/Unix: export PATH=<your path to qt>/bin:$PATH
17         Windows   : set PATH=<your path to qt>\bin;%PATH%
18     
19     When you wanna run LyX without installing from a out-of-source
20     build directory you have to set the environment variable LYX_DIR_21x
21     and it must point to the lib dir in the source tree.
22         Linux/Unix: export LYX_DIR_21x=<lyx-source>/lib
23         Windows   : set LYX_DIR_21x=<lyx-source>\lib
24
25     Windows specific
26     
27         On Windows install the supplementary modules:
28         * Visual Studio 2008: ftp://ftp.lyx.org/pub/lyx/contrib/lyx-windows-deps-msvc2008.zip
29         * Visual Studio 2010: ftp://ftp.devel.lyx.org/pub/contrib/windows/bin
30                 or use the option LYX_DEPENDENCIES_DOWNLOAD, then you have to add
31                 these paths to your PATH variable:
32                   <build-dir>\msvc2010-deps\deps20\bin
33                   <build-dir>\msvc2010-deps\deps20\python
34                   <build-dir>\msvc2010-deps\deps20\imagemagick
35                   <build-dir>\msvc2010-deps\deps20\ghostscript
36                   <build-dir>\msvc2010-deps\deps20\gettext-tools
37
38         If cmake couldn't find these modules set GNUWIN32_DIR, eg. 
39         -DGNUWIN32_DIR=c:\gnuwin32. By default cmake searches in your 
40         program folder. Or use the cmake GUI to set the GNUWIN32_DIR path.
41
42         The build process tries to find aspell on Windows
43         in %ProgramFiles%/GnuWin32/ and in /usr/ or in /usr/local 
44         under Linux. If it could not find aspell, spell checking
45         will be disabled.
46         
47         
48         
49 Generating build system files
50 ------------------------------
51
52     CMake is a build system file generator. On all systems it could
53     generate files for several build systems, for instance Makefiles
54     for make, project files for Visual Studio, Xcode, Eclipse.
55
56     Running cmake without any argument lists all supported build
57     systems on your system. Passing one of them as -G"<build system name>" 
58     argument when running cmake selects this.
59
60
61     
62 Building out-of-source
63 -----------------------
64
65     The standard way of using CMake is to build in a folder which doesn't resides
66     in the source tree. This has the advantage, that a complete fresh build could
67     be done by simply deleting all files in the build folder and to re-run cmake 
68     again.
69
70     Another benefit of out-of-source builds is that several builds (debug, release,
71     command-line builds, IDE project files) could all use the same source tree.
72
73     Therefore when using cmake create a folder outside of the source tree and
74     select this folder when using CMake's GUI, cmake-gui, or go into this folder
75     when you call cmake from the shell.
76
77     Before performing an out-of-source build, ensure that all CMake generated
78     in-source build information is removed from the source directory,
79     e.g., CMakeFiles directory, CMakeCache.txt. 
80
81     
82
83 Using cmake
84 ------------
85
86     When calling cmake you must pass the path to the source tree (absolute are relative)
87     and optionally the generator (each system has its own default). Additional arguments 
88     could be passed with the -D prefix.
89
90     Here some examples, assuming the build folder is in the same folder as the source tree:
91
92     * Makefiles on Linux
93         cmake ../trunk
94     
95     * Project files for QtCreator:
96         Open the trunk/CMakeLists.txt file and select the build folder
97         or create the files in the command line using the -G"CodeBlocks *" option, eg
98             cmake ../trunk -G"CodeBlocks - Unix Makefiles"
99     
100     * Project files for Xcode
101         cmake ../trunk -GXcode
102         
103     * Project files for Visual Studio 10
104         cmake ..\trunk -G"Visual Studio 10"
105
106     * NMake files for Visual Studio
107         cmake ..\trunk -G"NMake Makefiles"
108
109     * Makefiles for MinGW
110         cmake ..\trunk -G"MinGW Makefiles"
111
112
113     Daily work:
114
115     * Re-running cmake is simple
116         cmake .
117
118     * Adding new files 
119         The cmake build system scans the directories, so no need to update any file,
120         just re-run cmake. Also the mocing rules are generated.
121
122     * Unused source code file
123         Because cmake scans the directories for *.cpp and *.h files it will also
124         add files to the build system which are not mentioned to build. To exclude
125         them change their ending and re-run cmake.
126
127
128         
129       
130 Build options
131 --------------
132
133     Options could be passed by the -D prefix when running cmake.
134     Available options will be listed on each cmake run.
135     -Dhelp=1 lists all available options:
136     
137     # Available on all systems/compilers
138     -- LYX_CPACK                = OFF    : Use the CPack management (Implies LYX_INSTALL option)
139     -- LYX_INSTALL              = OFF    : Build install projects/rules (implies a bunch of other options)
140     -- LYX_NLS                  = ON     : Use nls
141     -- LYX_ASPELL               = OFF    : Require aspell
142     -- LYX_ENCHANT              = OFF    : Require Enchant
143     -- LYX_HUNSPELL             = OFF    : Require Hunspell
144     -- LYX_DEVEL_VERSION        = OFF    : Build developer version
145     -- LYX_RELEASE              = OFF    : Build release version, build debug when disabled
146     -- LYX_PACKAGE_SUFFIX       = ON     : Use version suffix for packaging
147     -- LYX_PCH                  = OFF    : Use precompiled headers
148     -- LYX_MERGE_FILES          = OFF    : Merge source files into one compilation unit
149     -- LYX_MERGE_REBUILD        = OFF    : Rebuild generated files from merged files build
150     -- LYX_QUIET                = OFF    : Don't generate verbose makefiles
151     -- LYX_INSTALL_PREFIX       = OFF    : Install path for LyX
152     -- LYX_EXTERNAL_LIBINTL     = ON     : Use external libintl
153     
154     # GCC specific 
155     -- LYX_PROFILE              = OFF    : Build profile version
156     -- LYX_EXTERNAL_BOOST       = OFF    : Use external boost
157     -- LYX_PROGRAM_SUFFIX       = ON     : Append version suffix to binaries
158     -- LYX_DEBUG_GLIBC          = OFF    : Enable libstdc++ debug mode
159     -- LYX_DEBUG_GLIBC_PEDANTIC = OFF    : Enable libstdc++pedantic debug mode
160     -- LYX_STDLIB_DEBUG         = OFF    : Use debug stdlib
161     -- LYX_CONCEPT_CHECKS       = OFF    : Enable concept-checks
162
163     # MSVC specific
164     -- LYX_CONSOLE              = ON     : Show console on Windows
165     -- LYX_VLD                  = OFF    : Use VLD with MSVC
166     -- LYX_WALL                 = OFF    : Enable all warnings
167     -- LYX_CONFIGURE_CHECKS     = OFF    : Also run configure checks for MSVC
168     -- LYX_DEPENDENCIES_DOWNLOAD= OFF    : Download precompiled 3rd party libraries for MSVC 10
169
170     
171
172 Using the merged files build
173 -----------------------------
174
175     When the option 'LYX_MERGE_FILES' is used then for each library a files 
176     is generated which includes all source files of this library, this speeds 
177     up compilation about factor 5.
178
179     When you heavily work on one file you could comment out the relevant 
180     define in the '_allinone_const.C' file, so only the file _allinone_touched.C'
181     file will be re-compiled again an again.
182
183
184     - Adding new files
185       When you add new files the merging files have to be rebuild:
186         cmake -DLYX_MERGE_REBUILD=1 .
187       Or start over by completely  cleaning the build folder.
188
189     - Starting over with same configuration
190       Delete all files but CMakeCache.txt and call
191         cmake .
192
193
194
195 Visual Studio C++
196 ------------------
197     
198     * Warnings: The default warning level of the msvc cmake builds 
199       is /W3. To enable /W4 use
200         '-DLYX_WALL=1 '
201       and 
202         '-DLYX_WALL=0'
203       switches back to to /W3, 
204       To disable a specific warning add it to MSVC_W_DISABLE in
205       cmake/CMakeLists.txt. To make the warning an error add it
206       to MSVC_W_ERROR.
207       
208     * Memory leak detection
209       For MSVC the usage of 'Visual Leak Detection' could be enabled
210       (http://dmoulding.googlepages.com/vld): -DLYX_VLD=1
211       
212       Building vld requires the 'Debugging Tools For Windows' (~16MB)
213       http://www.microsoft.com/whdc/devtools/debugging/default.mspx
214       Eventually you have to copy dbghelp.dll from your Visual Studio
215       Common7\IDE folder into the binary directory. 
216       'vld.ini' is part of lyx.proj where you can configure vld.
217       
218       The docu for vld could be found in development/Win32/vld, or
219       http://www.codeproject.com/tools/visualleakdetector.asp
220       
221       
222     Some tips:
223
224     * the Release build links much faster 
225     * for the 'Debug' and 'Release' build all precompiled headers are enabled
226       to compile without pch (non file merge mode) This could be used to check 
227       if all necessary headers are included.
228         * use 'MinSizeRel' which only precompiles the STL and Boost headers
229         * use 'RelWithDebInfo' which does not use any precompiled headers
230
231
232
233 GCC/Windows (Win2k only works with MSYS, XP?)
234 ----------------------------------------------
235     QMAKESPEC is needed:
236       export QMAKESPEC=win32-g++ (MSYS) or set QMAKESPEC=win32-g++ (CMD)
237
238
239
240 Ubuntu/Kubuntu
241 --------------_
242
243     You need additionally these packages:
244       * g++
245       * cmake
246       * qt4-dev-tools
247
248       
249
250 Xcode/Mac
251 ----------
252     
253     Some tips:
254
255     * Xcode prefers UTF8 when opening source files, though LyX usually uses
256       Latin1. To fix that select all source files in Xcode and click "Get Info"
257       in the context menu. Change the encoding to Latin1.
258
259     * You can run and debug LyX from Xcode. For LyX to find its resources, there
260       are two possibilities:
261         a) Put a resource directory, e.g. a link to the lib directory of the 
262            source tree, at .../trunk/../build/bin/Resources
263         b) Select the lyx-qt4 executable in Xcode, click on "Get Info" in the 
264            context menu and add "-sysdir a_valid_LyX_resource_directory" 
265            pointing e.g. to a valid Contents/Resources of a LyX.app directory.
266
267     * LyX on Mac doesn't look for fonts in the resource directory if the
268       executable is not in an .app bundle. Instead you have to create a
269       symbolic link to the fonts directory in the place where the executable
270       is: ln -s .../trunk/lib/fonts .../trunk/../build/bin/Debug/
271       If you don't do that math character will not show up correctly.
272
273     * CMake properly finds the Qt4 library bundles from Trolltech's binary
274       Qt4 package for Mac. So no need to compile Qt on your own.
275
276
277
278 Updating the translations
279 ----------
280
281     Read README.localization for information on the translation process.
282     Here we list only the cmake specific part. As with the autotools build
283     system the translations are only updated on demand.
284
285     - Update .po files and create .gmo files (does not touch the source tree):
286         make translations
287
288     - Copy the updated .po files into the source tree for committing:
289       make update-po
290
291     - Update the layouttranslations file in the source tree:
292         make layouttranslations1
293
294
295
296 Packaging
297 ----------
298
299     - Source .tar.gz, .tar.bz2, .zip:
300         make package_source
301
302     - Binary .tar.gz and install .sh:
303         make package
304
305     - Binary .deb:
306         create : cpack -G DEB --config CPackConfig.cmake
307         list   : dpkg-deb -c lyx-*.deb
308         install: dpkg -i lyx-*.deb
309
310     - Binary .rpm:
311         create : cpack -G RPM --config CPackConfig.cmake
312         list   : rpm -qlp lyx-*.rpm              
313         install: rpm -U lyx-*.rpm   
314