From 3f379915a6a5dcc5a59bdddb2bdd825c5fea1d6d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20K=C3=BCmmel?= Date: Sat, 30 Jan 2010 11:34:28 +0000 Subject: [PATCH] CMake: fix merged build, seems GCC could not handle the namespaces correctly git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33272 a592a061-630c-0410-9148-cb99ea01b6c8 --- development/cmake/CMakeLists.txt | 4 +++ development/cmake/config.h.cmake | 35 ++++++++++++++++++++ development/cmake/src/client/CMakeLists.txt | 2 +- development/cmake/src/support/CMakeLists.txt | 7 ++-- src/frontends/qt4/GuiHyperlink.cpp | 12 +++++++ src/frontends/qt4/GuiListings.cpp | 12 +++---- src/frontends/qt4/GuiView.cpp | 3 +- src/support/strfwd.h | 1 + 8 files changed, 66 insertions(+), 10 deletions(-) diff --git a/development/cmake/CMakeLists.txt b/development/cmake/CMakeLists.txt index 65009f0d96..b18e0928b7 100644 --- a/development/cmake/CMakeLists.txt +++ b/development/cmake/CMakeLists.txt @@ -1,3 +1,4 @@ + # This file is part of LyX, the document processor. # Licence details can be found in the file COPYING. # @@ -19,12 +20,14 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) # is checked set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules") set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) +set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) option(lyxinstall "Build install projects/rules" ON) + # Supress regeneration set(CMAKE_SUPPRESS_REGENERATION TRUE) @@ -119,6 +122,7 @@ if(merge OR merge_rebuild) message(STATUS "") message(STATUS "All *.cpp files of a project are merged into two files, disable with -Dmerge=0") message(STATUS "") + add_definitions(-DLYX_MERGED_BUILD) else() set(merge 0 CACHE TYPE STRING FORCE) set(MERGE_FILES 0 CACHE TYPE STRING FORCE) diff --git a/development/cmake/config.h.cmake b/development/cmake/config.h.cmake index ab3e539ef3..3022bef10e 100644 --- a/development/cmake/config.h.cmake +++ b/development/cmake/config.h.cmake @@ -42,3 +42,38 @@ #cmakedefine PATH_MAX ${PATH_MAX} #endif + + +// cleanup global namespace +#ifdef ColorMode +#undef ColorMode +#endif + +#ifdef FocusOut +#undef FocusOut +#endif + +#ifdef FocusIn +#undef FocusIn +#endif + +#ifdef KeyRelease +#undef KeyRelease +#endif + +#ifdef CursorShape +#undef CursorShape +#endif + +#ifdef IGNORE +#undef IGNORE +#endif + +#ifdef GrayScale +#undef GrayScale +#endif + +#ifdef Status +#undef Status +#endif + diff --git a/development/cmake/src/client/CMakeLists.txt b/development/cmake/src/client/CMakeLists.txt index 3442a902e3..8df2da675b 100644 --- a/development/cmake/src/client/CMakeLists.txt +++ b/development/cmake/src/client/CMakeLists.txt @@ -21,7 +21,7 @@ target_link_libraries(${_lyxclient} support ${Lyx_Boost_Libraries} ${LIBINTL_LIBRARIES} - ${ICONV_LIBRARY} + ${ICONV_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ) diff --git a/development/cmake/src/support/CMakeLists.txt b/development/cmake/src/support/CMakeLists.txt index 9b40da0c65..6e00386b75 100644 --- a/development/cmake/src/support/CMakeLists.txt +++ b/development/cmake/src/support/CMakeLists.txt @@ -54,13 +54,16 @@ if(NOT MERGE_FILES) 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 + list(REMOVE_ITEM support_sources ${TOP_SRC_DIR}/src/support/socktools.cpp) + set(support_separate ${TOP_SRC_DIR}/src/support/socktools.cpp) lyx_const_touched_files(_allinone support_sources) - set(depends_moc ${support_headers}) + 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} + add_library(support ${library_type} ${_allinone_files} ${support_separate} ${support_mythes_sources} ${support_linkback_sources} ${support_headers} ${dont_merge}) endif() diff --git a/src/frontends/qt4/GuiHyperlink.cpp b/src/frontends/qt4/GuiHyperlink.cpp index 8323b65ff3..60b0fe430e 100644 --- a/src/frontends/qt4/GuiHyperlink.cpp +++ b/src/frontends/qt4/GuiHyperlink.cpp @@ -21,6 +21,18 @@ #include #include +#ifdef LYX_MERGED_BUILD +// GCC couldn't find operator== +namespace lyx { + bool operator==(lyx::docstring & d, char const * c) + { return lyx::operator ==(d, c); } + namespace frontend { + bool operator==(lyx::docstring & d, char const * c) + { return lyx::operator ==(d, c); } + } +} +#endif + namespace lyx { namespace frontend { diff --git a/src/frontends/qt4/GuiListings.cpp b/src/frontends/qt4/GuiListings.cpp index 9bb8f05dba..6591b5550c 100644 --- a/src/frontends/qt4/GuiListings.cpp +++ b/src/frontends/qt4/GuiListings.cpp @@ -44,7 +44,7 @@ namespace frontend { ///////////////////////////////////////////////////////////////////// -char const * languages[] = +char const * languages_supported[] = { "no language", "ABAP", "ACSL", "Ada", "ALGOL", "Assembler", "Awk", "bash", "Basic", "C", "C++", "Caml", "Clean", "Cobol", "Comal 80", "command.com", "Comsol", "csh", "Delphi", "Eiffel", "Elan", "erlang", "Euphoria", "Fortran", "Gnuplot", "Haskell", "HTML", "IDL", "inform", @@ -213,7 +213,7 @@ GuiListings::GuiListings(GuiView & lv) connect(bypassCB, SIGNAL(clicked()), this, SLOT(setListingsMsg())); - for (int n = 0; languages[n][0]; ++n) + for (int n = 0; languages_supported[n][0]; ++n) languageCO->addItem(qt_(languages_gui[n])); for (int n = 0; font_styles[n][0]; ++n) @@ -251,7 +251,7 @@ void GuiListings::change_adaptor() string GuiListings::construct_params() { - string language = languages[qMax(0, languageCO->currentIndex())]; + string language = languages_supported[qMax(0, languageCO->currentIndex())]; string dialect; string const dialect_gui = fromqstr(dialectCO->currentText()); if (dialectCO->currentIndex() > 0) { @@ -412,7 +412,7 @@ void GuiListings::on_languageCO_currentIndexChanged(int index) // 0 is "no dialect" int default_dialect = 0; dialectCO->addItem(qt_("No dialect")); - string const language = languages[index]; + string const language = languages_supported[index]; for (size_t i = 0; i != nr_dialects; ++i) { if (language == dialects[i].language) { @@ -448,7 +448,7 @@ void GuiListings::updateContents() // set default values listingsTB->setPlainText( qt_("Input listing parameters on the right. Enter ? for a list of parameters.")); - languageCO->setCurrentIndex(findToken(languages, "no language")); + languageCO->setCurrentIndex(findToken(languages_supported, "no language")); dialectCO->setCurrentIndex(0); floatCB->setChecked(false); placementLE->clear(); @@ -489,7 +489,7 @@ void GuiListings::updateContents() } else { language = arg; } - int n = findToken(languages, language); + int n = findToken(languages_supported, language); if (n >= 0) { languageCO->setCurrentIndex(n); in_gui = true; diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index fe0c201b8d..e5556b1bea 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -2722,7 +2722,8 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr) case LFUN_BUFFER_EXPORT: { if (!doc_buffer) break; - if (cmd.argument() == "custom") { + // GCC only sees strfwd.h when building merged + if (::lyx::operator==(cmd.argument(), "custom")) { dispatch(FuncRequest(LFUN_DIALOG_SHOW, "sendto"), dr); break; diff --git a/src/support/strfwd.h b/src/support/strfwd.h index 85dfed168f..fcd97f5685 100644 --- a/src/support/strfwd.h +++ b/src/support/strfwd.h @@ -69,6 +69,7 @@ extern odocstream & operator<<(odocstream &, char); docstring const & empty_docstring(); std::string const & empty_string(); +bool operator==(docstring const &, char const *); } // namespace lyx -- 2.39.2