Add travis and linux build support

This commit is contained in:
adrido 2018-03-25 05:46:46 +02:00 committed by GitHub
parent 903bafe4d3
commit 9d55309f01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 82 additions and 20 deletions

17
.travis.yml Normal file
View File

@ -0,0 +1,17 @@
language: cpp
compiler:
- gcc
- clang
addons:
apt:
packages:
- libgd2-noxpm-dev
before_script:
- mkdir build
- cd build
- cmake ..
script:
- cmake --build . --config Release

View File

@ -42,22 +42,27 @@ add_definitions(-DVER_COMPANYNAME_STR="MyCompany")
add_definitions(-DVER_FILEVERSION_STR="1,1,0.0")
endif(WIN32)
find_package (sqlite3 REQUIRED)
find_package (zlib REQUIRED)
find_library(ZLIB_LIBRARY NAMES zlib z)
find_path(ZLIB_INCLUDE_DIR NAMES zlib.h)
find_library(LIBGD_LIBRARY NAMES libgd libgd_static)
find_library(LIBGD_LIBRARY NAMES gd libgd libgd_static)
find_path(LIBGD_INCLUDE_DIR NAMES gd.h)
if(WIN32)
include_directories(../wingetopt/src/)
find_path(SYSTEM_INCLUDE_DIR dirent.h)
include_directories(${SYSTEM_INCLUDE_DIR})
include_directories(../wingetopt/src/)
find_path(SYSTEM_INCLUDE_DIR dirent.h)
include_directories(${SYSTEM_INCLUDE_DIR})
add_library (wingetopt STATIC ../wingetopt/src/getopt.c)
add_library (wingetopt STATIC ../wingetopt/src/getopt.c)
endif()
set(wingetopt_lib "")
if(WIN32)
set(wingetopt_lib wingetopt)
endif()
#link_directories (../wingetopt)
# Fügen Sie der ausführbaren Datei für dieses Projekt eine Quelle hinzu.
add_executable (Minetestmapper ${sources})
target_link_libraries(Minetestmapper wingetopt ${LIBGD_LIBRARY} ${ZLIB_LIBRARY} sqlite3)
target_link_libraries(Minetestmapper ${wingetopt_lib} ${LIBGD_LIBRARY} ${ZLIB_LIBRARY} ${SQLITE3_LIBRARY})
# TODO: Fügen Sie bei Bedarf Tests und Installationsziele hinzu.

View File

@ -1,6 +1,8 @@
#include "PaintEngine_libgd.h"
#include <sstream>
#include <cstring>
#include <stdexcept>
#include <gdfontmb.h>
#include <gdfontl.h>

View File

@ -1,5 +1,5 @@
#pragma once
#include "paintEngine.h"
#include "PaintEngine.h"
#include "CharEncodingConverter.h"
#include <gd.h>

View File

@ -8,26 +8,34 @@
*/
#include <dirent.h>
#include <filesystem>
//#include <experimental/filesystem>
#include <fstream>
#include <sstream>
#include <iostream>
#include "PlayerAttributes.h"
using namespace std;
namespace fs = std::experimental::filesystem::v1;
//namespace fs = std::experimental::filesystem::v1;
PlayerAttributes::PlayerAttributes(const std::string &sourceDirectory)
{
string playersPath = sourceDirectory + "players";
DIR *dir;
dir = opendir(playersPath.c_str());
if (dir == NULL) {
return;
}
for (auto& dirEntry : fs::directory_iterator(playersPath)) {
cout << dirEntry << std::endl;
//dirEntry.path().filename();
struct dirent *ent;
while ((ent = readdir(dir)) != NULL) {
if (ent->d_name[0] == '.') {
continue;
}
string path = playersPath + '/' + ent->d_name;
ifstream in;
in.open(dirEntry.path().string(), ifstream::in);
in.open(path.c_str(), ifstream::in);
string buffer;
string name;
string position;
@ -51,6 +59,36 @@ PlayerAttributes::PlayerAttributes(const std::string &sourceDirectory)
m_players.push_back(player);
}
closedir(dir);
//for (auto& dirEntry : fs::directory_iterator(playersPath)) {
// cout << dirEntry << std::endl;
// //dirEntry.path().filename();
// ifstream in;
// in.open(dirEntry.path().string(), ifstream::in);
// string buffer;
// string name;
// string position;
// while (getline(in, buffer)) {
// if (buffer.find("name = ") == 0) {
// name = buffer.substr(7);
// }
// else if (buffer.find("position = ") == 0) {
// position = buffer.substr(12, buffer.length() - 13);
// }
// }
// char comma;
// Player player;
// istringstream positionStream(position, istringstream::in);
// positionStream >> player.x;
// positionStream >> comma;
// positionStream >> player.y;
// positionStream >> comma;
// positionStream >> player.z;
// player.name = name;
// m_players.push_back(player);
//}
}
PlayerAttributes::Players::iterator PlayerAttributes::begin()

View File

@ -48,11 +48,11 @@
// default database to use
#if defined(USE_SQLITE3) && !defined(USE_POSTGRESQL) && !defined(USE_LEVELDB) && !defined(USE_REDIS)
#define DEFAULT_BACKEND "sqlite3"
#elif !USE_SQLITE3 && USE_POSTGRESQL && !USE_LEVELDB && !USE_REDIS
#elif !defined(USE_SQLITE3) && defined(USE_POSTGRESQL) && !defined(USE_LEVELDB) && !defined(USE_REDIS)
#define DEFAULT_BACKEND "postgresql"
#elif !USE_SQLITE3 && !USE_POSTGRESQL && USE_LEVELDB && !USE_REDIS
#elif !defined(USE_SQLITE3) && !defined(USE_POSTGRESQL) && defined(USE_LEVELDB) && !defined(USE_REDIS)
#define DEFAULT_BACKEND "leveldb"
#elif !USE_SQLITE3 && !USE_POSTGRESQL && !USE_LEVELDB && USE_REDIS
#elif !defined(USE_SQLITE3) && !defined(USE_POSTGRESQL) && !defined(USE_LEVELDB) && defined(USE_REDIS)
#define DEFAULT_BACKEND "redis"
#else
#define DEFAULT_BACKEND "auto"