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)
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)
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)
+
+
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}
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)
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)
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)
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)
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)
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)
${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)
"-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