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
This commit is contained in:
Peter Kümmel 2010-01-30 11:34:28 +00:00
parent f6e81bbb95
commit 3f379915a6
8 changed files with 66 additions and 10 deletions

View File

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

View File

@ -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

View File

@ -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_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()

View File

@ -21,6 +21,18 @@
#include <QLineEdit>
#include <QPushButton>
#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 {

View File

@ -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;

View File

@ -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;

View File

@ -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