From 288c02b04e325381498c9ff567854313ff4a85ca Mon Sep 17 00:00:00 2001 From: Erik Andresen <e.andresen@uni-wuppertal.de> Date: Mon, 21 Mar 2016 16:30:07 +0100 Subject: [PATCH] got ready for compilation on windows (VTK 0.7; Qt 5.4) --- CMakeLists.txt | 5 ++++- src/MainWindow.cpp | 2 +- src/SaxParser.cpp | 12 ++++++------ src/geometry/Building.cpp | 2 +- src/geometry/Line.cpp | 4 ++-- src/geometry/SubRoom.cpp | 10 +++++----- src/main.cpp | 8 ++++++++ 7 files changed, 27 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 98be855..2988993 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -240,7 +240,6 @@ if("${DESIRED_QT_VERSION}" STREQUAL "5") # # other modules must be enabled like this: set(QT_USE_QTXML TRUE) # needed! set(QT_USE_QTNETWORK TRUE) - MESSAGE(STATUS "Found Qt version: ${Qt5Core_VERSION_STRING}") elseif("${DESIRED_QT_VERSION}" STREQUAL "4") @@ -305,6 +304,8 @@ elseif( ${QT5_INSTALLED}) ${RCS} ) qt5_use_modules(JPSvis Widgets) + target_link_libraries(JPSvis Qt5::Xml) + target_link_libraries(JPSvis Qt5::Network) target_link_libraries(JPSvis ${Qt5Widgets_LIBRARIES}) else() message(FATAL_ERROR "QT NOT FOUND - ABORT") @@ -380,6 +381,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") endif() #-------------------- +if(NOT MSVC) include(CheckCXXCompilerFlag) CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) @@ -391,6 +393,7 @@ else() message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") endif() message(STATUS "Checking for C++11 compiler - available") +endif(NOT MSVC) #--------------------- if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") message(STATUS "Using Clang " ${CMAKE_CXX_COMPILER_VERSION}) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 822aa4f..64bd3da 100755 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -1882,7 +1882,7 @@ void MainWindow::slotShowGeometryStructure() //_geoStructure.setVisible(! _geoStructure.isVisible()); //_geoStructure.showColumn(0); //_geoStructure.show(); - _geoStructure.setHidden(not ui.actionShowGeometry_Structure->isChecked()); + _geoStructure.setHidden(!ui.actionShowGeometry_Structure->isChecked()); if(_visualisationThread->getGeometry().RefreshView()) { _geoStructure.setWindowTitle("Geometry structure"); diff --git a/src/SaxParser.cpp b/src/SaxParser.cpp index eb753d0..73696cf 100644 --- a/src/SaxParser.cpp +++ b/src/SaxParser.cpp @@ -485,12 +485,12 @@ bool SaxParser::startElement(const QString & /* namespaceURI */, } else if (qName == "agentInfo") { double height=std::numeric_limits<double>::quiet_NaN(); - int color=std::numeric_limits<int>::quiet_NaN(); - int id=std::numeric_limits<int>::quiet_NaN(); + double color=std::numeric_limits<double>::quiet_NaN(); + double id=std::numeric_limits<double>::quiet_NaN(); for(int i=0; i<at.length(); i++) { if(at.localName(i)=="ID") { - id=at.value(i).toInt(); + id=at.value(i).toDouble(); } if(at.localName(i)=="height") { height=at.value(i).toDouble()*FAKTOR; @@ -502,12 +502,12 @@ bool SaxParser::startElement(const QString & /* namespaceURI */, if(std::isnan(id)) return true; if(!std::isnan(height)) { - _initialPedestriansHeights.append(QString::number(id)); + _initialPedestriansHeights.append(QString::number(int(id))); _initialPedestriansHeights.append(QString::number(height)); } if(!std::isnan(color)) { - _initialPedestriansColors.append(QString::number(id)); - _initialPedestriansColors.append(QString::number(color)); + _initialPedestriansColors.append(QString::number(int(id))); + _initialPedestriansColors.append(QString::number(int(color))); } } return true; diff --git a/src/geometry/Building.cpp b/src/geometry/Building.cpp index dda5bfe..1d125ab 100644 --- a/src/geometry/Building.cpp +++ b/src/geometry/Building.cpp @@ -892,7 +892,7 @@ bool Building::IsVisible(const Point& p1, const Point& p2, const std::vector<Sub { for(auto&& sub: subrooms) { - if(sub and sub->IsVisible(p1,p2,considerHlines)==false) return false; + if(sub && sub->IsVisible(p1,p2,considerHlines)==false) return false; } } diff --git a/src/geometry/Line.cpp b/src/geometry/Line.cpp index 1df6872..823e6d9 100644 --- a/src/geometry/Line.cpp +++ b/src/geometry/Line.cpp @@ -268,13 +268,13 @@ bool Line::Overlapp(const Line& l) const if(fabs(vecAB.Determinant(vecDC))<J_EPS) { - if( IsInLineSegment(l.GetPoint1()) and not HasEndPoint(l.GetPoint1())) + if( IsInLineSegment(l.GetPoint1()) && !HasEndPoint(l.GetPoint1())) { //Log->Write("ERROR: 1. Overlapping walls %s and %s ", toString().c_str(),l.toString().c_str()); return true; } - if( IsInLineSegment(l.GetPoint2()) and not HasEndPoint(l.GetPoint2())) + if( IsInLineSegment(l.GetPoint2()) && !HasEndPoint(l.GetPoint2())) { //Log->Write("ERROR: 2. Overlapping walls %s and %s ", toString().c_str(),l.toString().c_str()); return true; diff --git a/src/geometry/SubRoom.cpp b/src/geometry/SubRoom.cpp index 82209a1..19862d4 100644 --- a/src/geometry/SubRoom.cpp +++ b/src/geometry/SubRoom.cpp @@ -200,7 +200,7 @@ void SubRoom::AddTransition(Transition* line) void SubRoom::AddNeighbor(SubRoom* sub) { - if(sub and (IsElementInVector(_neighbors, sub)==false)) + if(sub && (IsElementInVector(_neighbors, sub)==false)) { _neighbors.push_back(sub); } @@ -528,7 +528,7 @@ bool SubRoom::SanityCheck() exit(EXIT_FAILURE); //return false; } - connected=connected or w1.ShareCommonPointWith(w2); + connected=connected || w1.ShareCommonPointWith(w2); } //overlapping with lines for(auto&& hline: _hlines) @@ -549,7 +549,7 @@ bool SubRoom::SanityCheck() exit(EXIT_FAILURE); //return false; } - connected=connected or w1.ShareCommonPointWith(*c); + connected=connected || w1.ShareCommonPointWith(*c); } //overlaping with transitions for(auto&& t: _transitions) @@ -560,10 +560,10 @@ bool SubRoom::SanityCheck() exit(EXIT_FAILURE); //return false; } - connected=connected or w1.ShareCommonPointWith(*t); + connected=connected || w1.ShareCommonPointWith(*t); } - if(not connected) + if(!connected) { Log->Write("ERROR: loose wall found %s in Room/Subroom %d/%d",w1.toString().c_str(),_roomID,_id); exit(EXIT_FAILURE); diff --git a/src/main.cpp b/src/main.cpp index 793a8fb..9eec0ed 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,6 +59,14 @@ #include <QDir> #include <locale.h> +// for compiling a standalone windows exe with VS +#ifdef _MSC_VER +# ifdef NDEBUG +# pragma comment(linker, "/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup") +# else +# pragma comment(linker, "/SUBSYSTEM:CONSOLE") +# endif +#endif #define vtkErrorMacro (x) () -- GitLab