From 7764757b6af8748cf81b0b5844c7c4f8a59817b2 Mon Sep 17 00:00:00 2001 From: Sylvain Thery Date: Thu, 28 Jul 2011 16:00:25 +0200 Subject: [PATCH] Ajout fichier apps_cmake, a include derriere la definition du CGoGN_ROOT_DIR --- build/apps_cmake.txt | 56 +++++++++++++++++++++++++++++++++++++ include/Utils/cgognStream.h | 7 +++-- src/Utils/cgognStream.cpp | 23 +++++++-------- 3 files changed, 73 insertions(+), 13 deletions(-) create mode 100644 build/apps_cmake.txt diff --git a/build/apps_cmake.txt b/build/apps_cmake.txt new file mode 100644 index 00000000..26adcfda --- /dev/null +++ b/build/apps_cmake.txt @@ -0,0 +1,56 @@ + +# A mettre juste apres la definition de CGoGN_ROOT_DIR a la racine du CGoGN_Apps + +SET(CMAKE_MODULE_PATH " ${CMAKE_MODULE_PATH} ${CGoGN_ROOT_DIR}/cmake_modules/") + +find_package(OpenGL) +FIND_PACKAGE(Qt4 REQUIRED) +#for basile ;) +find_package(GLUT) + +IF (DEFINED ASSERTON) + add_definitions(-DCGOGN_ASSERT_BOOL=${ASSERTON}) +ELSE (DEFINED ASSERTON) + add_definitions(-DCGOGN_ASSERT_BOOL=false) +ENDIF (DEFINED ASSERTON) + +# FOR Qt4 +SET(QT_USE_QTOPENGL TRUE) +INCLUDE(${QT_USE_FILE}) +ADD_DEFINITIONS(${QT_DEFINITIONS}) + +# qq definition specifiques pour mac +IF(APPLE) +# a changer pour chercher la bonne version automatiquement ?? + SET(CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-undefined -Wl,dynamic_lookup") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMAC_OSX") + SET(CMAKE_OSX_ARCHITECTURES x86_64) +ENDIF(APPLE) + +IF(WIN32) + SET(GLEW_LIBRARY glew32) + SET(DEVIL_LIBRARIES DevIL ILU ILUT) + SET(ZLIB_LIBRARIES zlib) + SET(LIBXML2_LIBRARIES xml2) + INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/windows_dependencies/include/) + LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/windows_dependencies/lib/) +ELSE(WIN32) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + find_package(DevIL) + find_package(ZLIB) + find_package(LibXml2) + SET(GLEW_LIBRARY GLEW) + IF (IL_LIBRARIES) + SET(DEVIL_LIBRARIES ${IL_LIBRARIES} ${ILU_LIBRARIES} ${ILUT_LIBRARIES}) + ELSE(IL_LIBRARIES) + SET(DEVIL_LIBRARIES ${IL_LIBRARY} ${ILU_LIBRARY} ${ILUT_LIBRARY}) + ENDIF(IL_LIBRARIES) +ENDIF(WIN32) + +SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin) + +SET(COMMON_LIBS ${GLUT_LIBRARY} ${OPENGL_LIBRARY} ${GLEW_LIBRARY} ${DEVIL_LIBRARIES} ${ZLIB_LIBRARIES} ${LIBXML2_LIBRARIES} gzstream openctm assimp) +SET(CGoGN_LIBS_D topologyD algoD containerD utilsD) +SET(CGoGN_LIBS_R topology algo container utils) +SET(NUMERICAL_LIBS numerical lapack blas f2c) diff --git a/include/Utils/cgognStream.h b/include/Utils/cgognStream.h index cc2f1f28..aef99646 100644 --- a/include/Utils/cgognStream.h +++ b/include/Utils/cgognStream.h @@ -51,6 +51,7 @@ void allToStd(bool yes = true); */ void allToFile(const std::string& filename); +#ifndef NO_QT /** * set all outputs to status bar of Qt interface */ @@ -61,6 +62,8 @@ void allToStatusBar(Utils::QT::SimpleQT* sqt); */ void allToConsole(Utils::QT::SimpleQT* sqt); +#endif + /** * set all outputs to string stream buffer */ @@ -86,13 +89,13 @@ protected: int m_out_mode; std::stringstream m_buffer; - +#ifndef NO_QT Utils::QT::SimpleQT* m_sqt_bar; Utils::QT::SimpleQT* m_sqt_console; QTextEdit* m_qte; - +#endif std::ofstream* m_ofs; std::stringstream* m_oss; diff --git a/src/Utils/cgognStream.cpp b/src/Utils/cgognStream.cpp index 4a0caedb..fb9b92c3 100644 --- a/src/Utils/cgognStream.cpp +++ b/src/Utils/cgognStream.cpp @@ -24,8 +24,9 @@ #include "Utils/cgognStream.h" #include "Utils/qtSimple.h" +#ifndef NO_QT #include - +#endif namespace CGoGN { @@ -54,6 +55,7 @@ void allToFile(const std::string& filename ) } +#ifndef NO_QT void allToStatusBar(Utils::QT::SimpleQT* sqt) { CGoGNout.toStatusBar(sqt); @@ -69,6 +71,7 @@ void allToConsole(Utils::QT::SimpleQT* sqt) CGoGNdbg.toConsole(sqt); } +#endif void allToBuffer(std::stringstream* ss) { @@ -84,9 +87,11 @@ void allToBuffer(std::stringstream* ss) Out::Out(): m_out_mode(STDOUT), +#ifndef NO_QT m_sqt_bar(NULL), m_sqt_console(NULL), m_qte(NULL), +#endif m_ofs(NULL), m_oss(NULL), m_code(0) @@ -139,6 +144,7 @@ void Out::toFile(const std::string& filename ) m_ofs = new std::ofstream(filename.c_str()); } +#ifndef NO_QT void Out::toStatusBar(Utils::QT::SimpleQT* sqt) { if (sqt != NULL) @@ -157,7 +163,7 @@ void Out::toConsole(Utils::QT::SimpleQT* sqt) m_out_mode &= ~QTCONSOLE; m_sqt_console = sqt; } - +#endif void Out::toBuffer(std::stringstream* ss) { @@ -205,13 +211,12 @@ Out& Out::operator<< (Special& os ) *m_ofs << bufc << std::endl; } } - +#ifndef NO_QT if (m_out_mode & QTSTATUSBAR) { while (! m_buffer.eof()) { m_buffer.getline(bufc,512); -// m_sqt_bar->statusMsg(bufc); } } @@ -230,13 +235,10 @@ Out& Out::operator<< (Special& os ) else m_sqt_console->console()->setTextColor(QColor(0, 0, 150)); } - -// m_sqt_console->console()->insertPlainText(QString(bufc)); -// m_sqt_console->console()->insertPlainText(QString("\n")); m_sqt_console->console()->append(QString(bufc)); } } - +#endif if (m_out_mode & SSBUFFER) { while (! m_buffer.eof()) @@ -265,13 +267,12 @@ Out& Out::operator<< (Special& os ) *m_ofs << bufc << std::flush; } } - +#ifndef NO_QT if (m_out_mode & QTSTATUSBAR) { while (! m_buffer.eof()) { m_buffer.getline(bufc,512); -// m_sqt_bar->statusMsg(bufc); } } @@ -295,7 +296,7 @@ Out& Out::operator<< (Special& os ) m_sqt_console->console()->insertPlainText(QString(bufc)); } } - +#endif if (m_out_mode & SSBUFFER) { while (! m_buffer.eof()) -- GitLab