cmake build system:

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
This commit is contained in:
Peter Kümmel 2007-03-20 22:13:21 +00:00
parent ace2418598
commit 531e4b726d
10 changed files with 95 additions and 16 deletions

View 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)

View 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)

View 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}

View 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)

View 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)

View 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)

View 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)

View 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)

View 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)

View 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