]> git.lyx.org Git - features.git/commitdiff
cmake build system:
authorPeter Kümmel <syntheticpp@gmx.net>
Tue, 20 Mar 2007 22:13:21 +0000 (22:13 +0000)
committerPeter Kümmel <syntheticpp@gmx.net>
Tue, 20 Mar 2007 22:13:21 +0000 (22:13 +0000)
   Add "merge" option which minimizes the number of files to build.
   only the qt4 and boost files will not merged into one file.
   This really speeds up the compilation.
   Usage:
     cmake ../trunk/development/cmake -Dmerge=1

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17495 a592a061-630c-0410-9148-cb99ea01b6c8

development/cmake/CMakeLists.txt
development/cmake/modules/LyXMacros.cmake
development/cmake/src/CMakeLists.txt
development/cmake/src/frontends/CMakeLists.txt
development/cmake/src/frontends/controllers/CMakeLists.txt
development/cmake/src/graphics/CMakeLists.txt
development/cmake/src/insets/CMakeLists.txt
development/cmake/src/mathed/CMakeLists.txt
development/cmake/src/support/CMakeLists.txt
development/cmake/src/tex2lyx/CMakeLists.txt

index d02e4cfa08e59c75d798cea197af50dcaa4d7845..2101dec28180b4e696f9c5b7b44fc2958e355f7f 100644 (file)
@@ -33,6 +33,15 @@ include(LyXPaths)
 include(LyXMacros)
 include(ProjectSourceGroup)
 
+if(merge OR MERGE_FILES)
+       if(NOT MERGE_FILES)
+               set(MERGE_FILES TRUE CACHE TYPE STRING FORCE)
+       endif(NOT MERGE_FILES)
+       message(STATUS "")
+       message(STATUS "will merge all *.C files of a project into one file (exception: qt4 and boost files)")
+       message(STATUS "")
+endif(merge OR MERGE_FILES)    
+
 if(release)
        set(CMAKE_BUILD_TYPE Release)
        set(release)
@@ -42,6 +51,10 @@ endif(release)
 set(qt_postfix qt4)
 project(lyx-${qt_postfix})
 find_package(Qt4 REQUIRED)
+# maybe anyway
+if(MERGE_FILES)
+       add_definitions(-DQT_CLEAN_NAMESPACE -DQT_NO_STL -DQT_NO_KEYWORDS)
+endif(MERGE_FILES)
 
 find_package(ZLIB REQUIRED)
 find_package(ICONV REQUIRED)
index caf323506fa9479ddc5ebe902b2641a6ad735b4e..dcde46f5f5e03f785e95e60ace8787e2b1198ff3 100644 (file)
@@ -124,3 +124,17 @@ MACRO (LYX_AUTOMOC)
       endif (EXISTS ${_abs_FILE} AND NOT _skip)
    endforeach (_current_FILE)
 endmacro (LYX_AUTOMOC)
+
+
+macro(lyx_merge_files _filename _list)
+       set(_tmp)
+       set(_content)
+       foreach(_current ${${_list}})
+               file(READ ${_current} _tmp)
+               set(_content ${_content} "\n\n\n\n//----------------------------------------\n/*\n file: ${_current} \n*/\n\n")
+               set(_content ${_content} ${_tmp})
+       endforeach(_current)     
+       file(WRITE ${_filename} "${_content}")
+endmacro(lyx_merge_files _list _filename)
+
+
index 90ef06eeaab4985d44184d4e2a4cd228e9ec586d..1edb6bcfb8d0c9c5cd720bce7a4e9dd1b6947ee0 100644 (file)
@@ -37,7 +37,13 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR})
 
 lyx_add_msvc_pch(lyx)
 
