Redo CMake structure to be usable with VisualStudio+vcpkg
|
@ -1,17 +1,3 @@
|
||||||
minetestmapper
|
|
||||||
minetestmapper.exe
|
|
||||||
CMakeCache.txt
|
|
||||||
CMakeFiles/
|
|
||||||
CPack*
|
|
||||||
_CPack_Packages/
|
|
||||||
Makefile
|
|
||||||
cmake_install.cmake
|
|
||||||
build_config.h
|
|
||||||
*.deb
|
|
||||||
*.rpm
|
|
||||||
*.tar.gz
|
|
||||||
*~
|
|
||||||
## The following lines where taken at 23.01.2016 from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
## Ignore Visual Studio temporary files, build results, and
|
||||||
## files generated by popular Visual Studio add-ons.
|
## files generated by popular Visual Studio add-ons.
|
||||||
|
|
||||||
|
@ -34,6 +20,7 @@ x86/
|
||||||
bld/
|
bld/
|
||||||
[Bb]in/
|
[Bb]in/
|
||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
|
[Ll]og/
|
||||||
|
|
||||||
# Visual Studio 2015 cache/options directory
|
# Visual Studio 2015 cache/options directory
|
||||||
.vs/
|
.vs/
|
||||||
|
@ -55,6 +42,7 @@ dlldata.c
|
||||||
|
|
||||||
# DNX
|
# DNX
|
||||||
project.lock.json
|
project.lock.json
|
||||||
|
project.fragment.lock.json
|
||||||
artifacts/
|
artifacts/
|
||||||
|
|
||||||
*_i.c
|
*_i.c
|
||||||
|
@ -93,6 +81,8 @@ ipch/
|
||||||
*.opensdf
|
*.opensdf
|
||||||
*.sdf
|
*.sdf
|
||||||
*.cachefile
|
*.cachefile
|
||||||
|
*.VC.db
|
||||||
|
*.VC.VC.opendb
|
||||||
|
|
||||||
# Visual Studio profiler
|
# Visual Studio profiler
|
||||||
*.psess
|
*.psess
|
||||||
|
@ -153,9 +143,14 @@ publish/
|
||||||
*.azurePubxml
|
*.azurePubxml
|
||||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||||
# but database connection strings (with potential passwords) will be unencrypted
|
# but database connection strings (with potential passwords) will be unencrypted
|
||||||
*.pubxml
|
#*.pubxml
|
||||||
*.publishproj
|
*.publishproj
|
||||||
|
|
||||||
|
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||||
|
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||||
|
# in these scripts will be unencrypted
|
||||||
|
PublishScripts/
|
||||||
|
|
||||||
# NuGet Packages
|
# NuGet Packages
|
||||||
*.nupkg
|
*.nupkg
|
||||||
# The packages folder can be ignored because of Package Restore
|
# The packages folder can be ignored because of Package Restore
|
||||||
|
@ -176,12 +171,11 @@ csx/
|
||||||
ecf/
|
ecf/
|
||||||
rcf/
|
rcf/
|
||||||
|
|
||||||
# Microsoft Azure ApplicationInsights config file
|
# Windows Store app package directories and files
|
||||||
ApplicationInsights.config
|
|
||||||
|
|
||||||
# Windows Store app package directory
|
|
||||||
AppPackages/
|
AppPackages/
|
||||||
BundleArtifacts/
|
BundleArtifacts/
|
||||||
|
Package.StoreAssociation.xml
|
||||||
|
_pkginfo.txt
|
||||||
|
|
||||||
# Visual Studio cache files
|
# Visual Studio cache files
|
||||||
# files ending in .cache can be ignored
|
# files ending in .cache can be ignored
|
||||||
|
@ -195,11 +189,16 @@ ClientBin/
|
||||||
*~
|
*~
|
||||||
*.dbmdl
|
*.dbmdl
|
||||||
*.dbproj.schemaview
|
*.dbproj.schemaview
|
||||||
|
*.jfm
|
||||||
*.pfx
|
*.pfx
|
||||||
*.publishsettings
|
*.publishsettings
|
||||||
node_modules/
|
node_modules/
|
||||||
orleans.codegen.cs
|
orleans.codegen.cs
|
||||||
|
|
||||||
|
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||||
|
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||||
|
#bower_components/
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
# RIA/Silverlight projects
|
||||||
Generated_Code/
|
Generated_Code/
|
||||||
|
|
||||||
|
@ -245,8 +244,18 @@ _Pvt_Extensions
|
||||||
|
|
||||||
# Paket dependency manager
|
# Paket dependency manager
|
||||||
.paket/paket.exe
|
.paket/paket.exe
|
||||||
|
paket-files/
|
||||||
|
|
||||||
# FAKE - F# Make
|
# FAKE - F# Make
|
||||||
.fake/
|
.fake/
|
||||||
MSVC/versioninfo.h
|
|
||||||
minetestmapper.VC.db
|
# JetBrains Rider
|
||||||
|
.idea/
|
||||||
|
*.sln.iml
|
||||||
|
|
||||||
|
# CodeRush
|
||||||
|
.cr/
|
||||||
|
|
||||||
|
# Python Tools for Visual Studio (PTVS)
|
||||||
|
__pycache__/
|
||||||
|
*.pyc
|
4
AUTHORS
|
@ -1,4 +0,0 @@
|
||||||
Miroslav Bendík <miroslav.bendik@gmail.com>
|
|
||||||
ShadowNinja <shadowninja@minetest.net>
|
|
||||||
sfan5 <sfan5@live.de>
|
|
||||||
Rogier <rogier777@gmail.com>
|
|
561
CMakeLists.txt
|
@ -1,193 +1,53 @@
|
||||||
project(minetestmapper CXX C)
|
# CMakeList.txt: CMake-Projektdatei der obersten Ebene. Führen Sie eine globale Konfiguration durch,
|
||||||
cmake_minimum_required(VERSION 2.6)
|
# und schließen Sie hier Unterprojekte ein.
|
||||||
cmake_policy(SET CMP0003 NEW)
|
#
|
||||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
cmake_minimum_required (VERSION 3.8)
|
||||||
|
|
||||||
if(WIN32)
|
#find_package(Git)
|
||||||
message(WARNING "Thanks for using minetestmapper on Windows.\nAs I do not have a windows computer at my disposal, I have not been able\nto test some windows-specific parts.\nPlease let me know if minetestmapper compiles OK, and if it runs fine.\nThanks!\n(Contact me via github)")
|
#set (VERSION_UPDATE_FROM_GIT ON)
|
||||||
endif(WIN32)
|
set (CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
||||||
|
|
||||||
# Try to compute a useful version number. (goal: uniquely identify the commit used to generate it)
|
#include ("GetVersionFromGitTag")
|
||||||
# Prefer the output of git describe (if available)
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
# Else, use a stored version, and a checksum of the files (and hope that is dependable)
|
project (
|
||||||
|
"Minetestmapper"
|
||||||
|
VERSION 0.1.0
|
||||||
|
DESCRIPTION "Map generator for Minetest"
|
||||||
|
LANGUAGES CXX)
|
||||||
|
|
||||||
# Obtain stored major version number
|
# Set output directories
|
||||||
# Make sure cmake is rerun when version has changed
|
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||||
configure_file(base-version base-version.dup COPYONLY)
|
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||||
file(REMOVE base-version.dup)
|
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||||
file(STRINGS "${CMAKE_HOME_DIRECTORY}/base-version" VERSION_FROM_FILE)
|
|
||||||
|
|
||||||
execute_process(COMMAND git describe --long "--match=[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" --dirty=-WIP --abbrev=8
|
|
||||||
RESULT_VARIABLE VERSION_EXIT OUTPUT_VARIABLE GIT_VERSION ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
if(VERSION_EXIT)
|
|
||||||
set(VERSION_MAJOR "${VERSION_FROM_FILE}")
|
|
||||||
file(GLOB MAPPER_FILES RELATIVE "${CMAKE_HOME_DIRECTORY}" *.cpp *.h CMakeLists.txt)
|
|
||||||
string(REGEX REPLACE "[^;]" "" MAPPER_FILES_COUNT "${MAPPER_FILES};")
|
|
||||||
string(LENGTH "${MAPPER_FILES_COUNT}" MAPPER_FILES_COUNT)
|
|
||||||
execute_process(COMMAND cmake -E md5sum ${MAPPER_FILES} RESULT_VARIABLE VERSION_EXIT OUTPUT_VARIABLE FILES_MD5SUM ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
if(VERSION_EXIT)
|
|
||||||
message(STATUS "Could not compute md5sum for files")
|
|
||||||
set(VERSION_MINOR "0")
|
|
||||||
else(VERSION_EXIT)
|
|
||||||
string(MD5 SUMMARY_MD5SUM "${FILES_MD5SUM}")
|
|
||||||
string(SUBSTRING "${SUMMARY_MD5SUM}" 1 16 VERSION_MINOR)
|
|
||||||
set(VERSION_MINOR "N${MAPPER_FILES_COUNT}-CHK${VERSION_MINOR}")
|
|
||||||
endif(VERSION_EXIT)
|
|
||||||
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}")
|
|
||||||
message(STATUS "No git tree found; stored / computed version: ${VERSION_STRING}")
|
|
||||||
else(VERSION_EXIT)
|
|
||||||
string(REGEX REPLACE "-(.*)" ".\\1" VERSION_STRING "${GIT_VERSION}")
|
|
||||||
string(REGEX REPLACE "^([^.]+)\\.(.*)" "\\1" VERSION_MAJOR "${VERSION_STRING}")
|
|
||||||
string(REGEX REPLACE "^([^.]+)\\.(.*)" "\\2" VERSION_MINOR "${VERSION_STRING}")
|
|
||||||
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}")
|
|
||||||
message(STATUS "Git tree found; git commit version: ${VERSION_STRING}")
|
|
||||||
if(NOT VERSION_STRING STREQUAL VERSION_FROM_FILE AND NOT VERSION_MAJOR STREQUAL VERSION_FROM_FILE)
|
|
||||||
message(STATUS "**NOTE: contents of file 'version' do not match output of 'git describe' (this is harmless)")
|
|
||||||
endif(NOT VERSION_STRING STREQUAL VERSION_FROM_FILE AND NOT VERSION_MAJOR STREQUAL VERSION_FROM_FILE)
|
|
||||||
endif(VERSION_EXIT)
|
|
||||||
|
|
||||||
# try_compile does not remove the temporary build directory, so put it in CMakeFiles...
|
|
||||||
# Also: use absolute paths; cmake chokes on relative paths :-(
|
|
||||||
try_compile(CXX_C0X_SUPPORTED "${CMAKE_HOME_DIRECTORY}/CMakeFiles/CMakeTmp/c0x-test" "${CMAKE_HOME_DIRECTORY}/cmake/empty.cpp" CMAKE_FLAGS "-std=c++0x")
|
|
||||||
if(CXX_C0X_SUPPORTED)
|
|
||||||
# Yes, I *know* c++0x is *not* an official C++ standard...
|
|
||||||
message(STATUS "Compiler: C++ standard version 'c++0x' is supported")
|
|
||||||
else(CXX_C0X_SUPPORTED)
|
|
||||||
message(STATUS "Compiler: C++ standard version c++0x is not supported")
|
|
||||||
message(FATAL_ERROR "Your compiler is not modern enough to compile this code\nPlease upgrade your compiler to one supporting at least c++0x.\n(or submit a bug report)")
|
|
||||||
endif(CXX_C0X_SUPPORTED)
|
|
||||||
try_compile(CXX_C11_SUPPORTED "${CMAKE_HOME_DIRECTORY}/CMakeFiles/CMakeTmp/c11-test" "${CMAKE_HOME_DIRECTORY}/cmake/empty.cpp" CMAKE_FLAGS "-std=c++11")
|
|
||||||
if(CXX_C11_SUPPORTED)
|
|
||||||
message(STATUS "Compiler: C++ standard version 'c++11' is supported")
|
|
||||||
else(CXX_C11_SUPPORTED)
|
|
||||||
message(STATUS "Compiler: C++ standard version 'c++11' is not supported")
|
|
||||||
endif(CXX_C11_SUPPORTED)
|
|
||||||
|
|
||||||
# Determine C++ standard to use
|
|
||||||
# If CXX_CXX_STANDARD is empty, use autodetected c++ standard version
|
|
||||||
set(CXX_CXX_STANDARD "" CACHE STRING "C++ standard version to use. Leave empty, or set to c++11 or c++0x")
|
|
||||||
string(COMPARE NOTEQUAL "${CXX_CXX_STANDARD}" "" CXX_CXX_STANDARD_OVERRIDE)
|
|
||||||
if(CXX_CXX_STANDARD_OVERRIDE)
|
|
||||||
string(COMPARE EQUAL "${CXX_CXX_STANDARD}" "c++11" CXX_C11_REQUESTED)
|
|
||||||
string(COMPARE EQUAL "${CXX_CXX_STANDARD}" "c++0x" CXX_C0X_REQUESTED)
|
|
||||||
if(CXX_C11_REQUESTED AND CXX_C11_SUPPORTED)
|
|
||||||
message(STATUS "Compiler: C++ standard version 'c++11' selected (as requested)")
|
|
||||||
set(CXX_USE_CXX_STANDARD "c++11")
|
|
||||||
elseif(CXX_C11_REQUESTED AND NOT CXX_C11_SUPPORTED)
|
|
||||||
message(SEND_ERROR "Compiler: requested standard version '${CXX_CXX_STANDARD}' is not supported")
|
|
||||||
elseif(CXX_C0X_REQUESTED)
|
|
||||||
message(STATUS "Compiler: C++ standard version 'c++0x' selected (as requested)")
|
|
||||||
set(CXX_USE_CXX_STANDARD "c++0x")
|
|
||||||
else(CXX_C11_REQUESTED AND CXX_C11_SUPPORTED)
|
|
||||||
message(FATAL_ERROR "Unrecognised c++ standard version requested: ${CXX_CXX_STANDARD}")
|
|
||||||
endif(CXX_C11_REQUESTED AND CXX_C11_SUPPORTED)
|
|
||||||
else(CXX_CXX_STANDARD_OVERRIDE)
|
|
||||||
if(CXX_C11_SUPPORTED)
|
|
||||||
message(STATUS "Compiler: C++ standard version 'c++11' selected")
|
|
||||||
set(CXX_USE_CXX_STANDARD "c++11")
|
|
||||||
else(CXX_C11_SUPPORTED)
|
|
||||||
message(STATUS "Compiler: C++ standard version 'c++0x' selected (c++11 not supported)")
|
|
||||||
set(CXX_USE_CXX_STANDARD "c++0x")
|
|
||||||
endif(CXX_C11_SUPPORTED)
|
|
||||||
endif(CXX_CXX_STANDARD_OVERRIDE)
|
|
||||||
|
|
||||||
# Clean targets after change in c++ standard, and remember current standard
|
|
||||||
string(COMPARE EQUAL "${CXX_CXX_STANDARD_LAST}" "" FIRST_CXX_STANDARD)
|
|
||||||
string(COMPARE NOTEQUAL "${CXX_CXX_STANDARD_LAST}" "${CXX_USE_CXX_STANDARD}" DIFFERENT_CXX_STANDARD)
|
|
||||||
set(CXX_CXX_STANDARD_LAST_TEMP "${CXX_CXX_STANDARD_LAST}")
|
|
||||||
set(CXX_CXX_STANDARD_LAST "${CXX_USE_CXX_STANDARD}" CACHE INTERNAL "Internal use - do not modify")
|
|
||||||
if(DIFFERENT_CXX_STANDARD AND NOT FIRST_CXX_STANDARD)
|
|
||||||
execute_process(COMMAND "${CMAKE_BUILD_TOOL}" clean RESULT_VARIABLE CLEANING_RESULT OUTPUT_QUIET ERROR_QUIET)
|
|
||||||
if(CLEANING_RESULT)
|
|
||||||
message(STATUS "Clean previous build because of standard change (was: '${CXX_CXX_STANDARD_LAST_TEMP}') (exit: ${CLEANING_RESULT})")
|
|
||||||
else(CLEANING_RESULT)
|
|
||||||
message(STATUS "Clean previous build because of standard change (was: '${CXX_CXX_STANDARD_LAST_TEMP}')")
|
|
||||||
endif(CLEANING_RESULT)
|
|
||||||
endif(DIFFERENT_CXX_STANDARD AND NOT FIRST_CXX_STANDARD)
|
|
||||||
|
|
||||||
set(CMAKE_CONFIGURATION_TYPES "Release|Debug")
|
|
||||||
string(COMPARE EQUAL "${CMAKE_BUILD_TYPE}" "" EMPTY_BUILD_TYPE)
|
|
||||||
if(EMPTY_BUILD_TYPE)
|
|
||||||
set(CMAKE_BUILD_TYPE "Release")
|
|
||||||
message(STATUS "Build type not set ('Debug' or 'Release') - selecting 'Release'")
|
|
||||||
endif(EMPTY_BUILD_TYPE)
|
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS "-std=${CXX_USE_CXX_STANDARD} -Wall")
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
|
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wextra -DDEBUG")
|
|
||||||
|
|
||||||
|
|
||||||
# Find libgd
|
|
||||||
find_library(LIBGD_LIBRARY gd)
|
|
||||||
find_path(LIBGD_INCLUDE_DIR gd.h)
|
|
||||||
message (STATUS "libgd library: ${LIBGD_LIBRARY}")
|
|
||||||
message (STATUS "libgd headers: ${LIBGD_INCLUDE_DIR}")
|
|
||||||
if(NOT LIBGD_LIBRARY OR NOT LIBGD_INCLUDE_DIR)
|
|
||||||
message(SEND_ERROR "libgd not found!")
|
|
||||||
endif(NOT LIBGD_LIBRARY OR NOT LIBGD_INCLUDE_DIR)
|
|
||||||
|
|
||||||
# Find zlib
|
|
||||||
find_library(ZLIB_LIBRARY z)
|
|
||||||
find_path(ZLIB_INCLUDE_DIR zlib.h)
|
|
||||||
message (STATUS "zlib library: ${ZLIB_LIBRARY}")
|
|
||||||
message (STATUS "zlib headers: ${ZLIB_INCLUDE_DIR}")
|
|
||||||
if(NOT ZLIB_LIBRARY OR NOT ZLIB_INCLUDE_DIR)
|
|
||||||
message(SEND_ERROR "zlib not found!")
|
|
||||||
endif(NOT ZLIB_LIBRARY OR NOT ZLIB_INCLUDE_DIR)
|
|
||||||
|
|
||||||
# Find iconv
|
|
||||||
OPTION(ENABLE_ICONV "Enable character encoding conversion of text written on the map" True)
|
|
||||||
if(ENABLE_ICONV)
|
|
||||||
find_package(Iconv)
|
|
||||||
if(ICONV_FOUND)
|
|
||||||
set(USE_ICONV 1)
|
|
||||||
set(MAPPER_SRCS_ICONV CharEncodingConverterIConv.cpp)
|
|
||||||
message (STATUS "iconv libraries: ${ICONV_LIBRARIES}")
|
|
||||||
else(ICONV_FOUND)
|
|
||||||
message (SEND_ERROR "iconv libraries not found")
|
|
||||||
endif(ICONV_FOUND)
|
|
||||||
else(ENABLE_ICONV)
|
|
||||||
set(USE_ICONV 0)
|
|
||||||
endif(ENABLE_ICONV)
|
|
||||||
|
|
||||||
find_package(PkgConfig)
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
|
|
||||||
# Find database(s)
|
|
||||||
set(USE_SQLITE3 0)
|
|
||||||
set(USE_POSTGRESQL 0)
|
|
||||||
set(USE_LEVELDB 0)
|
|
||||||
set(USE_REDIS 0)
|
|
||||||
|
|
||||||
OPTION(ENABLE_ANY_DATABASE "Enable any available database backends" True)
|
|
||||||
OPTION(ENABLE_ALL_DATABASES "Enable all possible database backends")
|
|
||||||
OPTION(ENABLE_SQLITE3 "Enable sqlite3 backend" True)
|
OPTION(ENABLE_SQLITE3 "Enable sqlite3 backend" True)
|
||||||
OPTION(ENABLE_POSTGRESQL "Enable postgresql backend")
|
OPTION(ENABLE_POSTGRESQL "Enable postgresql backend")
|
||||||
OPTION(ENABLE_LEVELDB "Enable LevelDB backend")
|
OPTION(ENABLE_LEVELDB "Enable LevelDB backend")
|
||||||
OPTION(ENABLE_REDIS "Enable redis backend")
|
OPTION(ENABLE_REDIS "Enable redis backend")
|
||||||
|
|
||||||
# Find sqlite3
|
# Find sqlite3
|
||||||
if(ENABLE_SQLITE3 OR ENABLE_ANY_DATABASE OR ENABLE_ALL_DATABASES)
|
if(ENABLE_SQLITE3)
|
||||||
find_library(SQLITE3_LIBRARY sqlite3)
|
find_library(SQLITE3_LIBRARY sqlite3)
|
||||||
find_path(SQLITE3_INCLUDE_DIR sqlite3.h)
|
find_path(SQLITE3_INCLUDE_DIR sqlite3.h)
|
||||||
message (STATUS "sqlite3 library: ${SQLITE3_LIBRARY}")
|
message (STATUS "sqlite3 library: ${SQLITE3_LIBRARY}")
|
||||||
message (STATUS "sqlite3 headers: ${SQLITE3_INCLUDE_DIR}")
|
message (STATUS "sqlite3 headers: ${SQLITE3_INCLUDE_DIR}")
|
||||||
|
message (STATUS "sqlite3 dll: ${SQLITE3_DLL}")
|
||||||
if(SQLITE3_LIBRARY AND SQLITE3_INCLUDE_DIR)
|
if(SQLITE3_LIBRARY AND SQLITE3_INCLUDE_DIR)
|
||||||
set(USE_SQLITE3 1)
|
set(USE_SQLITE3 1)
|
||||||
message(STATUS "sqlite3 backend enabled")
|
message(STATUS "sqlite3 backend enabled")
|
||||||
include_directories(${SQLITE3_INCLUDE_DIR})
|
include_directories(${SQLITE3_INCLUDE_DIR})
|
||||||
else(SQLITE3_LIBRARY AND SQLITE3_INCLUDE_DIR)
|
else(SQLITE3_LIBRARY AND SQLITE3_INCLUDE_DIR)
|
||||||
set(USE_SQLITE3 0)
|
set(USE_SQLITE3 0)
|
||||||
if(ENABLE_SQLITE3 OR ENABLE_ALL_DATABASES)
|
if(ENABLE_SQLITE3)
|
||||||
message(SEND_ERROR "sqlite3 backend requested but sqlite3 libraries not found!")
|
message(SEND_ERROR "sqlite3 backend requested but sqlite3 libraries not found!")
|
||||||
else(ENABLE_SQLITE3 OR ENABLE_ALL_DATABASES)
|
else(ENABLE_SQLITE3)
|
||||||
message(STATUS "sqlite3 not enabled (sqlite3 libraries and/or headers not found)")
|
message(STATUS "sqlite3 not enabled (sqlite3 libraries and/or headers not found)")
|
||||||
endif(ENABLE_SQLITE3 OR ENABLE_ALL_DATABASES)
|
endif(ENABLE_SQLITE3)
|
||||||
endif(SQLITE3_LIBRARY AND SQLITE3_INCLUDE_DIR)
|
endif(SQLITE3_LIBRARY AND SQLITE3_INCLUDE_DIR)
|
||||||
endif(ENABLE_SQLITE3 OR ENABLE_ANY_DATABASE OR ENABLE_ALL_DATABASES)
|
endif(ENABLE_SQLITE3)
|
||||||
|
|
||||||
# Find postgresql
|
# Find postgresql
|
||||||
if(ENABLE_POSTGRESQL OR ENABLE_ANY_DATABASE OR ENABLE_ALL_DATABASES)
|
if(ENABLE_POSTGRESQL)
|
||||||
find_library(POSTGRESQL_LIBRARY pq)
|
find_library(POSTGRESQL_LIBRARY pq)
|
||||||
find_path(POSTGRESQL_INCLUDE_DIR libpq-fe.h PATH_SUFFIXES postgresql)
|
find_path(POSTGRESQL_INCLUDE_DIR libpq-fe.h PATH_SUFFIXES postgresql)
|
||||||
message (STATUS "postgresql library: ${POSTGRESQL_LIBRARY}")
|
message (STATUS "postgresql library: ${POSTGRESQL_LIBRARY}")
|
||||||
|
@ -198,16 +58,16 @@ if(ENABLE_POSTGRESQL OR ENABLE_ANY_DATABASE OR ENABLE_ALL_DATABASES)
|
||||||
include_directories(${POSTGRESQL_INCLUDE_DIR})
|
include_directories(${POSTGRESQL_INCLUDE_DIR})
|
||||||
else(POSTGRESQL_LIBRARY AND POSTGRESQL_INCLUDE_DIR)
|
else(POSTGRESQL_LIBRARY AND POSTGRESQL_INCLUDE_DIR)
|
||||||
set(USE_POSTGRESQL 0)
|
set(USE_POSTGRESQL 0)
|
||||||
if(ENABLE_POSTGRESQL OR ENABLE_ALL_DATABASES)
|
if(ENABLE_POSTGRESQL)
|
||||||
message(SEND_ERROR "postgresql backend requested but postgresql libraries not found!")
|
message(SEND_ERROR "postgresql backend requested but postgresql libraries not found!")
|
||||||
else(ENABLE_POSTGRESQL OR ENABLE_ALL_DATABASES)
|
else(ENABLE_POSTGRESQL)
|
||||||
message(STATUS "postgresql not enabled (postgresql libraries and/or headers not found)")
|
message(STATUS "postgresql not enabled (postgresql libraries and/or headers not found)")
|
||||||
endif(ENABLE_POSTGRESQL OR ENABLE_ALL_DATABASES)
|
endif(ENABLE_POSTGRESQL)
|
||||||
endif(POSTGRESQL_LIBRARY AND POSTGRESQL_INCLUDE_DIR)
|
endif(POSTGRESQL_LIBRARY AND POSTGRESQL_INCLUDE_DIR)
|
||||||
endif(ENABLE_POSTGRESQL OR ENABLE_ANY_DATABASE OR ENABLE_ALL_DATABASES)
|
endif(ENABLE_POSTGRESQL)
|
||||||
|
|
||||||
# Find leveldb
|
# Find leveldb
|
||||||
if(ENABLE_LEVELDB OR ENABLE_ANY_DATABASE OR ENABLE_ALL_DATABASES)
|
if(ENABLE_LEVELDB)
|
||||||
find_library(LEVELDB_LIBRARY leveldb)
|
find_library(LEVELDB_LIBRARY leveldb)
|
||||||
find_path(LEVELDB_INCLUDE_DIR db.h PATH_SUFFIXES leveldb)
|
find_path(LEVELDB_INCLUDE_DIR db.h PATH_SUFFIXES leveldb)
|
||||||
message (STATUS "LevelDB library: ${LEVELDB_LIBRARY}")
|
message (STATUS "LevelDB library: ${LEVELDB_LIBRARY}")
|
||||||
|
@ -218,13 +78,13 @@ if(ENABLE_LEVELDB OR ENABLE_ANY_DATABASE OR ENABLE_ALL_DATABASES)
|
||||||
include_directories(${LEVELDB_INCLUDE_DIR})
|
include_directories(${LEVELDB_INCLUDE_DIR})
|
||||||
else(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
|
else(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
|
||||||
set(USE_LEVELDB 0)
|
set(USE_LEVELDB 0)
|
||||||
if(ENABLE_LEVELDB OR ENABLE_ALL_DATABASES)
|
if(ENABLE_LEVELDB)
|
||||||
message(SEND_ERROR "leveldb backend requested but leveldb libraries not found!")
|
message(SEND_ERROR "leveldb backend requested but leveldb libraries not found!")
|
||||||
else(ENABLE_LEVELDB OR ENABLE_ALL_DATABASES)
|
else(ENABLE_LEVELDB)
|
||||||
message(STATUS "leveldb not enabled (leveldb libraries and/or headers not found)")
|
message(STATUS "leveldb not enabled (leveldb libraries and/or headers not found)")
|
||||||
endif(ENABLE_LEVELDB OR ENABLE_ALL_DATABASES)
|
endif(ENABLE_LEVELDB)
|
||||||
endif(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
|
endif(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
|
||||||
endif(ENABLE_LEVELDB OR ENABLE_ANY_DATABASE OR ENABLE_ALL_DATABASES)
|
endif(ENABLE_LEVELDB)
|
||||||
|
|
||||||
# Find redis
|
# Find redis
|
||||||
if(ENABLE_REDIS OR ENABLE_ANY_DATABASE OR ENABLE_ALL_DATABASES)
|
if(ENABLE_REDIS OR ENABLE_ANY_DATABASE OR ENABLE_ALL_DATABASES)
|
||||||
|
@ -246,353 +106,20 @@ if(ENABLE_REDIS OR ENABLE_ANY_DATABASE OR ENABLE_ALL_DATABASES)
|
||||||
endif(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
|
endif(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
|
||||||
endif(ENABLE_REDIS OR ENABLE_ANY_DATABASE OR ENABLE_ALL_DATABASES)
|
endif(ENABLE_REDIS OR ENABLE_ANY_DATABASE OR ENABLE_ALL_DATABASES)
|
||||||
|
|
||||||
if(NOT USE_SQLITE3 AND NOT USE_POSTGRESQL AND NOT USE_LEVELDB AND NOT USE_REDIS)
|
# Schließen Sie Unterprojekte ein.
|
||||||
message(SEND_ERROR "No database backends are configured, or none could be found")
|
add_subdirectory ("wingetopt")
|
||||||
endif(NOT USE_SQLITE3 AND NOT USE_POSTGRESQL AND NOT USE_LEVELDB AND NOT USE_REDIS)
|
add_subdirectory ("Minetestmapper")
|
||||||
|
|
||||||
# Determine whether there is a libstdc++ ABI incompatibility.
|
message(STATUS "VCPKG_APPLOCAL_DEPS: ${VCPKG_APPLOCAL_DEPS}")
|
||||||
# Currently only needed for leveldb.
|
|
||||||
set(CPP_ABI_STDSTRING_OK 1)
|
|
||||||
if(USE_LEVELDB)
|
|
||||||
# try_compile does not remove the temporary build directory, so put it in CMakeFiles...
|
|
||||||
# Also: use absolute paths; cmake chokes on relative paths :-(
|
|
||||||
# AARGH! try_compile does not understand the INCLUDE_DIRECTORIES directive.
|
|
||||||
try_compile(CPP_ABI_STDSTRING_RESULT
|
|
||||||
"${CMAKE_HOME_DIRECTORY}/CMakeFiles/CMakeTmp/abi-stdstring-test"
|
|
||||||
"${CMAKE_HOME_DIRECTORY}/cmake/abi-stdstring.cpp"
|
|
||||||
LINK_LIBRARIES ${LEVELDB_LIBRARY})
|
|
||||||
#INCLUDE_DIRECTORIES ${LEVELDB_INCLUDE_DIR}
|
|
||||||
if(NOT CPP_ABI_STDSTRING_RESULT)
|
|
||||||
set(CPP_ABI_STDSTRING_OK 0)
|
|
||||||
message(STATUS "C++ library ABI mismatch for std::string. Enabling workaround - this may affect functionality")
|
|
||||||
endif(NOT CPP_ABI_STDSTRING_RESULT)
|
|
||||||
endif(USE_LEVELDB)
|
|
||||||
|
|
||||||
include_directories(
|
configure_file(
|
||||||
"${PROJECT_BINARY_DIR}"
|
"${PROJECT_SOURCE_DIR}/version.h.in"
|
||||||
"${CMAKE_CURRENT_SOURCE_DIR}"
|
"${PROJECT_SOURCE_DIR}/Minetestmapper/version.h"
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}"
|
|
||||||
${LIBGD_INCLUDE_DIR}
|
|
||||||
${ZLIB_INCLUDE_DIR}
|
|
||||||
${ICONV_INCLUDE_DIR}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(mapper_SRCS
|
|
||||||
PixelAttributes.cpp
|
|
||||||
PlayerAttributes.cpp
|
|
||||||
TileGenerator.cpp
|
|
||||||
ZlibDecompressor.cpp
|
|
||||||
Color.cpp
|
|
||||||
Settings.cpp
|
|
||||||
BlockPos.cpp
|
|
||||||
mapper.cpp
|
|
||||||
CharEncodingConverter.cpp
|
|
||||||
PaintEngine_libgd.cpp
|
|
||||||
${MAPPER_SRCS_ICONV}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(LINK_LIBRARIES
|
|
||||||
minetestmapper
|
|
||||||
${LIBGD_LIBRARY}
|
|
||||||
${ZLIB_LIBRARY}
|
|
||||||
${ICONV_LIBRARIES}
|
|
||||||
)
|
|
||||||
|
|
||||||
if(USE_SQLITE3)
|
|
||||||
set(mapper_SRCS ${mapper_SRCS} db-sqlite3.cpp)
|
|
||||||
set(LINK_LIBRARIES ${LINK_LIBRARIES} ${SQLITE3_LIBRARY})
|
|
||||||
endif(USE_SQLITE3)
|
|
||||||
|
|
||||||
if(USE_POSTGRESQL)
|
|
||||||
set(mapper_SRCS ${mapper_SRCS} db-postgresql.cpp)
|
|
||||||
set(LINK_LIBRARIES ${LINK_LIBRARIES} ${POSTGRESQL_LIBRARY})
|
|
||||||
endif(USE_POSTGRESQL)
|
|
||||||
|
|
||||||
if(USE_LEVELDB)
|
|
||||||
set(mapper_SRCS ${mapper_SRCS} db-leveldb.cpp)
|
|
||||||
set(LINK_LIBRARIES ${LINK_LIBRARIES} ${LEVELDB_LIBRARY})
|
|
||||||
endif(USE_LEVELDB)
|
|
||||||
|
|
||||||
if(USE_REDIS)
|
|
||||||
set(mapper_SRCS ${mapper_SRCS} db-redis.cpp)
|
|
||||||
set(LINK_LIBRARIES ${LINK_LIBRARIES} ${REDIS_LIBRARY})
|
|
||||||
endif(USE_REDIS)
|
|
||||||
|
|
||||||
add_executable(minetestmapper
|
|
||||||
${mapper_SRCS}
|
|
||||||
)
|
|
||||||
target_link_libraries(
|
|
||||||
${LINK_LIBRARIES}
|
|
||||||
)
|
|
||||||
|
|
||||||
add_subdirectory(doc)
|
|
||||||
|
|
||||||
# CPack
|
|
||||||
|
|
||||||
file(GLOB META_FILES RELATIVE "${CMAKE_HOME_DIRECTORY}" AUTHORS COPYING LICENSE.* README.rst)
|
|
||||||
file(GLOB DOC_RST_FILES RELATIVE "${CMAKE_HOME_DIRECTORY}" doc/*.rst)
|
|
||||||
string(REPLACE ".rst" ".html" DOC_HTML_FILES "${DOC_RST_FILES}")
|
|
||||||
file(GLOB DOC_IMAGE_FILES RELATIVE "${CMAKE_HOME_DIRECTORY}" doc/images/*)
|
|
||||||
if(USE_RST2HTML)
|
|
||||||
set(DOC_HTML_FILES_PACKAGE "${DOC_HTML_FILES}")
|
|
||||||
else(USE_RST2HTML)
|
|
||||||
set(DOC_HTML_FILES_PACKAGE "")
|
|
||||||
endif(USE_RST2HTML)
|
|
||||||
set(COLORS_FILES
|
|
||||||
colors.txt
|
|
||||||
heightmap-nodes.txt
|
|
||||||
heightmap-colors.txt
|
|
||||||
heightmap-colors-rainbow.txt
|
|
||||||
colors-average-alpha.txt
|
|
||||||
colors-cumulative-alpha.txt
|
|
||||||
)
|
|
||||||
set(DUMPNODES_FILES
|
|
||||||
dumpnodes/README.dumpnodes
|
|
||||||
dumpnodes/init.lua
|
|
||||||
)
|
|
||||||
set(DUMPNODES_MOD_FILES
|
|
||||||
dumpnodes/init.lua
|
|
||||||
)
|
|
||||||
set(DUMPNODES_SCRIPTS
|
|
||||||
dumpnodes/avgcolor.py
|
|
||||||
dumpnodes/mkcolors
|
|
||||||
)
|
|
||||||
|
|
||||||
set(PACKAGING_VERSION "1" CACHE STRING "Version of the packaging - '1' by default; increment when building a new package from the same sources (i.e. from the same commit)")
|
|
||||||
#set(CPACK_SET_DESTDIR ON)
|
|
||||||
set(CPACK_GIT_VERSION ${GIT_VERSION})
|
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Map generator for Minetest")
|
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_HOME_DIRECTORY}/package-description.txt")
|
|
||||||
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
|
|
||||||
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
|
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH ${PACKAGING_VERSION})
|
|
||||||
set(CPACK_PACKAGE_VENDOR "Minetestmapper")
|
|
||||||
set(CPACK_PACKAGE_CONTACT "(Unknown)")
|
|
||||||
set(CPACK_PACKAGE_URL "https://github.com/Rogier-5/minetest-mapper-cpp")
|
|
||||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${VERSION_STRING}")
|
|
||||||
set(CPACK_PACKAGE_EXECUTABLES minetestmapper)
|
|
||||||
set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/CMakeCPackLists.txt")
|
|
||||||
|
|
||||||
# Make install as root leaves a root-owned file behind that interferes
|
|
||||||
# with package creation - remove it.
|
|
||||||
if(EXISTS install_manifest.txt)
|
|
||||||
file(REMOVE install_manifest.txt)
|
|
||||||
endif(EXISTS install_manifest.txt)
|
|
||||||
|
|
||||||
set(ARCHIVE_PACKAGE_NAME "" CACHE STRING "Name of the .zip / .tar.gz archive package to be created by cpack (without extension)")
|
|
||||||
if(NOT WIN32)
|
|
||||||
set(CREATE_FLAT_PACKAGE TRUE CACHE BOOL "Create the .tar.gz package without included directory hierarchy (must be OFF for 'make install' and to create .deb, .rpm packages)")
|
|
||||||
endif(NOT WIN32)
|
|
||||||
|
|
||||||
if(WIN32)
|
|
||||||
set(PACKAGING_FLAT 1)
|
|
||||||
set(CPACK_GENERATOR ZIP)
|
|
||||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}.${CPACK_PACKAGE_VERSION_PATCH}-win32")
|
|
||||||
|
|
||||||
install(FILES ${META_FILES} DESTINATION ".")
|
|
||||||
install(FILES ${COLORS_FILES} DESTINATION ".")
|
|
||||||
install(FILES ${DOC_RST_FILES} DESTINATION "doc")
|
|
||||||
install(FILES ${DOC_HTML_FILES_PACKAGE} DESTINATION "doc")
|
|
||||||
install(FILES ${DOC_IMAGE_FILES} DESTINATION "doc/images")
|
|
||||||
install(FILES ${DUMPNODES_FILES} DESTINATION "dumpnodes")
|
|
||||||
install(PROGRAMS ${DUMPNODES_SCRIPTS} DESTINATION "dumpnodes")
|
|
||||||
install(PROGRAMS "${PROJECT_BINARY_DIR}/minetestmapper.exe" DESTINATION ".")
|
|
||||||
|
|
||||||
elseif(CREATE_FLAT_PACKAGE)
|
|
||||||
set(PACKAGING_FLAT 1)
|
|
||||||
message(WARNING "CREATE_FLAT_PACKAGE is set ON: creating a flat package.\nFor 'make install', .deb and .rpm packages, CREATE_FLAT_PACKAGE must be OFF")
|
|
||||||
set(CPACK_GENERATOR TGZ)
|
|
||||||
set(CPACK_SOURCE_GENERATOR TGZ)
|
|
||||||
if(ARCHIVE_PACKAGE_NAME)
|
|
||||||
set(CPACK_TGZ_PACKAGE_FILE_NAME "${ARCHIVE_PACKAGE_NAME}")
|
|
||||||
else(ARCHIVE_PACKAGE_NAME)
|
|
||||||
if (APPLE)
|
|
||||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_MAJOR}-MacOSX-flat")
|
|
||||||
else(APPLE)
|
|
||||||
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_MAJOR}-Linux-flat")
|
|
||||||
endif(APPLE)
|
|
||||||
endif(ARCHIVE_PACKAGE_NAME)
|
|
||||||
message(STATUS "Flat archive package name: ${CPACK_PACKAGE_FILE_NAME}.tar.gz")
|
|
||||||
|
|
||||||
install(FILES ${META_FILES} DESTINATION ".")
|
|
||||||
install(FILES ${COLORS_FILES} DESTINATION ".")
|
|
||||||
install(FILES ${DOC_RST_FILES} DESTINATION "doc")
|
|
||||||
install(FILES ${DOC_HTML_FILES_PACKAGE} DESTINATION "doc")
|
|
||||||
install(FILES ${DOC_IMAGE_FILES} DESTINATION "doc/images")
|
|
||||||
install(FILES ${DUMPNODES_FILES} DESTINATION "dumpnodes")
|
|
||||||
install(PROGRAMS ${DUMPNODES_SCRIPTS} DESTINATION "dumpnodes")
|
|
||||||
install(PROGRAMS "${PROJECT_BINARY_DIR}/minetestmapper" DESTINATION ".")
|
|
||||||
|
|
||||||
else(WIN32)
|
|
||||||
set(PACKAGING_FLAT 0)
|
|
||||||
set(CPACK_GENERATOR TGZ)
|
|
||||||
set(CPACK_SOURCE_GENERATOR TGZ)
|
|
||||||
|
|
||||||
# Determine binary architecture
|
|
||||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -v
|
|
||||||
RESULT_VARIABLE VERSION_EXIT
|
|
||||||
OUTPUT_VARIABLE PACKAGE_TARGET_ARCHITECTURE
|
|
||||||
ERROR_VARIABLE PACKAGE_TARGET_ARCHITECTURE
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
string(REGEX REPLACE ".*[\n\r]Target:[ \t\n\r]*([^ \t\n\r]+).*" "\\1" PACKAGE_TARGET_ARCHITECTURE "${PACKAGE_TARGET_ARCHITECTURE}")
|
|
||||||
if(VERSION_EXIT)
|
|
||||||
message(FATAL_ERROR "Could not determine target architecture")
|
|
||||||
elseif(PACKAGE_TARGET_ARCHITECTURE MATCHES "[ \t\n\r]")
|
|
||||||
message(FATAL_ERROR "Could not determine target architecture - error parsing compiler messages")
|
|
||||||
else(VERSION_EXIT)
|
|
||||||
message(STATUS "Target architecture: ${PACKAGE_TARGET_ARCHITECTURE}")
|
|
||||||
endif(VERSION_EXIT)
|
|
||||||
|
|
||||||
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
|
||||||
set(CPACK_TGZ_LOCATION_STRING "usr")
|
|
||||||
elseif(CMAKE_INSTALL_PREFIX STREQUAL "/usr/local")
|
|
||||||
set(CPACK_TGZ_LOCATION_STRING "usrlocal")
|
|
||||||
else(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
|
||||||
set(CPACK_TGZ_LOCATION_STRING "custom")
|
|
||||||
endif(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
|
||||||
|
|
||||||
# default package name (i.e. for .tar.gz)
|
|
||||||
if(ARCHIVE_PACKAGE_NAME)
|
|
||||||
set(CPACK_TGZ_PACKAGE_FILE_NAME "${ARCHIVE_PACKAGE_NAME}")
|
|
||||||
else(ARCHIVE_PACKAGE_NAME)
|
|
||||||
set(CPACK_TGZ_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}.${CPACK_PACKAGE_VERSION_PATCH}_${PACKAGE_TARGET_ARCHITECTURE}_${CPACK_TGZ_LOCATION_STRING}")
|
|
||||||
endif(ARCHIVE_PACKAGE_NAME)
|
|
||||||
message(STATUS "Archive package name: ${CPACK_TGZ_PACKAGE_FILE_NAME}.tar.gz")
|
|
||||||
|
|
||||||
install(FILES ${META_FILES} DESTINATION "share/doc/${PROJECT_NAME}" COMPONENT mapper)
|
|
||||||
install(FILES ${COLORS_FILES} DESTINATION "share/games/${PROJECT_NAME}" COMPONENT mapper)
|
|
||||||
install(FILES ${DOC_RST_FILES} DESTINATION "share/doc/${PROJECT_NAME}/doc" COMPONENT mapper)
|
|
||||||
install(FILES ${DOC_HTML_FILES_PACKAGE} DESTINATION "share/doc/${PROJECT_NAME}/doc" COMPONENT mapper)
|
|
||||||
install(FILES ${DOC_IMAGE_FILES} DESTINATION "share/doc/${PROJECT_NAME}/doc/images" COMPONENT mapper)
|
|
||||||
install(FILES ${DUMPNODES_FILES} DESTINATION "share/doc/${PROJECT_NAME}/dumpnodes" COMPONENT mapper)
|
|
||||||
install(PROGRAMS ${DUMPNODES_SCRIPTS} DESTINATION "share/doc/${PROJECT_NAME}/dumpnodes" COMPONENT mapper)
|
|
||||||
install(TARGETS minetestmapper RUNTIME DESTINATION bin COMPONENT mapper)
|
|
||||||
|
|
||||||
if(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
|
||||||
# Require install prefix to be /usr when building .deb and .rpm packages
|
|
||||||
# (else minetestmapper will not find the default colors.txt file)
|
|
||||||
|
|
||||||
# When installing into /usr, assume minetest is also installed in /usr.
|
|
||||||
install(FILES ${DUMPNODES_MOD_FILES} DESTINATION "share/games/minetest/mods/dumpnodes" COMPONENT mapper)
|
|
||||||
|
|
||||||
# .deb settings
|
|
||||||
# Debian package building needs xxxxx, but cpack doesn't check for it first...
|
|
||||||
find_program(DPKG_AVAILABLE "dpkg")
|
|
||||||
# Fakeroot is needed to get correct file ownership (root/root) in the package
|
|
||||||
find_program(FAKEROOT_AVAILABLE "fakeroot")
|
|
||||||
if(DPKG_AVAILABLE AND FAKEROOT_AVAILABLE)
|
|
||||||
message(STATUS "dpkg and fakeroot found - enabling .deb package generation")
|
|
||||||
set(CPACK_GENERATOR ${CPACK_GENERATOR} DEB)
|
|
||||||
|
|
||||||
# Cmake does not support delayed variable expansion. No alternative but to compute things ourselves :-((((
|
|
||||||
# Maybe we should be checking PACKAGE_TARGET_ARCHITECTURE as well (and add specific code for every architecture :-()
|
|
||||||
# (on a multiarch system, the only compiler installed may not be the native one...)
|
|
||||||
execute_process(COMMAND dpkg --print-architecture
|
|
||||||
RESULT_VARIABLE VERSION_EXIT
|
|
||||||
OUTPUT_VARIABLE DEBIAN_PACKAGE_ARCHITECTURE
|
|
||||||
ERROR_QUIET
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
if(VERSION_EXIT)
|
|
||||||
message(FATAL_ERROR "Could not determine target architecture for debian package")
|
|
||||||
else(VERSION_EXIT)
|
|
||||||
message(STATUS "Debian package architecture: ${DEBIAN_PACKAGE_ARCHITECTURE}")
|
|
||||||
endif(VERSION_EXIT)
|
|
||||||
|
|
||||||
set(CPACK_DEBIAN_PACKAGE_FILE_NAME "${PROJECT_NAME}_${VERSION_STRING}-${CPACK_PACKAGE_VERSION_PATCH}_${DEBIAN_PACKAGE_ARCHITECTURE}")
|
|
||||||
message(STATUS "Debian package name: ${CPACK_DEBIAN_PACKAGE_FILE_NAME}.deb")
|
|
||||||
set(CPACK_DEBIAN_PACKAGE_VERSION "${VERSION_STRING}-${CPACK_PACKAGE_VERSION_PATCH}")
|
|
||||||
file(READ "${CPACK_PACKAGE_DESCRIPTION_FILE}" CPACK_DEBIAN_PACKAGE_DESCRIPTION)
|
|
||||||
# Unfortunately, cpack does not use (and adequately format) the description file - must do it ourselves
|
|
||||||
string(STRIP "${CPACK_DEBIAN_PACKAGE_DESCRIPTION}" CPACK_DEBIAN_PACKAGE_DESCRIPTION)
|
|
||||||
string(REGEX REPLACE "\n" "\n " CPACK_DEBIAN_PACKAGE_DESCRIPTION " ${CPACK_DEBIAN_PACKAGE_DESCRIPTION}")
|
|
||||||
string(REGEX REPLACE "(^ |\n )[ \t]*\n" "\\1.\n" CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_PACKAGE_DESCRIPTION}")
|
|
||||||
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}\n${CPACK_DEBIAN_PACKAGE_DESCRIPTION}")
|
|
||||||
set(CPACK_DEBIAN_PACKAGE_ENHANCES "minetest")
|
|
||||||
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS 1)
|
|
||||||
set(CPACK_DEBIAN_PACKAGE_SECTION "games")
|
|
||||||
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CPACK_PACKAGE_URL}")
|
|
||||||
else(DPKG_AVAILABLE AND FAKEROOT_AVAILABLE)
|
|
||||||
if(NOT DPKG_AVAILABLE)
|
|
||||||
message(STATUS "dpkg not found - no .deb package will be generated")
|
|
||||||
endif(NOT DPKG_AVAILABLE)
|
|
||||||
if(NOT FAKEROOT_AVAILABLE)
|
|
||||||
message(STATUS "fakeroot not found - no .deb package will be generated")
|
|
||||||
endif(NOT FAKEROOT_AVAILABLE)
|
|
||||||
endif(DPKG_AVAILABLE AND FAKEROOT_AVAILABLE)
|
|
||||||
unset(FAKEROOT_AVAILABLE CACHE)
|
|
||||||
unset(DPKG_AVAILABLE CACHE)
|
|
||||||
|
|
||||||
# .rpm settings
|
|
||||||
# RPM package building needs rpmbuild, but cpack doesn't check for it first...
|
|
||||||
find_program(RPM_AVAILABLE "rpmbuild")
|
|
||||||
if(RPM_AVAILABLE)
|
|
||||||
execute_process(COMMAND rpm -q rpm
|
|
||||||
RESULT_VARIABLE RPM_VERSION_EXIT
|
|
||||||
OUTPUT_VARIABLE RPMCOMMAND_PACKAGE_VERSION
|
|
||||||
ERROR_QUIET
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
if(RPM_VERSION_EXIT)
|
|
||||||
if(NOT RPMCOMMAND_PACKAGE_VERSION STREQUAL "package rpm is not installed")
|
|
||||||
message(FATAL_ERROR "Could not determine version of installed rpm package")
|
|
||||||
endif(NOT RPMCOMMAND_PACKAGE_VERSION STREQUAL "package rpm is not installed")
|
|
||||||
endif(RPM_VERSION_EXIT)
|
|
||||||
endif(RPM_AVAILABLE)
|
|
||||||
if(RPM_AVAILABLE AND NOT RPM_VERSION_EXIT)
|
|
||||||
message(STATUS "rpmbuild found - enabling .rpm package generation")
|
|
||||||
set(CPACK_GENERATOR ${CPACK_GENERATOR} RPM)
|
|
||||||
|
|
||||||
if(RPM_VERSION_EXIT)
|
|
||||||
message(FATAL_ERROR "Could not determine version of installed rpm package")
|
|
||||||
else(RPM_VERSION_EXIT)
|
|
||||||
# Fedora sample: rpm-4.13.0-0.rc1.13.fc23.x86_64
|
|
||||||
# OpenSuse sample: rpm-4.12.0.1-13.1.x86_64
|
|
||||||
string(REGEX MATCH "(\\.((fc|el)[0-9]+))?\\.([^.]+)$" MATCH_RESULT "${RPMCOMMAND_PACKAGE_VERSION}")
|
|
||||||
if(CMAKE_MATCH_2 STREQUAL "")
|
|
||||||
set(CPACK_RPM_DIST "")
|
|
||||||
else(CMAKE_MATCH_2 STREQUAL "")
|
|
||||||
set(CPACK_RPM_DIST ".${CMAKE_MATCH_2}")
|
|
||||||
endif(CMAKE_MATCH_2 STREQUAL "")
|
|
||||||
set(RPM_PACKAGE_ARCHITECTURE "${CMAKE_MATCH_4}")
|
|
||||||
string(REGEX MATCH "${RPM_PACKAGE_ARCHITECTURE}" MATCH_RESULT "${PACKAGE_TARGET_ARCHITECTURE}")
|
|
||||||
if(NOT "${MATCH_RESULT}" STREQUAL "${RPM_PACKAGE_ARCHITECTURE}")
|
|
||||||
set(RPM_PACKAGE_ARCHITECTURE "${PACKAGE_TARGET_ARCHITECTURE}")
|
|
||||||
endif()
|
|
||||||
endif(RPM_VERSION_EXIT)
|
|
||||||
message(STATUS "Rpm distribution: ${CPACK_RPM_DIST}")
|
|
||||||
message(STATUS "Rpm package architecture: ${RPM_PACKAGE_ARCHITECTURE}")
|
|
||||||
|
|
||||||
string(REPLACE "-" "." RPM_VERSION_STRING "${VERSION_STRING}")
|
|
||||||
set(CPACK_RPM_PACKAGE_FILE_NAME "${PROJECT_NAME}-${RPM_VERSION_STRING}.${CPACK_PACKAGE_VERSION_PATCH}${CPACK_RPM_DIST}.${RPM_PACKAGE_ARCHITECTURE}")
|
|
||||||
message(STATUS "Rpm package name: ${CPACK_RPM_PACKAGE_FILE_NAME}.rpm")
|
|
||||||
set(CPACK_RPM_PACKAGE_VERSION "${RPM_VERSION_STRING}.${CPACK_PACKAGE_VERSION_PATCH}${CPACK_RPM_DIST}")
|
|
||||||
set(CPACK_RPM_PACKAGE_GROUP "Amusements/Games")
|
|
||||||
set(CPACK_RPM_PACKAGE_LICENSE "GPLv2.1+")
|
|
||||||
set(CPACK_RPM_PACKAGE_URL "${CPACK_PACKAGE_URL}")
|
|
||||||
elseif(RPM_VERSION_EXIT)
|
|
||||||
message(STATUS "rpm is installed, but not the native package manager - no .rpm package will be generated")
|
|
||||||
else(RPM_AVAILABLE AND NOT RPM_VERSION_EXIT)
|
|
||||||
message(STATUS "rpmbuild not found - no .rpm package will be generated")
|
|
||||||
endif(RPM_AVAILABLE AND NOT RPM_VERSION_EXIT)
|
|
||||||
unset(RPM_AVAILABLE CACHE)
|
|
||||||
else(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
|
||||||
message(STATUS "Install prefix is not '/usr' - not building .deb / .rpm packages")
|
|
||||||
endif(CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
|
||||||
|
|
||||||
endif(WIN32)
|
|
||||||
|
|
||||||
include(CPack)
|
|
||||||
|
|
||||||
# DO this near the end - to make sure all variables have been computed
|
|
||||||
# and are final.
|
|
||||||
set(INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
|
|
||||||
set(BUILD_CONFIG_GENTOOL CMake)
|
|
||||||
# CMake does not have a date format specifier for timezone...
|
|
||||||
execute_process(COMMAND date -R RESULT_VARIABLE DATE_EXITVAL OUTPUT_VARIABLE BUILD_CONFIG_GENDATE ERROR_FILE /dev/null OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
if(DATE_EXITVAL)
|
|
||||||
message(FATAL_ERROR "Failed to run command 'date -R'")
|
|
||||||
endif(DATE_EXITVAL)
|
|
||||||
configure_file(
|
configure_file(
|
||||||
"${PROJECT_SOURCE_DIR}/build_config.h.in"
|
"${PROJECT_SOURCE_DIR}/build_config.h.in"
|
||||||
"${PROJECT_BINARY_DIR}/build_config.h"
|
"${PROJECT_SOURCE_DIR}/Minetestmapper/build_config.h"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# build a CPack driven installer package
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
{
|
||||||
|
// Informationen zu dieser Datei finden Sie unter https://go.microsoft.com//fwlink//?linkid=834763.
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "x86-Debug",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"configurationType": "Debug",
|
||||||
|
"inheritEnvironments": [ "msvc_x86" ],
|
||||||
|
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||||
|
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||||
|
"cmakeCommandArgs": "",
|
||||||
|
"buildCommandArgs": "-v",
|
||||||
|
"ctestCommandArgs": "",
|
||||||
|
"variables": [
|
||||||
|
{
|
||||||
|
"name": "CMAKE_TOOLCHAIN_FILE",
|
||||||
|
"value": "D:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x86-Release",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"configurationType": "RelWithDebInfo",
|
||||||
|
"inheritEnvironments": [ "msvc_x86" ],
|
||||||
|
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||||
|
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||||
|
"cmakeCommandArgs": "",
|
||||||
|
"buildCommandArgs": "-v",
|
||||||
|
"ctestCommandArgs": "",
|
||||||
|
"variables": [
|
||||||
|
{
|
||||||
|
"name": "CMAKE_TOOLCHAIN_FILE",
|
||||||
|
"value": "D:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x64-Debug",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"configurationType": "Debug",
|
||||||
|
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||||
|
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||||
|
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||||
|
"cmakeCommandArgs": "",
|
||||||
|
"buildCommandArgs": "-v",
|
||||||
|
"ctestCommandArgs": "",
|
||||||
|
"variables": [
|
||||||
|
{
|
||||||
|
"name": "CMAKE_TOOLCHAIN_FILE",
|
||||||
|
"value": "D:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x64-Release",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"configurationType": "RelWithDebInfo",
|
||||||
|
"inheritEnvironments": [ "msvc_x64_x64" ],
|
||||||
|
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||||
|
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||||
|
"cmakeCommandArgs": "",
|
||||||
|
"buildCommandArgs": "-v",
|
||||||
|
"ctestCommandArgs": "",
|
||||||
|
"variables": [
|
||||||
|
{
|
||||||
|
"name": "CMAKE_TOOLCHAIN_FILE",
|
||||||
|
"value": "D:\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Linux-Debug",
|
||||||
|
"generator": "Unix Makefiles",
|
||||||
|
"remoteMachineName": "${defaultRemoteMachineName}",
|
||||||
|
"configurationType": "Debug",
|
||||||
|
"remoteCMakeListsRoot": "/var/tmp/src/${workspaceHash}/${name}",
|
||||||
|
"cmakeExecutable": "/usr/local/bin/cmake",
|
||||||
|
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||||
|
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||||
|
"remoteBuildRoot": "/var/tmp/build/${workspaceHash}/build/${name}",
|
||||||
|
"remoteInstallRoot": "/var/tmp/build/${workspaceHash}/install/${name}",
|
||||||
|
"remoteCopySources": true,
|
||||||
|
"remoteCopySourcesOutputVerbosity": "Normal",
|
||||||
|
"remoteCopySourcesConcurrentCopies": "10",
|
||||||
|
"remoteCopySourcesMethod": "sftp",
|
||||||
|
"cmakeCommandArgs": "",
|
||||||
|
"buildCommandArgs": "",
|
||||||
|
"ctestCommandArgs": "",
|
||||||
|
"inheritEnvironments": [ "linux-x64" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Linux-Release",
|
||||||
|
"generator": "Unix Makefiles",
|
||||||
|
"remoteMachineName": "${defaultRemoteMachineName}",
|
||||||
|
"configurationType": "Release",
|
||||||
|
"remoteCMakeListsRoot": "/var/tmp/src/${workspaceHash}/${name}",
|
||||||
|
"cmakeExecutable": "/usr/local/bin/cmake",
|
||||||
|
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||||
|
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||||
|
"remoteBuildRoot": "/var/tmp/build/${workspaceHash}/build/${name}",
|
||||||
|
"remoteInstallRoot": "/var/tmp/build/${workspaceHash}/install/${name}",
|
||||||
|
"remoteCopySources": true,
|
||||||
|
"remoteCopySourcesOutputVerbosity": "Normal",
|
||||||
|
"remoteCopySourcesConcurrentCopies": "10",
|
||||||
|
"remoteCopySourcesMethod": "sftp",
|
||||||
|
"cmakeCommandArgs": "",
|
||||||
|
"buildCommandArgs": "",
|
||||||
|
"ctestCommandArgs": "",
|
||||||
|
"inheritEnvironments": [ "linux-x64" ]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,22 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2015 Toni Rönkkö
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
The file include/dirent.h was taken at 29.12.2015 from https://github.com/tronkko/dirent
|
|
||||||
Its licened under MIT license. See the LICENSE file for details.
|
|
||||||
|
|
||||||
|
|
||||||
There are some reasons why foreign code is included here:
|
|
||||||
* To avoid build steps like "Copy file x from http:// and place it in direcory y ..." and so on.
|
|
||||||
* Nobody can give a guaranty that the source from the Internet are still aviable in some years.
|
|
||||||
Even github repos can be deleted.
|
|
|
@ -1,917 +0,0 @@
|
||||||
/*
|
|
||||||
* Dirent interface for Microsoft Visual Studio
|
|
||||||
* Version 1.21
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006-2012 Toni Ronkko
|
|
||||||
* This file is part of dirent. Dirent may be freely distributed
|
|
||||||
* under the MIT license. For all details and documentation, see
|
|
||||||
* https://github.com/tronkko/dirent
|
|
||||||
*/
|
|
||||||
#ifndef DIRENT_H
|
|
||||||
#define DIRENT_H
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Define architecture flags so we don't need to include windows.h.
|
|
||||||
* Avoiding windows.h makes it simpler to use windows sockets in conjunction
|
|
||||||
* with dirent.h.
|
|
||||||
*/
|
|
||||||
#if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(_M_IX86)
|
|
||||||
# define _X86_
|
|
||||||
#endif
|
|
||||||
#if !defined(_68K_) && !defined(_MPPC_) && !defined(_X86_) && !defined(_IA64_) && !defined(_AMD64_) && defined(_M_AMD64)
|
|
||||||
#define _AMD64_
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <windef.h>
|
|
||||||
#include <winbase.h>
|
|
||||||
#include <wchar.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
/* Indicates that d_type field is available in dirent structure */
|
|
||||||
#define _DIRENT_HAVE_D_TYPE
|
|
||||||
|
|
||||||
/* Indicates that d_namlen field is available in dirent structure */
|
|
||||||
#define _DIRENT_HAVE_D_NAMLEN
|
|
||||||
|
|
||||||
/* Entries missing from MSVC 6.0 */
|
|
||||||
#if !defined(FILE_ATTRIBUTE_DEVICE)
|
|
||||||
# define FILE_ATTRIBUTE_DEVICE 0x40
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* File type and permission flags for stat(), general mask */
|
|
||||||
#if !defined(S_IFMT)
|
|
||||||
# define S_IFMT _S_IFMT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Directory bit */
|
|
||||||
#if !defined(S_IFDIR)
|
|
||||||
# define S_IFDIR _S_IFDIR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Character device bit */
|
|
||||||
#if !defined(S_IFCHR)
|
|
||||||
# define S_IFCHR _S_IFCHR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Pipe bit */
|
|
||||||
#if !defined(S_IFFIFO)
|
|
||||||
# define S_IFFIFO _S_IFFIFO
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Regular file bit */
|
|
||||||
#if !defined(S_IFREG)
|
|
||||||
# define S_IFREG _S_IFREG
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Read permission */
|
|
||||||
#if !defined(S_IREAD)
|
|
||||||
# define S_IREAD _S_IREAD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Write permission */
|
|
||||||
#if !defined(S_IWRITE)
|
|
||||||
# define S_IWRITE _S_IWRITE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Execute permission */
|
|
||||||
#if !defined(S_IEXEC)
|
|
||||||
# define S_IEXEC _S_IEXEC
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Pipe */
|
|
||||||
#if !defined(S_IFIFO)
|
|
||||||
# define S_IFIFO _S_IFIFO
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Block device */
|
|
||||||
#if !defined(S_IFBLK)
|
|
||||||
# define S_IFBLK 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Link */
|
|
||||||
#if !defined(S_IFLNK)
|
|
||||||
# define S_IFLNK 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Socket */
|
|
||||||
#if !defined(S_IFSOCK)
|
|
||||||
# define S_IFSOCK 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Read user permission */
|
|
||||||
#if !defined(S_IRUSR)
|
|
||||||
# define S_IRUSR S_IREAD
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Write user permission */
|
|
||||||
#if !defined(S_IWUSR)
|
|
||||||
# define S_IWUSR S_IWRITE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Execute user permission */
|
|
||||||
#if !defined(S_IXUSR)
|
|
||||||
# define S_IXUSR 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Read group permission */
|
|
||||||
#if !defined(S_IRGRP)
|
|
||||||
# define S_IRGRP 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Write group permission */
|
|
||||||
#if !defined(S_IWGRP)
|
|
||||||
# define S_IWGRP 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Execute group permission */
|
|
||||||
#if !defined(S_IXGRP)
|
|
||||||
# define S_IXGRP 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Read others permission */
|
|
||||||
#if !defined(S_IROTH)
|
|
||||||
# define S_IROTH 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Write others permission */
|
|
||||||
#if !defined(S_IWOTH)
|
|
||||||
# define S_IWOTH 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Execute others permission */
|
|
||||||
#if !defined(S_IXOTH)
|
|
||||||
# define S_IXOTH 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Maximum length of file name */
|
|
||||||
#if !defined(PATH_MAX)
|
|
||||||
# define PATH_MAX MAX_PATH
|
|
||||||
#endif
|
|
||||||
#if !defined(FILENAME_MAX)
|
|
||||||
# define FILENAME_MAX MAX_PATH
|
|
||||||
#endif
|
|
||||||
#if !defined(NAME_MAX)
|
|
||||||
# define NAME_MAX FILENAME_MAX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* File type flags for d_type */
|
|
||||||
#define DT_UNKNOWN 0
|
|
||||||
#define DT_REG S_IFREG
|
|
||||||
#define DT_DIR S_IFDIR
|
|
||||||
#define DT_FIFO S_IFIFO
|
|
||||||
#define DT_SOCK S_IFSOCK
|
|
||||||
#define DT_CHR S_IFCHR
|
|
||||||
#define DT_BLK S_IFBLK
|
|
||||||
#define DT_LNK S_IFLNK
|
|
||||||
|
|
||||||
/* Macros for converting between st_mode and d_type */
|
|
||||||
#define IFTODT(mode) ((mode) & S_IFMT)
|
|
||||||
#define DTTOIF(type) (type)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* File type macros. Note that block devices, sockets and links cannot be
|
|
||||||
* distinguished on Windows and the macros S_ISBLK, S_ISSOCK and S_ISLNK are
|
|
||||||
* only defined for compatibility. These macros should always return false
|
|
||||||
* on Windows.
|
|
||||||
*/
|
|
||||||
#if !defined(S_ISFIFO)
|
|
||||||
# define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO)
|
|
||||||
#endif
|
|
||||||
#if !defined(S_ISDIR)
|
|
||||||
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
|
||||||
#endif
|
|
||||||
#if !defined(S_ISREG)
|
|
||||||
# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
|
||||||
#endif
|
|
||||||
#if !defined(S_ISLNK)
|
|
||||||
# define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
|
|
||||||
#endif
|
|
||||||
#if !defined(S_ISSOCK)
|
|
||||||
# define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
|
|
||||||
#endif
|
|
||||||
#if !defined(S_ISCHR)
|
|
||||||
# define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR)
|
|
||||||
#endif
|
|
||||||
#if !defined(S_ISBLK)
|
|
||||||
# define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Return the exact length of d_namlen without zero terminator */
|
|
||||||
#define _D_EXACT_NAMLEN(p) ((p)->d_namlen)
|
|
||||||
|
|
||||||
/* Return number of bytes needed to store d_namlen */
|
|
||||||
#define _D_ALLOC_NAMLEN(p) (PATH_MAX)
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Wide-character version */
|
|
||||||
struct _wdirent {
|
|
||||||
/* Always zero */
|
|
||||||
long d_ino;
|
|
||||||
|
|
||||||
/* Structure size */
|
|
||||||
unsigned short d_reclen;
|
|
||||||
|
|
||||||
/* Length of name without \0 */
|
|
||||||
size_t d_namlen;
|
|
||||||
|
|
||||||
/* File type */
|
|
||||||
int d_type;
|
|
||||||
|
|
||||||
/* File name */
|
|
||||||
wchar_t d_name[PATH_MAX];
|
|
||||||
};
|
|
||||||
typedef struct _wdirent _wdirent;
|
|
||||||
|
|
||||||
struct _WDIR {
|
|
||||||
/* Current directory entry */
|
|
||||||
struct _wdirent ent;
|
|
||||||
|
|
||||||
/* Private file data */
|
|
||||||
WIN32_FIND_DATAW data;
|
|
||||||
|
|
||||||
/* True if data is valid */
|
|
||||||
int cached;
|
|
||||||
|
|
||||||
/* Win32 search handle */
|
|
||||||
HANDLE handle;
|
|
||||||
|
|
||||||
/* Initial directory name */
|
|
||||||
wchar_t *patt;
|
|
||||||
};
|
|
||||||
typedef struct _WDIR _WDIR;
|
|
||||||
|
|
||||||
static _WDIR *_wopendir (const wchar_t *dirname);
|
|
||||||
static struct _wdirent *_wreaddir (_WDIR *dirp);
|
|
||||||
static int _wclosedir (_WDIR *dirp);
|
|
||||||
static void _wrewinddir (_WDIR* dirp);
|
|
||||||
|
|
||||||
|
|
||||||
/* For compatibility with Symbian */
|
|
||||||
#define wdirent _wdirent
|
|
||||||
#define WDIR _WDIR
|
|
||||||
#define wopendir _wopendir
|
|
||||||
#define wreaddir _wreaddir
|
|
||||||
#define wclosedir _wclosedir
|
|
||||||
#define wrewinddir _wrewinddir
|
|
||||||
|
|
||||||
|
|
||||||
/* Multi-byte character versions */
|
|
||||||
struct dirent {
|
|
||||||
/* Always zero */
|
|
||||||
long d_ino;
|
|
||||||
|
|
||||||
/* Structure size */
|
|
||||||
unsigned short d_reclen;
|
|
||||||
|
|
||||||
/* Length of name without \0 */
|
|
||||||
size_t d_namlen;
|
|
||||||
|
|
||||||
/* File type */
|
|
||||||
int d_type;
|
|
||||||
|
|
||||||
/* File name */
|
|
||||||
char d_name[PATH_MAX];
|
|
||||||
};
|
|
||||||
typedef struct dirent dirent;
|
|
||||||
|
|
||||||
struct DIR {
|
|
||||||
struct dirent ent;
|
|
||||||
struct _WDIR *wdirp;
|
|
||||||
};
|
|
||||||
typedef struct DIR DIR;
|
|
||||||
|
|
||||||
static DIR *opendir (const char *dirname);
|
|
||||||
static struct dirent *readdir (DIR *dirp);
|
|
||||||
static int closedir (DIR *dirp);
|
|
||||||
static void rewinddir (DIR* dirp);
|
|
||||||
|
|
||||||
|
|
||||||
/* Internal utility functions */
|
|
||||||
static WIN32_FIND_DATAW *dirent_first (_WDIR *dirp);
|
|
||||||
static WIN32_FIND_DATAW *dirent_next (_WDIR *dirp);
|
|
||||||
|
|
||||||
static int dirent_mbstowcs_s(
|
|
||||||
size_t *pReturnValue,
|
|
||||||
wchar_t *wcstr,
|
|
||||||
size_t sizeInWords,
|
|
||||||
const char *mbstr,
|
|
||||||
size_t count);
|
|
||||||
|
|
||||||
static int dirent_wcstombs_s(
|
|
||||||
size_t *pReturnValue,
|
|
||||||
char *mbstr,
|
|
||||||
size_t sizeInBytes,
|
|
||||||
const wchar_t *wcstr,
|
|
||||||
size_t count);
|
|
||||||
|
|
||||||
static void dirent_set_errno (int error);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Open directory stream DIRNAME for read and return a pointer to the
|
|
||||||
* internal working area that is used to retrieve individual directory
|
|
||||||
* entries.
|
|
||||||
*/
|
|
||||||
static _WDIR*
|
|
||||||
_wopendir(
|
|
||||||
const wchar_t *dirname)
|
|
||||||
{
|
|
||||||
_WDIR *dirp = NULL;
|
|
||||||
int error;
|
|
||||||
|
|
||||||
/* Must have directory name */
|
|
||||||
if (dirname == NULL || dirname[0] == '\0') {
|
|
||||||
dirent_set_errno (ENOENT);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate new _WDIR structure */
|
|
||||||
dirp = (_WDIR*) malloc (sizeof (struct _WDIR));
|
|
||||||
if (dirp != NULL) {
|
|
||||||
DWORD n;
|
|
||||||
|
|
||||||
/* Reset _WDIR structure */
|
|
||||||
dirp->handle = INVALID_HANDLE_VALUE;
|
|
||||||
dirp->patt = NULL;
|
|
||||||
dirp->cached = 0;
|
|
||||||
|
|
||||||
/* Compute the length of full path plus zero terminator */
|
|
||||||
n = GetFullPathNameW (dirname, 0, NULL, NULL);
|
|
||||||
|
|
||||||
/* Allocate room for absolute directory name and search pattern */
|
|
||||||
dirp->patt = (wchar_t*) malloc (sizeof (wchar_t) * n + 16);
|
|
||||||
if (dirp->patt) {
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Convert relative directory name to an absolute one. This
|
|
||||||
* allows rewinddir() to function correctly even when current
|
|
||||||
* working directory is changed between opendir() and rewinddir().
|
|
||||||
*/
|
|
||||||
n = GetFullPathNameW (dirname, n, dirp->patt, NULL);
|
|
||||||
if (n > 0) {
|
|
||||||
wchar_t *p;
|
|
||||||
|
|
||||||
/* Append search pattern \* to the directory name */
|
|
||||||
p = dirp->patt + n;
|
|
||||||
if (dirp->patt < p) {
|
|
||||||
switch (p[-1]) {
|
|
||||||
case '\\':
|
|
||||||
case '/':
|
|
||||||
case ':':
|
|
||||||
/* Directory ends in path separator, e.g. c:\temp\ */
|
|
||||||
/*NOP*/;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
/* Directory name doesn't end in path separator */
|
|
||||||
*p++ = '\\';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*p++ = '*';
|
|
||||||
*p = '\0';
|
|
||||||
|
|
||||||
/* Open directory stream and retrieve the first entry */
|
|
||||||
if (dirent_first (dirp)) {
|
|
||||||
/* Directory stream opened successfully */
|
|
||||||
error = 0;
|
|
||||||
} else {
|
|
||||||
/* Cannot retrieve first entry */
|
|
||||||
error = 1;
|
|
||||||
dirent_set_errno (ENOENT);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/* Cannot retrieve full path name */
|
|
||||||
dirent_set_errno (ENOENT);
|
|
||||||
error = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/* Cannot allocate memory for search pattern */
|
|
||||||
error = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/* Cannot allocate _WDIR structure */
|
|
||||||
error = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clean up in case of error */
|
|
||||||
if (error && dirp) {
|
|
||||||
_wclosedir (dirp);
|
|
||||||
dirp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return dirp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Read next directory entry. The directory entry is returned in dirent
|
|
||||||
* structure in the d_name field. Individual directory entries returned by
|
|
||||||
* this function include regular files, sub-directories, pseudo-directories
|
|
||||||
* "." and ".." as well as volume labels, hidden files and system files.
|
|
||||||
*/
|
|
||||||
static struct _wdirent*
|
|
||||||
_wreaddir(
|
|
||||||
_WDIR *dirp)
|
|
||||||
{
|
|
||||||
WIN32_FIND_DATAW *datap;
|
|
||||||
struct _wdirent *entp;
|
|
||||||
|
|
||||||
/* Read next directory entry */
|
|
||||||
datap = dirent_next (dirp);
|
|
||||||
if (datap) {
|
|
||||||
size_t n;
|
|
||||||
DWORD attr;
|
|
||||||
|
|
||||||
/* Pointer to directory entry to return */
|
|
||||||
entp = &dirp->ent;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copy file name as wide-character string. If the file name is too
|
|
||||||
* long to fit in to the destination buffer, then truncate file name
|
|
||||||
* to PATH_MAX characters and zero-terminate the buffer.
|
|
||||||
*/
|
|
||||||
n = 0;
|
|
||||||
while (n + 1 < PATH_MAX && datap->cFileName[n] != 0) {
|
|
||||||
entp->d_name[n] = datap->cFileName[n];
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
dirp->ent.d_name[n] = 0;
|
|
||||||
|
|
||||||
/* Length of file name excluding zero terminator */
|
|
||||||
entp->d_namlen = n;
|
|
||||||
|
|
||||||
/* File type */
|
|
||||||
attr = datap->dwFileAttributes;
|
|
||||||
if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
|
|
||||||
entp->d_type = DT_CHR;
|
|
||||||
} else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
|
|
||||||
entp->d_type = DT_DIR;
|
|
||||||
} else {
|
|
||||||
entp->d_type = DT_REG;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset dummy fields */
|
|
||||||
entp->d_ino = 0;
|
|
||||||
entp->d_reclen = sizeof (struct _wdirent);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
/* Last directory entry read */
|
|
||||||
entp = NULL;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return entp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Close directory stream opened by opendir() function. This invalidates the
|
|
||||||
* DIR structure as well as any directory entry read previously by
|
|
||||||
* _wreaddir().
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
_wclosedir(
|
|
||||||
_WDIR *dirp)
|
|
||||||
{
|
|
||||||
int ok;
|
|
||||||
if (dirp) {
|
|
||||||
|
|
||||||
/* Release search handle */
|
|
||||||
if (dirp->handle != INVALID_HANDLE_VALUE) {
|
|
||||||
FindClose (dirp->handle);
|
|
||||||
dirp->handle = INVALID_HANDLE_VALUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Release search pattern */
|
|
||||||
if (dirp->patt) {
|
|
||||||
free (dirp->patt);
|
|
||||||
dirp->patt = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Release directory structure */
|
|
||||||
free (dirp);
|
|
||||||
ok = /*success*/0;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/* Invalid directory stream */
|
|
||||||
dirent_set_errno (EBADF);
|
|
||||||
ok = /*failure*/-1;
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Rewind directory stream such that _wreaddir() returns the very first
|
|
||||||
* file name again.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
_wrewinddir(
|
|
||||||
_WDIR* dirp)
|
|
||||||
{
|
|
||||||
if (dirp) {
|
|
||||||
/* Release existing search handle */
|
|
||||||
if (dirp->handle != INVALID_HANDLE_VALUE) {
|
|
||||||
FindClose (dirp->handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Open new search handle */
|
|
||||||
dirent_first (dirp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get first directory entry (internal) */
|
|
||||||
static WIN32_FIND_DATAW*
|
|
||||||
dirent_first(
|
|
||||||
_WDIR *dirp)
|
|
||||||
{
|
|
||||||
WIN32_FIND_DATAW *datap;
|
|
||||||
|
|
||||||
/* Open directory and retrieve the first entry */
|
|
||||||
dirp->handle = FindFirstFileW (dirp->patt, &dirp->data);
|
|
||||||
if (dirp->handle != INVALID_HANDLE_VALUE) {
|
|
||||||
|
|
||||||
/* a directory entry is now waiting in memory */
|
|
||||||
datap = &dirp->data;
|
|
||||||
dirp->cached = 1;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
/* Failed to re-open directory: no directory entry in memory */
|
|
||||||
dirp->cached = 0;
|
|
||||||
datap = NULL;
|
|
||||||
|
|
||||||
}
|
|
||||||
return datap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get next directory entry (internal) */
|
|
||||||
static WIN32_FIND_DATAW*
|
|
||||||
dirent_next(
|
|
||||||
_WDIR *dirp)
|
|
||||||
{
|
|
||||||
WIN32_FIND_DATAW *p;
|
|
||||||
|
|
||||||
/* Get next directory entry */
|
|
||||||
if (dirp->cached != 0) {
|
|
||||||
|
|
||||||
/* A valid directory entry already in memory */
|
|
||||||
p = &dirp->data;
|
|
||||||
dirp->cached = 0;
|
|
||||||
|
|
||||||
} else if (dirp->handle != INVALID_HANDLE_VALUE) {
|
|
||||||
|
|
||||||
/* Get the next directory entry from stream */
|
|
||||||
if (FindNextFileW (dirp->handle, &dirp->data) != FALSE) {
|
|
||||||
/* Got a file */
|
|
||||||
p = &dirp->data;
|
|
||||||
} else {
|
|
||||||
/* The very last entry has been processed or an error occured */
|
|
||||||
FindClose (dirp->handle);
|
|
||||||
dirp->handle = INVALID_HANDLE_VALUE;
|
|
||||||
p = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
/* End of directory stream reached */
|
|
||||||
p = NULL;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Open directory stream using plain old C-string.
|
|
||||||
*/
|
|
||||||
static DIR*
|
|
||||||
opendir(
|
|
||||||
const char *dirname)
|
|
||||||
{
|
|
||||||
struct DIR *dirp;
|
|
||||||
int error;
|
|
||||||
|
|
||||||
/* Must have directory name */
|
|
||||||
if (dirname == NULL || dirname[0] == '\0') {
|
|
||||||
dirent_set_errno (ENOENT);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate memory for DIR structure */
|
|
||||||
dirp = (DIR*) malloc (sizeof (struct DIR));
|
|
||||||
if (dirp) {
|
|
||||||
wchar_t wname[PATH_MAX];
|
|
||||||
size_t n;
|
|
||||||
|
|
||||||
/* Convert directory name to wide-character string */
|
|
||||||
error = dirent_mbstowcs_s (&n, wname, PATH_MAX, dirname, PATH_MAX);
|
|
||||||
if (!error) {
|
|
||||||
|
|
||||||
/* Open directory stream using wide-character name */
|
|
||||||
dirp->wdirp = _wopendir (wname);
|
|
||||||
if (dirp->wdirp) {
|
|
||||||
/* Directory stream opened */
|
|
||||||
error = 0;
|
|
||||||
} else {
|
|
||||||
/* Failed to open directory stream */
|
|
||||||
error = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* Cannot convert file name to wide-character string. This
|
|
||||||
* occurs if the string contains invalid multi-byte sequences or
|
|
||||||
* the output buffer is too small to contain the resulting
|
|
||||||
* string.
|
|
||||||
*/
|
|
||||||
error = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/* Cannot allocate DIR structure */
|
|
||||||
error = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clean up in case of error */
|
|
||||||
if (error && dirp) {
|
|
||||||
free (dirp);
|
|
||||||
dirp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return dirp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Read next directory entry.
|
|
||||||
*
|
|
||||||
* When working with text consoles, please note that file names returned by
|
|
||||||
* readdir() are represented in the default ANSI code page while any output to
|
|
||||||
* console is typically formatted on another code page. Thus, non-ASCII
|
|
||||||
* characters in file names will not usually display correctly on console. The
|
|
||||||
* problem can be fixed in two ways: (1) change the character set of console
|
|
||||||
* to 1252 using chcp utility and use Lucida Console font, or (2) use
|
|
||||||
* _cprintf function when writing to console. The _cprinf() will re-encode
|
|
||||||
* ANSI strings to the console code page so many non-ASCII characters will
|
|
||||||
* display correcly.
|
|
||||||
*/
|
|
||||||
static struct dirent*
|
|
||||||
readdir(
|
|
||||||
DIR *dirp)
|
|
||||||
{
|
|
||||||
WIN32_FIND_DATAW *datap;
|
|
||||||
struct dirent *entp;
|
|
||||||
|
|
||||||
/* Read next directory entry */
|
|
||||||
datap = dirent_next (dirp->wdirp);
|
|
||||||
if (datap) {
|
|
||||||
size_t n;
|
|
||||||
int error;
|
|
||||||
|
|
||||||
/* Attempt to convert file name to multi-byte string */
|
|
||||||
error = dirent_wcstombs_s(
|
|
||||||
&n, dirp->ent.d_name, PATH_MAX, datap->cFileName, PATH_MAX);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If the file name cannot be represented by a multi-byte string,
|
|
||||||
* then attempt to use old 8+3 file name. This allows traditional
|
|
||||||
* Unix-code to access some file names despite of unicode
|
|
||||||
* characters, although file names may seem unfamiliar to the user.
|
|
||||||
*
|
|
||||||
* Be ware that the code below cannot come up with a short file
|
|
||||||
* name unless the file system provides one. At least
|
|
||||||
* VirtualBox shared folders fail to do this.
|
|
||||||
*/
|
|
||||||
if (error && datap->cAlternateFileName[0] != '\0') {
|
|
||||||
error = dirent_wcstombs_s(
|
|
||||||
&n, dirp->ent.d_name, PATH_MAX,
|
|
||||||
datap->cAlternateFileName, PATH_MAX);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!error) {
|
|
||||||
DWORD attr;
|
|
||||||
|
|
||||||
/* Initialize directory entry for return */
|
|
||||||
entp = &dirp->ent;
|
|
||||||
|
|
||||||
/* Length of file name excluding zero terminator */
|
|
||||||
entp->d_namlen = n - 1;
|
|
||||||
|
|
||||||
/* File attributes */
|
|
||||||
attr = datap->dwFileAttributes;
|
|
||||||
if ((attr & FILE_ATTRIBUTE_DEVICE) != 0) {
|
|
||||||
entp->d_type = DT_CHR;
|
|
||||||
} else if ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
|
|
||||||
entp->d_type = DT_DIR;
|
|
||||||
} else {
|
|
||||||
entp->d_type = DT_REG;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Reset dummy fields */
|
|
||||||
entp->d_ino = 0;
|
|
||||||
entp->d_reclen = sizeof (struct dirent);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* Cannot convert file name to multi-byte string so construct
|
|
||||||
* an errornous directory entry and return that. Note that
|
|
||||||
* we cannot return NULL as that would stop the processing
|
|
||||||
* of directory entries completely.
|
|
||||||
*/
|
|
||||||
entp = &dirp->ent;
|
|
||||||
entp->d_name[0] = '?';
|
|
||||||
entp->d_name[1] = '\0';
|
|
||||||
entp->d_namlen = 1;
|
|
||||||
entp->d_type = DT_UNKNOWN;
|
|
||||||
entp->d_ino = 0;
|
|
||||||
entp->d_reclen = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/* No more directory entries */
|
|
||||||
entp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return entp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Close directory stream.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
closedir(
|
|
||||||
DIR *dirp)
|
|
||||||
{
|
|
||||||
int ok;
|
|
||||||
if (dirp) {
|
|
||||||
|
|
||||||
/* Close wide-character directory stream */
|
|
||||||
ok = _wclosedir (dirp->wdirp);
|
|
||||||
dirp->wdirp = NULL;
|
|
||||||
|
|
||||||
/* Release multi-byte character version */
|
|
||||||
free (dirp);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
/* Invalid directory stream */
|
|
||||||
dirent_set_errno (EBADF);
|
|
||||||
ok = /*failure*/-1;
|
|
||||||
|
|
||||||
}
|
|
||||||
return ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Rewind directory stream to beginning.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
rewinddir(
|
|
||||||
DIR* dirp)
|
|
||||||
{
|
|
||||||
/* Rewind wide-character string directory stream */
|
|
||||||
_wrewinddir (dirp->wdirp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert multi-byte string to wide character string */
|
|
||||||
static int
|
|
||||||
dirent_mbstowcs_s(
|
|
||||||
size_t *pReturnValue,
|
|
||||||
wchar_t *wcstr,
|
|
||||||
size_t sizeInWords,
|
|
||||||
const char *mbstr,
|
|
||||||
size_t count)
|
|
||||||
{
|
|
||||||
int error;
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
|
||||||
|
|
||||||
/* Microsoft Visual Studio 2005 or later */
|
|
||||||
error = mbstowcs_s (pReturnValue, wcstr, sizeInWords, mbstr, count);
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* Older Visual Studio or non-Microsoft compiler */
|
|
||||||
size_t n;
|
|
||||||
|
|
||||||
/* Convert to wide-character string (or count characters) */
|
|
||||||
n = mbstowcs (wcstr, mbstr, sizeInWords);
|
|
||||||
if (!wcstr || n < count) {
|
|
||||||
|
|
||||||
/* Zero-terminate output buffer */
|
|
||||||
if (wcstr && sizeInWords) {
|
|
||||||
if (n >= sizeInWords) {
|
|
||||||
n = sizeInWords - 1;
|
|
||||||
}
|
|
||||||
wcstr[n] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Length of resuting multi-byte string WITH zero terminator */
|
|
||||||
if (pReturnValue) {
|
|
||||||
*pReturnValue = n + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Success */
|
|
||||||
error = 0;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
/* Could not convert string */
|
|
||||||
error = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Convert wide-character string to multi-byte string */
|
|
||||||
static int
|
|
||||||
dirent_wcstombs_s(
|
|
||||||
size_t *pReturnValue,
|
|
||||||
char *mbstr,
|
|
||||||
size_t sizeInBytes, /* max size of mbstr */
|
|
||||||
const wchar_t *wcstr,
|
|
||||||
size_t count)
|
|
||||||
{
|
|
||||||
int error;
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
|
||||||
|
|
||||||
/* Microsoft Visual Studio 2005 or later */
|
|
||||||
error = wcstombs_s (pReturnValue, mbstr, sizeInBytes, wcstr, count);
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* Older Visual Studio or non-Microsoft compiler */
|
|
||||||
size_t n;
|
|
||||||
|
|
||||||
/* Convert to multi-byte string (or count the number of bytes needed) */
|
|
||||||
n = wcstombs (mbstr, wcstr, sizeInBytes);
|
|
||||||
if (!mbstr || n < count) {
|
|
||||||
|
|
||||||
/* Zero-terminate output buffer */
|
|
||||||
if (mbstr && sizeInBytes) {
|
|
||||||
if (n >= sizeInBytes) {
|
|
||||||
n = sizeInBytes - 1;
|
|
||||||
}
|
|
||||||
mbstr[n] = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Length of resulting multi-bytes string WITH zero-terminator */
|
|
||||||
if (pReturnValue) {
|
|
||||||
*pReturnValue = n + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Success */
|
|
||||||
error = 0;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
/* Cannot convert string */
|
|
||||||
error = 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set errno variable */
|
|
||||||
static void
|
|
||||||
dirent_set_errno(
|
|
||||||
int error)
|
|
||||||
{
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
|
||||||
|
|
||||||
/* Microsoft Visual Studio 2005 and later */
|
|
||||||
_set_errno (error);
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* Non-Microsoft compiler or older Microsoft compiler */
|
|
||||||
errno = error;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /*DIRENT_H*/
|
|
||||||
|
|
|
@ -1,330 +0,0 @@
|
||||||
@ECHO OFF
|
|
||||||
SETLOCAL
|
|
||||||
GOTO START
|
|
||||||
|
|
||||||
:: Script for generating build_config.h and versioninfo.h
|
|
||||||
::
|
|
||||||
:: Copyright (C) 2016 Rogier <rogier777@gmail.com>
|
|
||||||
::
|
|
||||||
:: This program is free software; you can redistribute it and/or modify
|
|
||||||
:: it under the terms of the GNU Lesser General Public License as published by
|
|
||||||
:: the Free Software Foundation; either version 2.1 of the License, or
|
|
||||||
:: (at your option) any later version.
|
|
||||||
::
|
|
||||||
:: This program is distributed in the hope that it will be useful,
|
|
||||||
:: but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
:: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
:: GNU Lesser General Public License for more details.
|
|
||||||
::
|
|
||||||
:: You should have received a copy of the GNU Lesser General Public License along
|
|
||||||
:: with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
:: 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
|
|
||||||
|
|
||||||
:USAGE
|
|
||||||
ECHO Usage^: %~nx0 [options] -p PROJECTDIR
|
|
||||||
ECHO.
|
|
||||||
ECHO Options^:
|
|
||||||
ECHO -h^|--help ^: Print this message
|
|
||||||
ECHO -v^|--verbose ^: Print minetestmapper version info
|
|
||||||
ECHO --test ^: Instead of creating the configuration files,
|
|
||||||
ECHO print their would-be contents to the console.
|
|
||||||
ECHO --use-sqlite3 ^: Make minetestmapper understand SQLite3
|
|
||||||
ECHO --use-postgresql ^: Make minetestmapper understand PostgreSQL
|
|
||||||
ECHO --use-leveldb ^: Make minetestmapper understand LevelDB
|
|
||||||
ECHO --use-redis ^: Make minetestmapper understand Redis
|
|
||||||
ECHO -p PROJECTDIR ^: Specify the base directory of the project
|
|
||||||
ECHO ^(this option is mandatory^)
|
|
||||||
ECHO.
|
|
||||||
ECHO NOTE^: At least one of the databases must be enabled.
|
|
||||||
EXIT /B 0
|
|
||||||
|
|
||||||
:START
|
|
||||||
|
|
||||||
SET $MYNAME=%~nx0
|
|
||||||
SET $MYPATH=%~p0
|
|
||||||
SET $BASE_VERSION_FILE=base-version
|
|
||||||
SET $BUILDCONFIG_TEMPLATE=build_config.h.in
|
|
||||||
SET $BUILDCONFIG_FILE=build_config.h
|
|
||||||
SET $VERSIONINFO_FILE=MSVC\versioninfo.h
|
|
||||||
|
|
||||||
SET $USE_SQLITE3=0
|
|
||||||
SET $USE_POSTGRESQL=0
|
|
||||||
SET $USE_LEVELDB=0
|
|
||||||
SET $USE_REDIS=0
|
|
||||||
SET $USE_ICONV=0
|
|
||||||
SET $PACKAGING_FLAT=1
|
|
||||||
SET $INSTALL_PREFIX=\\
|
|
||||||
SET $PROJECTDIR=""
|
|
||||||
|
|
||||||
|
|
||||||
SET $USE_ANY=0
|
|
||||||
SET $VERBOSE=0
|
|
||||||
SET $TEST=0
|
|
||||||
|
|
||||||
:: Command-line argument parsing
|
|
||||||
:PARSEARGS
|
|
||||||
SET $OPT=%~1
|
|
||||||
IF /I "%$OPT%"=="-h" (
|
|
||||||
CALL :USAGE
|
|
||||||
EXIT /B 0
|
|
||||||
) ELSE IF /I "%$OPT%"=="--help" (
|
|
||||||
CALL :USAGE
|
|
||||||
EXIT /B 0
|
|
||||||
) ELSE IF /I "%$OPT%"=="-v" (
|
|
||||||
SET $VERBOSE=1
|
|
||||||
) ELSE IF /I "%$OPT%"=="--verbose" (
|
|
||||||
SET $VERBOSE=1
|
|
||||||
) ELSE IF /I "%$OPT%"=="--test" (
|
|
||||||
SET $TEST=1
|
|
||||||
) ELSE IF /I "%$OPT%"=="--use-sqlite3" (
|
|
||||||
SET $USE_SQLITE3=1
|
|
||||||
SET $USE_ANY=1
|
|
||||||
) ELSE IF /I "%$OPT%"=="--use-postgresql" (
|
|
||||||
SET $USE_POSTGRESQL=1
|
|
||||||
SET $USE_ANY=1
|
|
||||||
) ELSE IF /I "%$OPT%"=="--use-leveldb" (
|
|
||||||
SET $USE_LEVELDB=1
|
|
||||||
SET $USE_ANY=1
|
|
||||||
) ELSE IF /I "%$OPT%"=="--use-redis" (
|
|
||||||
SET $USE_REDIS=1
|
|
||||||
SET $USE_ANY=1
|
|
||||||
) ELSE IF /I "%$OPT%"=="-p" (
|
|
||||||
SET $PROJECTDIR=%~f2
|
|
||||||
:: SHIFT because we took a second argument here.
|
|
||||||
SHIFT
|
|
||||||
) ELSE IF /I "%$OPT:~0,1%"=="-" (
|
|
||||||
ECHO %$MYNAME%^: Error^: unrecognised option^: %$OPT%
|
|
||||||
CALL :USAGE
|
|
||||||
EXIT /B 1
|
|
||||||
) ELSE (
|
|
||||||
GOTO GEN_CONFIG
|
|
||||||
)
|
|
||||||
SHIFT
|
|
||||||
GOTO PARSEARGS
|
|
||||||
|
|
||||||
:GEN_CONFIG
|
|
||||||
IF NOT "%1"=="" (
|
|
||||||
ECHO %$MYNAME%^: Error^: too many arguments ^(%*^)
|
|
||||||
CALL :USAGE
|
|
||||||
EXIT /B 1
|
|
||||||
)
|
|
||||||
IF NOT %$USE_ANY%==1 (
|
|
||||||
ECHO %$MYNAME%^: Error^: at least one --use-^<database^> option must be given
|
|
||||||
CALL :USAGE
|
|
||||||
EXIT /B 1
|
|
||||||
)
|
|
||||||
IF %$PROJECTDIR%=="" (
|
|
||||||
ECHO %$MYNAME%^: Error^: PROJECTDIR argument is required
|
|
||||||
CALL :USAGE
|
|
||||||
EXIT /B 1
|
|
||||||
)
|
|
||||||
|
|
||||||
CALL :CHECK_FOR_GIT
|
|
||||||
IF ERRORLEVEL 1 (
|
|
||||||
CALL :GET_NONGIT_VERSION
|
|
||||||
) ELSE (
|
|
||||||
CALL :GET_GIT_VERSION
|
|
||||||
)
|
|
||||||
IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL%
|
|
||||||
|
|
||||||
CALL :COMPUTE_BINARY_VERSION
|
|
||||||
IF ERRORLEVEL 1 EXIT /B %ERRORLEVEL%
|
|
||||||
|
|
||||||
IF %$VERBOSE%==1 (
|
|
||||||
CALL :REPORT_VERSION
|
|
||||||
)
|
|
||||||
|
|
||||||
set $EXITVAL=0
|
|
||||||
CALL :WRITE_BUILDCONFIG
|
|
||||||
IF ERRORLEVEL 1 SET $EXITVAL=%ERRORLEVEL%
|
|
||||||
CALL :WRITE_VERSIONINFO
|
|
||||||
IF ERRORLEVEL 1 SET $EXITVAL=%ERRORLEVEL%
|
|
||||||
|
|
||||||
:: End of main script code.
|
|
||||||
:: Remaining code consists of functions only
|
|
||||||
EXIT /B %$EXITVAL%
|
|
||||||
|
|
||||||
:: Check for git. This does two things:
|
|
||||||
:: - verify that git is installed
|
|
||||||
:: - verify that we are in a git tree (instead of just an unpacked archive)
|
|
||||||
:CHECK_FOR_GIT
|
|
||||||
CALL git describe > NUL 2>&1
|
|
||||||
EXIT /B %ERRORLEVEL%
|
|
||||||
|
|
||||||
:: Obtain the git version information
|
|
||||||
:GET_GIT_VERSION
|
|
||||||
|
|
||||||
FOR /F "usebackq tokens=*" %%V IN (`git describe --long "--match=[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" "--dirty=-WIP" "--abbrev=8"`) DO (
|
|
||||||
SET $VERSION_FULL=%%V
|
|
||||||
)
|
|
||||||
FOR /F "tokens=1 delims=-" %%M in ("%$VERSION_FULL%") DO (
|
|
||||||
SET $VERSION_MAJOR=%%M
|
|
||||||
)
|
|
||||||
FOR /F "tokens=2 delims=-" %%M in ("%$VERSION_FULL%") DO (
|
|
||||||
SET $VERSION_MINOR_COMMITS=%%M
|
|
||||||
)
|
|
||||||
FOR /F "tokens=3 delims=-" %%M in ("%$VERSION_FULL%") DO (
|
|
||||||
SET $VERSION_MINOR_SHA1=%%M
|
|
||||||
)
|
|
||||||
FOR /F "tokens=4 delims=-" %%M in ("%$VERSION_FULL%") DO (
|
|
||||||
SET $VERSION_MINOR_WIP=%%M
|
|
||||||
)
|
|
||||||
IF DEFINED $VERSION_MINOR_WIP (
|
|
||||||
SET $VERSION_MINOR=%$VERSION_MINOR_COMMITS%-%$VERSION_MINOR_SHA1%-%$VERSION_MINOR_WIP%
|
|
||||||
) ELSE (
|
|
||||||
SET $VERSION_MINOR=%$VERSION_MINOR_COMMITS%-%$VERSION_MINOR_SHA1%
|
|
||||||
)
|
|
||||||
|
|
||||||
EXIT /B 0
|
|
||||||
|
|
||||||
:: Obtain version information when git cannot be used
|
|
||||||
:GET_NONGIT_VERSION
|
|
||||||
|
|
||||||
IF NOT EXIST %$PROJECTDIR%\%$BASE_VERSION_FILE% (
|
|
||||||
ECHO %$MYNAME%^: Error^: base version file ^(%$PROJECTDIR%\%$BASE_VERSION_FILE%^) not found.
|
|
||||||
EXIT /B 2
|
|
||||||
)
|
|
||||||
FOR /F "tokens=*" %%V IN (%$PROJECTDIR%\%$BASE_VERSION_FILE%) DO (
|
|
||||||
SET $VERSION_MAJOR=%%V
|
|
||||||
)
|
|
||||||
SET $VERSION_MINOR=-X
|
|
||||||
EXIT /B 0
|
|
||||||
|
|
||||||
:: Compute binary version for MSVC
|
|
||||||
:COMPUTE_BINARY_VERSION
|
|
||||||
:: This assumes the version is of the form:
|
|
||||||
:: YYYYMMDD-nn-cccccccc[-WIP]
|
|
||||||
:: or:
|
|
||||||
:: YYYYMMDD-X
|
|
||||||
:: Binary version consists of 4 16-bit numbers.
|
|
||||||
:: Conversion:
|
|
||||||
:: - 1st 16-bit number: 0
|
|
||||||
:: - 2st 16-bit number: 1024*YY+32*MM+DD (usable until 2064)
|
|
||||||
:: - 3nd 16-bit number: 2 * nn (# commits since major version)
|
|
||||||
:: 2 * nn + 1 if the working tree was dirty ('-WIP')
|
|
||||||
:: 65535 if unknown ('X')
|
|
||||||
:: - 4rd 16-bit number: 1st 4 hex digits of cccccccc (commit SHA1)
|
|
||||||
SET /A $BV2=1024*%$VERSION_MAJOR:~2,2%+32*%$VERSION_MAJOR:~4,2%+%$VERSION_MAJOR:~6,2%
|
|
||||||
IF /I "%$VERSION_MINOR_COMMITS%"=="X" (
|
|
||||||
SET /A $BV3=65535
|
|
||||||
) ELSE IF DEFINED $VERSION_MINOR_WIP (
|
|
||||||
SET /A $BV3=2*%$VERSION_MINOR_COMMITS%+1
|
|
||||||
) ELSE (
|
|
||||||
SET /A $BV3=2*%$VERSION_MINOR_COMMITS%
|
|
||||||
)
|
|
||||||
IF /I "%$VERSION_MINOR_COMMITS%"=="X" (
|
|
||||||
SET /A $BV4=0
|
|
||||||
) ELSE (
|
|
||||||
SET /A $BV4=0x%$VERSION_MINOR_SHA1:~1,4%
|
|
||||||
)
|
|
||||||
SET $VERSION_BINARY=0,%$BV2%,%$BV3%,%$BV4%
|
|
||||||
EXIT /B 0
|
|
||||||
|
|
||||||
:: Report version info to the console
|
|
||||||
:REPORT_VERSION
|
|
||||||
ECHO Minetestmapper version information^:
|
|
||||||
ECHO.
|
|
||||||
IF /I "%$VERSION_MINOR_COMMITS%"=="X" (
|
|
||||||
ECHO WARNING^: git executable not found, or no git tree found.
|
|
||||||
ECHO No exact version information could be obtained.
|
|
||||||
ECHO.
|
|
||||||
)
|
|
||||||
ECHO Full version^: %$VERSION_FULL%
|
|
||||||
ECHO Major version^: %$VERSION_MAJOR%
|
|
||||||
ECHO Minor version^: %$VERSION_MINOR%
|
|
||||||
|
|
||||||
IF /I NOT "%$VERSION_MINOR_COMMITS%"=="X" (
|
|
||||||
ECHO Commits since full version^: %$VERSION_MINOR_COMMITS%
|
|
||||||
ECHO Latest commit SHA1 id ^(short^)^: %$VERSION_MINOR_SHA1%
|
|
||||||
IF DEFINED $VERSION_MINOR_WIP (
|
|
||||||
ECHO Working tree is clean^: NO
|
|
||||||
) ELSE (
|
|
||||||
ECHO Working tree is clean^: YES
|
|
||||||
)
|
|
||||||
)
|
|
||||||
ECHO Binary version^: %$VERSION_BINARY%
|
|
||||||
EXIT /B 0
|
|
||||||
|
|
||||||
:: Create the build file
|
|
||||||
:WRITE_BUILDCONFIG
|
|
||||||
SET "$INDENT="
|
|
||||||
IF NOT EXIST %$PROJECTDIR%\%$BUILDCONFIG_TEMPLATE% (
|
|
||||||
ECHO %$MYNAME%^: Error^: template file ^(%$PROJECTDIR%\%$BUILDCONFIG_TEMPLATE%^) not found.
|
|
||||||
EXIT /B 2
|
|
||||||
)
|
|
||||||
IF %$VERBOSE%==1 (
|
|
||||||
ECHO ---- Generating %$PROJECTDIR%\%$BUILDCONFIG_FILE%
|
|
||||||
)
|
|
||||||
SET $OUTPUT=%$PROJECTDIR%\%$BUILDCONFIG_FILE%
|
|
||||||
IF %$TEST%==1 (
|
|
||||||
ECHO The build config file ^(%$BUILDCONFIG_FILE%^) contents would be^:
|
|
||||||
SET "$INDENT= "
|
|
||||||
SET $OUTPUT=CON
|
|
||||||
) ELSE (
|
|
||||||
:: If not in testmode, delete the file, because its regenerated
|
|
||||||
COPY NUL "%$OUTPUT%" >NUL
|
|
||||||
)
|
|
||||||
FOR /F "tokens=*" %%L in (%$PROJECTDIR%\%$BUILDCONFIG_TEMPLATE%) DO CALL :WRITE_LINE %%L
|
|
||||||
EXIT /B 0
|
|
||||||
|
|
||||||
:: This funktion writes 1 line with the correct build parameter into the build_config.h file.
|
|
||||||
:: Usage: CALL :WRITE_LINE <string>
|
|
||||||
:WRITE_LINE
|
|
||||||
SETLOCAL ENABLEDELAYEDEXPANSION
|
|
||||||
SET $LINE=%*
|
|
||||||
|
|
||||||
SET $LINE=!$LINE:@BUILD_CONFIG_GENDATE@=%DATE% %TIME%!
|
|
||||||
SET $LINE=!$LINE:@BUILD_CONFIG_GENTOOL@=%$MYNAME%!
|
|
||||||
SET $LINE=!$LINE:@USE_SQLITE3@=%$USE_SQLITE3%!
|
|
||||||
SET $LINE=!$LINE:@USE_POSTGRESQL@=%$USE_POSTGRESQL%!
|
|
||||||
SET $LINE=!$LINE:@USE_LEVELDB@=%$USE_LEVELDB%!
|
|
||||||
SET $LINE=!$LINE:@USE_REDIS@=%$USE_REDIS%!
|
|
||||||
SET $LINE=!$LINE:@USE_ICONV@=%$USE_ICONV%!
|
|
||||||
SET $LINE=!$LINE:@VERSION_MAJOR@=%$VERSION_MAJOR%!
|
|
||||||
SET $LINE=!$LINE:@VERSION_MINOR@=%$VERSION_MINOR%!
|
|
||||||
SET $LINE=!$LINE:@PACKAGING_FLAT@=%$PACKAGING_FLAT%!
|
|
||||||
SET $LINE=!$LINE:@INSTALL_PREFIX@=%$INSTALL_PREFIX%!
|
|
||||||
SET $LINE=!$LINE:@CPP_ABI_STDSTRING_OK@=1!
|
|
||||||
|
|
||||||
ECHO %$INDENT%%$LINE% >> %$OUTPUT%
|
|
||||||
ENDLOCAL
|
|
||||||
EXIT /B 0
|
|
||||||
|
|
||||||
:: Create the versioninfo file
|
|
||||||
:WRITE_VERSIONINFO
|
|
||||||
SETLOCAL
|
|
||||||
SET "$INDENT="
|
|
||||||
IF %$VERBOSE%==1 (
|
|
||||||
ECHO ---- Generating %$PROJECTDIR%\%$VERSIONINFO_FILE%%
|
|
||||||
)
|
|
||||||
SET $OUTPUT=%$PROJECTDIR%\%$VERSIONINFO_FILE%
|
|
||||||
IF %$TEST%==1 (
|
|
||||||
ECHO The versioninfo file ^(%$VERSIONINFO_FILE%^) contents would be^:
|
|
||||||
SET "$INDENT= "
|
|
||||||
SET $OUTPUT=CON
|
|
||||||
)
|
|
||||||
> %$OUTPUT% (
|
|
||||||
ECHO %$INDENT%// This file is auto-generated. Any changes to it will be overwritten.
|
|
||||||
ECHO %$INDENT%// Modify the following build-system specific script instead^:
|
|
||||||
ECHO %$INDENT%// MSVC/generate_build_config.bat
|
|
||||||
ECHO.
|
|
||||||
ECHO %$INDENT%#define MINETESTMAPPER_VERSION_FULL "%$VERSION_FULL%"
|
|
||||||
ECHO %$INDENT%#define MINETESTMAPPER_VERSION_MAJOR "%$VERSION_MAJOR%"
|
|
||||||
ECHO %$INDENT%#define MINETESTMAPPER_VERSION_MINOR "%$VERSION_MINOR%"
|
|
||||||
ECHO %$INDENT%#define MINETESTMAPPER_VERSION_BINARY %$VERSION_BINARY%
|
|
||||||
IF DEFINED $VERSION_MINOR_WIP (
|
|
||||||
ECHO %$INDENT%#define MINETESTMAPPER_WIP_FLAG ^| VS_FF_PATCHED
|
|
||||||
) ELSE (
|
|
||||||
:: Clear 'VS_FF_PATCHED' only if the WIP part is empty
|
|
||||||
ECHO %$INDENT%#define MINETESTMAPPER_WIP_FLAG
|
|
||||||
)
|
|
||||||
ECHO.
|
|
||||||
ECHO %$INDENT%#ifdef _DEBUG
|
|
||||||
ECHO %$INDENT%#define MINETESTMAPPER_DEBUG_FLAG ^| VS_FF_DEBUG
|
|
||||||
ECHO %$INDENT%#else
|
|
||||||
ECHO %$INDENT%#define MINETESTMAPPER_DEBUG_FLAG
|
|
||||||
ECHO %$INDENT%#endif
|
|
||||||
)
|
|
||||||
ENDLOCAL
|
|
||||||
EXIT /B 0
|
|
|
@ -1,232 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<Import Project="..\packages\LevelDB.1.16.0.5\build\native\LevelDB.props" Condition="Exists('..\packages\LevelDB.1.16.0.5\build\native\LevelDB.props')" />
|
|
||||||
<Import Project="..\packages\Snappy.1.1.1.7\build\native\Snappy.props" Condition="Exists('..\packages\Snappy.1.1.1.7\build\native\Snappy.props')" />
|
|
||||||
<Import Project="..\packages\Crc32C.1.0.4\build\native\Crc32C.props" Condition="Exists('..\packages\Crc32C.1.0.4\build\native\Crc32C.props')" />
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>{3F30298F-2395-4811-A79E-EBB603F42948}</ProjectGuid>
|
|
||||||
<Keyword>Win32Proj</Keyword>
|
|
||||||
<RootNamespace>minetestmapper</RootNamespace>
|
|
||||||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>true</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<UseDebugLibraries>false</UseDebugLibraries>
|
|
||||||
<PlatformToolset>v140</PlatformToolset>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>Unicode</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<ImportGroup Label="ExtensionSettings">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="Shared">
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<LinkIncremental>true</LinkIncremental>
|
|
||||||
<LibraryPath>D:\libs\gd\Win32\RelWithDebInfo;$(LibraryPath)</LibraryPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<LinkIncremental>true</LinkIncremental>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<LinkIncremental>false</LinkIncremental>
|
|
||||||
<LibraryPath>D:\libs\gd\Win32\RelWithDebInfo;$(LibraryPath)</LibraryPath>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<LinkIncremental>false</LinkIncremental>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<AdditionalIncludeDirectories>D:\libs\gd\include;$(ProjectDir)dirent\include;$(ProjectDir)wingetopt\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<AdditionalDependencies>libgd.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
</Link>
|
|
||||||
<PreBuildEvent>
|
|
||||||
<Command>CALL $(SolutionDir)MSVC\gen-build-config.bat --use-sqlite3 --use-leveldb -p "$(SolutionDir)"</Command>
|
|
||||||
</PreBuildEvent>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<AdditionalIncludeDirectories>D:\libs\gd\include;$(ProjectDir)dirent\include;$(ProjectDir)wingetopt\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<AdditionalDependencies>libgd.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
</Link>
|
|
||||||
<PreBuildEvent>
|
|
||||||
<Command>CALL $(SolutionDir)MSVC\gen-build-config.bat --use-sqlite3 --use-leveldb -p "$(SolutionDir)"</Command>
|
|
||||||
</PreBuildEvent>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<AdditionalIncludeDirectories>D:\libs\gd\include;$(ProjectDir)dirent\include;$(ProjectDir)wingetopt\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<AdditionalDependencies>libgd.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
</Link>
|
|
||||||
<PreBuildEvent>
|
|
||||||
<Command>CALL $(SolutionDir)MSVC\gen-build-config.bat --use-sqlite3 --use-leveldb -p "$(SolutionDir)"</Command>
|
|
||||||
</PreBuildEvent>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<PrecompiledHeader>
|
|
||||||
</PrecompiledHeader>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<AdditionalIncludeDirectories>D:\libs\gd\include;$(ProjectDir)dirent\include;$(ProjectDir)wingetopt\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Console</SubSystem>
|
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<AdditionalDependencies>libgd.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
</Link>
|
|
||||||
<PreBuildEvent>
|
|
||||||
<Command>CALL $(SolutionDir)MSVC\gen-build-config.bat --use-sqlite3 --use-leveldb -p "$(SolutionDir)"</Command>
|
|
||||||
</PreBuildEvent>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="..\BlockPos.h" />
|
|
||||||
<ClInclude Include="..\CharEncodingConverter.h" />
|
|
||||||
<ClInclude Include="..\Color.h" />
|
|
||||||
<ClInclude Include="..\config.h" />
|
|
||||||
<ClInclude Include="..\db-leveldb.h" />
|
|
||||||
<ClInclude Include="..\db-sqlite3.h" />
|
|
||||||
<ClInclude Include="..\db.h" />
|
|
||||||
<ClInclude Include="..\minetest-database.h" />
|
|
||||||
<ClInclude Include="..\PaintEngine.h" />
|
|
||||||
<ClInclude Include="..\PaintEngine_libgd.h" />
|
|
||||||
<ClInclude Include="..\PixelAttributes.h" />
|
|
||||||
<ClInclude Include="..\PlayerAttributes.h" />
|
|
||||||
<ClInclude Include="..\porting.h" />
|
|
||||||
<ClInclude Include="..\porting_win32.h" />
|
|
||||||
<ClInclude Include="..\Settings.h" />
|
|
||||||
<ClInclude Include="..\TileGenerator.h" />
|
|
||||||
<ClInclude Include="..\types.h" />
|
|
||||||
<ClInclude Include="..\ZlibDecompressor.h" />
|
|
||||||
<ClInclude Include="resource.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ResourceCompile Include="minetestmapper.rc" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="..\BlockPos.cpp" />
|
|
||||||
<ClCompile Include="..\CharEncodingConverter.cpp" />
|
|
||||||
<ClCompile Include="..\Color.cpp" />
|
|
||||||
<ClCompile Include="..\db-leveldb.cpp" />
|
|
||||||
<ClCompile Include="..\db-sqlite3.cpp" />
|
|
||||||
<ClCompile Include="..\mapper.cpp" />
|
|
||||||
<ClCompile Include="..\PaintEngine_libgd.cpp" />
|
|
||||||
<ClCompile Include="..\PixelAttributes.cpp" />
|
|
||||||
<ClCompile Include="..\PlayerAttributes.cpp" />
|
|
||||||
<ClCompile Include="..\Settings.cpp" />
|
|
||||||
<ClCompile Include="..\TileGenerator.cpp" />
|
|
||||||
<ClCompile Include="..\ZlibDecompressor.cpp" />
|
|
||||||
<ClCompile Include="wingetopt\src\getopt.c" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<ImportGroup Label="ExtensionTargets">
|
|
||||||
<Import Project="..\packages\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.targets" Condition="Exists('..\packages\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.targets')" />
|
|
||||||
<Import Project="..\packages\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.targets" Condition="Exists('..\packages\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.targets')" />
|
|
||||||
<Import Project="..\packages\sqlite.redist.3.8.4.2\build\native\sqlite.redist.targets" Condition="Exists('..\packages\sqlite.redist.3.8.4.2\build\native\sqlite.redist.targets')" />
|
|
||||||
<Import Project="..\packages\sqlite.3.8.4.2\build\native\sqlite.targets" Condition="Exists('..\packages\sqlite.3.8.4.2\build\native\sqlite.targets')" />
|
|
||||||
<Import Project="..\packages\libpng.redist.1.6.20.1\build\native\libpng.redist.targets" Condition="Exists('..\packages\libpng.redist.1.6.20.1\build\native\libpng.redist.targets')" />
|
|
||||||
</ImportGroup>
|
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
|
||||||
<PropertyGroup>
|
|
||||||
<ErrorText>This projekt requires at least one NuGet-Package which is missing on this Computer. Use Restore NuGet Packages to download the missing files. More informations are aviable under "http://go.microsoft.com/fwlink/?LinkID=322105". The missing file is "{0}".</ErrorText>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Error Condition="!Exists('..\packages\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v120.windesktop.msvcstl.dyn.rt-dyn.targets'))" />
|
|
||||||
<Error Condition="!Exists('..\packages\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.1.2.8.8\build\native\zlib.v140.windesktop.msvcstl.dyn.rt-dyn.targets'))" />
|
|
||||||
<Error Condition="!Exists('..\packages\sqlite.redist.3.8.4.2\build\native\sqlite.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\sqlite.redist.3.8.4.2\build\native\sqlite.redist.targets'))" />
|
|
||||||
<Error Condition="!Exists('..\packages\sqlite.3.8.4.2\build\native\sqlite.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\sqlite.3.8.4.2\build\native\sqlite.targets'))" />
|
|
||||||
<Error Condition="!Exists('..\packages\Crc32C.1.0.4\build\native\Crc32C.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Crc32C.1.0.4\build\native\Crc32C.props'))" />
|
|
||||||
<Error Condition="!Exists('..\packages\Snappy.1.1.1.7\build\native\Snappy.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Snappy.1.1.1.7\build\native\Snappy.props'))" />
|
|
||||||
<Error Condition="!Exists('..\packages\LevelDB.1.16.0.5\build\native\LevelDB.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LevelDB.1.16.0.5\build\native\LevelDB.props'))" />
|
|
||||||
<Error Condition="!Exists('..\packages\libpng.redist.1.6.20.1\build\native\libpng.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\libpng.redist.1.6.20.1\build\native\libpng.redist.targets'))" />
|
|
||||||
</Target>
|
|
||||||
</Project>
|
|
|
@ -1,125 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Source files">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Resource files">
|
|
||||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
|
||||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header files">
|
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
||||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClInclude Include="..\BlockPos.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\Color.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\config.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\db.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\db-leveldb.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\db-sqlite3.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\minetest-database.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\PixelAttributes.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\PlayerAttributes.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\TileGenerator.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\types.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\ZlibDecompressor.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\porting.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\porting_win32.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="resource.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\Settings.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\CharEncodingConverter.h">
|
|
||||||
<Filter>Header files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ResourceCompile Include="minetestmapper.rc">
|
|
||||||
<Filter>Resource files</Filter>
|
|
||||||
</ResourceCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="..\BlockPos.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\Color.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\db-leveldb.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\db-sqlite3.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\mapper.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\PixelAttributes.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\PlayerAttributes.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\TileGenerator.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\ZlibDecompressor.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\leveldb-single-file.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\snappy-single-file.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\native\src\crc32c.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="wingetopt\src\getopt.c">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\Settings.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\CharEncodingConverter.cpp">
|
|
||||||
<Filter>Source files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<None Include="packages.config" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="Crc32C" version="1.0.4" targetFramework="native" />
|
|
||||||
<package id="LevelDB" version="1.16.0.5" targetFramework="native" />
|
|
||||||
<package id="libpng.redist" version="1.6.20.1" targetFramework="native" />
|
|
||||||
<package id="Snappy" version="1.1.1.7" targetFramework="native" />
|
|
||||||
<package id="sqlite" version="3.8.4.2" targetFramework="native" />
|
|
||||||
<package id="sqlite.redist" version="3.8.4.2" targetFramework="native" />
|
|
||||||
<package id="zlib" version="1.2.8.8" targetFramework="native" />
|
|
||||||
<package id="zlib.v120.windesktop.msvcstl.dyn.rt-dyn" version="1.2.8.8" targetFramework="native" />
|
|
||||||
<package id="zlib.v140.windesktop.msvcstl.dyn.rt-dyn" version="1.2.8.8" targetFramework="native" />
|
|
||||||
</packages>
|
|
|
@ -1,2 +0,0 @@
|
||||||
The files src/getopt.h and src/getopt.c were taken at 29.12.2015 from https://github.com/alex85k/wingetopt
|
|
||||||
For license information please look into LICENSE.txt
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
# CMakeList.txt: CMake-Projekt für "Minetestmapper". Schließen Sie die Quelle ein, und definieren Sie
|
||||||
|
# projektspezifische Logik hier.
|
||||||
|
#
|
||||||
|
cmake_minimum_required (VERSION 3.8)
|
||||||
|
|
||||||
|
set (CMAKE_CXX_STANDARD 11)
|
||||||
|
|
||||||
|
set(sources
|
||||||
|
PixelAttributes.cpp
|
||||||
|
PixelAttributes.h
|
||||||
|
PlayerAttributes.cpp
|
||||||
|
PlayerAttributes.h
|
||||||
|
TileGenerator.cpp
|
||||||
|
TileGenerator.h
|
||||||
|
ZlibDecompressor.cpp
|
||||||
|
ZlibDecompressor.h
|
||||||
|
Color.cpp
|
||||||
|
Color.h
|
||||||
|
Settings.cpp
|
||||||
|
Settings.h
|
||||||
|
BlockPos.cpp
|
||||||
|
BlockPos.h
|
||||||
|
mapper.cpp
|
||||||
|
CharEncodingConverter.cpp
|
||||||
|
CharEncodingConverter.h
|
||||||
|
PaintEngine_libgd.cpp
|
||||||
|
PaintEngine_libgd.h
|
||||||
|
db.h
|
||||||
|
db-leveldb.cpp
|
||||||
|
db-leveldb.h
|
||||||
|
db-postgresql.cpp
|
||||||
|
db-postgresql.h
|
||||||
|
db-redis.cpp
|
||||||
|
db-redis.h
|
||||||
|
db-sqlite3.cpp
|
||||||
|
db-sqlite3.h
|
||||||
|
)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(sources ${sources} ResTempl1.rct)
|
||||||
|
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(LIBGD_LIBRARY NAMES libgd libgd_static)
|
||||||
|
find_path(LIBGD_INCLUDE_DIR NAMES gd.h)
|
||||||
|
|
||||||
|
|
||||||
|
include_directories(../wingetopt/src/)
|
||||||
|
find_path(SYSTEM_INCLUDE_DIR dirent.h)
|
||||||
|
include_directories(${SYSTEM_INCLUDE_DIR})
|
||||||
|
|
||||||
|
#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)
|
||||||
|
# TODO: Fügen Sie bei Bedarf Tests und Installationsziele hinzu.
|
||||||
|
|
||||||
|
|
||||||
|
set (CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION ".")
|
||||||
|
include (InstallRequiredSystemLibraries)
|
||||||
|
include (CPack)
|
||||||
|
set(CPACK_GENERATOR "ZIP")
|
||||||
|
install (TARGETS Minetestmapper RUNTIME DESTINATION ".")
|
||||||
|
install(DIRECTORY "${PROJECT_BINARY_DIR}/Minetestmapper/" DESTINATION "."
|
||||||
|
FILES_MATCHING PATTERN "*.dll" PATTERN "/" EXCLUDE)
|
|
@ -8,33 +8,26 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
#include <filesystem>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "config.h"
|
#include <iostream>
|
||||||
#include "PlayerAttributes.h"
|
#include "PlayerAttributes.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
namespace fs = std::experimental::filesystem::v1;
|
||||||
|
|
||||||
PlayerAttributes::PlayerAttributes(const std::string &sourceDirectory)
|
PlayerAttributes::PlayerAttributes(const std::string &sourceDirectory)
|
||||||
{
|
{
|
||||||
|
|
||||||
string playersPath = sourceDirectory + "players";
|
string playersPath = sourceDirectory + "players";
|
||||||
DIR *dir;
|
|
||||||
dir = opendir (playersPath.c_str());
|
|
||||||
if (dir == NULL) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct dirent *ent;
|
for (auto& dirEntry : fs::directory_iterator(playersPath)) {
|
||||||
while ((ent = readdir (dir)) != NULL) {
|
cout << dirEntry << std::endl;
|
||||||
if (ent->d_name[0] == '.') {
|
//dirEntry.path().filename();
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
string path = playersPath + PATH_SEPARATOR + ent->d_name;
|
|
||||||
|
|
||||||
ifstream in;
|
ifstream in;
|
||||||
in.open(path.c_str(), ifstream::in);
|
in.open(dirEntry.path().string(), ifstream::in);
|
||||||
string buffer;
|
string buffer;
|
||||||
string name;
|
string name;
|
||||||
string position;
|
string position;
|
||||||
|
@ -58,7 +51,6 @@ PlayerAttributes::PlayerAttributes(const std::string &sourceDirectory)
|
||||||
|
|
||||||
m_players.push_back(player);
|
m_players.push_back(player);
|
||||||
}
|
}
|
||||||
closedir(dir);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerAttributes::Players::iterator PlayerAttributes::begin()
|
PlayerAttributes::Players::iterator PlayerAttributes::begin()
|
|
@ -22,7 +22,7 @@
|
||||||
#include "TileGenerator.h"
|
#include "TileGenerator.h"
|
||||||
#include "ZlibDecompressor.h"
|
#include "ZlibDecompressor.h"
|
||||||
#include "PaintEngine_libgd.h"
|
#include "PaintEngine_libgd.h"
|
||||||
#if USE_SQLITE3
|
#ifdef USE_SQLITE3
|
||||||
#include "db-sqlite3.h"
|
#include "db-sqlite3.h"
|
||||||
#endif
|
#endif
|
||||||
#if USE_POSTGRESQL
|
#if USE_POSTGRESQL
|
||||||
|
@ -812,7 +812,7 @@ void TileGenerator::openDb(const std::string &input)
|
||||||
m_backend = getWorldDatabaseBackend(input);
|
m_backend = getWorldDatabaseBackend(input);
|
||||||
|
|
||||||
if(m_backend == "sqlite3") {
|
if(m_backend == "sqlite3") {
|
||||||
#if USE_SQLITE3
|
#ifdef USE_SQLITE3
|
||||||
DBSQLite3 *db;
|
DBSQLite3 *db;
|
||||||
m_db = db = new DBSQLite3(input);
|
m_db = db = new DBSQLite3(input);
|
||||||
m_scanEntireWorld = true;
|
m_scanEntireWorld = true;
|
|
@ -257,7 +257,7 @@ private:
|
||||||
int m_heightScaleMajor;
|
int m_heightScaleMajor;
|
||||||
int m_heightScaleMinor;
|
int m_heightScaleMinor;
|
||||||
|
|
||||||
DB *m_db;
|
DB *m_db = nullptr;
|
||||||
int m_generateNoPrefetch;
|
int m_generateNoPrefetch;
|
||||||
bool m_databaseFormatSet;
|
bool m_databaseFormatSet;
|
||||||
BlockPos::StrFormat m_databaseFormat;
|
BlockPos::StrFormat m_databaseFormat;
|
|
@ -0,0 +1,9 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define USE_SQLITE3
|
||||||
|
|
||||||
|
/* #undef USE_POSTGRESQL */
|
||||||
|
|
||||||
|
/* #undef USE_LEVELDB */
|
||||||
|
|
||||||
|
/* #undef USE_REDIS */
|
|
@ -1,20 +1,42 @@
|
||||||
/*
|
|
||||||
* =====================================================================
|
#pragma once
|
||||||
* Version: 1.0
|
|
||||||
* Created: 01.09.2012 12:58:02
|
|
||||||
* Author: Miroslav Bendík
|
|
||||||
* Company: LinuxOS.sk
|
|
||||||
* =====================================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "build_config.h"
|
#include "build_config.h"
|
||||||
|
|
||||||
#if MSDOS || __OS2__ || __NT__ || _WIN32
|
|
||||||
|
#ifdef _WIN32
|
||||||
#define PATH_SEPARATOR '\\'
|
#define PATH_SEPARATOR '\\'
|
||||||
#else
|
#else
|
||||||
#define PATH_SEPARATOR '/'
|
#define PATH_SEPARATOR '/'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// List of possible database names (for usage message)
|
||||||
|
#ifdef USE_SQLITE3
|
||||||
|
#define USAGE_NAME_SQLITE "/sqlite3"
|
||||||
|
#else
|
||||||
|
#define USAGE_NAME_SQLITE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_POSTGRESQL
|
||||||
|
#define USAGE_NAME_POSTGRESQL "/postgresql"
|
||||||
|
#else
|
||||||
|
#define USAGE_NAME_POSTGRESQL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_LEVELDB
|
||||||
|
#define USAGE_NAME_LEVELDB "/leveldb"
|
||||||
|
#else
|
||||||
|
#define USAGE_NAME_LEVELDB
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_REDIS
|
||||||
|
#define USAGE_NAME_REDIS "/redis"
|
||||||
|
#else
|
||||||
|
#define USAGE_NAME_REDIS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USAGE_DATABASES "auto" USAGE_NAME_SQLITE USAGE_NAME_POSTGRESQL USAGE_NAME_LEVELDB USAGE_NAME_REDIS
|
||||||
|
|
||||||
#define BLOCK_SIZE 16
|
#define BLOCK_SIZE 16
|
||||||
#define MAPBLOCK_MIN (-2048)
|
#define MAPBLOCK_MIN (-2048)
|
||||||
#define MAPBLOCK_MAX 2047
|
#define MAPBLOCK_MAX 2047
|
||||||
|
@ -23,39 +45,8 @@
|
||||||
// Max number of node name -> color mappings stored in a mapblock
|
// Max number of node name -> color mappings stored in a mapblock
|
||||||
#define MAPBLOCK_MAXCOLORS 65536
|
#define MAPBLOCK_MAXCOLORS 65536
|
||||||
|
|
||||||
// List of possible database names (for usage message)
|
|
||||||
#if USE_SQLITE3
|
|
||||||
#define USAGE_NAME_SQLITE "/sqlite3"
|
|
||||||
#else
|
|
||||||
#define USAGE_NAME_SQLITE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_POSTGRESQL
|
|
||||||
#define USAGE_NAME_POSTGRESQL "/postgresql"
|
|
||||||
#else
|
|
||||||
#define USAGE_NAME_POSTGRESQL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_LEVELDB
|
|
||||||
#define USAGE_NAME_LEVELDB "/leveldb"
|
|
||||||
#else
|
|
||||||
#define USAGE_NAME_LEVELDB
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if USE_REDIS
|
|
||||||
#define USAGE_NAME_REDIS "/redis"
|
|
||||||
#else
|
|
||||||
#define USAGE_NAME_REDIS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define USAGE_DATABASES "auto" USAGE_NAME_SQLITE USAGE_NAME_POSTGRESQL USAGE_NAME_LEVELDB USAGE_NAME_REDIS
|
|
||||||
|
|
||||||
#if !USE_SQLITE3 && !USE_POSTGRESQL && !USE_LEVELDB && !USE_REDIS
|
|
||||||
#error No database backends configured !
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// default database to use
|
// default database to use
|
||||||
#if USE_SQLITE3 && !USE_POSTGRESQL && !USE_LEVELDB && !USE_REDIS
|
#if defined(USE_SQLITE3) && !defined(USE_POSTGRESQL) && !defined(USE_LEVELDB) && !defined(USE_REDIS)
|
||||||
#define DEFAULT_BACKEND "sqlite3"
|
#define DEFAULT_BACKEND "sqlite3"
|
||||||
#elif !USE_SQLITE3 && USE_POSTGRESQL && !USE_LEVELDB && !USE_REDIS
|
#elif !USE_SQLITE3 && USE_POSTGRESQL && !USE_LEVELDB && !USE_REDIS
|
||||||
#define DEFAULT_BACKEND "postgresql"
|
#define DEFAULT_BACKEND "postgresql"
|
||||||
|
@ -66,4 +57,3 @@
|
||||||
#else
|
#else
|
||||||
#define DEFAULT_BACKEND "auto"
|
#define DEFAULT_BACKEND "auto"
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
|
||||||
|
#if USE_LEVELDB
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "db-leveldb.h"
|
#include "db-leveldb.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -114,3 +119,4 @@ DB::Block DBLevelDB::getBlockOnPos(const BlockPos &pos)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // USE_LEVELDB
|
|
@ -1,5 +1,6 @@
|
||||||
#ifndef _DB_LEVELDB_H
|
#pragma once
|
||||||
#define _DB_LEVELDB_H
|
|
||||||
|
#if USE_LEVELDB
|
||||||
|
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include <leveldb/db.h>
|
#include <leveldb/db.h>
|
||||||
|
@ -21,5 +22,5 @@ private:
|
||||||
unsigned m_keyFormatI64Usage;
|
unsigned m_keyFormatI64Usage;
|
||||||
unsigned m_keyFormatAXYZUsage;
|
unsigned m_keyFormatAXYZUsage;
|
||||||
};
|
};
|
||||||
|
#endif // USE_LEVELDB
|
||||||
|
|
||||||
#endif // _DB_LEVELDB_H
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
|
||||||
|
#if USE_POSTGRESQL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "db-postgresql.h"
|
#include "db-postgresql.h"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <unistd.h> // for usleep
|
#include <unistd.h> // for usleep
|
||||||
|
@ -168,3 +173,4 @@ DB::Block DBPostgreSQL::getBlockOnPos(const BlockPos &pos)
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // USE_POSTGRESQL
|
|
@ -1,5 +1,8 @@
|
||||||
#ifndef _DB_POSTGRESQL_H
|
#pragma once
|
||||||
#define _DB_POSTGRESQL_H
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#if USE_POSTGRESQL
|
||||||
|
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include <libpq-fe.h>
|
#include <libpq-fe.h>
|
||||||
|
@ -42,4 +45,4 @@ private:
|
||||||
const BlockPosList &processBlockPosListQueryResult(PGresult *result);
|
const BlockPosList &processBlockPosListQueryResult(PGresult *result);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DB_POSTGRESQL_H
|
#endif // USE_POSTGRESQL
|
|
@ -1,3 +1,7 @@
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#if USE_REDIS
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
@ -100,4 +104,4 @@ DB::Block DBRedis::getBlockOnPos(const BlockPos &pos)
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
#endif // USE_REDIS
|
|
@ -1,5 +1,9 @@
|
||||||
#ifndef DB_REDIS_HEADER
|
#pragma once
|
||||||
#define DB_REDIS_HEADER
|
|
||||||
|
#include "config.h"
|
||||||
|
#if USE_REDIS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include <hiredis.h>
|
#include <hiredis.h>
|
||||||
|
@ -20,4 +24,4 @@ private:
|
||||||
BlockPosList m_blockPosList;
|
BlockPosList m_blockPosList;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DB_REDIS_HEADER
|
#endif // USE_REDIS
|
|
@ -1,4 +1,7 @@
|
||||||
#include "db-sqlite3.h"
|
#include "db-sqlite3.h"
|
||||||
|
|
||||||
|
#ifdef USE_SQLITE3
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
@ -245,3 +248,4 @@ DB::Block DBSQLite3::getBlockOnPos(const BlockPos &pos)
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif // USE_SQLITE3
|
|
@ -1,5 +1,7 @@
|
||||||
#ifndef _DB_SQLITE3_H
|
#pragma once
|
||||||
#define _DB_SQLITE3_H
|
|
||||||
|
#include "config.h"
|
||||||
|
#ifdef USE_SQLITE3
|
||||||
|
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
|
@ -58,4 +60,4 @@ private:
|
||||||
void cacheBlocks(sqlite3_stmt *SQLstatement);
|
void cacheBlocks(sqlite3_stmt *SQLstatement);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _DB_SQLITE3_H
|
#endif // USE_SQLITE3
|
|
@ -7,6 +7,7 @@
|
||||||
* =====================================================================
|
* =====================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -18,6 +19,9 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "version.h"
|
||||||
#include "porting.h"
|
#include "porting.h"
|
||||||
#include "TileGenerator.h"
|
#include "TileGenerator.h"
|
||||||
#include "PixelAttributes.h"
|
#include "PixelAttributes.h"
|
||||||
|
@ -25,6 +29,7 @@
|
||||||
#include "db-sqlite3.h"
|
#include "db-sqlite3.h"
|
||||||
#include "CharEncodingConverter.h"
|
#include "CharEncodingConverter.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
// Will be used in error messages if nothing better is available.
|
// Will be used in error messages if nothing better is available.
|
||||||
|
@ -59,7 +64,7 @@ using namespace std;
|
||||||
// Will be replaced with the actual name and location of the executable (if found)
|
// Will be replaced with the actual name and location of the executable (if found)
|
||||||
string executableName = DEFAULT_PROGRAM_NAME;
|
string executableName = DEFAULT_PROGRAM_NAME;
|
||||||
string executablePath; // ONLY for use on windows
|
string executablePath; // ONLY for use on windows
|
||||||
string installPrefix = INSTALL_PREFIX;
|
//string installPrefix = INSTALL_PREFIX;
|
||||||
string nodeColorsDefaultFile = "colors.txt";
|
string nodeColorsDefaultFile = "colors.txt";
|
||||||
string heightMapNodesDefaultFile = "heightmap-nodes.txt";
|
string heightMapNodesDefaultFile = "heightmap-nodes.txt";
|
||||||
string heightMapColorsDefaultFile = "heightmap-colors.txt";
|
string heightMapColorsDefaultFile = "heightmap-colors.txt";
|
||||||
|
@ -150,7 +155,7 @@ void usage()
|
||||||
" --disable-blocklist-prefetch[=force]\n"
|
" --disable-blocklist-prefetch[=force]\n"
|
||||||
" --database-format minetest-i64|freeminer-axyz|mixed|query\n"
|
" --database-format minetest-i64|freeminer-axyz|mixed|query\n"
|
||||||
" --prescan-world=full|auto|disabled\n"
|
" --prescan-world=full|auto|disabled\n"
|
||||||
#if USE_SQLITE3
|
#ifdef USE_SQLITE3
|
||||||
" --sqlite3-limit-prescan-query-size[=n]\n"
|
" --sqlite3-limit-prescan-query-size[=n]\n"
|
||||||
#endif
|
#endif
|
||||||
" --geometry <geometry>\n"
|
" --geometry <geometry>\n"
|
||||||
|
@ -251,14 +256,14 @@ void parseDataFile(TileGenerator &generator, const string &input, string dataFil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!installPrefix.empty()) {
|
// if (!installPrefix.empty()) {
|
||||||
#if PACKAGING_FLAT
|
//#if PACKAGING_FLAT
|
||||||
colorPaths.push_back(installPrefix + PATH_SEPARATOR + "colors");
|
// colorPaths.push_back(installPrefix + PATH_SEPARATOR + "colors");
|
||||||
colorPaths.push_back(installPrefix);
|
// colorPaths.push_back(installPrefix);
|
||||||
#else
|
//#else
|
||||||
colorPaths.push_back(installPrefix + "/share/games/minetestmapper");
|
// colorPaths.push_back(installPrefix + "/share/games/minetestmapper");
|
||||||
#endif
|
//#endif
|
||||||
}
|
// }
|
||||||
colorPaths.push_back("");
|
colorPaths.push_back("");
|
||||||
|
|
||||||
std::vector<std::string> fileNames;
|
std::vector<std::string> fileNames;
|
||||||
|
@ -793,7 +798,7 @@ int main(int argc, char *argv[])
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
cout << "Minetestmapper - Version-ID: " << VERSION_MAJOR << "." << VERSION_MINOR << std::endl;
|
cout << "Minetestmapper - Version-ID: " << PROJECT_VERSION_MAJOR << "." << PROJECT_VERSION_MINOR << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
|
@ -865,7 +870,7 @@ int main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
case OPT_SQLITE_LIMIT_PRESCAN_QUERY:
|
case OPT_SQLITE_LIMIT_PRESCAN_QUERY:
|
||||||
if (!optarg || !*optarg) {
|
if (!optarg || !*optarg) {
|
||||||
#if USE_SQLITE3
|
#ifdef USE_SQLITE3
|
||||||
DBSQLite3::setLimitBlockListQuerySize();
|
DBSQLite3::setLimitBlockListQuerySize();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -875,7 +880,7 @@ int main(int argc, char *argv[])
|
||||||
usage();
|
usage();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
#if USE_SQLITE3
|
#ifdef USE_SQLITE3
|
||||||
int size = atoi(optarg);
|
int size = atoi(optarg);
|
||||||
DBSQLite3::setLimitBlockListQuerySize(size);
|
DBSQLite3::setLimitBlockListQuerySize(size);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1041,7 +1046,7 @@ int main(int argc, char *argv[])
|
||||||
generator.setSilenceSuggestion(SUGGESTION_PREFETCH);
|
generator.setSilenceSuggestion(SUGGESTION_PREFETCH);
|
||||||
}
|
}
|
||||||
else if (flag == "sqlite3-lock") {
|
else if (flag == "sqlite3-lock") {
|
||||||
#if USE_SQLITE3
|
#ifdef USE_SQLITE3
|
||||||
DBSQLite3::warnDatabaseLockDelay = false;
|
DBSQLite3::warnDatabaseLockDelay = false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
|
@ -1,16 +1,6 @@
|
||||||
// Microsoft Visual C++ generated resource script.
|
// Microsoft Visual C++ generated resource script.
|
||||||
//
|
//
|
||||||
#include "versioninfo.h"
|
#include "version.h"
|
||||||
|
|
||||||
#define APSTUDIO_READONLY_SYMBOLS
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Generated from the TEXTINCLUDE 2 resource.
|
|
||||||
//
|
|
||||||
#include "winres.h"
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
|
||||||
#undef APSTUDIO_READONLY_SYMBOLS
|
|
||||||
|
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -20,13 +10,7 @@
|
||||||
|
|
||||||
1 TEXTINCLUDE
|
1 TEXTINCLUDE
|
||||||
BEGIN
|
BEGIN
|
||||||
"versioninfo.h\0"
|
"version.h\0"
|
||||||
END
|
|
||||||
|
|
||||||
2 TEXTINCLUDE
|
|
||||||
BEGIN
|
|
||||||
"#include ""winres.h""\r\n"
|
|
||||||
"\0"
|
|
||||||
END
|
END
|
||||||
|
|
||||||
3 TEXTINCLUDE
|
3 TEXTINCLUDE
|
|
@ -0,0 +1,23 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
/* Project name */
|
||||||
|
#define PROJECT_NAME "Minetestmapper"
|
||||||
|
|
||||||
|
/* Version */
|
||||||
|
#define PROJECT_VERSION "0.1.0"
|
||||||
|
#define PROJECT_VERSION_MAJOR 0
|
||||||
|
#define PROJECT_VERSION_MINOR 1
|
||||||
|
#define PROJECT_VERSION_PATCH 0
|
||||||
|
#define PROJECT_VERSION_TWEAK
|
||||||
|
|
||||||
|
#define MINETESTMAPPER_VERSION_BINARY 0, 1, 0, 0,
|
||||||
|
#define MINETESTMAPPER_VERSION_FULL "0. 1. 0"
|
||||||
|
|
||||||
|
/* Copyright string */
|
||||||
|
/* #undef PROJECT_COPYRIGHT */
|
||||||
|
|
||||||
|
/* Contact email */
|
||||||
|
/* #undef PROJECT_CONTACT */
|
||||||
|
|
||||||
|
/* Website */
|
||||||
|
/* #undef ORG_WEBSITE */
|
|
@ -1 +0,0 @@
|
||||||
20160531
|
|
|
@ -1,27 +1,9 @@
|
||||||
// The file 'build_config.h' is auto-generated. Any changes to it
|
#pragma once
|
||||||
// will be overwritten.
|
|
||||||
//
|
|
||||||
// Modify the file build_config.h.in instead.
|
|
||||||
//
|
|
||||||
// This file was generated on @BUILD_CONFIG_GENDATE@ by @BUILD_CONFIG_GENTOOL@
|
|
||||||
|
|
||||||
#ifndef BUILD_CONFIG_H
|
#cmakedefine USE_SQLITE3
|
||||||
#define BUILD_CONFIG_H
|
|
||||||
|
|
||||||
#define USE_SQLITE3 @USE_SQLITE3@
|
#cmakedefine USE_POSTGRESQL
|
||||||
#define USE_POSTGRESQL @USE_POSTGRESQL@
|
|
||||||
#define USE_LEVELDB @USE_LEVELDB@
|
|
||||||
#define USE_REDIS @USE_REDIS@
|
|
||||||
|
|
||||||
#define USE_ICONV @USE_ICONV@
|
#cmakedefine USE_LEVELDB
|
||||||
|
|
||||||
#define VERSION_MAJOR "@VERSION_MAJOR@"
|
|
||||||
#define VERSION_MINOR "@VERSION_MINOR@"
|
|
||||||
|
|
||||||
#define PACKAGING_FLAT @PACKAGING_FLAT@
|
|
||||||
#define INSTALL_PREFIX "@INSTALL_PREFIX@"
|
|
||||||
|
|
||||||
#define CPP_ABI_STDSTRING_OK @CPP_ABI_STDSTRING_OK@
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#cmakedefine USE_REDIS
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
# - Find python docutils
|
|
||||||
#
|
|
||||||
# This module defines the following variables:
|
|
||||||
#
|
|
||||||
# DOCUTILS_FOUND - system has docutils
|
|
||||||
#
|
|
||||||
# RST2HTML_EXECUTABLE - the rst2html executable
|
|
||||||
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright 2010 Sascha Peilicke <sasch.pe@gmx.de
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
|
|
||||||
find_program(RST2HTML_EXECUTABLE NAMES rst2html.py rst2html
|
|
||||||
DOC "The Python Docutils reStructuredText HTML converter")
|
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set DOCUTILS_FOUND to TRUE if
|
|
||||||
# all listed variables are TRUE
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Docutils DEFAULT_MSG RST2HTML_EXECUTABLE)
|
|
||||||
|
|
||||||
if(RST2HTML_EXECUTABLE)
|
|
||||||
macro(RST2HTML)
|
|
||||||
foreach(it ${ARGN})
|
|
||||||
get_filename_component(basename ${it} NAME_WE)
|
|
||||||
set(infile ${CMAKE_CURRENT_SOURCE_DIR}/${it})
|
|
||||||
set(outfile ${CMAKE_CURRENT_BINARY_DIR}/${basename}.html)
|
|
||||||
|
|
||||||
# Unfortunately, cmake does not remove any generated target of a
|
|
||||||
# failed build. So a build with with warnings that are considered
|
|
||||||
# fatal (--exit-status=2) will not be retried.
|
|
||||||
# Execute the command twice to get a full list of warnings and errors,
|
|
||||||
# but to avoid generating the target if there were warnings or errors.
|
|
||||||
add_custom_command( OUTPUT ${outfile}
|
|
||||||
COMMAND ${RST2HTML_EXECUTABLE}
|
|
||||||
ARGS ${RST2HTML_FLAGS} --halt=4 ${infile} /dev/null
|
|
||||||
COMMAND ${RST2HTML_EXECUTABLE}
|
|
||||||
ARGS ${RST2HTML_FLAGS} --quiet ${infile} ${outfile}
|
|
||||||
DEPENDS ${infile})
|
|
||||||
endforeach()
|
|
||||||
endmacro()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
mark_as_advanced(RST2HTML_EXECUTABLE)
|
|
|
@ -1,22 +0,0 @@
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
2. Redistributions in binary form must reproduce the copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
3. The name of the author may not be used to endorse or promote products
|
|
||||||
derived from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
@ -1,66 +0,0 @@
|
||||||
# From: http://gitorious.org/gammu/mainline/blobs/master/cmake/FindIconv.cmake
|
|
||||||
|
|
||||||
# - Try to find Iconv
|
|
||||||
# Once done this will define
|
|
||||||
#
|
|
||||||
# ICONV_FOUND - system has Iconv
|
|
||||||
# ICONV_INCLUDE_DIR - the Iconv include directory
|
|
||||||
# ICONV_LIBRARIES - Link these to use Iconv
|
|
||||||
# ICONV_SECOND_ARGUMENT_IS_CONST - the second argument for iconv() is const
|
|
||||||
#
|
|
||||||
include(CheckCCompilerFlag)
|
|
||||||
include(CheckCXXSourceCompiles)
|
|
||||||
|
|
||||||
IF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
|
||||||
# Already in cache, be silent
|
|
||||||
SET(ICONV_FIND_QUIETLY TRUE)
|
|
||||||
ENDIF (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
|
||||||
|
|
||||||
FIND_PATH(ICONV_INCLUDE_DIR iconv.h)
|
|
||||||
|
|
||||||
FIND_LIBRARY(ICONV_LIBRARIES NAMES iconv libiconv c)
|
|
||||||
|
|
||||||
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
|
||||||
SET(ICONV_FOUND TRUE)
|
|
||||||
ENDIF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
|
|
||||||
IF(ICONV_FOUND)
|
|
||||||
check_c_compiler_flag("-Werror" ICONV_HAVE_WERROR)
|
|
||||||
set (CMAKE_C_FLAGS_BACKUP "${CMAKE_C_FLAGS}")
|
|
||||||
if(ICONV_HAVE_WERROR)
|
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
|
||||||
endif(ICONV_HAVE_WERROR)
|
|
||||||
check_c_source_compiles("
|
|
||||||
#include <iconv.h>
|
|
||||||
int main(){
|
|
||||||
iconv_t conv = 0;
|
|
||||||
const char* in = 0;
|
|
||||||
size_t ilen = 0;
|
|
||||||
char* out = 0;
|
|
||||||
size_t olen = 0;
|
|
||||||
iconv(conv, &in, &ilen, &out, &olen);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
" ICONV_SECOND_ARGUMENT_IS_CONST )
|
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS_BACKUP}")
|
|
||||||
ENDIF(ICONV_FOUND)
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES)
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES)
|
|
||||||
|
|
||||||
IF(ICONV_FOUND)
|
|
||||||
IF(NOT ICONV_FIND_QUIETLY)
|
|
||||||
MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
|
|
||||||
ENDIF(NOT ICONV_FIND_QUIETLY)
|
|
||||||
ELSE(ICONV_FOUND)
|
|
||||||
IF(Iconv_FIND_REQUIRED)
|
|
||||||
MESSAGE(FATAL_ERROR "Could not find Iconv")
|
|
||||||
ENDIF(Iconv_FIND_REQUIRED)
|
|
||||||
ENDIF(ICONV_FOUND)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(
|
|
||||||
ICONV_INCLUDE_DIR
|
|
||||||
ICONV_LIBRARIES
|
|
||||||
ICONV_SECOND_ARGUMENT_IS_CONST
|
|
||||||
)
|
|
|
@ -0,0 +1,177 @@
|
||||||
|
#.rst:
|
||||||
|
# VersionFromGit
|
||||||
|
# -------
|
||||||
|
#
|
||||||
|
# Get a project's version number from the latest Git tag.
|
||||||
|
#
|
||||||
|
# See README.md for the full documentation.
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
#
|
||||||
|
# The MIT License (MIT)
|
||||||
|
#
|
||||||
|
# Copyright (c) 2015 Theo Willows
|
||||||
|
#
|
||||||
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
|
# in the Software without restriction, including without limitation the rights
|
||||||
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
# copies of the Software, and to permit persons to whom the Software is
|
||||||
|
# furnished to do so, subject to the following conditions:
|
||||||
|
#
|
||||||
|
# The above copyright notice and this permission notice shall be included in all
|
||||||
|
# copies or substantial portions of the Software.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
# SOFTWARE.
|
||||||
|
#
|
||||||
|
#=============================================================================
|
||||||
|
|
||||||
|
cmake_minimum_required( VERSION 3.0.0 )
|
||||||
|
|
||||||
|
message( WARNING
|
||||||
|
"VersionFromGit is now part of munkei-cmake. This version is deprecated. You should get the new module from <https://github.com/Munkei/munkei-cmake>."
|
||||||
|
)
|
||||||
|
|
||||||
|
include( CMakeParseArguments )
|
||||||
|
|
||||||
|
function( version_from_git )
|
||||||
|
# Parse arguments
|
||||||
|
set( options OPTIONAL FAST )
|
||||||
|
set( oneValueArgs
|
||||||
|
GIT_EXECUTABLE
|
||||||
|
INCLUDE_HASH
|
||||||
|
LOG
|
||||||
|
TIMESTAMP
|
||||||
|
)
|
||||||
|
set( multiValueArgs )
|
||||||
|
cmake_parse_arguments( ARG "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||||
|
|
||||||
|
# Defaults
|
||||||
|
if( NOT DEFINED ARG_INCLUDE_HASH )
|
||||||
|
set( ARG_INCLUDE_HASH ON )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( DEFINED ARG_GIT_EXECUTABLE )
|
||||||
|
set( GIT_EXECUTABLE "${ARG_GIT_EXECUTABLE}" )
|
||||||
|
else ()
|
||||||
|
# Find Git or bail out
|
||||||
|
find_package( Git )
|
||||||
|
if( NOT GIT_FOUND )
|
||||||
|
message( FATAL_ERROR "Git not found" )
|
||||||
|
endif( NOT GIT_FOUND )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Git describe
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" describe --tags
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE git_result
|
||||||
|
OUTPUT_VARIABLE git_describe
|
||||||
|
ERROR_VARIABLE git_error
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
ERROR_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
if( NOT git_result EQUAL 0 )
|
||||||
|
message( FATAL_ERROR "Failed to execute Git: ${git_error}" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Get Git tag
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" describe --tags --abbrev=0
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE git_result
|
||||||
|
OUTPUT_VARIABLE git_tag
|
||||||
|
ERROR_VARIABLE git_error
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
ERROR_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
if( NOT git_result EQUAL 0 )
|
||||||
|
message( FATAL_ERROR "Failed to execute Git: ${git_error}" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( git_tag MATCHES "^v(0|[1-9][0-9]*)[.](0|[1-9][0-9]*)[.](0|[1-9][0-9]*)(-[.0-9A-Za-z-]+)?([+][.0-9A-Za-z-]+)?$" )
|
||||||
|
set( version_major "${CMAKE_MATCH_1}" )
|
||||||
|
set( version_minor "${CMAKE_MATCH_2}" )
|
||||||
|
set( version_patch "${CMAKE_MATCH_3}" )
|
||||||
|
set( identifiers "${CMAKE_MATCH_4}" )
|
||||||
|
set( metadata "${CMAKE_MATCH_5}" )
|
||||||
|
else()
|
||||||
|
message( FATAL_ERROR "Git tag isn't valid semantic version: [${git_tag}]" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( "${git_tag}" STREQUAL "${git_describe}" )
|
||||||
|
set( git_at_a_tag ON )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( NOT git_at_a_tag )
|
||||||
|
# Extract the Git hash (if one exists)
|
||||||
|
string( REGEX MATCH "g[0-9a-f]+$" git_hash "${git_describe}" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Construct the version variables
|
||||||
|
set( version ${version_major}.${version_minor}.${version_patch} )
|
||||||
|
set( semver ${version} )
|
||||||
|
|
||||||
|
# Identifiers
|
||||||
|
if( identifiers MATCHES ".+" )
|
||||||
|
string( SUBSTRING "${identifiers}" 1 -1 identifiers )
|
||||||
|
set( semver "${semver}-${identifiers}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Metadata
|
||||||
|
# TODO Split and join (add Git hash inbetween)
|
||||||
|
if( metadata MATCHES ".+" )
|
||||||
|
string( SUBSTRING "${metadata}" 1 -1 metadata )
|
||||||
|
# Split
|
||||||
|
string( REPLACE "." ";" metadata "${metadata}" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( NOT git_at_a_tag )
|
||||||
|
|
||||||
|
if( ARG_INCLUDE_HASH )
|
||||||
|
list( APPEND metadata "${git_hash}" )
|
||||||
|
endif( ARG_INCLUDE_HASH )
|
||||||
|
|
||||||
|
# Timestamp
|
||||||
|
if( DEFINED ARG_TIMESTAMP )
|
||||||
|
string( TIMESTAMP timestamp "${ARG_TIMESTAMP}" ${ARG_UTC} )
|
||||||
|
list( APPEND metadata "${timestamp}" )
|
||||||
|
endif( DEFINED ARG_TIMESTAMP )
|
||||||
|
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Join
|
||||||
|
string( REPLACE ";" "." metadata "${metadata}" )
|
||||||
|
|
||||||
|
if( metadata MATCHES ".+" )
|
||||||
|
set( semver "${semver}+${metadata}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Log the results
|
||||||
|
if( ARG_LOG )
|
||||||
|
message( STATUS
|
||||||
|
"Version: ${version}
|
||||||
|
Git tag: [${git_tag}]
|
||||||
|
Git hash: [${git_hash}]
|
||||||
|
Decorated: [${git_describe}]
|
||||||
|
Identifiers: [${identifiers}]
|
||||||
|
Metadata: [${metadata}]
|
||||||
|
SemVer: [${semver}]"
|
||||||
|
)
|
||||||
|
endif( ARG_LOG )
|
||||||
|
|
||||||
|
# Set parent scope variables
|
||||||
|
set( GIT_TAG ${git_tag} PARENT_SCOPE )
|
||||||
|
set( SEMVER ${semver} PARENT_SCOPE )
|
||||||
|
set( VERSION ${version} PARENT_SCOPE )
|
||||||
|
set( VERSION_MAJOR ${version_major} PARENT_SCOPE )
|
||||||
|
set( VERSION_MINOR ${version_minor} PARENT_SCOPE )
|
||||||
|
set( VERSION_PATCH ${version_patch} PARENT_SCOPE )
|
||||||
|
|
||||||
|
endfunction( version_from_git )
|
|
@ -1,7 +0,0 @@
|
||||||
#include <string>
|
|
||||||
#include <leveldb/status.h>
|
|
||||||
int main(void) {
|
|
||||||
leveldb::Status status;
|
|
||||||
std::string str = status.ToString();
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
// File used by cmake to check for c++ standard support
|
|
||||||
// See: CmakeLists.txt
|
|
||||||
|
|
||||||
int main(void) { return 0; }
|
|
|
@ -1 +0,0 @@
|
||||||
*.html
|
|
|
@ -1,76 +0,0 @@
|
||||||
project(minetestmapper CXX)
|
|
||||||
cmake_minimum_required(VERSION 2.6)
|
|
||||||
cmake_policy(SET CMP0003 NEW)
|
|
||||||
|
|
||||||
if(NOT DEFINED USE_RST2HTML)
|
|
||||||
set(USE_RST2HTML -1)
|
|
||||||
endif(NOT DEFINED USE_RST2HTML)
|
|
||||||
|
|
||||||
SET(RST2HTML_FLAGS --exit-status=2)
|
|
||||||
|
|
||||||
SET(REQUIRE_HTML_DOCUMENTATION_DOC "Convert rst documents to html or fail")
|
|
||||||
SET(DISABLE_HTML_DOCUMENTATION_DOC "Don't convert rst documents to html")
|
|
||||||
OPTION(REQUIRE_HTML_DOCUMENTATION ${REQUIRE_HTML_DOCUMENTATION_DOC} False)
|
|
||||||
OPTION(DISABLE_HTML_DOCUMENTATION ${DISABLE_HTML_DOCUMENTATION_DOC} False)
|
|
||||||
|
|
||||||
# Find rst to html converter
|
|
||||||
if(REQUIRE_HTML_DOCUMENTATION AND DISABLE_HTML_DOCUMENTATION)
|
|
||||||
message(WARNING "REQUIRE_HTML_DOCUMENTATION and DISABLE_HTML_DOCUMENTATION are both enabled. Reinitializing rst to html conversion.")
|
|
||||||
set(REQUIRE_HTML_DOCUMENTATION False CACHE BOOL ${REQUIRE_HTML_DOCUMENTATION_DOC} FORCE)
|
|
||||||
set(DISABLE_HTML_DOCUMENTATION False CACHE BOOL ${DISABLE_HTML_DOCUMENTATION_DOC} FORCE)
|
|
||||||
set(USE_RST2HTML -1)
|
|
||||||
endif(REQUIRE_HTML_DOCUMENTATION AND DISABLE_HTML_DOCUMENTATION)
|
|
||||||
|
|
||||||
find_package(Docutils)
|
|
||||||
if(DOCUTILS_FOUND)
|
|
||||||
message(STATUS "Python docutils found (rst2html: ${RST2HTML_EXECUTABLE})")
|
|
||||||
else(DOCUTILS_FOUND)
|
|
||||||
message(STATUS "Python docutils not found")
|
|
||||||
endif(DOCUTILS_FOUND)
|
|
||||||
|
|
||||||
if(REQUIRE_HTML_DOCUMENTATION)
|
|
||||||
set(USE_RST2HTML 1)
|
|
||||||
message(STATUS "Conversion of documentation to html enabled as requested")
|
|
||||||
elseif(DISABLE_HTML_DOCUMENTATION)
|
|
||||||
set(USE_RST2HTML 0)
|
|
||||||
message(STATUS "Conversion of documentation to html disabled as requested")
|
|
||||||
elseif(USE_RST2HTML EQUAL -1)
|
|
||||||
# First time, and no preference specified: choose depending
|
|
||||||
# on availability of rst2html
|
|
||||||
if (DOCUTILS_FOUND)
|
|
||||||
set(USE_RST2HTML 1)
|
|
||||||
message(STATUS "Conversion of documentation to html enabled (because python docutils found)")
|
|
||||||
else (DOCUTILS_FOUND)
|
|
||||||
set(USE_RST2HTML 0)
|
|
||||||
message(STATUS "Conversion of documentation to html disabled (because python docutils not found)")
|
|
||||||
endif (DOCUTILS_FOUND)
|
|
||||||
elseif(USE_RST2HTML EQUAL 0)
|
|
||||||
if (DOCUTILS_FOUND)
|
|
||||||
set(USE_RST2HTML 1)
|
|
||||||
message(STATUS "Conversion of documentation to html enabled (because python docutils has become available)")
|
|
||||||
else (DOCUTILS_FOUND)
|
|
||||||
message(STATUS "Conversion of documentation to html disabled (because python docutils still not found)")
|
|
||||||
endif (DOCUTILS_FOUND)
|
|
||||||
elseif(USE_RST2HTML EQUAL 1)
|
|
||||||
message(STATUS "Conversion of documentation to html enabled (because enabled previously)")
|
|
||||||
endif(REQUIRE_HTML_DOCUMENTATION)
|
|
||||||
|
|
||||||
if(USE_RST2HTML AND NOT DOCUTILS_FOUND)
|
|
||||||
message(SEND_ERROR "Conversion of documentation to html is enabled, but python docutils was not found.")
|
|
||||||
endif(USE_RST2HTML AND NOT DOCUTILS_FOUND)
|
|
||||||
|
|
||||||
# Save USE_RST2HTML for next invocation
|
|
||||||
set(USE_RST2HTML ${USE_RST2HTML} CACHE INTERNAL "Internal use - do not modify")
|
|
||||||
|
|
||||||
file(GLOB DOC_RST_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.rst)
|
|
||||||
string(REPLACE ".rst" ".html" DOC_HTML_FILES "${DOC_RST_FILES}")
|
|
||||||
|
|
||||||
if(USE_RST2HTML)
|
|
||||||
add_custom_target(htmldoc ALL DEPENDS ${DOC_HTML_FILES})
|
|
||||||
elseif(NOT USE_RST2HTML AND DOCUTILS_FOUND)
|
|
||||||
add_custom_target(htmldoc DEPENDS ${DOC_HTML_FILES})
|
|
||||||
endif(USE_RST2HTML)
|
|
||||||
if(USE_RST2HTML OR DOCUTILS_FOUND)
|
|
||||||
RST2HTML(${DOC_RST_FILES})
|
|
||||||
endif(USE_RST2HTML OR DOCUTILS_FOUND)
|
|
||||||
|
|
|
@ -1,400 +0,0 @@
|
||||||
Minetest Mapper Build Instructions
|
|
||||||
##################################
|
|
||||||
|
|
||||||
Minetestmapper can be built on posix (Linux, \*BSD, ...), OSX and Windows
|
|
||||||
platforms.
|
|
||||||
|
|
||||||
Not all platforms receive the same amount of testing:
|
|
||||||
|
|
||||||
* Gcc and clang builds on Linux are frequently tested.
|
|
||||||
* The BSD family should also give little trouble. It is not tested that I know of.
|
|
||||||
* MSVC on Windows is tested.
|
|
||||||
* Windows building using MinGW is tested intermittently and should work.
|
|
||||||
* Building on OSX has not been tested recently and may not work.
|
|
||||||
|
|
||||||
Please let me know how you fared on your platform (when you encounter problems,
|
|
||||||
but also when you're successful - so I can update this text with the latest
|
|
||||||
information).
|
|
||||||
|
|
||||||
.. Contents:: :depth: 2
|
|
||||||
|
|
||||||
Requirements
|
|
||||||
============
|
|
||||||
|
|
||||||
Libraries
|
|
||||||
---------
|
|
||||||
|
|
||||||
* zlib
|
|
||||||
* libgd
|
|
||||||
* sqlite3 (optional - enabled by default, set ENABLE_SQLITE3=0 in CMake to disable)
|
|
||||||
* postgresql (optional, set ENABLE_POSTGRESQL=1 in CMake to enable postgresql support)
|
|
||||||
* leveldb (optional, set ENABLE_LEVELDB=1 in CMake to enable leveldb support)
|
|
||||||
* hiredis (optional, set ENABLE_REDIS=1 in CMake to enable redis support)
|
|
||||||
|
|
||||||
At least one of ``sqlite3``, ``postgresql``, ``leveldb`` and ``hiredis`` is required.
|
|
||||||
Check the minetest worlds that will be mapped to know which ones should be included.
|
|
||||||
|
|
||||||
Not all database backend libraries may be obtainable for all platforms (in particular
|
|
||||||
for Windows).
|
|
||||||
|
|
||||||
The current build scripts for MSVC on windows support the SQLite3 and LevelDB backends out
|
|
||||||
of the box. Compiling with Redis or PostgreSQL support will require some extra work.
|
|
||||||
|
|
||||||
Build Environment
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
* C++ compiler suite (clang or gcc (including mingw); msvc on Windows)
|
|
||||||
* cmake (not for msvc)
|
|
||||||
* make (not for msvc)
|
|
||||||
|
|
||||||
Documentation
|
|
||||||
-------------
|
|
||||||
|
|
||||||
If converting the documentation to HTML, or another format is desired:
|
|
||||||
|
|
||||||
* python-docutils
|
|
||||||
|
|
||||||
Packaging
|
|
||||||
---------
|
|
||||||
|
|
||||||
If creation of installation packages is desired:
|
|
||||||
|
|
||||||
* fakeroot (for a deb package)
|
|
||||||
* rpm-build (for an rpm package)
|
|
||||||
|
|
||||||
Install Dependencies
|
|
||||||
====================
|
|
||||||
|
|
||||||
Debian and Derivatives
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
Install a compiler if not yet installed. Either gcc/g++:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
apt-get install make cmake cmake-curses-gui g++
|
|
||||||
|
|
||||||
Or clang:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
apt-get install make cmake cmake-curses-gui clang
|
|
||||||
|
|
||||||
To convert the manual to HTML (if desired), install ``python-docutils``
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
apt-get install python-docutils
|
|
||||||
|
|
||||||
In order to make a ``.deb`` package (if desired), install the required tools:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
apt-get install fakeroot
|
|
||||||
|
|
||||||
Finally install the minetestmapper dependencies. At least one of ``libsqlite3-dev``,
|
|
||||||
``libpq-dev``, ``libleveldb-dev`` and ``libhiredis-dev`` is required.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
apt-get install zlib1g-dev libgd-dev libsqlite3-dev libpq-dev libleveldb-dev libhiredis-dev
|
|
||||||
|
|
||||||
Fedora and Derivatives
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
Install a compiler if not yet installed. Either gcc/g++:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
yum install make cmake gcc-c++
|
|
||||||
|
|
||||||
Or clang:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
yum install make cmake clang
|
|
||||||
|
|
||||||
To convert the manual to HTML (if desired), install ``python-docutils``
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
yum install python-docutils
|
|
||||||
|
|
||||||
In order to make an ``.rpm`` package (if desired), install the required tools:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
yum install rpm-build
|
|
||||||
|
|
||||||
Finally install the minetestmapper dependencies. At least one of ``libsqlite3x-devel``,
|
|
||||||
``postgresql-devel``, ``leveldb-devel`` and ``hiredis-devel`` is required.
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
yum install zlib-devel gd-devel libsqlite3x-devel postgresql-devel leveldb-devel hiredis-devel
|
|
||||||
|
|
||||||
Ubuntu
|
|
||||||
------
|
|
||||||
See `Debian and Derivatives`_
|
|
||||||
|
|
||||||
Linux Mint
|
|
||||||
----------
|
|
||||||
See `Debian and Derivatives`_
|
|
||||||
|
|
||||||
Windows (MinGW)
|
|
||||||
---------------
|
|
||||||
|
|
||||||
You're probably in for a lot of work, downloading software, and
|
|
||||||
probably compiling at least some of the direct and indirect dependencies.
|
|
||||||
At the moment, regrettably, detailed instructions are not available.
|
|
||||||
|
|
||||||
Windows (MSVC)
|
|
||||||
--------------
|
|
||||||
|
|
||||||
The following must be installed to successfully compile minetestmapper using MSVC:
|
|
||||||
|
|
||||||
* Visual Studio 2015 or 2013 (lower may not work). VS Community can be obtained here:
|
|
||||||
https://www.visualstudio.com/
|
|
||||||
* A precompiled version of the gd library. A suitable version can be downloaded from
|
|
||||||
https://github.com/Rogier-5/minetest-mapper-cpp/wiki/Downloads#the-gd-library-for-compiling-minetestmapper-with-msvc
|
|
||||||
|
|
||||||
Alternatively, the gd sources can be downloaded from https://github.com/libgd/libgd.
|
|
||||||
They must be compiled using the same version of zlib that will be used when compiling
|
|
||||||
minetestmapper.
|
|
||||||
|
|
||||||
Version 2.2.1 of gd is verified to work, but any version 2.2.x should also work.
|
|
||||||
And presumably any version 2.x later than 2.2 should work as well.
|
|
||||||
|
|
||||||
All other required dependencies will be downloaded automatically by MSVC.
|
|
||||||
|
|
||||||
|
|
||||||
Other
|
|
||||||
-----
|
|
||||||
|
|
||||||
At this moment, no specific instructions are available for other platforms.
|
|
||||||
Feel free to contribute...
|
|
||||||
|
|
||||||
Compilation
|
|
||||||
===========
|
|
||||||
|
|
||||||
Linux / BSD / ...
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
Plain:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cmake .
|
|
||||||
make
|
|
||||||
|
|
||||||
With levelDB and Redis support:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cmake -DENABLE_LEVELDB=true -DENABLE_REDIS=true .
|
|
||||||
make
|
|
||||||
|
|
||||||
Create native installation package(s):
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCREATE_FLAT_PACKAGE=False
|
|
||||||
cpack
|
|
||||||
|
|
||||||
See `CMake Variables`_ for more CMake options.
|
|
||||||
|
|
||||||
Windows (MinGW)
|
|
||||||
---------------
|
|
||||||
|
|
||||||
Unfortunately, at the moment no instructions are available for Windows building using MinGW.
|
|
||||||
|
|
||||||
Windows (MSVC)
|
|
||||||
--------------
|
|
||||||
|
|
||||||
Setting up the IDE
|
|
||||||
..................
|
|
||||||
|
|
||||||
1. Open ``minetestmapper.sln`` or ``MSVC\mintestmapper.vcxproj`` with Visual Studio.
|
|
||||||
2. Configure the gd libary:
|
|
||||||
1. Open projectsettings `ALT+F7`.
|
|
||||||
2. Select `All Configurations` and `All Platforms`.
|
|
||||||
3. Click `C/C++` -> `additional include directories` and enter the path to the include directory of libGD.
|
|
||||||
4. Click `Apply`
|
|
||||||
5. Select a configuration (``Debug|Release``) and a platform (``x86|x64``)
|
|
||||||
6. Click `Linker` --> `additional libary directories` Enter the path to libgd that fits to your configuration and platform.
|
|
||||||
|
|
||||||
Do this step for all configurations and platforms you want to use.
|
|
||||||
|
|
||||||
WARNING: You will get a linker error if you select a version of libgd that does not fit to your configuration and platform.
|
|
||||||
|
|
||||||
Building Minetestmapper
|
|
||||||
.......................
|
|
||||||
|
|
||||||
With everything set up, Minetestmapper can be built.
|
|
||||||
|
|
||||||
Debugging Minetestmapper
|
|
||||||
........................
|
|
||||||
|
|
||||||
1. In projectsettings (`ALT+F7`) click `Debugging`.
|
|
||||||
2. Specify the Arguments in `Command arguments`.
|
|
||||||
3. Every time you launch the debugger, minetstmapper will be executed with those arguments.
|
|
||||||
|
|
||||||
OSX
|
|
||||||
---
|
|
||||||
|
|
||||||
Probably quite similar to Linux, BSD, etc. Unfortunately no detailed instructions
|
|
||||||
are available.
|
|
||||||
|
|
||||||
CMake Variables
|
|
||||||
---------------
|
|
||||||
|
|
||||||
ENABLE_SQLITE3:
|
|
||||||
Whether to enable sqlite3 backend support (on by default)
|
|
||||||
|
|
||||||
ENABLE_POSTGRESQL:
|
|
||||||
Whether to enable postresql backend support (off by default)
|
|
||||||
|
|
||||||
ENABLE_LEVELDB:
|
|
||||||
Whether to enable leveldb backend support (off by default)
|
|
||||||
|
|
||||||
ENABLE_REDIS:
|
|
||||||
Whether to enable redis backend support (off by default)
|
|
||||||
|
|
||||||
ENABLE_ALL_DATABASES:
|
|
||||||
Whether to enable support for all backends (off by default)
|
|
||||||
|
|
||||||
CMAKE_BUILD_TYPE:
|
|
||||||
Type of build: 'Release' or 'Debug'. Defaults to 'Release'.
|
|
||||||
|
|
||||||
CREATE_FLAT_PACKAGE:
|
|
||||||
Whether to create a .tar.gz package suitable for installation in a user's private
|
|
||||||
directory.
|
|
||||||
The archive will unpack into a single directory, with the mapper's files inside
|
|
||||||
(this is the default).
|
|
||||||
|
|
||||||
If off, ``.tar.gz``, ``.deb`` and/or ``.rpm`` packages suitable for system-wide installation
|
|
||||||
will be created if possible. The ``tar.gz`` package will unpack into a directory hierarchy.
|
|
||||||
|
|
||||||
For creation of ``.deb`` and ``.rpm packages``, CMAKE_INSTALL_PREFIX must be '/usr'.
|
|
||||||
|
|
||||||
For ``.deb`` package creation, dpkg and fakeroot are required.
|
|
||||||
|
|
||||||
For ``.rpm`` package creation, rpmbuild is required.
|
|
||||||
|
|
||||||
PACKAGING_VERSION:
|
|
||||||
The version number of the packaging itself. It is appended to the software version
|
|
||||||
number when packaging.
|
|
||||||
|
|
||||||
This number should normally be set to '1', but it should be increased when
|
|
||||||
a package has been installed or distributed, and a newer package is created from
|
|
||||||
from the same sources (i.e. from the same git commit).
|
|
||||||
|
|
||||||
This can happen for instance, if a problem was caused by the packaging itself,
|
|
||||||
or if a bug in a library was fixed, and minetestmapper needs to be recompiled
|
|
||||||
to incorporate that fix.
|
|
||||||
|
|
||||||
CMAKE_INSTALL_PREFIX:
|
|
||||||
The install location. Should probably be ``/usr`` or ``/usr/local`` on Linux and BSD variants.
|
|
||||||
|
|
||||||
ARCHIVE_PACKAGE_NAME:
|
|
||||||
Name of the ``.zip`` or ``.tar.gz`` package (without extension). This will also be
|
|
||||||
the name of the directory into which the archive unpacks.
|
|
||||||
|
|
||||||
Defaults to ``minetestmapper-<version>-<os-type>``
|
|
||||||
|
|
||||||
The names of ``.deb`` and ``.rpm`` packages are *not* affected by this variable.
|
|
||||||
|
|
||||||
REQUIRE_HTML_DOCUMENTATION:
|
|
||||||
Whether HTML documentation must be generated. If enabled, and python-docutils is not
|
|
||||||
installed, building will fail.
|
|
||||||
|
|
||||||
By default, HTML documentation will be generated if python-docutils is found, else
|
|
||||||
it will not be generated.
|
|
||||||
|
|
||||||
See also the note below.
|
|
||||||
|
|
||||||
DISABLE_HTML_DOCUMENTATION:
|
|
||||||
Whether to skip generation of HTML documentation, even if python-docutils could be
|
|
||||||
found.
|
|
||||||
|
|
||||||
Note that if HTML documentation is not generated at build time, it will also not
|
|
||||||
be included in the packages, even if python-docutils is in fact installed and
|
|
||||||
even if the converted documentation is available (e.g. because it was generated
|
|
||||||
manually).
|
|
||||||
|
|
||||||
See also the note below.
|
|
||||||
|
|
||||||
HTML Documentation note:
|
|
||||||
If both REQUIRE_HTML_DOCUMENTATION and DISABLE_HTML_DOCUMENTATION are disabled,
|
|
||||||
then the question of whether HTML documentation will be generated depends on
|
|
||||||
whether python-docutils is installed. If installed, then henceforth HTML
|
|
||||||
documentation will be generated. If not installed, then it will not be generated.
|
|
||||||
|
|
||||||
As long as REQUIRE_HTML_DOCUMENTATION and DISABLE_HTML_DOCUMENTATION are both
|
|
||||||
disabled then, for consistency, once python-docutils has been found to be installed
|
|
||||||
and the decision has been made to generate HTML documentation, this decision persists.
|
|
||||||
If subsequently python-docutils is deinstalled, or can no longer be found, later
|
|
||||||
builds will fail, until the situation has been fixed. This can be done in several
|
|
||||||
ways:
|
|
||||||
|
|
||||||
- (Obviously:) Reinstalling python-docutils, or making sure it can be found.
|
|
||||||
|
|
||||||
- Enabling both REQUIRE_HTML_DOCUMENTATION and DISABLE_HTML_DOCUMENTATION. As this
|
|
||||||
is not a sensible combination, the build system will disable both, and it will
|
|
||||||
then also reevaluate the persistent decision to generate HTML documentation.
|
|
||||||
|
|
||||||
- Setting DISABLE_HTML_DOCUMENTATION to True to permanently disable generation of
|
|
||||||
HTML documentation.
|
|
||||||
|
|
||||||
- Setting DISABLE_HTML_DOCUMENTATION to True, running cmake, and then setting it
|
|
||||||
back to false. This will disable HTML generation until python-docutils is
|
|
||||||
available again.
|
|
||||||
|
|
||||||
Converting the Documentation
|
|
||||||
============================
|
|
||||||
|
|
||||||
Using python-docutils, the manual can be converted to a variety of formats.
|
|
||||||
|
|
||||||
HTML
|
|
||||||
----
|
|
||||||
|
|
||||||
By default, documentation is converted to HTML when building minetestmapper, provided
|
|
||||||
python-docutils is installed.
|
|
||||||
|
|
||||||
If automatic documentation conversion at build time is disabled, but python-docutils
|
|
||||||
is installed, non-automatic conversion is still possible. Either using make:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
make hmtldoc
|
|
||||||
|
|
||||||
Or by manually invoking ``rst2html``
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cd doc
|
|
||||||
rst2html manual.rst > manual.html
|
|
||||||
|
|
||||||
Unix manpage
|
|
||||||
------------
|
|
||||||
|
|
||||||
Conversion to unix man format has acceptable, but not perfect results:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
cd doc
|
|
||||||
rst2man manual.rst > minetestmapper.1
|
|
||||||
|
|
||||||
PDF
|
|
||||||
---
|
|
||||||
|
|
||||||
The results of using ``rst2pdf`` (which, as an aside, is not part of python-docutils,
|
|
||||||
and needs to be obtained separately) to convert to PDF directly are not good: random
|
|
||||||
images are scaled down, some even to almost invisibly small. If PDF is desired, a
|
|
||||||
good option is to open the HTML file in a webbrowser, and print it to PDF.
|
|
||||||
|
|
||||||
Other
|
|
||||||
-----
|
|
||||||
|
|
||||||
Other conversions are possible using python-docutils. If you tried any, and
|
|
||||||
they warrant specific instructions, feel free to contribute.
|
|
121
doc/features.rst
|
@ -1,121 +0,0 @@
|
||||||
Minetest Mapper Features
|
|
||||||
########################
|
|
||||||
|
|
||||||
Minetestmapper generates maps of minetest and freeminer worlds.
|
|
||||||
|
|
||||||
Major Features
|
|
||||||
==============
|
|
||||||
* Support for both minetest and freeminer
|
|
||||||
* Support for sqlite3, postgresql, leveldb and redis map databases
|
|
||||||
* Generate a subsection of the map, or a full map
|
|
||||||
(but the size of generated images is limited - see
|
|
||||||
'Known Problems' below)
|
|
||||||
* Generate regular maps or height-maps
|
|
||||||
* All colors for regular or height maps are configurable
|
|
||||||
* Draw player positions
|
|
||||||
* Draw different geometric figures, or text on the map
|
|
||||||
* Draw the map at a reduced scale. E.g. 1:4 (max: 1:16).
|
|
||||||
* Draw a scale on the left and/or top side of the map,
|
|
||||||
and/or a height scale (for height maps) on the bottom.
|
|
||||||
* Optionally draw some nodes transparently (e.g. water)
|
|
||||||
* Includes a user manual
|
|
||||||
|
|
||||||
Build Features
|
|
||||||
==============
|
|
||||||
* Supports both the gcc and clang compiler suites
|
|
||||||
* Supports MSVC building on Windows (with SQLite3 and LevelDB)
|
|
||||||
|
|
||||||
* With automatic downloading of all but one of the required libraries.
|
|
||||||
|
|
||||||
* Build rpm, deb and/or tar.gz installation
|
|
||||||
packages. Or simply type 'make install'.
|
|
||||||
|
|
||||||
Minor Features
|
|
||||||
==============
|
|
||||||
* Specify a number colors symbolically ('red', ...)
|
|
||||||
* Draw a grid on the map
|
|
||||||
* Show a progress indicator
|
|
||||||
* Draw shades to accentuate height differences (on by default)
|
|
||||||
* Report actual world dimensions in all directions, as
|
|
||||||
well which part of it will be in the map.
|
|
||||||
* optionally, avoid reading the block list from the database
|
|
||||||
(may be more efficient when mapping small parts of the *existing* world)
|
|
||||||
|
|
||||||
Differences From Stock Minetestmapper
|
|
||||||
=====================================
|
|
||||||
* Support for the new freeminer database format
|
|
||||||
* Support for the unofficial postgresql backend.
|
|
||||||
* Ability to draw height-maps
|
|
||||||
* Different methods for drawing transparent blocks
|
|
||||||
(more than transparency on and off)
|
|
||||||
* Different colors can be specified for nodes, in the
|
|
||||||
same colors file, depending on whether transparency
|
|
||||||
is enabled or not.
|
|
||||||
* Abiliy to draw different geometric figures, or text on the map
|
|
||||||
* Map dimensions can be specified in different ways:
|
|
||||||
|
|
||||||
- using two corners
|
|
||||||
- using a corner and the size
|
|
||||||
- using the center and the size
|
|
||||||
|
|
||||||
* Pixel or block granularity for the dimensions
|
|
||||||
(stock minetestmapper always uses block granularity: it rounds
|
|
||||||
all dimensions to the next multiple of 16).
|
|
||||||
* Colors files are automatically searched for in the world
|
|
||||||
directory, or in system directories
|
|
||||||
* Colors files can include others, so that just a few colors can
|
|
||||||
be redefined, and the system colors file used for the others.
|
|
||||||
* The map can be drawn at a reduced scale (1:1 - 1:16).
|
|
||||||
This means that a full world map can now be generated.
|
|
||||||
* A grid can be drawn on the map.
|
|
||||||
* A number of symbolic colors ('red', ...) are available on the
|
|
||||||
command-line.
|
|
||||||
* The scale can be enabled on the left and top side individually
|
|
||||||
* Major and minor (tick) intervals are configurable for the scale
|
|
||||||
* Block numbers are shown on the scale as well
|
|
||||||
* Optionally, avoid reading the block list from the database
|
|
||||||
(dramatically speeds up generating maps of small parts of large worlds)
|
|
||||||
* Compiles using MSVC on windows.
|
|
||||||
|
|
||||||
In addition a number bugs have been fixed. As bugs are also getting
|
|
||||||
fixed in the stock version of minetestmapper, no accurate list
|
|
||||||
can be given.
|
|
||||||
|
|
||||||
Known Problems
|
|
||||||
==============
|
|
||||||
|
|
||||||
* It is currently not possible to generate huge maps.
|
|
||||||
|
|
||||||
On 32-bit systems, the map size is limited by the maximum amount of memory
|
|
||||||
(or really: the size of the address space).
|
|
||||||
this means in practise that maps larger than about 24100x24100 (determined
|
|
||||||
experimentally - YMMV) can't be generated. Note, that even if a larger
|
|
||||||
/could/ be generated, most 32-bit applications would still not be able to
|
|
||||||
display it for the same reason.
|
|
||||||
|
|
||||||
On 64-bit systems, the libgd image library unfortunately limits the map
|
|
||||||
size to approximately 2147483648 pixels, e.g. approximately 46300x46300.
|
|
||||||
|
|
||||||
If a full map is required for a world that is too large, there are currently
|
|
||||||
two options:
|
|
||||||
|
|
||||||
- Generate the map in sections, and use another application to paste them
|
|
||||||
together.
|
|
||||||
- Generate a 1:2 or 1:4 scaled version of the map, if the reduced level of
|
|
||||||
detail is acceptable.
|
|
||||||
|
|
||||||
A third alternative, is of course to support the libgd project in removing
|
|
||||||
the current restrictions on image size.
|
|
||||||
|
|
||||||
* On scaled maps, the colors of some pixels may be imperceptibly different on
|
|
||||||
different systems.
|
|
||||||
|
|
||||||
The difference would be at most 1/256 per color.
|
|
||||||
(e.g., a pixel with color ``#4c92a1`` on one system, might have color
|
|
||||||
``#4x91a1`` on another system)
|
|
||||||
|
|
||||||
The cause of this difference has not been determined yet.
|
|
||||||
|
|
||||||
* The drawing library supports ISO8859-2 fonts only. Characters in text and
|
|
||||||
player names that cannot be converted to the ISO8859-2 character set will
|
|
||||||
not be rendered correctly.
|
|
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 335 B |
Before Width: | Height: | Size: 410 B |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 6.6 KiB |
Before Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.2 KiB |
Before Width: | Height: | Size: 5.2 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 28 KiB |