From: Uwe Stöhr Date: Sat, 14 May 2011 21:35:36 +0000 (+0000) Subject: backport CMake efforts to branch to be able to compile LyX 2.0.x the same way as... X-Git-Tag: 2.0.1~304 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=9eb6b3b8ac0d5f85f2d81e051a42eabdc24e828b;p=features.git backport CMake efforts to branch to be able to compile LyX 2.0.x the same way as trunk git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@38758 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/boost/CMakeLists.txt b/boost/CMakeLists.txt new file mode 100644 index 0000000000..6d7839a713 --- /dev/null +++ b/boost/CMakeLists.txt @@ -0,0 +1,8 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2006-2011 Peter Kümmel, +# + +add_subdirectory(libs) + diff --git a/boost/libs/CMakeLists.txt b/boost/libs/CMakeLists.txt new file mode 100644 index 0000000000..67a68498af --- /dev/null +++ b/boost/libs/CMakeLists.txt @@ -0,0 +1,18 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2010-2011 Peter Kümmel, +# + +project(boost) + + +if(LYX_USE_TR1_REGEX) + message(STATUS "Using TR1 regex") +else() + add_subdirectory(regex) +endif() + + +add_subdirectory(signals) + diff --git a/boost/libs/regex/CMakeLists.txt b/boost/libs/regex/CMakeLists.txt new file mode 100644 index 0000000000..ffce508a80 --- /dev/null +++ b/boost/libs/regex/CMakeLists.txt @@ -0,0 +1,23 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2006-2011 Peter Kümmel, +# + +project(boost_regex) + +set(boost_regex_sources + cpp_regex_traits.cpp + c_regex_traits.cpp + cregex.cpp + fileiter.cpp + instances.cpp + regex.cpp + regex_raw_buffer.cpp + regex_traits_defaults.cpp + w32_regex_traits.cpp) + +lyx_add_path(boost_regex_sources ${TOP_SRC_DIR}/boost/libs/regex/src) + +add_library(boost_regex STATIC ${boost_regex_sources}) + diff --git a/boost/libs/signals/CMakeLists.txt b/boost/libs/signals/CMakeLists.txt new file mode 100644 index 0000000000..6616401edb --- /dev/null +++ b/boost/libs/signals/CMakeLists.txt @@ -0,0 +1,25 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2006-2011 Peter Kümmel, +# + +project(boost_signals) + +set(boost_signals_sources + connection.cpp + named_slot_map.cpp + signal_base.cpp + slot.cpp + trackable.cpp +) + +lyx_add_path(boost_signals_sources ${TOP_SRC_DIR}/boost/libs/signals/src) + +if(NOT LYX_MERGE_FILES) + add_library(boost_signals STATIC ${boost_signals_sources}) +else() + lyx_const_touched_files(_allinone boost_signals_sources) + add_library(boost_signals STATIC ${_allinone_files}) +endif() + diff --git a/development/cmake/PyCompile.cmake b/development/cmake/PyCompile.cmake index 0a77c22ff9..899c857a0c 100644 --- a/development/cmake/PyCompile.cmake +++ b/development/cmake/PyCompile.cmake @@ -36,8 +36,8 @@ foreach(_orig_py ${_py_files}) COMMAND ${py_compile} ${_copied_py} DEPENDS ${_copied_py} ) - SET_SOURCE_FILES_PROPERTIES(${_copied_py} ${_created_py_} GENERATED) - install(FILES ${_compiled_py_} DESTINATION ${_project}) + SET_SOURCE_FILES_PROPERTIES(${_copied_py} GENERATED) + install(PROGRAMS ${_compiled_py_} ${_copied_py} DESTINATION ${_project}) LIST(APPEND _generated ${_compiled_py_}) endforeach(_orig_py) diff --git a/development/cmake/config.h.cmake b/development/cmake/config.h.cmake index e5db2e7303..7ec087ed26 100644 --- a/development/cmake/config.h.cmake +++ b/development/cmake/config.h.cmake @@ -13,9 +13,9 @@ #define _CONFIG_H // obligatory flags -#define QT_NO_STL -#define QT_NO_KEYWORDS -#define HAVE_ICONV +#define QT_NO_STL 1 +#define QT_NO_KEYWORDS 1 +#define HAVE_ICONV 1 #include "configCompiler.h" @@ -75,7 +75,42 @@ #cmakedefine LYX_NLS 1 #ifdef LYX_NLS -#define ENABLE_NLS +#define ENABLE_NLS 1 +// These are needed when building included gettext (taken from autoconf macro) +#cmakedefine LYX_EXTERNAL_LIBINTL 1 +#if !defined(LYX_EXTERNAL_LIBINTL) +// this only makes sense when LYX_EXTERNAL_LIBINTL is OFF. +#define __libc_lock_t gl_lock_t +#define __libc_lock_define gl_lock_define +#define __libc_lock_define_initialized gl_lock_define_initialized +#define __libc_lock_init gl_lock_init +#define __libc_lock_lock gl_lock_lock +#define __libc_lock_unlock gl_lock_unlock +#define __libc_lock_recursive_t gl_recursive_lock_t +#define __libc_lock_define_recursive gl_recursive_lock_define +#define __libc_lock_define_initialized_recursive gl_recursive_lock_define_initialized +#define __libc_lock_init_recursive gl_recursive_lock_init +#define __libc_lock_lock_recursive gl_recursive_lock_lock +#define __libc_lock_unlock_recursive gl_recursive_lock_unlock +#define glthread_in_use libintl_thread_in_use +#define glthread_lock_init libintl_lock_init +#define glthread_lock_lock libintl_lock_lock +#define glthread_lock_unlock libintl_lock_unlock +#define glthread_lock_destroy libintl_lock_destroy +#define glthread_rwlock_init libintl_rwlock_init +#define glthread_rwlock_rdlock libintl_rwlock_rdlock +#define glthread_rwlock_wrlock libintl_rwlock_wrlock +#define glthread_rwlock_unlock libintl_rwlock_unlock +#define glthread_rwlock_destroy libintl_rwlock_destroy +#define glthread_recursive_lock_init libintl_recursive_lock_init +#define glthread_recursive_lock_lock libintl_recursive_lock_lock +#define glthread_recursive_lock_unlock libintl_recursive_lock_unlock +#define glthread_recursive_lock_destroy libintl_recursive_lock_destroy +#define glthread_once libintl_once +#define glthread_once_call libintl_once_call +#define glthread_once_singlethreaded libintl_once_singlethreaded +#define hash_string libintl_hash_string +#endif /* LYX_EXTERNAL_LIBINTL */ #endif diff --git a/development/cmake/configCompiler.h.msvc b/development/cmake/configCompiler.h.msvc index 4715557ad4..d4007daf7e 100644 --- a/development/cmake/configCompiler.h.msvc +++ b/development/cmake/configCompiler.h.msvc @@ -43,6 +43,7 @@ #define HAVE__PCLOSE 1 #define HAVE_GETPID 1 #define HAVE__GETPID 1 +#define HAVE_GETTEXT 1 /* TODO this is set manually */ #define HAVE_MKDIR 1 #define HAVE__MKDIR 1 /* #undef HAVE_SETENV 1 */ diff --git a/lib/lyx2lyx/CMakeLists.txt b/lib/lyx2lyx/CMakeLists.txt new file mode 100644 index 0000000000..ed30a54d31 --- /dev/null +++ b/lib/lyx2lyx/CMakeLists.txt @@ -0,0 +1,17 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2008-2011 Peter Kümmel, +# Copyright (c) 2008-2011 Kornel Benko, +# + +configure_file(${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx_version.py.in + ${CMAKE_CURRENT_BINARY_DIR}/lyx2lyx_version.py) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/lyx2lyx_version.py DESTINATION ${LYX_DATA_SUBDIR}lyx2lyx) + +if (UNIX) + set(_project "lyx2lyx") + include(../PyCompile) +endif() + +install(PROGRAMS ${TOP_SRC_DIR}/lib/lyx2lyx/lyx2lyx DESTINATION ${LYX_DATA_SUBDIR}lyx2lyx) diff --git a/lib/scripts/CMakeLists.txt b/lib/scripts/CMakeLists.txt new file mode 100644 index 0000000000..2274dc0506 --- /dev/null +++ b/lib/scripts/CMakeLists.txt @@ -0,0 +1,12 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2008-2011 Peter Kümmel, +# Copyright (c) 2008-2011 Kornel Benko, +# + +if (UNIX) + set(_project "scripts") + include(../PyCompile) +endif() + diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt new file mode 100644 index 0000000000..37e23e2abb --- /dev/null +++ b/po/CMakeLists.txt @@ -0,0 +1,162 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2008-2011 Peter Kümmel, +# Copyright (c) 2008-2011 Kornel Benko, +# + +project(po) + +include_directories(${TOP_SRC_DIR}/po) + +SET(_lyxname ${PACKAGE}) +SET(_py_sources) +macro(add_gettext_python _par _dir) + set(_sources) + foreach(_arg ${ARGN}) + file(GLOB _s1 ${TOP_SRC_DIR}/${_dir}/${_arg}) + list(SORT _s1) + list(APPEND _sources ${_s1}) + endforeach(_arg) + if (${_par} MATCHES "layouttranslations") + SET(_dst "${CMAKE_CURRENT_BINARY_DIR}/${_par}") + else () + SET(_dst "${CMAKE_CURRENT_BINARY_DIR}/${_par}_l10n.pot") + endif() + SET(_tmp_src_files "${CMAKE_CURRENT_BINARY_DIR}/${_par}_tmp_files") + SET(_src_files "${CMAKE_CURRENT_BINARY_DIR}/${_par}_files") + file(WRITE ${_tmp_src_files} "") + foreach(_s ${_sources}) + FILE(APPEND ${_tmp_src_files} "${_s}\n") + endforeach() + if(${_par} MATCHES "^\(.*\)_[0-9]+$") + set(_par1 ${CMAKE_MATCH_1}) + else() + set(_par1 ${_par}) + endif() + ADD_CUSTOM_COMMAND( + OUTPUT ${_src_files} + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_tmp_src_files} ${_src_files} + DEPENDS ${_tmp_src_files} + ) + if (${_par} MATCHES "layouttranslations") + ADD_CUSTOM_COMMAND( + OUTPUT "${_dst}" + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${TOP_SRC_DIR}/lib/layouttranslations" "${_dst}" + COMMAND ${LYX_PYTHON_EXECUTABLE} + ARGS "${TOP_SRC_DIR}/po/lyx_pot.py" -b "${TOP_SRC_DIR}" -o "${_dst}" -t ${_par1} "--src_file=${_src_files}" + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${_dst}" "${TOP_SRC_DIR}/lib/layouttranslations" + DEPENDS ${_sources} ${_src_files} "${TOP_SRC_DIR}/lib/layouttranslations" + COMMENT "${LYX_PYTHON_EXECUTABLE} ${TOP_SRC_DIR}/po/lyx_pot.py -b ${TOP_SRC_DIR} -o ${_dst} -t ${_par1} --src_file=${_src_files}" + ) + ADD_CUSTOM_TARGET(layouttranslations1 DEPENDS "${_dst}") + if (LYX_DATA_SUBDIR STREQUAL "") + install(FILES "${TOP_SRC_DIR}/lib/layouttranslations" DESTINATION .) + else() + install(FILES "${TOP_SRC_DIR}/lib/layouttranslations" DESTINATION ${LYX_DATA_SUBDIR}) + endif() + else() + ADD_CUSTOM_COMMAND( + OUTPUT "${_dst}" + PRE_BUILD + COMMAND ${LYX_PYTHON_EXECUTABLE} + ARGS "${TOP_SRC_DIR}/po/lyx_pot.py" -b "${TOP_SRC_DIR}" -o "${_dst}" -t ${_par1} "--src_file=${_src_files}" + DEPENDS ${_sources} ${_src_files} + COMMENT "${LYX_PYTHON_EXECUTABLE} ${TOP_SRC_DIR}/po/lyx_pot.py -b ${TOP_SRC_DIR} -o ${_dst} -t ${_par1} --src_file=${_src_files}" + ) + LIST(APPEND _py_sources "${_dst}") + endif() + SET_SOURCE_FILES_PROPERTIES("${_dst}" GENERATED) + SET_SOURCE_FILES_PROPERTIES("${_src_files}" GENERATED) +endmacro(add_gettext_python) + +SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot" GENERATED) +SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" GENERATED) +SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot" GENERATED) + +add_gettext_python(qt4 src/frontends/qt4/ui *.ui) +add_gettext_python(layouts lib/layouts *.layout *.inc *.module) +add_gettext_python(languages lib languages) +add_gettext_python(encodings lib encodings) +add_gettext_python(ui lib/ui *.ui *.inc) +add_gettext_python(external lib external_templates) +add_gettext_python(formats lib configure.py) +add_gettext_python(layouttranslations lib/layouts *.layout *.inc *.module) + +ADD_CUSTOM_COMMAND( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot" + COMMAND ${LYX_PYTHON_EXECUTABLE} + ARGS "${TOP_SRC_DIR}/development/cmake/po/cat.py" ${_py_sources} > "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot" + DEPENDS ${_py_sources} + ) + +ADD_CUSTOM_COMMAND( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" + COMMAND ${GETTEXT_MSGUNIQ_EXECUTABLE} + ARGS -o "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.cat.pot" + ) + +SET(_potfiles_dep) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in "") +file(GLOB_RECURSE _tmp_potfiles RELATIVE ${TOP_SRC_DIR}/ ${TOP_SRC_DIR}/src/*.h ${TOP_SRC_DIR}/src/*.cpp ${TOP_SRC_DIR}/src/*.cpp.in) +list(SORT _tmp_potfiles) +list(REMOVE_ITEM _tmp_potfiles src/support/Package.cpp) + +foreach(_f ${_tmp_potfiles}) + # we don't need to select only relevant files because the outcome of xgettext + # will stay the same. + # Relevant files are files containing the string '_(".*")' + LIST(APPEND _potfiles_dep "${TOP_SRC_DIR}/${_f}") + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in "${_f}\n") +endforeach(_f) + +ADD_CUSTOM_COMMAND( + OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot" + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot" + COMMAND ${GETTEXT_XGETTEXT_EXECUTABLE} + ARGS --default-domain=${_lyxname} --directory=${TOP_SRC_DIR} --add-comments=TRANSLATORS: --language=C++ --join-existing --keyword=_ --keyword=N_ --keyword=B_ --keyword=qt_ --files-from="${CMAKE_CURRENT_BINARY_DIR}/POTFILES.in" --copyright-holder="LyX Developers" --msgid-bugs-address=lyx-devel@lists.lyx.org -o "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot" + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.fmt.pot" ${_potfiles_dep} + ) + +# +# We have to copy the po-files first, +# otherwise they would be modified (inside the macro GETTEXT_CREATE_TRANSLATIONS()) +# This makes the "svn up" on po-files work again +file(GLOB LYX_BASE_PO_FILES RELATIVE ${TOP_SRC_DIR}/po ${TOP_SRC_DIR}/po/*.po) +set(LYX_PO_FILES) +SET(LYX_UPDATED_PO_FILES) +SET(LYX_DEST_PO ${TOP_SRC_DIR}/po) + +foreach(_pofile ${LYX_BASE_PO_FILES}) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_pofile} + COMMAND ${CMAKE_COMMAND} -E copy ${TOP_SRC_DIR}/po/${_pofile} ${CMAKE_CURRENT_BINARY_DIR}/${_pofile} + DEPENDS ${TOP_SRC_DIR}/po/${_pofile} + ) + list(APPEND LYX_PO_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}) +endforeach(_pofile) + +foreach(_pofile ${LYX_BASE_PO_FILES}) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}.copied + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${_pofile} ${LYX_DEST_PO}/${_pofile} + COMMAND ${CMAKE_COMMAND} -E touch ${_pofile}.copied + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_pofile} + ) + list(APPEND LYX_UPDATED_PO_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_pofile}.copied) +endforeach(_pofile) + +if(LYX_CPACK OR LYX_INSTALL) + set(_addALLOption ALL) +endif() +GETTEXT_CREATE_TRANSLATIONS(${CMAKE_CURRENT_BINARY_DIR}/${_lyxname}.pot ${_addALLOption} ${LYX_PO_FILES}) + +# ALL omitted here, to prevent from automatic creation +ADD_CUSTOM_TARGET(update_po_files DEPENDS ${LYX_UPDATED_PO_FILES}) +add_dependencies(update_po_files translations) + +# ADD_POFILES("lyx") + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000000..5a6615637f --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,154 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2006-2011 Peter Kümmel, +# + +set(_lyx ${PACKAGE_BASE}${PROGRAM_SUFFIX}) +project(${_lyx}) + +include_directories(${TOP_SRC_DIR}/src) + +add_subdirectory(frontends) +add_subdirectory(graphics) +add_subdirectory(insets) +add_subdirectory(mathed) +add_subdirectory(support) +add_subdirectory(tex2lyx) +if (UNIX) + add_subdirectory(client) +endif() + +file(GLOB lyx_sources ${TOP_SRC_DIR}/src/${LYX_CPP_FILES}) +file(GLOB moc_files ${TOP_SRC_DIR}/src/${LYX_MOC_FILES}) +list(REMOVE_ITEM lyx_sources ${moc_files} .) +file(GLOB lyx_headers ${TOP_SRC_DIR}/src/${LYX_HPP_FILES}) + +list(REMOVE_ITEM lyx_sources + ${TOP_SRC_DIR}/src/Variables.cpp + ${TOP_SRC_DIR}/src/Section.cpp + ${TOP_SRC_DIR}/src/lyxcore.cpp + ${TOP_SRC_DIR}/src/lyxinsets.cpp + ${TOP_SRC_DIR}/src/lyxmathed.cpp) + +list(REMOVE_ITEM lyx_headers + ${TOP_SRC_DIR}/src/Variables.h + ${TOP_SRC_DIR}/src/Section.h) + +if(NOT APPLE) + list(REMOVE_ITEM lyx_sources ${TOP_SRC_DIR}/src/AppleSpellChecker.cpp) + list(REMOVE_ITEM lyx_headers ${TOP_SRC_DIR}/src/AppleSpellChecker.h) +endif() + +if(NOT ASPELL_FOUND) + list(REMOVE_ITEM lyx_sources ${TOP_SRC_DIR}/src/AspellChecker.cpp) + list(REMOVE_ITEM lyx_headers ${TOP_SRC_DIR}/src/AspellChecker.h) +else() + set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/AspellChecker.cpp) +endif() + +if(NOT ENCHANT_FOUND) + list(REMOVE_ITEM lyx_sources ${TOP_SRC_DIR}/src/EnchantChecker.cpp) + list(REMOVE_ITEM lyx_headers ${TOP_SRC_DIR}/src/EnchantChecker.h) +else() + set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/EnchantChecker.cpp) +endif() + +if(NOT HUNSPELL_FOUND) + list(REMOVE_ITEM lyx_sources ${TOP_SRC_DIR}/src/HunspellChecker.cpp) + list(REMOVE_ITEM lyx_headers ${TOP_SRC_DIR}/src/HunspellChecker.h) +else() + set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/HunspellChecker.cpp) +endif() + + +lyx_automoc(${TOP_SRC_DIR}/src/Compare.cpp) +if(WIN32) + lyx_automoc(${TOP_SRC_DIR}/src/Server.cpp) +endif() + +include_directories(${CMAKE_CURRENT_BINARY_DIR} + ${ZLIB_INCLUDE_DIR} ${QT_INCLUDES}) + +lyx_add_msvc_pch(lyx) + +if (LYX_DEVEL_VERSION) + add_definitions(-DDEVEL_VERSION) +endif() + + +if (LYX_MERGE_FILES) + if(dont_merge) + list(REMOVE_ITEM lyx_sources ${dont_merge}) + endif() + lyx_const_touched_files(_allinone lyx_sources) + set(lyx_sources ${_allinone_files} ${dont_merge}) +endif() + +if (LYX_VLD) + configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/vld.ini COPYONLY) + configure_file(${vld_path}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt COPYONLY) + set(vld_files ${CMAKE_CURRENT_BINARY_DIR}/vld.ini ${CMAKE_CURRENT_BINARY_DIR}/memory_leak_report.txt) +endif() + +if(WIN32) + set(FILE_RC ${TOP_SRC_DIR}/development/cmake/lyx.rc) + message(STATUS "Using icon defined in resource file: ${FILE_RC}") +endif() + +lyx_find_info_files(LyXInfoFiles ${TOP_SRC_DIR}/*) +lyx_find_info_files(LyXCMakeFiles ${TOP_SRC_DIR}/development/cmake/*.txt) +lyx_find_info_files(LyXCMakeFiles ${TOP_SRC_DIR}/development/cmake/*.cmake) +lyx_find_info_files(LyXCMakeFiles ${TOP_SRC_DIR}/development/cmake/*.h) +lyx_find_info_files(LyXCMakeFiles ${TOP_SRC_DIR}/development/cmake/*.msvc) +lyx_find_info_files(LyXCMakeFiles ${TOP_SRC_DIR}/development/cmake/modules/*) +lyx_find_info_files(LyXUiFiles ${TOP_SRC_DIR}/lib/ui/*) + +add_executable(${_lyx} + ${WIN32_CONSOLE} + ${lyx_sources} + ${lyx_headers} + ${vld_files} + ${FILE_RC} + ${lyx_info_files} + ${lyx_cmake_files} +) + +lyx_add_gcc_pch(${_lyx}) + +target_link_libraries(${_lyx} + mathed + insets + frontends + frontend_qt4 + graphics + support + ${LIBINTL_LIBRARIES} + ${ICONV_LIBRARY} + ${QT_QTMAIN_LIBRARY} + ${vld_dll}) + + +if(HUNSPELL_FOUND) + target_link_libraries(${_lyx} ${HUNSPELL_LIBRARY}) +endif() +if(ASPELL_FOUND) + target_link_libraries(${_lyx} ${ASPELL_LIBRARY}) +endif() +if(ENCHANT_FOUND) + target_link_libraries(${_lyx} ${ENCHANT_LIBRARY}) +endif() + +if(APPLE) + target_link_libraries(${_lyx} "-bind_at_load") + target_link_libraries(${_lyx} "-framework Carbon") +endif() + +if(MINGW) + target_link_libraries(${_lyx} ole32) +endif() + +project_source_group("${GROUP_CODE}" lyx_sources lyx_headers) + +install(TARGETS ${_lyx} DESTINATION bin) + diff --git a/src/frontends/CMakeLists.txt b/src/frontends/CMakeLists.txt new file mode 100644 index 0000000000..171e0a26f9 --- /dev/null +++ b/src/frontends/CMakeLists.txt @@ -0,0 +1,27 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2006-2011 Peter Kümmel, +# + +project(frontends) + +include_directories(${TOP_SRC_DIR}/src/frontends) + +add_subdirectory(qt4) + +file(GLOB frontends_sources ${TOP_SRC_DIR}/src/frontends/${LYX_CPP_FILES}) +file(GLOB frontends_headers ${TOP_SRC_DIR}/src/frontends/${LYX_HPP_FILES}) + + +if(NOT LYX_MERGE_FILES) + add_library(frontends ${library_type} ${frontends_sources} ${frontends_headers}) +else() + lyx_const_touched_files(_allinone frontends_sources) + add_library(frontends ${library_type} ${_allinone_files}) +endif() + +target_link_libraries(frontends ${Lyx_Boost_Libraries}) + +project_source_group("${GROUP_CODE}" frontends_sources frontends_headers) + diff --git a/src/frontends/qt4/CMakeLists.txt b/src/frontends/qt4/CMakeLists.txt new file mode 100644 index 0000000000..8d05dcf516 --- /dev/null +++ b/src/frontends/qt4/CMakeLists.txt @@ -0,0 +1,70 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2006-2011 Peter Kümmel, +# + +project(frontend_qt4) + +file(GLOB frontends_qt4_sources ${TOP_SRC_DIR}/src/frontends/qt4/${LYX_CPP_FILES}) +file(GLOB moc_files ${TOP_SRC_DIR}/src/frontends/qt4/${LYX_MOC_FILES}) + +list(REMOVE_ITEM frontends_qt4_sources ${moc_files} .) +list(REMOVE_ITEM frontends_qt4_sources ${TOP_SRC_DIR}/src/frontends/qt4/liblyxqt4.cpp) +list(REMOVE_ITEM frontends_qt4_sources ${TOP_SRC_DIR}/src/frontends/qt4/Resources.cpp) + +file(GLOB frontends_qt4_headers ${TOP_SRC_DIR}/src/frontends/qt4/${LYX_HPP_FILES}) +file(GLOB frontend_qt4_UI ${TOP_SRC_DIR}/src/frontends/qt4/ui/*.ui) + +lyx_add_msvc_pch(frontends_qt4) + +lyx_automoc(${frontends_qt4_sources}) + +lyx_add_ui_files(frontends_qt4_sources ui_files ${frontend_qt4_UI}) + +file(GLOB_RECURSE frontend_qt4_images_png ${TOP_SRC_DIR}/lib/images/*.png) +file(GLOB_RECURSE frontend_qt4_images_gif ${TOP_SRC_DIR}/lib/images/*.gif) +set(resource_name ${CMAKE_CURRENT_BINARY_DIR}/Resources.qrc) +set(frontend_qt4_images ${frontend_qt4_images_png} ${frontend_qt4_images_gif}) +lyx_qt_resources_file(${resource_name} "${TOP_SRC_DIR}/lib/" frontend_qt4_images) +qt4_add_resources(resource_files ${resource_name}) + + +add_definitions(-DQT_GENUINE_STR -DLYX_BUILD_QT4_FRONTEND) + +include_directories( + ${TOP_SRC_DIR}/src/frontends/qt4 + ${QT_INCLUDES} + ${CMAKE_CURRENT_BINARY_DIR}) + +if (LYX_DEVEL_VERSION) + add_definitions(-DDEVEL_VERSION) +endif() + +if(LYX_MERGE_FILES) + lyx_const_touched_files(_allinone frontends_qt4_sources) + set(depends_moc_uic ${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 ${library_type} + ${_allinone_files} ${frontends_qt4_headers} ${ui_files} ${resource_files}) +else() + add_library(frontend_qt4 ${library_type} ${frontends_qt4_sources} ${frontends_qt4_headers} ${ui_files} ${resource_files}) +endif() + + +target_link_libraries(frontend_qt4 + frontends + ${QT_QTCORE_LIBRARY} + ${QT_QTGUI_LIBRARY}) + +lyx_add_gcc_pch(frontend_qt4) + +if(WIN32) + target_link_libraries(frontend_qt4 Gdi32) +endif() + +project_source_group("${GROUP_CODE}" frontends_qt4_sources frontends_qt4_headers) + +source_group("Uic files" FILES ${frontend_qt4_UI}) + diff --git a/src/graphics/CMakeLists.txt b/src/graphics/CMakeLists.txt new file mode 100644 index 0000000000..56daf64b08 --- /dev/null +++ b/src/graphics/CMakeLists.txt @@ -0,0 +1,27 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2006-2011 Peter Kümmel, +# + +project(graphics) + +file(GLOB graphics_sources ${TOP_SRC_DIR}/src/graphics/${LYX_CPP_FILES}) +file(GLOB graphics_headers ${TOP_SRC_DIR}/src/graphics/${LYX_HPP_FILES}) + +lyx_add_msvc_pch(graphics) + + +include_directories(${TOP_SRC_DIR}/src/graphics) + +if(NOT LYX_MERGE_FILES) + add_library(graphics ${library_type} ${graphics_sources} ${graphics_headers}) +else() + lyx_const_touched_files(_allinone graphics_sources) + add_library(graphics ${library_type} ${_allinone_files}) +endif() + +lyx_add_gcc_pch(graphics) + +project_source_group("${GROUP_CODE}" graphics_sources graphics_headers) + diff --git a/src/insets/CMakeLists.txt b/src/insets/CMakeLists.txt new file mode 100644 index 0000000000..a16ce3f496 --- /dev/null +++ b/src/insets/CMakeLists.txt @@ -0,0 +1,29 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2006-2011 Peter Kümmel, +# + +project(insets) + +file(GLOB insets_sources ${TOP_SRC_DIR}/src/insets/${LYX_CPP_FILES}) +file(GLOB insets_headers ${TOP_SRC_DIR}/src/insets/${LYX_HPP_FILES}) + +list(REMOVE_ITEM insets_sources ${TOP_SRC_DIR}/src/insets/InsetTheorem.cpp) + +lyx_add_msvc_pch(insets) + +include_directories(${TOP_SRC_DIR}/src/insets ${QT_INCLUDES}) + + +if(NOT LYX_MERGE_FILES) + add_library(insets ${library_type} ${insets_sources} ${insets_headers}) +else() + lyx_const_touched_files(_allinone insets_sources) + add_library(insets ${library_type} ${_allinone_files}) +endif() + +lyx_add_gcc_pch(insets) + +project_source_group("${GROUP_CODE}" insets_sources insets_headers) + diff --git a/src/mathed/CMakeLists.txt b/src/mathed/CMakeLists.txt new file mode 100644 index 0000000000..55dd303795 --- /dev/null +++ b/src/mathed/CMakeLists.txt @@ -0,0 +1,30 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2006-2011, Peter Kümmel, +# + +project(mathed) + +file(GLOB mathed_sources ${TOP_SRC_DIR}/src/mathed/${LYX_CPP_FILES}) +file(GLOB mathed_headers ${TOP_SRC_DIR}/src/mathed/${LYX_HPP_FILES}) + +list(REMOVE_ITEM mathed_sources + ${TOP_SRC_DIR}/src/mathed/InsetMathXYArrow.cpp + ${TOP_SRC_DIR}/src/mathed/InsetFormulaMacro.cpp) + +lyx_add_msvc_pch(mathed) + +include_directories(${TOP_SRC_DIR}/src/mathed) + +if(NOT LYX_MERGE_FILES) + add_library(mathed ${library_type} ${mathed_sources} ${mathed_headers}) +else() + lyx_const_touched_files(_allinone mathed_sources) + add_library(mathed ${library_type} ${_allinone_files}) +endif() + +lyx_add_gcc_pch(mathed) + +project_source_group("${GROUP_CODE}" mathed_sources mathed_headers) + diff --git a/src/support/CMakeLists.txt b/src/support/CMakeLists.txt new file mode 100644 index 0000000000..cc48091732 --- /dev/null +++ b/src/support/CMakeLists.txt @@ -0,0 +1,86 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2006-2011 Peter Kümmel, +# + +project(support) + +file(GLOB support_sources ${TOP_SRC_DIR}/src/support/${LYX_CPP_FILES}) +file(GLOB moc_files ${TOP_SRC_DIR}/src/support/${LYX_MOC_FILES}) +list(REMOVE_ITEM support_sources ${moc_files} .) +if(APPLE) + list(APPEND dont_merge ${TOP_SRC_DIR}/src/support/AppleSpeller.m) +endif() + +file(GLOB support_headers ${TOP_SRC_DIR}/src/support/${LYX_HPP_FILES}) + +file(GLOB support_mythes_sources ${TOP_SRC_DIR}/src/support/mythes/*.cxx) +file(GLOB support_mythes_headers ${TOP_SRC_DIR}/src/support/mythes/*.hxx) + +file(GLOB support_linkback_sources ${TOP_SRC_DIR}/src/support/linkback/*.m*) +file(GLOB support_linkback_headers ${TOP_SRC_DIR}/src/support/linkback/*.h) + +list(REMOVE_ITEM support_sources + ${TOP_SRC_DIR}/src/support/os_win32.cpp + ${TOP_SRC_DIR}/src/support/os_unix.cpp + ${TOP_SRC_DIR}/src/support/os_cygwin.cpp + ${TOP_SRC_DIR}/src/support/os_os2.C + ${TOP_SRC_DIR}/src/support/atexit.c + ${TOP_SRC_DIR}/src/support/strerror.c + ${TOP_SRC_DIR}/src/support/gettext.cpp) + +if(APPLE) + message(STATUS "Mac LinkBack support") +else() + set(support_linkback_sources "") + set(support_linkback_headers "") +endif() + +# needed to compile tex2lyx in merged mode +set(dont_merge ${dont_merge} ${TOP_SRC_DIR}/src/support/gettext.cpp) + +lyx_add_msvc_pch(support) + +lyx_automoc(${support_sources}) + +include_directories( + ${TOP_SRC_DIR}/src/support + ${TOP_BINARY_DIR}/src/support + ${TOP_SRC_DIR}/src/support/mythes + ${QT_INCLUDES} + ${ICONV_INCLUDE_DIR} + ${ZLIB_INCLUDE_DIR} + ${LIBINTL_INCLUDE_DIR}) + + +if(NOT LYX_MERGE_FILES) + set(support_sources ${support_sources} ${support_mythes_sources} ${support_linkback_sources}) + set(support_headers ${support_headers} ${support_mythes_headers} ${support_linkback_headers}) + add_library(support ${library_type} ${support_sources} ${support_headers} ${dont_merge}) +else() + # GCC bug: gcc resolves ::bind as boost::bind + set(support_separate ${TOP_SRC_DIR}/src/support/socktools.cpp ${TOP_SRC_DIR}/src/support/Messages.cpp) + list(REMOVE_ITEM support_sources ${support_separate}) + lyx_const_touched_files(_allinone support_sources) + set(depends_moc ${support_headers}) + set_source_files_properties(_allinone_const.C + PROPERTIES OBJECT_DEPENDS "${depends_moc}") + set_source_files_properties(_allinone_touched.C + PROPERTIES OBJECT_DEPENDS "${depends_moc}") + add_library(support ${library_type} ${_allinone_files} ${support_separate} + ${support_mythes_sources} ${support_linkback_sources} ${support_headers} ${dont_merge}) +endif() + +target_link_libraries(support ${Lyx_Boost_Libraries} ${QT_QTCORE_LIBRARY} ${ZLIB_LIBRARY}) + +lyx_add_gcc_pch(support) + +if(APPLE) + target_link_libraries(support "objc" "-framework Appkit" "-framework CoreFoundation") +elseif(WIN32) + target_link_libraries(support shlwapi psapi) +endif() + +project_source_group("${GROUP_CODE}" support_sources support_headers) + diff --git a/src/tex2lyx/CMakeLists.txt b/src/tex2lyx/CMakeLists.txt new file mode 100644 index 0000000000..b01ceabd99 --- /dev/null +++ b/src/tex2lyx/CMakeLists.txt @@ -0,0 +1,61 @@ +# This file is part of LyX, the document processor. +# Licence details can be found in the file COPYING. +# +# Copyright (c) 2006-2011 Peter Kümmel, +# Copyright (c) 2008-2011 Kornel Benko, +# + +set(_tex2lyx tex2lyx${PROGRAM_SUFFIX}) +project(${_tex2lyx}) + +# There is no header file lengthcommon.h +set(LINKED_sources ${TOP_SRC_DIR}/src/lengthcommon.cpp) +set(LINKED_headers) + +foreach(_src insets/InsetLayout Color Counters + Encoding FloatList Floating + Layout LayoutFile LayoutModuleList Lexer ModuleList TextClass + FontInfo Spacing) + list(APPEND LINKED_sources ${TOP_SRC_DIR}/src/${_src}.cpp) + list(APPEND LINKED_headers ${TOP_SRC_DIR}/src/${_src}.h) +endforeach(_src) + +file(GLOB tex2lyx_sources ${TOP_SRC_DIR}/src/tex2lyx/${LYX_CPP_FILES}) + +file(GLOB tex2lyx_headers ${TOP_SRC_DIR}/src/tex2lyx/${LYX_HPP_FILES}) + +include_directories(BEFORE + ${TOP_SRC_DIR}/src/tex2lyx + ${TOP_SRC_DIR}/src/support/minizip + ${ZLIB_INCLUDE_DIR}) + +add_definitions(-DTEX2LYX) + +if(NOT LYX_MERGE_FILES) + add_executable(${_tex2lyx} ${tex2lyx_sources} ${LINKED_sources} ${tex2lyx_headers} ${LINKED_headers}) +else() + lyx_const_touched_files(_allinone tex2lyx_sources) + lyx_const_touched_files(_allinone_linked LINKED_sources) + add_executable(${_tex2lyx} ${_allinone_files} ${_allinone_linked_files}) +endif() + +target_link_libraries(${_tex2lyx} + support + ${Lyx_Boost_Libraries} + ${QT_QTCORE_LIBRARY} + ${LIBINTL_LIBRARIES} + ${ICONV_LIBRARY}) + +if(WIN32) + target_link_libraries(${_tex2lyx} shlwapi ole32 psapi) +endif() + +if(APPLE) + target_link_libraries(${_tex2lyx} "-framework Carbon") +endif() + + +project_source_group("${GROUP_CODE}" tex2lyx_sources tex2lyx_headers) + +install(TARGETS ${_tex2lyx} DESTINATION bin) +