From: Nick Gasson Date: Thu, 11 Feb 2021 03:03:41 +0000 (+0800) Subject: Some changes to get it to build X-Git-Url: https://git.nickg.me.uk/traingame.git/commitdiff_plain Some changes to get it to build --- diff --git a/CMakeLists.txt b/CMakeLists.txt index ecf5a08..299bfd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project (TrainGame) set (${PROJECT_NAME}_MAJOR_VERSION 0) set (${PROJECT_NAME}_MINOR_VERSION 3) -set (${PROJECT_NAME}_PATCH_LEVEL 0-dev) +set (${PROJECT_NAME}_PATCH_LEVEL 0-dev) set (EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) @@ -13,7 +13,7 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/" # Make sure optimisation is always enabled if (UNIX) if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_CXX_FLAGS "-g -Wall -ffast-math -O2 -std=c++0x") + set (CMAKE_CXX_FLAGS "-g -Wall -ffast-math -O2 -std=c++11") # "-Wconversion -Werror" if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i686") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -mfpmath=sse") @@ -29,7 +29,7 @@ else (UNIX) endif (UNIX) # Find all the source files -file (GLOB_RECURSE folder_source +file (GLOB_RECURSE folder_source ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) source_group (${PROJECT_NAME} FILES ${folder_source}) @@ -37,8 +37,8 @@ find_package (SDL REQUIRED) find_package (SDL_image REQUIRED) find_package (OpenGL REQUIRED) find_package (GLEW REQUIRED) -find_package (Boost 1.37 REQUIRED - COMPONENTS filesystem signals program_options system) +find_package (Boost 1.37 REQUIRED + COMPONENTS filesystem program_options system) find_package (Freetype REQUIRED) if (NOT WIN32) @@ -82,11 +82,11 @@ set (REL "${${PROJECT_NAME}_MAJOR_VERSION}.${${PROJECT_NAME}_MINOR_VERSION}") set (PKGNAME "${PROJECT_NAME}-${REL}") # Installation -install (PROGRAMS bin/${PROJECT_NAME} +install (PROGRAMS bin/${PROJECT_NAME} DESTINATION bin) install (DIRECTORY data maps buildings schemas waggons engines DESTINATION .) -install (FILES COPYING.txt README.txt COPYRIGHT.vera +install (FILES COPYING.txt README.txt COPYRIGHT.vera DESTINATION .) # Packaging diff --git a/src/Config.cpp b/src/Config.cpp index 1ae0760..61a8b76 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -148,7 +148,7 @@ void Config::flush() log() << "Saving config to " << config_file; - ofstream ofs(config_file.string().c_str()); + std::ofstream ofs(config_file.string().c_str()); if (!ofs.good()) throw runtime_error("Failed to write to config file"); @@ -219,4 +219,3 @@ IConfigPtr get_config() return cfg; } - diff --git a/src/Map.cpp b/src/Map.cpp index 1e59bd4..85c0e6e 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -1616,7 +1616,7 @@ void Map::save() log() << "Saving map to " << h.file_name(); - ofstream& of = h.wstream(); + std::ofstream& of = h.wstream(); try { save_to(of); diff --git a/src/Mesh.cpp b/src/Mesh.cpp index d588aad..7d1a3e0 100644 --- a/src/Mesh.cpp +++ b/src/Mesh.cpp @@ -50,7 +50,7 @@ struct MeshBuffer : IMeshBuffer { vector tex_coords; ITexturePtr texture; }; - typedef shared_ptr ChunkPtr; + typedef std::shared_ptr ChunkPtr; size_t vertex_count() const; size_t index_count() const; diff --git a/src/Resource.cpp b/src/Resource.cpp index d6e461e..f755dbd 100644 --- a/src/Resource.cpp +++ b/src/Resource.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -59,14 +60,14 @@ IResource::Handle::Handle(const string& file_name, Mode mode) : file_name_(file_name), mode_(mode), aborted(false) { if (mode == READ) { - read_stream = shared_ptr(new ifstream(file_name.c_str())); + read_stream = shared_ptr(new std::ifstream(file_name.c_str())); if (!read_stream->good()) throw runtime_error("Failed to open resource file " + file_name); } else if (mode == WRITE) { const string tmp = tmp_file_name(); - write_stream = shared_ptr(new ofstream(tmp.c_str())); + write_stream = shared_ptr(new std::ofstream(tmp.c_str())); if (!write_stream->good()) throw runtime_error("Failed to open resource file " + file_name);