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

View File

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

View File

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

View File

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

4
db.h
View File

@ -1,11 +1,13 @@
#ifndef _DB_H #ifndef _DB_H
#define _DB_H #define _DB_H
#include <cstdint> #include <stdint.h>
#include <vector> #include <vector>
#include <list> #include <list>
#include <string> #include <string>
#include <utility>
// 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::pair<int64_t, std::basic_string<unsigned char> > DBBlock;
typedef std::list<DBBlock> DBBlockList; typedef std::list<DBBlock> DBBlockList;

View File

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