cmake precompile:

- only precompile boost and stl headers
- for qt4 also precompile QtGui and QtGui
- don't use one global precomiled header file
  to get out of the dependency hell 





git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15517 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2006-10-23 19:04:29 +00:00
parent 6700802966
commit cd0b5b6ca9
11 changed files with 33 additions and 169 deletions

View File

@ -96,27 +96,18 @@ endif(MSVC)
if(pch AND MSVC)
set(pch TRUE CACHE TYPE STRING)
macro(lyx_add_msvc_pch _sources)
SET_SOURCE_FILES_PROPERTIES(${${_sources}} PROPERTIES COMPILE_FLAGS
"/Yuconfig.h /Fp${CMAKE_BINARY_DIR}/config.pch /Fd${CMAKE_BINARY_DIR}/pchlib.pdb")
add_definitions(-DLYX_PRECOMPILED_HEADERS)
configure_file(${CMAKE_SOURCE_DIR}/pcheaders.h ${CMAKE_BINARY_DIR}/pcheaders.h)
macro(lyx_add_msvc_pch name_)
configure_file(${CMAKE_SOURCE_DIR}/config.C.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.C)
SET_SOURCE_FILES_PROPERTIES(${${name_}_sources} PROPERTIES COMPILE_FLAGS /Yuconfig.h)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/config.C PROPERTIES COMPILE_FLAGS /Ycconfig.h)
add_definitions(/DLYX_PRECOMPILED_HEADERS)
set(${name_}_sources ${${name_}_sources} ${CMAKE_CURRENT_BINARY_DIR}/config.C ${CMAKE_BINARY_DIR}/pcheaders.h)
endmacro(lyx_add_msvc_pch)
configure_file(config.C.cmake ${CMAKE_BINARY_DIR}/config.C)
configure_file(pcheaders.h ${CMAKE_BINARY_DIR}/pcheaders.h)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/config.C PROPERTIES COMPILE_FLAGS
"/Ycconfig.h /Fp${CMAKE_BINARY_DIR}/config.pch /Fd${CMAKE_BINARY_DIR}/pchlib.pdb -DLYX_PRECOMPILED_HEADERS")
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${TOP_SRC_DIR}/src/support ${ICONV_INCLUDE_DIR})
add_library(pchlib STATIC ${CMAKE_BINARY_DIR}/config.C ${CMAKE_BINARY_DIR}/pcheaders.h)
set(pchlibname pchlib )
set(PRECOMPILED_HEADERS TRUE)
else(pch AND MSVC)
macro(lyx_add_msvc_pch)
endmacro(lyx_add_msvc_pch)
set(pchlibname boost_signals) # dummy
endif(pch AND MSVC)

View File

@ -168,7 +168,11 @@
#endif
#ifdef LYX_PRECOMPILED_HEADERS
#include "pcheaders.h"
# include "pcheaders.h"
# ifdef LYX_BUILD_QT4_FRONTEND
# include <QtCore>
# include <QtGUI>
# endif
#endif
#endif

View File

