Make it (almost) compile for windows

This commit is contained in:
Sfan5 2014-03-09 12:32:13 +01:00
parent b2896331cd
commit 46023f77f5
5 changed files with 16 additions and 18 deletions

@ -28,19 +28,13 @@ find_package(PkgConfig)
include(FindPackageHandleStandardArgs)
# Find libsqlite3
pkg_check_modules(PC_LIBSQLITE QUIET sqlite3)
set(LIBSQLITE3_DEFINITIONS ${PC_LIBSQLITE_CFLAGS_OTHER})
find_path(LIBSQLITE3_INCLUDE_DIR sqlite3.h HINTS ${PC_LIBSQLITE_INCLUDEDIR} ${PC_LIBSQLITE_INCLUDE_DIRS} PATH_SUFFIXES libsqlite3)
find_library(LIBSQLITE3_LIBRARY NAMES sqlite3 libsqlite3 HINTS ${PC_LIBSQLITE_LIBDIR} ${PC_LIBSQLITE_LIBRARY_DIRS})
set(LIBSQLITE3_LIBRARIES ${LIBSQLITE3_LIBRARY})
set(LIBSQLITE3_INCLUDE_DIRS ${LIBSQLITE3_INCLUDE_DIR})
find_package_handle_standard_args(LibSqlite3 DEFAULT_MSG LIBSQLITE3_LIBRARY LIBSQLITE3_INCLUDE_DIR)
mark_as_advanced(LIBSQLITE3_INCLUDE_DIR LIBSQLITE3_LIBRARY)
if(NOT LIBSQLITE3_INCLUDE_DIR)
message(FATAL_ERROR "Could not find sqlite3")
endif(NOT LIBSQLITE3_INCLUDE_DIR)
find_library(SQLITE3_LIBRARY sqlite3)
find_path(SQLITE3_INCLUDE_DIR zlib.h)
message (STATUS "sqlite3 library: ${SQLITE3_LIBRARY}")
message (STATUS "sqlite3 headers: ${SQLITE3_INCLUDE_DIR}")
if(NOT SQLITE3_LIBRARY OR NOT SQLITE3_INCLUDE_DIR)
message(FATAL_ERROR "sqlite3 not found!")
endif(NOT SQLITE3_LIBRARY OR NOT SQLITE3_INCLUDE_DIR)
# Find leveldb
set(USE_LEVELDB 0)
@ -84,7 +78,7 @@ include_directories(
"${PROJECT_BINARY_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}"
${LIBSQLITE3_INCLUDE_DIRS}
${SQLITE3_INCLUDE_DIR}
${LIBGD_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
)
@ -114,7 +108,7 @@ add_executable(minetestmapper
target_link_libraries(
minetestmapper
${LIBSQLITE3_LIBRARIES}
${SQLITE3_LIBRARY}
${LEVELDB_LIBRARY}
${LIBGD_LIBRARY}
${ZLIB_LIBRARY}

@ -14,6 +14,7 @@
#include <gdfontmb.h>
#include <iostream>
#include <sstream>
#include <stdexcept>
#include "config.h"
#include "PlayerAttributes.h"
#include "TileGenerator.h"

@ -11,7 +11,7 @@ DBSQLite3::DBSQLite3(const std::string &mapdir) {
}
DBSQLite3::~DBSQLite3() {
sqlite3_close_v2(m_db);
sqlite3_close(m_db);
}
std::vector<int64_t> DBSQLite3::getBlockPos() {

6
db.h

@ -1,12 +1,14 @@
#ifndef _DB_H
#define _DB_H
#include <cstdint>
#include <stdint.h>
#include <vector>
#include <list>
#include <string>
#include <utility>
typedef std::pair<int64_t, std::basic_string<unsigned char>> DBBlock;
// we cannot use ... char>> here because mingw-gcc is f**king retarded (caring about whitespace and shit)
typedef std::pair<int64_t, std::basic_string<unsigned char> > DBBlock;
typedef std::list<DBBlock> DBBlockList;
class DB {

@ -13,6 +13,7 @@
#include <map>
#include <string>
#include <sstream>
#include <stdexcept>
#include "TileGenerator.h"
using namespace std;