also improve build times when working on some files

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17530 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Peter Kümmel 2007-03-24 11:33:03 +00:00
parent 65870c3168
commit 3a74b10d91
13 changed files with 93 additions and 29 deletions

View File

@ -38,7 +38,7 @@ if(merge OR 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_regex files )")
message(STATUS "will merge all *.C files of a project into two files")
message(STATUS "")
endif(merge OR MERGE_FILES)

View File

@ -19,7 +19,10 @@ if(NOT MERGE_FILES)
add_library(boost_filesystem STATIC ${boost_filesystem_sources})
else(NOT MERGE_FILES)
add_definitions(-D_WIN32_WINNT=0x500)
lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/boost_filesystem_allinone.C boost_filesystem_sources)
add_library(boost_filesystem STATIC ${CMAKE_CURRENT_BINARY_DIR}/boost_filesystem_allinone.C)
lyx_merge_files(allinone boost_filesystem_sources)
add_library(boost_filesystem STATIC
${CMAKE_CURRENT_BINARY_DIR}/allinone.h
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES)

View File

@ -19,8 +19,12 @@ include_directories(${ZLIB_INCLUDE_DIR})
if(NOT MERGE_FILES)
add_library(boost_iostreams STATIC ${boost_iostreams_sources})
else(NOT MERGE_FILES)
lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/boost_iostreams_allinone.C boost_iostreams_sources)
add_library(boost_iostreams STATIC ${CMAKE_CURRENT_BINARY_DIR}/boost_iostreams_allinone.C)
lyx_merge_files(allinone boost_iostreams_sources)
add_library(boost_iostreams STATIC
${CMAKE_CURRENT_BINARY_DIR}/allinone.h
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES)
target_link_libraries(boost_iostreams ${ZLIB_LIBRARY})

View File

@ -19,7 +19,10 @@ lyx_add_path(boost_signals_sources ${TOP_SRC_DIR}/boost/libs/signals/src)
if(NOT MERGE_FILES)
add_library(boost_signals STATIC ${boost_signals_sources})
else(NOT MERGE_FILES)
lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/boost_signals_allinone.C boost_signals_sources)
add_library(boost_signals STATIC ${CMAKE_CURRENT_BINARY_DIR}/boost_signals_allinone.C)
lyx_merge_files(allinone boost_signals_sources)
add_library(boost_signals STATIC
${CMAKE_CURRENT_BINARY_DIR}/allinone.h
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES)

View File

@ -131,9 +131,18 @@ endmacro (LYX_AUTOMOC)
# This is not done for the C sources, they are just gathered in a separate list
# because they are usually not written by KDE and as such not intended to be
# compiled all-in-one.
macro (KDE4_CREATE_FINAL_FILES _filenameCPP _filesExcludedFromFinalFile )
macro (LYX_CREATE_FINAL_FILES _filenameCPP _filesExcludedFromFinalFile )
set(${_filesExcludedFromFinalFile})
file(WRITE ${_filenameCPP} "//autogenerated file\n")
set(_file_macros ${CMAKE_CURRENT_BINARY_DIR}/${_filenameCPP}.h)
set(_file_const ${CMAKE_CURRENT_BINARY_DIR}/${_filenameCPP}_const.C)
set(_file_touched ${CMAKE_CURRENT_BINARY_DIR}/${_filenameCPP}_touched.C)
file(WRITE ${_file_macros} "// undef the macro when working on this file \n\n\n")
file(WRITE ${_file_const} "// const files\n#include \"${_file_macros}\" \n\n\n")
file(WRITE ${_file_touched} "// touched files\n#include \"${_file_macros}\"\n\n\n")
foreach (_current_FILE ${ARGN})
get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
# don't include any generated files in the final-file
@ -149,13 +158,28 @@ macro (KDE4_CREATE_FINAL_FILES _filenameCPP _filesExcludedFromFinalFile )
list(APPEND ${_filesExcludedFromFinalFile} ${_abs_FILE})
else (_isCFile)
file(APPEND ${_filenameCPP} "#include \"${_abs_FILE}\"\n")
GET_FILENAME_COMPONENT(_file_name ${_abs_FILE} NAME_WE)
STRING(REGEX REPLACE "-" "_" _file_name "${_file_name}" )
set(__macro_name ASSUME_CONST_____${_file_name})
file(APPEND ${_file_macros} "#define ${__macro_name}\n")
file(APPEND ${_file_const} "#ifdef ${__macro_name}\n")
file(APPEND ${_file_const} "#include \"${_abs_FILE}\"\n")
file(APPEND ${_file_const} "#endif\n\n")
file(APPEND ${_file_touched} "#ifndef ${__macro_name}\n")
file(APPEND ${_file_touched} "#include \"${_abs_FILE}\"\n")
file(APPEND ${_file_touched} "#endif\n\n")
endif (_isCFile)
endif (_isGenerated)
endforeach (_current_FILE)
endmacro (KDE4_CREATE_FINAL_FILES)
endmacro (LYX_CREATE_FINAL_FILES)
macro(lyx_merge_files _filename _list)
KDE4_CREATE_FINAL_FILES(${_filename} _nix_nothing ${${_list}})
endmacro(lyx_merge_files _list _filename)
LYX_CREATE_FINAL_FILES(${_filename} _nix_nothing ${${_list}})
endmacro(lyx_merge_files _list _filename)

