diff --git a/BaseLib/CMakeLists.txt b/BaseLib/CMakeLists.txt index 906ac86afb04c3ea84cb567885d422c3a2f9adf6..fa5d9501cf402b213ca188247346770c19f42820 100644 --- a/BaseLib/CMakeLists.txt +++ b/BaseLib/CMakeLists.txt @@ -17,7 +17,4 @@ INCLUDE_DIRECTORIES( ADD_SUBDIRECTORY(logog) SET_PROPERTY(TARGET Continuous PROPERTY FOLDER "logog") SET_PROPERTY(TARGET logog PROPERTY FOLDER "logog") -IF (DOXYGEN_FOUND) - SET_PROPERTY(TARGET logog-doc PROPERTY FOLDER "logog") -ENDIF () SET_PROPERTY(TARGET test-logog PROPERTY FOLDER "logog") diff --git a/BaseLib/RapidXML/rapidxml_print.hpp b/BaseLib/RapidXML/rapidxml_print.hpp index 0ae2b14faa11a1e0c0c63ba8715983b132f6f2c6..f75fbea087d7c56faa767e83ea377a7484978d6e 100644 --- a/BaseLib/RapidXML/rapidxml_print.hpp +++ b/BaseLib/RapidXML/rapidxml_print.hpp @@ -28,10 +28,13 @@ namespace rapidxml //! \cond internal namespace internal { - + // LB Forward declaration (for clang) + template<class OutIt, class Ch> + inline OutIt print_node(OutIt out, const xml_node<Ch> *node, int flags, int indent); + /////////////////////////////////////////////////////////////////////////// // Internal character operations - + // Copy characters from given range to given output iterator template<class OutIt, class Ch> inline OutIt copy_chars(const Ch *begin, const Ch *end, OutIt out) @@ -40,7 +43,7 @@ namespace rapidxml *out++ = *begin++; return out; } - + // Copy characters from given range to given output iterator and expand // characters into references (< > ' " &) template<class OutIt, class Ch> @@ -59,17 +62,17 @@ namespace rapidxml case Ch('<'): *out++ = Ch('&'); *out++ = Ch('l'); *out++ = Ch('t'); *out++ = Ch(';'); break; - case Ch('>'): + case Ch('>'): *out++ = Ch('&'); *out++ = Ch('g'); *out++ = Ch('t'); *out++ = Ch(';'); break; - case Ch('\''): + case Ch('\''): *out++ = Ch('&'); *out++ = Ch('a'); *out++ = Ch('p'); *out++ = Ch('o'); *out++ = Ch('s'); *out++ = Ch(';'); break; - case Ch('"'): + case Ch('"'): *out++ = Ch('&'); *out++ = Ch('q'); *out++ = Ch('u'); *out++ = Ch('o'); *out++ = Ch('t'); *out++ = Ch(';'); break; - case Ch('&'): - *out++ = Ch('&'); *out++ = Ch('a'); *out++ = Ch('m'); *out++ = Ch('p'); *out++ = Ch(';'); + case Ch('&'): + *out++ = Ch('&'); *out++ = Ch('a'); *out++ = Ch('m'); *out++ = Ch('p'); *out++ = Ch(';'); break; default: *out++ = *begin; // No expansion, copy character @@ -101,70 +104,8 @@ namespace rapidxml /////////////////////////////////////////////////////////////////////////// // Internal printing operations - - // Print node - template<class OutIt, class Ch> - inline OutIt print_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) - { - // Print proper node type - switch (node->type()) - { - - // Document - case node_document: - out = print_children(out, node, flags, indent); - break; - // Element - case node_element: - out = print_element_node(out, node, flags, indent); - break; - - // Data - case node_data: - out = print_data_node(out, node, flags, indent); - break; - - // CDATA - case node_cdata: - out = print_cdata_node(out, node, flags, indent); - break; - - // Declaration - case node_declaration: - out = print_declaration_node(out, node, flags, indent); - break; - - // Comment - case node_comment: - out = print_comment_node(out, node, flags, indent); - break; - - // Doctype - case node_doctype: - out = print_doctype_node(out, node, flags, indent); - break; - - // Pi - case node_pi: - out = print_pi_node(out, node, flags, indent); - break; - - // Unknown - default: - assert(0); - break; - } - - // If indenting not disabled, add line break after node - if (!(flags & print_no_indenting)) - *out = Ch('\n'), ++out; - - // Return modified iterator - return out; - } - - // Print children of the node + // Print children of the node template<class OutIt, class Ch> inline OutIt print_children(OutIt out, const xml_node<Ch> *node, int flags, int indent) { @@ -177,6 +118,7 @@ namespace rapidxml template<class OutIt, class Ch> inline OutIt print_attributes(OutIt out, const xml_node<Ch> *node, int flags) { + (void)flags; // Unused for (xml_attribute<Ch> *attribute = node->first_attribute(); attribute; attribute = attribute->next_attribute()) { if (attribute->name() && attribute->value()) @@ -249,7 +191,7 @@ namespace rapidxml *out = Ch('<'), ++out; out = copy_chars(node->name(), node->name() + node->name_size(), out); out = print_attributes(out, node, flags); - + // If node is childless if (node->value_size() == 0 && !node->first_node()) { @@ -308,11 +250,11 @@ namespace rapidxml // Print attributes out = print_attributes(out, node, flags); - + // Print declaration end *out = Ch('?'), ++out; *out = Ch('>'), ++out; - + return out; } @@ -373,6 +315,68 @@ namespace rapidxml return out; } + // Print node + template<class OutIt, class Ch> + inline OutIt print_node(OutIt out, const xml_node<Ch> *node, int flags, int indent) + { + // Print proper node type + switch (node->type()) + { + + // Document + case node_document: + out = print_children(out, node, flags, indent); + break; + + // Element + case node_element: + out = print_element_node(out, node, flags, indent); + break; + + // Data + case node_data: + out = print_data_node(out, node, flags, indent); + break; + + // CDATA + case node_cdata: + out = print_cdata_node(out, node, flags, indent); + break; + + // Declaration + case node_declaration: + out = print_declaration_node(out, node, flags, indent); + break; + + // Comment + case node_comment: + out = print_comment_node(out, node, flags, indent); + break; + + // Doctype + case node_doctype: + out = print_doctype_node(out, node, flags, indent); + break; + + // Pi + case node_pi: + out = print_pi_node(out, node, flags, indent); + break; + + // Unknown + default: + assert(0); + break; + } + + // If indenting not disabled, add line break after node + if (!(flags & print_no_indenting)) + *out = Ch('\n'), ++out; + + // Return modified iterator + return out; + } + } //! \endcond @@ -384,7 +388,7 @@ namespace rapidxml //! \param node Node to be printed. Pass xml_document to print entire document. //! \param flags Flags controlling how XML is printed. //! \return Output iterator pointing to position immediately after last character of printed text. - template<class OutIt, class Ch> + template<class OutIt, class Ch> inline OutIt print(OutIt out, const xml_node<Ch> &node, int flags = 0) { return internal::print_node(out, &node, flags, 0); @@ -397,7 +401,7 @@ namespace rapidxml //! \param node Node to be printed. Pass xml_document to print entire document. //! \param flags Flags controlling how XML is printed. //! \return Output stream. - template<class Ch> + template<class Ch> inline std::basic_ostream<Ch> &print(std::basic_ostream<Ch> &out, const xml_node<Ch> &node, int flags = 0) { print(std::ostream_iterator<Ch>(out), node, flags); @@ -408,7 +412,7 @@ namespace rapidxml //! \param out Output stream to print to. //! \param node Node to be printed. //! \return Output stream. - template<class Ch> + template<class Ch> inline std::basic_ostream<Ch> &operator <<(std::basic_ostream<Ch> &out, const xml_node<Ch> &node) { return print(out, node); diff --git a/BaseLib/logog/CMakeLists.txt b/BaseLib/logog/CMakeLists.txt index 35bfb6c5764d3ac47e30f9dd368d3d698637fddd..31861996d351e5963460d4e6ad7593cd30a678b0 100644 --- a/BaseLib/logog/CMakeLists.txt +++ b/BaseLib/logog/CMakeLists.txt @@ -42,14 +42,16 @@ set_target_properties(logog PROPERTIES DEBUG_POSTFIX "d") add_executable( test-logog test/test.cpp ) target_link_libraries( test-logog logog ${CMAKE_THREAD_LIBS_INIT}) add_test( NAME test-harness COMMAND test-logog ) -install(TARGETS logog ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) -install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_PREFIX}/include/logog" +if (CMAKE_PROJECT_NAME STREQUAL logog) + install(TARGETS logog ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_PREFIX}/include/logog" FILES_MATCHING PATTERN "*.hpp") -# Docs generation with Doxygen -find_package( Doxygen ) -if( DOXYGEN_FOUND ) - add_custom_target (logog-doc ${DOXYGEN_EXECUTABLE} ${CMAKE_SOURCE_DIR}/doxyfile - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMENT "Generating source code documentation with Doxygen." VERBATIM) -endif() # DOXYGEN_FOUND \ No newline at end of file + # Docs generation with Doxygen + find_package( Doxygen ) + if( DOXYGEN_FOUND ) + add_custom_target (logog-doc ${DOXYGEN_EXECUTABLE} ${CMAKE_SOURCE_DIR}/doxyfile + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMENT "Generating source code documentation with Doxygen." VERBATIM) + endif() # DOXYGEN_FOUND +endif () # CMAKE_PROJECT_NAME = logog diff --git a/BaseLib/logog/src/target.cpp b/BaseLib/logog/src/target.cpp index 7bc26943a0c5f7d3079e76418024b48b567d0e4b..da9883e1feb8c6b526bc7569d9a541b8212d0ce0 100644 --- a/BaseLib/logog/src/target.cpp +++ b/BaseLib/logog/src/target.cpp @@ -1,4 +1,4 @@ - /* + /* * \file target.cpp */ @@ -74,6 +74,8 @@ namespace logog { #else OutputDebugStringA( (const LOGOG_CHAR *)data ); #endif // LOGOG_UNICODE +#else + (void)data; #endif // LOGOG_FLAVOR_WINDOWS return 0; } @@ -125,6 +127,7 @@ namespace logog { #ifdef LOGOG_FLAVOR_WINDOWS nError = fopen_s( &fpTest, m_pFileName, "r"); // ignore the error code #else // LOGOG_FLAVOR_WINDOWS + (void)nError; // Unused fpTest = fopen( m_pFileName, "r"); #endif // LOGOG_FLAVOR_WINDOWS diff --git a/CMakeLists.txt b/CMakeLists.txt index eff063dafa31b15acc9fb30d04dc16d652a13c4c..90b586d092aa32ae5962b56259a82f3d5ade3495 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,9 +37,15 @@ IF((CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) AND GPROF_PATH) OPTION(OGS_PROFILE "Enables compiling with flags set for profiling with gprof." OFF) ENDIF() # GCC AND GPROF_PATH -# Disable Qt +# Enable / Disable parts OPTION(OGS_DONT_USE_QT "Disables all Qt specific code." OFF) +OPTION(OGS_BUILD_CLI "Should the OGS simulator be built?" ON) +OPTION(OGS_BUILD_TESTS "Should the test executables be built?" ON) +OPTION(OGS_BUILD_GUI "Should the Data Explorer be built?" OFF) + +OPTION(OGS_NO_EXTERNAL_LIBS "Builds OGS without any external dependencies." OFF) + # Print CMake variable values IF (OGS_CMAKE_DEBUG) INCLUDE(ListAllCMakeVariableValues) @@ -51,9 +57,12 @@ IF (OGS_BUILD_INFO) ADD_DEFINITIONS (-DOGS_BUILD_INFO) ENDIF (OGS_BUILD_INFO) -OPTION(OGS_BUILD_GUI "Should the Data Explorer be built?" OFF) - -OPTION(OGS_NO_EXTERNAL_LIBS "Builds OGS without any external dependencies." OFF) +# Packaging +OPTION(OGS_PACKAGING "Creating installers / packages" OFF) +OPTION_REQUIRES(OGS_PACKAGING_ZIP "Do you want to package as zip?" OGS_PACKAGING) +IF(OGS_PACKAGING) + INCLUDE( scripts/cmake/Pack.cmake) +ENDIF() #OGS_PACKAGING ###################### ### Subdirectories ### @@ -66,16 +75,20 @@ ADD_SUBDIRECTORY( FileIO ) ADD_SUBDIRECTORY( GeoLib ) ADD_SUBDIRECTORY( MathLib ) ADD_SUBDIRECTORY( MeshLib ) -ADD_SUBDIRECTORY( OGS ) -ADD_SUBDIRECTORY( SimpleTests/MatrixTests ) -ADD_SUBDIRECTORY( SimpleTests/MeshTests ) -IF(NOT MSVC AND BLAS_FOUND AND LAPACK_FOUND) - ADD_SUBDIRECTORY( SimpleTests/SolverTests ) -ENDIF() +IF( OGS_BUILD_CLI ) + ADD_SUBDIRECTORY( OGS ) +ENDIF() # OGS_BUILD_CLI +IF( OGS_BUILD_TESTS ) + ADD_SUBDIRECTORY( SimpleTests/MatrixTests ) + ADD_SUBDIRECTORY( SimpleTests/MeshTests ) + IF(NOT MSVC AND BLAS_FOUND AND LAPACK_FOUND) + ADD_SUBDIRECTORY( SimpleTests/SolverTests ) + ENDIF() +ENDIF() # OGS_BUILD_TESTS IF(OGS_BUILD_GUI) ADD_DEFINITIONS(-DOGS_BUILD_GUI) ADD_SUBDIRECTORY(Gui) -ENDIF() +ENDIF() # OGS_BUILD_GUI CONFIGURE_FILE (BaseLib/BuildInfo.h.in ${PROJECT_BINARY_DIR}/BaseLib/BuildInfo.h) CONFIGURE_FILE (BaseLib/Configure.h.in ${PROJECT_BINARY_DIR}/BaseLib/Configure.h) \ No newline at end of file diff --git a/Gui/DataExplorer.cmake b/Gui/DataExplorer.cmake index 2a79c966ddc3425dade068d17b596101a7ef3ea9..0780ae920101221abac144f7349487f2897b9326 100644 --- a/Gui/DataExplorer.cmake +++ b/Gui/DataExplorer.cmake @@ -186,9 +186,9 @@ IF (OGS_PACKAGING) INSTALL (TARGETS ogs-gui RUNTIME DESTINATION bin COMPONENT ogs_gui) IF(MSVC) - SET(OGS_GUI_EXE ${OGS_EXECUTABLE}-gui.exe) + SET(OGS_GUI_EXE ${EXECUTABLE_OUTPUT_PATH}/Release/ogs-gui.exe) ELSE(MSVC) - SET(OGS_GUI_EXE ${OGS_EXECUTABLE}-gui) + SET(OGS_GUI_EXE ${EXECUTABLE_OUTPUT_PATH}/ogs-gui) ENDIF(MSVC) INCLUDE(GetPrerequisites) diff --git a/Gui/VtkVis/VtkRaster.cpp b/Gui/VtkVis/VtkRaster.cpp index c9ffd2e17b9148be5b2554f9c9f446810e765ac1..79aefde775256fc0d12eb5fc380a36cc3d4768df 100644 --- a/Gui/VtkVis/VtkRaster.cpp +++ b/Gui/VtkVis/VtkRaster.cpp @@ -402,7 +402,7 @@ vtkImageImport* VtkRaster::loadImageFromTIFF(const std::string &fileName, _TIFFfree(pixVal); GTIFFree(geoTiff); XTIFFClose(tiff); - return false; + return NULL; } // check for colormap diff --git a/Gui/VtkVis/VtkVisPointSetItem.cpp b/Gui/VtkVis/VtkVisPointSetItem.cpp index ed1a8c3f8442f75270f0933cf7ee1745aef1e068..663d34c207745ea9dcb55bf46d15e4ca37baeb4c 100644 --- a/Gui/VtkVis/VtkVisPointSetItem.cpp +++ b/Gui/VtkVis/VtkVisPointSetItem.cpp @@ -270,6 +270,7 @@ void VtkVisPointSetItem::SetActiveAttribute( const QString& name ) _algorithm->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, charName); _mapper->SetScalarModeToUsePointData(); pointData->GetArray(_activeArrayName.c_str())->GetRange(range); + pointData->GetArray(charName)->GetRange(range); } else { @@ -290,6 +291,7 @@ void VtkVisPointSetItem::SetActiveAttribute( const QString& name ) _algorithm->SetInputArrayToProcess(0, 0, 0, vtkDataObject::FIELD_ASSOCIATION_CELLS, charName); _mapper->SetScalarModeToUseCellData(); cellData->GetArray(_activeArrayName.c_str())->GetRange(range); + cellData->GetArray(charName)->GetRange(range); } else { @@ -340,6 +342,11 @@ bool VtkVisPointSetItem::activeAttributeExists(vtkDataSetAttributes* data, std:: { data->SetActiveAttribute(name.c_str(), vtkDataSetAttributes::SCALARS); return true; + int i = data->SetActiveAttribute(name.c_str(), vtkDataSetAttributes::SCALARS); + if (i < 0) + return false; + else + return true; } else return false; diff --git a/Gui/mainwindow.cpp b/Gui/mainwindow.cpp index b19c43fad91c710caef67c64f51130b90ec795a2..7375b7b88c64857eb2c7e61c814be4e14ca4b76d 100644 --- a/Gui/mainwindow.cpp +++ b/Gui/mainwindow.cpp @@ -393,7 +393,7 @@ void MainWindow::open(int file_type) ImportFileType::type t = static_cast<ImportFileType::type>(file_type); QString type_str = QString::fromStdString((ImportFileType::convertImportFileTypeToString(t))); QString fileName = QFileDialog::getOpenFileName(this, - "Select " + type_str + " file to import", + "Select " + type_str + " file to import", settings.value("lastOpenedFileDirectory").toString(), QString::fromStdString(ImportFileType::getFileSuffixString(t))); if (!fileName.isEmpty()) @@ -555,7 +555,7 @@ void MainWindow::loadFile(ImportFileType::type t, const QString &fileName) updateDataViews(); } else - OGSError::box("Failed to load a FEFLOW file."); + OGSError::box("Failed to load a FEFLOW file."); */ } else if (t == ImportFileType::GMS) @@ -654,7 +654,7 @@ void MainWindow::loadFile(ImportFileType::type t, const QString &fileName) OGSError::box("Failed to load a TetGen mesh."); settings.setValue("lastOpenedTetgenFileDirectory", QDir(node_fname).absolutePath()); */ - } + } } else if (t == ImportFileType::VTK) { @@ -754,9 +754,9 @@ QMenu* MainWindow::createImportFilesMenu() QAction* vtkFiles = importFiles->addAction("&VTK Files..."); connect( vtkFiles, SIGNAL(triggered()), _signal_mapper, SLOT(map()) ); _signal_mapper->setMapping(vtkFiles, ImportFileType::VTK); - + connect(_signal_mapper, SIGNAL(mapped(int)), this, SLOT(open(int))); - + return importFiles; } diff --git a/scripts/cmake/Pack.cmake b/scripts/cmake/Pack.cmake new file mode 100644 index 0000000000000000000000000000000000000000..d23cf023d02dbb6514062ba713141c4ef54b56a8 --- /dev/null +++ b/scripts/cmake/Pack.cmake @@ -0,0 +1,67 @@ +#### Packaging setup for OGS-6 #### + +#INCLUDE(CMakeConfiguration/InstallRequiredSystemLibraries.cmake) + +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OGS-6") +SET(CPACK_PACKAGE_VENDOR "OpenGeoSys Community (http://www.opengeosys.com)") +SET(CPACK_PACKAGE_INSTALL_DIRECTORY "OGS-${OGS_VERSION_MAJOR}.${OGS_VERSION_MINOR}.${OGS_VERSION_PATCH}") +SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") +SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt") +SET(CPACK_PACKAGE_VERSION_MAJOR "${OGS_VERSION_MAJOR}") +SET(CPACK_PACKAGE_VERSION_MINOR "${OGS_VERSION_MINOR}") +SET(CPACK_PACKAGE_VERSION_PATCH "${OGS_VERSION_PATCH}") +SET(CPACK_PACKAGE_FILE_NAME "ogs-${OGS_VERSION_MAJOR}.${OGS_VERSION_MINOR}.${OGS_VERSION_PATCH}-${CMAKE_SYSTEM}-x${BITS}") + +IF (OGS_PACKAGING_ZIP) + SET (CPACK_GENERATOR ZIP) + SET(CPACK_PACKAGE_FILE_NAME "ogs-6") +ELSE (OGS_PACKAGING_ZIP) + IF(WIN32) + SET(CPACK_GENERATOR NSIS) + # There is a bug in NSI that does not handle full unix paths properly. Make + # sure there is at least one set of four (4) backlasshes. + #SET(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/CMakeConfiguration\\\\OGS_Logo_Installer.bmp") + #SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\MyExecutable.exe") + SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}") + SET(CPACK_NSIS_HELP_LINK "https:\\\\\\\\www.opengeosys.com") + SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\www.opengeosys.com") + SET(CPACK_NSIS_CONTACT "lars.bilke@ufz.de") + SET(CPACK_NSIS_MODIFY_PATH ON) + #SET(CPACK_NSIS_MENU_LINKS "https://geosys.ufz.de/trac" "OGS Wiki") + MESSAGE (STATUS "Packaging set to NSIS") + ELSE(WIN32) + IF(UNIX) + SET(CPACK_GENERATOR TGZ) + ELSE(UNIX) + IF(APPLE) + SET(CPACK_GENERATOR TGZ) + ENDIF(APPLE) + ENDIF(UNIX) + #SET(CPACK_STRIP_FILES "bin/ogs") + #SET(CPACK_SOURCE_STRIP_FILES "") + ENDIF(WIN32) +ENDIF (OGS_PACKAGING_ZIP) + +# INCLUDE (FindMSVCRedist) +# IF (MSVC_REDIST) +# SET(CPACK_COMPONENTS_ALL msvc_redist) +# ENDIF () # MSVC_REDIST + +SET(CPACK_COMPONENT_OGS_DISPLAY_NAME "Executable") +SET(CPACK_COMPONENT_OGS_DESCRIPTION "The command line executable") +SET(CPACK_COMPONENT_MSVC_REDIST_DISPLAY_NAME "C++ Redistributable") +SET(CPACK_COMPONENT_MSVC_REDIST_DESCRIPTION "Microsoft Visual C++ Redistributable") + +SET(CPACK_COMPONENTS_ALL_IN_ONE_PACKAGE 1) +IF (OGS_BUILD_GUI) + SET(CPACK_PACKAGE_EXECUTABLES "ogs-gui" "OGS User Interface") + SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} ogs_gui Unspecified) + SET(CPACK_COMPONENT_OGS_GUI_DISPLAY_NAME "Data Explorer") + SET(CPACK_COMPONENT_OGS_GUI_DESCRIPTION "The graphical user interface for OpenGeoSys") + #SET(CPACK_COMPONENT_OGS_GUI_DEPENDS ogs) +ELSE () + # SET(CPACK_PACKAGE_EXECUTABLES "ogs" "OGS Command Line") + # SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} ogs Unspecified) +ENDIF () + +INCLUDE (CPack)