From 6286f02db77ce1acb97b23c6d3748e334d88336d Mon Sep 17 00:00:00 2001 From: Markus Bullmann Date: Wed, 28 Mar 2018 10:57:08 +0200 Subject: [PATCH] Minor fixes for MSVC --- CMakeLists.txt | 54 +++++++++++++++++++++++++++++--------------------- main.cpp | 27 ++++++++++++------------- 2 files changed, 44 insertions(+), 37 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 90091d4..712531c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,9 +19,9 @@ ENDIF() INCLUDE_DIRECTORIES( ../ - ../../ - ../../../ - ../../../../ + ../../ + ../../../ + ../../../../ ) @@ -42,33 +42,41 @@ FILE(GLOB SOURCES ./*/*/*.cpp ./*/*/*/*.cpp ../../Indoor/lib/tinyxml/tinyxml2.cpp - ../../Indoor/lib/Recast/*.cpp + ../../Indoor/lib/Recast/*.cpp ) -# system specific compiler flags -ADD_DEFINITIONS( +if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio*") + add_definitions( + -D_USE_MATH_DEFINES + -DUNICODE + -D_UNICODE + ) +else() + # system specific compiler flags + ADD_DEFINITIONS( - #-std=gnu++14 + #-std=gnu++14 - -Wall - -Werror=return-type - -Wextra - -Wpedantic + -Wall + -Werror=return-type + -Wextra + -Wpedantic - -fstack-protector-all + -fstack-protector-all - -g3 - #-O2 - -march=native + -g3 + #-O2 + -march=native + ) +endif() - -DWITH_TESTS +add_definitions( +# -DWITH_TESTS -DWITH_ASSERTIONS - #-DWITH_DEBUG_LOG - #-DWITH_DEBUG_PLOT - #-D_GLIBCXX_DEBUG - - +# -DWITH_DEBUG_LOG +# -DWITH_DEBUG_PLOT +# -D_GLIBCXX_DEBUG ) # allow OMP @@ -89,8 +97,8 @@ ADD_EXECUTABLE( # needed external libraries TARGET_LINK_LIBRARIES( ${PROJECT_NAME} - gtest - pthread +# gtest +# pthread ) SET(CMAKE_C_COMPILER ${CMAKE_CXX_COMPILER}) diff --git a/main.cpp b/main.cpp index 8d08200..eddb18c 100755 --- a/main.cpp +++ b/main.cpp @@ -1,4 +1,4 @@ -#include "main.h" +//#include "main.h" #include "navMesh/mesh.h" #include "navMesh/filter.h" @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -24,7 +25,6 @@ #include -#include Stats::Statistics run(Settings::DataSetup setup, int numFile, std::string folder) { @@ -34,24 +34,23 @@ Stats::Statistics run(Settings::DataSetup setup, int numFile, std::string WiFiFingerprints fingerprints(setup.fingerprints); std::ifstream inp(setup.wifiModel, std::ifstream::binary); - //ground truth + // ground truth std::vector gtPath; for(int i = 0; i < setup.numGTPoints; ++i){gtPath.push_back(i);} Interpolator gtInterpolator = fr.getGroundTruthPath(map, gtPath); Stats::Statistics errorStats; - //error file + // error file const long int t = static_cast(time(NULL)); - const std::string evalDir = Settings::errorDir + folder; - struct stat statStruct; - stat(evalDir.c_str(), &statStruct); - if(!S_ISDIR(statStruct.st_mode)){ - if(mkdir(evalDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1){ - Assert::doThrow("Eval folder couldn't be created!"); - } - } + auto evalDir = std::experimental::filesystem::path(Settings::errorDir); + evalDir.append(folder); + + if (!std::experimental::filesystem::exists(evalDir)) { + std::experimental::filesystem::create_directory(evalDir); + } + std::ofstream errorFile; - errorFile.open (evalDir + "/" + std::to_string(numFile) + "_" + std::to_string(t) + ".csv"); + errorFile.open (evalDir.string() + "/" + std::to_string(numFile) + "_" + std::to_string(t) + ".csv"); // wifi @@ -219,7 +218,7 @@ Stats::Statistics run(Settings::DataSetup setup, int numFile, std::string if(ts.ms() == 13410 || ts.ms() == 20802){ std::ofstream plotFile; - plotFile.open(evalDir + "/" + std::to_string(numFile) + "_" + std::to_string(t) + "_plot_zwischendrin_" + std::to_string(ts.ms()) + ".gp"); + plotFile.open(evalDir.string() + "/" + std::to_string(numFile) + "_" + std::to_string(t) + "_plot_zwischendrin_" + std::to_string(ts.ms()) + ".gp"); plot.saveToFile(plotFile); plotFile.close(); }