-set(lyx_sources ${lyx_sources} ${CMAKE_CURRENT_BINARY_DIR}/version.C)
+
+if(NOT MERGE_FILES)
+       set(lyx_sources ${lyx_sources} ${CMAKE_CURRENT_BINARY_DIR}/version.C)
+else(NOT MERGE_FILES)
+       lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/lyx_allinone.C lyx_sources)
+       set(lyx_sources ${CMAKE_CURRENT_BINARY_DIR}/lyx_allinone.C ${CMAKE_CURRENT_BINARY_DIR}/version.C)
+endif(NOT MERGE_FILES)
 
 add_executable(lyx-${qt_postfix}
        ${WIN32_CONSOLE}
index 52c565a1808d4297893631e7619c8dc7819485b6..e420e8873499d1b93aa3ba2c278e8dee1903f481 100644 (file)
@@ -17,7 +17,13 @@ file(GLOB frontends_headers ${TOP_SRC_DIR}/src/frontends/*.h)
 
 lyx_add_msvc_pch(frontends)
 
-add_library(frontends STATIC ${frontends_sources} ${frontends_headers})
+
+if(NOT MERGE_FILES)
+       add_library(frontends STATIC ${frontends_sources} ${frontends_headers})
+else(NOT MERGE_FILES)
+       lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/frontends_allinone.C frontends_sources)
+       add_library(frontends STATIC ${CMAKE_CURRENT_BINARY_DIR}/frontends_allinone.C)
+endif(NOT MERGE_FILES)
 
 project_source_group("${GROUP_CODE}" frontends_sources frontends_headers)
 
index 28e613c3c5e5f6a864ba4b49e9b860270cc13f31..9738cdc6f8601126da46948debbd17b96e365aa7 100644 (file)
@@ -13,7 +13,12 @@ lyx_add_msvc_pch(controllers)
 
 include_directories(${TOP_SRC_DIR}/src/frontends/controllers)
 
-add_library(controllers STATIC ${controllers_sources} ${controllers_headers})
+if(NOT MERGE_FILES)
+       add_library(controllers STATIC ${controllers_sources} ${controllers_headers})
+else(NOT MERGE_FILES)
+       lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/controllers_allinone.C controllers_sources)
+       add_library(controllers STATIC ${CMAKE_CURRENT_BINARY_DIR}/controllers_allinone.C)
+endif(NOT MERGE_FILES)
 
 target_link_libraries(controllers boost_regex boost_filesystem)
 
index fe24c1e25f47070e10f2c8397cdb21d40f9980d6..8f62e4382ae9d3d7c76310e029fdd0e41549f642 100644 (file)
@@ -11,9 +11,15 @@ file(GLOB graphics_headers ${TOP_SRC_DIR}/src/graphics/*.h)
 
 lyx_add_msvc_pch(graphics)
 
+
 include_directories(${TOP_SRC_DIR}/src/graphics)
 
-add_library(graphics STATIC ${graphics_sources} ${graphics_headers})
+if(NOT MERGE_FILES)
+       add_library(graphics STATIC ${graphics_sources} ${graphics_headers})
+else(NOT MERGE_FILES)
+       lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/graphics_allinone.C graphics_sources)
+       add_library(graphics STATIC ${CMAKE_CURRENT_BINARY_DIR}/graphics_allinone.C)
+endif(NOT MERGE_FILES)
 
 project_source_group("${GROUP_CODE}" graphics_sources graphics_headers)
 
index 733f4dc9863055f57ae90b94d8b6f1a24a043736..25be0c01a4961cc04bc5e275c69133d4701a0f37 100644 (file)
@@ -15,7 +15,14 @@ lyx_add_msvc_pch(insets)
 
 include_directories(${TOP_SRC_DIR}/src/insets)
 
-add_library(insets STATIC ${insets_sources} ${insets_headers})
+
+if(NOT MERGE_FILES)
+       add_library(insets STATIC ${insets_sources} ${insets_headers})
+else(NOT MERGE_FILES)
+       lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/insets_allinone.C insets_sources)
+       add_library(insets STATIC ${CMAKE_CURRENT_BINARY_DIR}/insets_allinone.C)
+endif(NOT MERGE_FILES)
+
 
 project_source_group("${GROUP_CODE}" insets_sources insets_headers)
 
index 7c00bd2e449be57d60f8fba28f82a8177c5d0990..da67eb15d1abeebe3825dab966816744d0023cab 100644 (file)
@@ -17,7 +17,13 @@ lyx_add_msvc_pch(mathed)
 
 include_directories(${TOP_SRC_DIR}/src/mathed)
 
-add_library(mathed STATIC ${mathed_sources} ${mathed_headers})
+if(NOT MERGE_FILES)
+       add_library(mathed STATIC ${mathed_sources} ${mathed_headers})
+else(NOT MERGE_FILES)
+       lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/mathed_allinone.C mathed_sources)
+       add_library(mathed STATIC ${CMAKE_CURRENT_BINARY_DIR}/mathed_allinone.C)
+endif(NOT MERGE_FILES)
+
 
 project_source_group("${GROUP_CODE}" mathed_sources mathed_headers)
 
index c23a30817050482b8867acbb4ce5e803c767f109..c2e7d3f120cfda1fc992384fd239a02910591566 100644 (file)
@@ -26,7 +26,13 @@ lyx_add_msvc_pch(support)
        
 include_directories(${TOP_SRC_DIR}/src/support ${ICONV_INCLUDE_DIR})
 
-add_library(support STATIC ${support_sources} ${support_headers})
+if(NOT MERGE_FILES)
+       add_library(support STATIC ${support_sources} ${support_headers})
+else(NOT MERGE_FILES)
+       lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/support_allinone.C support_sources)
+       add_library(support STATIC ${CMAKE_CURRENT_BINARY_DIR}/support_allinone.C)
+endif(NOT MERGE_FILES)
+
 
 target_link_libraries(support boost_signals)
 
index 1883eb5580e7dcd38d9dd70822bd51f0ba4627c6..e206f44ecf035baad267f4d0abc12e10c1d89665 100644 (file)
@@ -12,34 +12,36 @@ set(LINKED_FILES
        ${TOP_SRC_DIR}/src/FloatList.C
        ${TOP_SRC_DIR}/src/Floating.C
        ${TOP_SRC_DIR}/src/counters.C
-       ${TOP_SRC_DIR}/src/lyxlayout.h
        ${TOP_SRC_DIR}/src/lyxlayout.C
        ${TOP_SRC_DIR}/src/lyxtextclass.C
-       ${TOP_SRC_DIR}/src/lyxtextclass.h
        ${TOP_SRC_DIR}/src/lyxlex.C
        ${TOP_SRC_DIR}/src/lyxlex_pimpl.C
 )
 
 set(tex2lyx_sources
-       ${TOP_SRC_DIR}/src/tex2lyx/Spacing.h
        ${TOP_SRC_DIR}/src/tex2lyx/boost.C
        ${TOP_SRC_DIR}/src/tex2lyx/context.C
-       ${TOP_SRC_DIR}/src/tex2lyx/
-       ${TOP_SRC_DIR}/src/tex2lyx/context.h
        ${TOP_SRC_DIR}/src/tex2lyx/gettext.C
        ${TOP_SRC_DIR}/src/tex2lyx/lengthcommon.C
        ${TOP_SRC_DIR}/src/tex2lyx/lyxfont.C
-       ${TOP_SRC_DIR}/src/tex2lyx/lyxfont.h
        ${TOP_SRC_DIR}/src/tex2lyx/texparser.C
-       ${TOP_SRC_DIR}/src/tex2lyx/texparser.h
        ${TOP_SRC_DIR}/src/tex2lyx/tex2lyx.C
-       ${TOP_SRC_DIR}/src/tex2lyx/tex2lyx.h
        ${TOP_SRC_DIR}/src/tex2lyx/preamble.C
        ${TOP_SRC_DIR}/src/tex2lyx/math.C
        ${TOP_SRC_DIR}/src/tex2lyx/table.C
        ${TOP_SRC_DIR}/src/tex2lyx/text.C
 )
 
+set(tex2lyx_headers
+       ${TOP_SRC_DIR}/src/lyxlayout.h
+       ${TOP_SRC_DIR}/src/lyxtextclass.h
+       ${TOP_SRC_DIR}/src/tex2lyx/Spacing.h
+       ${TOP_SRC_DIR}/src/tex2lyx/context.h
+       ${TOP_SRC_DIR}/src/tex2lyx/lyxfont.h
+       ${TOP_SRC_DIR}/src/tex2lyx/texparser.h
+       ${TOP_SRC_DIR}/src/tex2lyx/tex2lyx.h
+)
+
 include_directories(BEFORE ${TOP_SRC_DIR}/src/tex2lyx)
 
 if(MSVC)
@@ -52,7 +54,15 @@ else(MSVC)
                "-include ${TOP_SRC_DIR}/src/tex2lyx/lyxfont.h -include ${TOP_SRC_DIR}/src/tex2lyx/Spacing.h")
 endif(MSVC)
 
-add_executable(tex2lyx ${tex2lyx_sources} ${LINKED_FILES})
+
+if(NOT MERGE_FILES)
+       add_executable(tex2lyx ${tex2lyx_sources} ${LINKED_FILES} ${tex2lyx_headers})
+else(NOT MERGE_FILES)
+       set(tex2lyx_sources_all ${tex2lyx_sources} ${LINKED_FILES})
+       lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/tex2lyx_allinone.C tex2lyx_sources_all)
+       add_executable(tex2lyx ${CMAKE_CURRENT_BINARY_DIR}/tex2lyx_allinone.C)
+endif(NOT MERGE_FILES)
+
 
 target_link_libraries(tex2lyx  
        support