From cd0b5b6ca99dde9e27c7fd2dc020e05bfae1bc5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Mon, 23 Oct 2006 19:04:29 +0000 Subject: [PATCH] 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 --- development/cmake/CMakeLists.txt | 23 +-- development/cmake/config.h.cmake | 6 +- development/cmake/pcheaders.h | 138 ++---------------- development/cmake/src/CMakeLists.txt | 3 +- .../cmake/src/frontends/CMakeLists.txt | 5 +- .../src/frontends/controllers/CMakeLists.txt | 4 +- .../cmake/src/frontends/qt4/CMakeLists.txt | 5 +- development/cmake/src/graphics/CMakeLists.txt | 4 +- development/cmake/src/insets/CMakeLists.txt | 4 +- development/cmake/src/mathed/CMakeLists.txt | 4 +- development/cmake/src/support/CMakeLists.txt | 6 +- 11 files changed, 33 insertions(+), 169 deletions(-) diff --git a/development/cmake/CMakeLists.txt b/development/cmake/CMakeLists.txt index 4512ec7094..6198f7006e 100644 --- a/development/cmake/CMakeLists.txt +++ b/development/cmake/CMakeLists.txt @@ -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) diff --git a/development/cmake/config.h.cmake b/development/cmake/config.h.cmake index d96187cdb5..fb1e7d4298 100644 --- a/development/cmake/config.h.cmake +++ b/development/cmake/config.h.cmake @@ -168,7 +168,11 @@ #endif #ifdef LYX_PRECOMPILED_HEADERS -#include "pcheaders.h" +# include "pcheaders.h" +# ifdef LYX_BUILD_QT4_FRONTEND +# include +# include +# endif #endif #endif diff --git a/development/cmake/pcheaders.h b/development/cmake/pcheaders.h index 2a588e7dd5..b4239847db 100644 --- a/development/cmake/pcheaders.h +++ b/development/cmake/pcheaders.h @@ -10,24 +10,29 @@ */ -//#define LYX_DONT_PRECOMPILE_SRC - #include #include #include +#include #include #include #include +#include #include +#include +#include +#include #include #include #include #include #include -#include -#include #include +#include #include +#include +#include +#include #include #if BOOST_VERSION < 103300 @@ -36,12 +41,10 @@ # include #endif -#include -#include -#include #include #include +#include #include #include #include @@ -61,127 +64,8 @@ #include #include #include +#include #include #include #include #include - -#ifndef LYX_DONT_PRECOMPILE_SRC -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#endif diff --git a/development/cmake/src/CMakeLists.txt b/development/cmake/src/CMakeLists.txt index a18f1d6f5f..25da339d6e 100644 --- a/development/cmake/src/CMakeLists.txt +++ b/development/cmake/src/CMakeLists.txt @@ -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) diff --git a/development/cmake/src/frontends/CMakeLists.txt b/development/cmake/src/frontends/CMakeLists.txt index 55e73bfd01..52c565a180 100644 --- a/development/cmake/src/frontends/CMakeLists.txt +++ b/development/cmake/src/frontends/CMakeLists.txt @@ -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) diff --git a/development/cmake/src/frontends/controllers/CMakeLists.txt b/development/cmake/src/frontends/controllers/CMakeLists.txt index a5c572348b..28e613c3c5 100644 --- a/development/cmake/src/frontends/controllers/CMakeLists.txt +++ b/development/cmake/src/frontends/controllers/CMakeLists.txt @@ -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) diff --git a/development/cmake/src/frontends/qt4/CMakeLists.txt b/development/cmake/src/frontends/qt4/CMakeLists.txt index b0dab2fada..ec26f4e277 100644 --- a/development/cmake/src/frontends/qt4/CMakeLists.txt +++ b/development/cmake/src/frontends/qt4/CMakeLists.txt @@ -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) diff --git a/development/cmake/src/graphics/CMakeLists.txt b/development/cmake/src/graphics/CMakeLists.txt index 3eb5421396..fe24c1e25f 100644 --- a/development/cmake/src/graphics/CMakeLists.txt +++ b/development/cmake/src/graphics/CMakeLists.txt @@ -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) diff --git a/development/cmake/src/insets/CMakeLists.txt b/development/cmake/src/insets/CMakeLists.txt index 4fe34c569d..733f4dc986 100644 --- a/development/cmake/src/insets/CMakeLists.txt +++ b/development/cmake/src/insets/CMakeLists.txt @@ -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) diff --git a/development/cmake/src/mathed/CMakeLists.txt b/development/cmake/src/mathed/CMakeLists.txt index d0e91000de..65ec043295 100644 --- a/development/cmake/src/mathed/CMakeLists.txt +++ b/development/cmake/src/mathed/CMakeLists.txt @@ -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) diff --git a/development/cmake/src/support/CMakeLists.txt b/development/cmake/src/support/CMakeLists.txt index ce2784676b..c23a308170 100644 --- a/development/cmake/src/support/CMakeLists.txt +++ b/development/cmake/src/support/CMakeLists.txt @@ -20,9 +20,9 @@ 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}) @@ -30,8 +30,6 @@ 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)