[Orxonox-commit 5781] r10441 - in code/branches/cpp11: cmake src/libraries/core/config

bknecht at orxonox.net bknecht at orxonox.net
Sun May 10 23:00:01 CEST 2015


Author: bknecht
Date: 2015-05-10 23:00:01 +0200 (Sun, 10 May 2015)
New Revision: 10441

Modified:
   code/branches/cpp11/cmake/CompilerConfigGCC.cmake
   code/branches/cpp11/src/libraries/core/config/ConfigFile.cc
Log:
Turned on c++11 flag in compiler and fixed a bug where boost couldn't handle it.

Modified: code/branches/cpp11/cmake/CompilerConfigGCC.cmake
===================================================================
--- code/branches/cpp11/cmake/CompilerConfigGCC.cmake	2015-05-10 16:49:49 UTC (rev 10440)
+++ code/branches/cpp11/cmake/CompilerConfigGCC.cmake	2015-05-10 21:00:01 UTC (rev 10441)
@@ -63,6 +63,10 @@
 ADD_COMPILER_FLAGS("-O3"                   Release        CACHE)
 ADD_COMPILER_FLAGS("-Os"                   MinSizeRel     CACHE)
 
+# Introducing c++11
+# Note: there is also 'std=gnu++11', but that might not be portable to windows
+ADD_COMPILER_FLAGS("-std=c++0x" CACHE)
+
 # CMake doesn't seem to set the PIC flags right on certain 64 bit systems
 IF(NOT MINGW AND ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
   ADD_COMPILER_FLAGS("-fPIC" CACHE)

Modified: code/branches/cpp11/src/libraries/core/config/ConfigFile.cc
===================================================================
--- code/branches/cpp11/src/libraries/core/config/ConfigFile.cc	2015-05-10 16:49:49 UTC (rev 10440)
+++ code/branches/cpp11/src/libraries/core/config/ConfigFile.cc	2015-05-10 21:00:01 UTC (rev 10441)
@@ -35,6 +35,9 @@
 
 #include <boost/filesystem.hpp>
 
+#include <iterator>
+#include <algorithm>
+
 #include "util/Convert.h"
 #include "util/StringUtils.h"
 #include "core/PathConfig.h"
@@ -92,7 +95,9 @@
                         // Try to copy default file from the data folder
                         try
                         {
-                            boost::filesystem::copy_file(defaultFilepath, filepath);
+                            std::ifstream input(defaultFilepath.string().c_str(), std::ifstream::in | std::ifstream::binary);
+                            std::ofstream output(filepath.string().c_str(), std::ofstream::out | std::ofstream::binary);
+                            copy(std::istreambuf_iterator<char>(input), std::istreambuf_iterator<char>(), std::ostream_iterator<char>(output));
                             orxout(internal_info, context::config) << "Copied " << this->filename_ << " from the default config folder." << endl;
                         }
                         catch (const boost::filesystem::filesystem_error& ex)




More information about the Orxonox-commit mailing list