@ -10,24 +10,29 @@
*/
//#define LYX_DONT_PRECOMPILE_SRC
#include <boost/any.hpp>
#include <boost/array.hpp>
#include <boost/assert.hpp>
#include <boost/bind.hpp>
#include <boost/crc.hpp>
#include <boost/cregex.hpp>
#include <boost/current_function.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/function.hpp>
#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iterator/indirect_iterator.hpp>
#include <boost/optional.hpp>
#include <boost/regex.hpp>
#include <boost/scoped_array.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/signals/connection.hpp>
#include <boost/signal.hpp>
#include <boost/signals/connection.hpp>
#include <boost/signals/trackable.hpp>
#include <boost/tokenizer.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/utility.hpp>
#include <boost/version.hpp>
#if BOOST_VERSION < 103300
@ -36,12 +41,10 @@
# include <boost/test/utils/nullstream.hpp>
#endif
#include <boost/tokenizer.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/utility.hpp>
#include <algorithm>
#include <cerrno>
#include <cassert>
#include <clocale>
#include <csignal>
#include <cstddef>
@ -61,127 +64,8 @@
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#ifndef LYX_DONT_PRECOMPILE_SRC
#include <vspace.h>
#include <version.h>
#include <vc-backend.h>
#include <undo.h>
#include <trans_mgr.h>
#include <trans_decl.h>
#include <trans.h>
#include <toc.h>
#include <texrow.h>
#include <tex-strings.h>
#include <tex-accent.h>
#include <tabular.h>
#include <sgml.h>
#include <session.h>
#include <rowpainter.h>
#include <pspell.h>
#include <pariterator.h>
#include <paragraph_pimpl.h>
#include <paragraph_funcs.h>
#include <paragraph.h>
#include <paper.h>
#include <outputparams.h>
#include <output_plaintext.h>
#include <output_latex.h>
#include <output_docbook.h>
#include <output.h>
#include <mover.h>
#include <metricsinfo.h>
#include <messages.h>
#include <lyxvc.h>
#include <lyxtextclasslist.h>
#include <lyxtextclass.h>
#include <lyxtext.h>
#include <lyxsocket.h>
#include <lyxserver.h>
#include <lyxrow.h>
#include <lyxrc.h>
#include <lyxlex_pimpl.h>
#include <lyxlex.h>
#include <lyxlength.h>
#include <lyxlayout_ptr_fwd.h>
#include <lyxlayout.h>
#include <lyxgluelength.h>
#include <lyxfunc.h>
#include <lyxfont.h>
#include <lyxfind.h>
#include <lyx_sty.h>
#include <lyx_main.h>
#include <lyx_cb.h>
#include <lfuns.h>
#include <lengthcommon.h>
#include <layout.h>
#include <language.h>
#include <kbsequence.h>
#include <kbmap.h>
#include <ispell.h>
#include <intl.h>
#include <insetiterator.h>
#include <importer.h>
#include <graph.h>
#include <gettext.h>
#include <funcrequest.h>
#include <format.h>
#include <factory.h>
#include <exporter.h>
#include <errorlist.h>
#include <encoding.h>
#include <dociterator.h>
#include <dispatchresult.h>
#include <dimension.h>
#include <debug.h>
#include <cursor_slice.h>
#include <cursor.h>
#include <counters.h>
#include <coordcache.h>
#include <converter.h>
#include <chset.h>
#include <changes.h>
#include <bufferview_funcs.h>
#include <bufferparams.h>
#include <bufferlist.h>
#include <buffer_funcs.h>
#include <buffer.h>
#include <box.h>
#include <author.h>
#include <aspell_local.h>
#include <WordLangTuple.h>
#include <Variables.h>
#include <ToolbarBackend.h>
#include <TocBackend.h>
#include <Thesaurus.h>
#include <SpellBase.h>
#include <Spacing.h>
#include <Sectioning.h>
#include <RowList_fwd.h>
#include <PrinterParams.h>
#include <ParagraphParameters.h>
#include <ParagraphList_fwd.h>
#include <ParagraphList.h>
#include <MenuBackend.h>
#include <LyXAction.h>
#include <LaTeXFeatures.h>
#include <LaTeX.h>
#include <LColor.h>
#include <InsetList.h>
#include <FuncStatus.h>
#include <FontIterator.h>
#include <Floating.h>
#include <FloatList.h>
#include <DepTable.h>
#include <CutAndPaste.h>
#include <Color.h>
#include <Chktex.h>
#include <Bullet.h>
#include <BufferView.h>
#include <BranchList.h>
#include <Bidi.h>
#endif

View File

@ -35,7 +35,7 @@ endif(ASPELL_FOUND)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
lyx_add_msvc_pch(lyx_sources)
lyx_add_msvc_pch(lyx)
set(lyx_sources ${lyx_sources} ${CMAKE_CURRENT_BINARY_DIR}/version.C)
@ -54,7 +54,6 @@ target_link_libraries(lyx-${qt_postfix}
intl
${QT_QTMAIN_LIBRARY}
boost_iostreams
${pchlibname}
)
if(ASPELL_FOUND)

View File