View File

@ -41,8 +41,13 @@ lyx_add_msvc_pch(lyx)
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)
lyx_merge_files(allinone lyx_sources)
set(lyx_sources
${CMAKE_CURRENT_BINARY_DIR}/allinone.h
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C
${CMAKE_CURRENT_BINARY_DIR}/version.C
)
endif(NOT MERGE_FILES)
add_executable(lyx-${qt_postfix}

View File

@ -21,8 +21,11 @@ lyx_add_msvc_pch(frontends)
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)
lyx_merge_files(allinone frontends_sources)
add_library(frontends STATIC
${CMAKE_CURRENT_BINARY_DIR}/allinone.h
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES)
project_source_group("${GROUP_CODE}" frontends_sources frontends_headers)

View File

@ -16,8 +16,11 @@ include_directories(${TOP_SRC_DIR}/src/frontends/controllers)
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)
lyx_merge_files(allinone controllers_sources)
add_library(controllers STATIC
${CMAKE_CURRENT_BINARY_DIR}/allinone.h
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES)
target_link_libraries(controllers boost_regex boost_filesystem)

View File

@ -31,12 +31,18 @@ include_directories(
${TOP_SRC_DIR}/src/frontends/controllers
${CMAKE_CURRENT_BINARY_DIR})
#set(MERGE_FILES 0)
if(MERGE_FILES AND MSVC)
lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/frontends_qt4_allinone.C frontends_qt4_sources)
lyx_merge_files(allinone frontends_qt4_sources)
set(depends_moc_uic ${frontends_qt4_headers} ${ui_files})
SET_SOURCE_FILES_PROPERTIES(frontends_qt4_allinone.C PROPERTIES OBJECT_DEPENDS "${depends_moc_uic}")
add_library(frontend_qt4 STATIC ${CMAKE_CURRENT_BINARY_DIR}/frontends_qt4_allinone.C ${frontends_qt4_headers} ${ui_files})
SET_SOURCE_FILES_PROPERTIES(allinone_const.C PROPERTIES OBJECT_DEPENDS "${depends_moc_uic}")
SET_SOURCE_FILES_PROPERTIES(allinone_touched.C PROPERTIES OBJECT_DEPENDS "${depends_moc_uic}")
add_library(frontend_qt4 STATIC
${CMAKE_CURRENT_BINARY_DIR}/allinone.h
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C
${frontends_qt4_headers}
${ui_files}
)
else(MERGE_FILES AND MSVC)
add_library(frontend_qt4 STATIC ${frontends_qt4_sources} ${frontends_qt4_headers} ${ui_files})
endif(MERGE_FILES AND MSVC)

View File

@ -17,8 +17,11 @@ include_directories(${TOP_SRC_DIR}/src/graphics)
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)
lyx_merge_files(allinone graphics_sources)
add_library(graphics STATIC
${CMAKE_CURRENT_BINARY_DIR}/allinone.h
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES)
project_source_group("${GROUP_CODE}" graphics_sources graphics_headers)

View File

@ -19,8 +19,11 @@ include_directories(${TOP_SRC_DIR}/src/insets)
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)
lyx_merge_files(allinone insets_sources)
add_library(insets STATIC
${CMAKE_CURRENT_BINARY_DIR}/allinone.h
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES)

View File

@ -20,8 +20,11 @@ include_directories(${TOP_SRC_DIR}/src/mathed)
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)
lyx_merge_files(allinone mathed_sources)
add_library(mathed STATIC
${CMAKE_CURRENT_BINARY_DIR}/allinone.h
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES)

View File

@ -35,8 +35,12 @@ else(NOT MERGE_FILES)
list(REMOVE_ITEM support_sources ${TOP_SRC_DIR}/src/support/lstrings.C)
list(APPEND support_sources ${TOP_SRC_DIR}/src/support/lstrings.C)
list(REVERSE support_sources)
lyx_merge_files(${CMAKE_CURRENT_BINARY_DIR}/support_allinone.C support_sources)
add_library(support STATIC ${CMAKE_CURRENT_BINARY_DIR}/support_allinone.C)
lyx_merge_files(allinone support_sources)
add_library(support STATIC
${CMAKE_CURRENT_BINARY_DIR}/allinone.h
${CMAKE_CURRENT_BINARY_DIR}/allinone_const.C
${CMAKE_CURRENT_BINARY_DIR}/allinone_touched.C)
endif(NOT MERGE_FILES)