@ -12,15 +12,12 @@ add_subdirectory(controllers)
add_subdirectory(${qt_postfix})
file(GLOB frontends_sources ${TOP_SRC_DIR}/src/frontends/*.C)
file(GLOB frontends_headers ${TOP_SRC_DIR}/src/frontends/*.h)
lyx_add_msvc_pch(frontends_sources)
lyx_add_msvc_pch(frontends)
add_library(frontends STATIC ${frontends_sources} ${frontends_headers})
add_dependencies(frontends ${pchlibname})
project_source_group("${GROUP_CODE}" frontends_sources frontends_headers)

View File

@ -9,7 +9,7 @@ project(controllers)
file(GLOB controllers_sources ${TOP_SRC_DIR}/src/frontends/controllers/*.C)
file(GLOB controllers_headers ${TOP_SRC_DIR}/src/frontends/controllers/*.h)
lyx_add_msvc_pch(controllers_sources)
lyx_add_msvc_pch(controllers)
include_directories(${TOP_SRC_DIR}/src/frontends/controllers)
@ -17,7 +17,5 @@ add_library(controllers STATIC ${controllers_sources} ${controllers_headers})
target_link_libraries(controllers boost_regex boost_filesystem)
add_dependencies(controllers ${pchlibname})
project_source_group("${GROUP_CODE}" controllers_sources controllers_headers)

View File

@ -11,7 +11,7 @@ file(GLOB frontends_qt4_sources ${TOP_SRC_DIR}/src/frontends/qt4/*.C)
file(GLOB frontends_qt4_headers ${TOP_SRC_DIR}/src/frontends/qt4/*.h)
file(GLOB frontend_qt4_UI ${TOP_SRC_DIR}/src/frontends/qt4/ui/*.ui)
lyx_add_msvc_pch(frontends_qt4_sources)
lyx_add_msvc_pch(frontends_qt4)
lyx_automoc(${frontends_qt4_sources})
@ -22,6 +22,7 @@ add_definitions(
-DQT_GENUINE_STR
-DQT_NO_STL
-DQT_NO_KEYWORDS
-DLYX_BUILD_QT4_FRONTEND
)
@ -33,8 +34,6 @@ add_library(frontend_qt4 STATIC ${frontends_qt4_sources} ${frontends_qt4_headers
target_link_libraries(frontend_qt4 ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} controllers)
add_dependencies(frontend_qt4 ${pchlibname})
if(WIN32)
target_link_libraries(frontend_qt4 Gdi32)
endif(WIN32)

View File

@ -9,13 +9,11 @@ project(graphics)
file(GLOB graphics_sources ${TOP_SRC_DIR}/src/graphics/*.C)
file(GLOB graphics_headers ${TOP_SRC_DIR}/src/graphics/*.h)
lyx_add_msvc_pch(graphics_sources)
lyx_add_msvc_pch(graphics)
include_directories(${TOP_SRC_DIR}/src/graphics)
add_library(graphics STATIC ${graphics_sources} ${graphics_headers})
add_dependencies(graphics ${pchlibname})
project_source_group("${GROUP_CODE}" graphics_sources graphics_headers)

View File

@ -11,13 +11,11 @@ file(GLOB insets_headers ${TOP_SRC_DIR}/src/insets/*.h)
list(REMOVE_ITEM insets_sources ${TOP_SRC_DIR}/src/insets/insettheorem.C)
lyx_add_msvc_pch(insets_sources)
lyx_add_msvc_pch(insets)
include_directories(${TOP_SRC_DIR}/src/insets)
add_library(insets STATIC ${insets_sources} ${insets_headers})
add_dependencies(insets ${pchlibname})
project_source_group("${GROUP_CODE}" insets_sources insets_headers)

View File

@ -14,13 +14,11 @@ list(REMOVE_ITEM mathed_sources
${TOP_SRC_DIR}/src/mathed/InsetMathMBox.C
${TOP_SRC_DIR}/src/mathed/InsetFormulaMacro.C)
lyx_add_msvc_pch(mathed_sources)
lyx_add_msvc_pch(mathed)
include_directories(${TOP_SRC_DIR}/src/mathed)
add_library(mathed STATIC ${mathed_sources} ${mathed_headers})
add_dependencies(mathed ${pchlibname})
project_source_group("${GROUP_CODE}" mathed_sources mathed_headers)

View File

@ -20,18 +20,16 @@ list(REMOVE_ITEM support_sources
${TOP_SRC_DIR}/src/support/atexit.c
${TOP_SRC_DIR}/src/support/strerror.c)
lyx_add_msvc_pch(support_sources)
set(support_sources ${support_sources} ${CMAKE_CURRENT_BINARY_DIR}/package.C)
lyx_add_msvc_pch(support)
include_directories(${TOP_SRC_DIR}/src/support ${ICONV_INCLUDE_DIR})
add_library(support STATIC ${support_sources} ${support_headers})
target_link_libraries(support boost_signals)
add_dependencies(support ${pchlibname})
if(WIN32)
target_link_libraries(support shlwapi)
endif(WIN32)