* Combine client and server man pages.
* Update unit test options and available databases in man page.
* Add `--worldname` to man page.
* Fix a bunch of places where `"Minetest"` was used directly instead of `PROJECT_NAME`.
* Disable server build by default on all operating systems.
* Make `ENABLE_FREETYPE` not fail if FreeType isn't found.
* Enable LevelDB, Redis, and FreeType detection by default.
* Remove the `VERSION_PATCH_ORIG` hack.
* Add option to search for and use system JSONCPP.
* Remove broken LuaJIT version detection.
* Rename `DISABLE_LUAJIT` to `ENABLE_LUAJIT`.
* Rename `minetest_*` variables in `version.{h,cpp}` to `g_*`.
* Clean up style of CMake files.
- gcc
- clang
env:
- - WINDOWS=32
- - WINDOWS=64
- - WINDOWS=no
+ - PLATFORM=Win32
+ - PLATFORM=Win64
+ - PLATFORM=Linux
before_install: ./util/travis/before_install.sh
script: ./util/travis/script.sh
notifications:
matrix:
fast_finish: true
exclude:
- - env: WINDOWS=32
+ - env: PLATFORM=Win32
compiler: clang
- - env: WINDOWS=64
+ - env: PLATFORM=Win64
compiler: clang
cmake_minimum_required(VERSION 2.6)
+
if(${CMAKE_VERSION} STREQUAL "2.8.2")
- # bug http://vtk.org/Bug/view.php?id=11020
- message( WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!")
-endif(${CMAKE_VERSION} STREQUAL "2.8.2")
+ # Bug http://vtk.org/Bug/view.php?id=11020
+ message(WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!")
+endif()
# This can be read from ${PROJECT_NAME} after project() is called
-project(minetest)
+project(Minetest)
+string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
-set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
-# Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
+# Also remember to set PROTOCOL_VERSION in network/networkprotocol.h when releasing
set(VERSION_MAJOR 0)
set(VERSION_MINOR 4)
set(VERSION_PATCH 12)
-set(VERSION_PATCH_ORIG ${VERSION_PATCH})
+set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
+set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
if(VERSION_EXTRA)
- set(VERSION_PATCH ${VERSION_PATCH}-${VERSION_EXTRA})
+ set(VERSION_STRING ${VERSION_STRING}-${VERSION_EXTRA})
else()
# Comment the following line during release
- set(VERSION_PATCH ${VERSION_PATCH}-dev)
+ set(VERSION_STRING "${VERSION_STRING}-dev")
endif()
-set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
-MESSAGE(STATUS "*** Will build version ${VERSION_STRING} ***")
+message(STATUS "*** Will build version ${VERSION_STRING} ***")
-# Configuration options
+# Configuration options
+set(DEFAULT_RUN_IN_PLACE FALSE)
if(WIN32)
- set(RUN_IN_PLACE 1 CACHE BOOL "Run directly in source directory structure")
-else()
- set(RUN_IN_PLACE 0 CACHE BOOL "Run directly in source directory structure")
+ set(DEFAULT_RUN_IN_PLACE TRUE)
endif()
+set(RUN_IN_PLACE ${DEFAULT_RUN_IN_PLACE} CACHE BOOL
+ "Run directly in source directory structure")
-# RUN_IN_PLACE is exported as a #define value, ensure it's 1/0 instead of ON/OFF
-if(RUN_IN_PLACE)
- set(RUN_IN_PLACE 1)
-else()
- set(RUN_IN_PLACE 0)
-endif()
-set(BUILD_CLIENT 1 CACHE BOOL "Build client")
-if(WIN32 OR APPLE)
- set(BUILD_SERVER 0 CACHE BOOL "Build server")
-else()
- set(BUILD_SERVER 1 CACHE BOOL "Build server")
-endif()
+set(BUILD_CLIENT TRUE CACHE BOOL "Build client")
+set(BUILD_SERVER FALSE CACHE BOOL "Build server")
-set(WARN_ALL 1 CACHE BOOL "Enable -Wall for Release build")
+
+set(WARN_ALL TRUE CACHE BOOL "Enable -Wall for Release build")
if(NOT CMAKE_BUILD_TYPE)
# Default to release
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
endif()
+
# Included stuff
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
-include(${CMAKE_SOURCE_DIR}/cmake/Modules/misc.cmake)
+
# This is done here so that relative search paths are more reasnable
find_package(Irrlicht)
-#
+
# Installation
-#
if(WIN32)
set(SHAREDIR ".")
set(EXAMPLE_CONF_DIR ".")
set(LOCALEDIR "locale")
elseif(APPLE)
- set(BUNDLE_NAME ${PROJECT_NAME}.app)
+ set(BUNDLE_NAME ${PROJECT_NAME_LOWER}.app)
set(BUNDLE_PATH "${BUNDLE_NAME}")
set(BINDIR ${BUNDLE_NAME}/Contents/MacOS)
set(SHAREDIR ${BUNDLE_NAME}/Contents/Resources)
- set(DOCDIR "${SHAREDIR}/${PROJECT_NAME}")
+ set(DOCDIR "${SHAREDIR}/${PROJECT_NAME_LOWER}")
set(EXAMPLE_CONF_DIR ${DOCDIR})
set(LOCALEDIR "${SHAREDIR}/locale")
elseif(UNIX) # Linux, BSD etc
set(ICONDIR "unix/icons")
set(LOCALEDIR "locale")
else()
- set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}")
+ set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME_LOWER}")
set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
- set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}")
+ set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME_LOWER}")
set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man")
set(EXAMPLE_CONF_DIR ${DOCDIR})
set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications")
set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/appdata")
set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons")
- set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/locale")
+ set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME_LOWER}/locale")
endif()
endif()
set(SHAREDIR "${CUSTOM_SHAREDIR}")
message(STATUS "Using SHAREDIR=${SHAREDIR}")
endif()
+
set(CUSTOM_BINDIR "" CACHE STRING "Directory to install binaries into")
if(NOT CUSTOM_BINDIR STREQUAL "")
set(BINDIR "${CUSTOM_BINDIR}")
message(STATUS "Using BINDIR=${BINDIR}")
endif()
+
set(CUSTOM_DOCDIR "" CACHE STRING "Directory to install documentation into")
if(NOT CUSTOM_DOCDIR STREQUAL "")
set(DOCDIR "${CUSTOM_DOCDIR}")
message(STATUS "Using DOCDIR=${DOCDIR}")
endif()
+
set(CUSTOM_MANDIR "" CACHE STRING "Directory to install manpages into")
if(NOT CUSTOM_MANDIR STREQUAL "")
set(MANDIR "${CUSTOM_MANDIR}")
message(STATUS "Using MANDIR=${MANDIR}")
endif()
+
set(CUSTOM_EXAMPLE_CONF_DIR "" CACHE STRING "Directory to install example config file into")
if(NOT CUSTOM_EXAMPLE_CONF_DIR STREQUAL "")
set(EXAMPLE_CONF_DIR "${CUSTOM_EXAMPLE_CONF_DIR}")
message(STATUS "Using EXAMPLE_CONF_DIR=${EXAMPLE_CONF_DIR}")
endif()
+
set(CUSTOM_XDG_APPS_DIR "" CACHE STRING "Directory to install .desktop files into")
if(NOT CUSTOM_XDG_APPS_DIR STREQUAL "")
set(XDG_APPS_DIR "${CUSTOM_XDG_APPS_DIR}")
message(STATUS "Using XDG_APPS_DIR=${XDG_APPS_DIR}")
endif()
+
set(CUSTOM_ICONDIR "" CACHE STRING "Directory to install icons into")
if(NOT CUSTOM_ICONDIR STREQUAL "")
set(ICONDIR "${CUSTOM_ICONDIR}")
message(STATUS "Using ICONDIR=${ICONDIR}")
endif()
+
set(CUSTOM_LOCALEDIR "" CACHE STRING "Directory to install l10n files into")
if(NOT CUSTOM_LOCALEDIR STREQUAL "")
set(LOCALEDIR "${CUSTOM_LOCALEDIR}")
message(STATUS "Using LOCALEDIR=${LOCALEDIR}")
endif()
+
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/builtin" DESTINATION "${SHAREDIR}")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client" DESTINATION "${SHAREDIR}")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minimal" DESTINATION "${SHAREDIR}/games")
install(FILES "misc/Info.plist" DESTINATION "${BUNDLE_PATH}/Contents")
endif()
-#
+
# Subdirectories
# Be sure to add all relevant definitions above this
-#
add_subdirectory(src)
+
# CPack
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner/Minecraft inspired game")
if(WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win64")
- else(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ else()
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
- endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ endif()
set(CPACK_GENERATOR ZIP)
elseif(APPLE)
include(CPack)
+
# Add a target to generate API documentation with Doxygen
find_package(Doxygen)
if(DOXYGEN_FOUND)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile @ONLY)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in
+ ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile @ONLY)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
-endif(DOXYGEN_FOUND)
+endif()
$ cd ..
Build a version that runs directly from the source directory:
-$ cmake . -DRUN_IN_PLACE=1
-$ make -j2
+$ cmake . -DRUN_IN_PLACE=TRUE
+$ make -j <number of processors>
Run it:
$ ./bin/minetest
- Use cmake . -LH to see all CMake options and their current state
-- If you want to install it system-wide (or are making a distribution package), you will want to use -DRUN_IN_PLACE=0
-- You can build a bare server or a bare client by specifying -DBUILD_CLIENT=0 or -DBUILD_SERVER=0
+- If you want to install it system-wide (or are making a distribution package),
+ you will want to use -DRUN_IN_PLACE=FALSE
+- You can build a bare server by specifying -DBUILD_SERVER=TRUE
+- You can disable the client build by specifying -DBUILD_CLIENT=FALSE
- You can select between Release and Debug build by -DCMAKE_BUILD_TYPE=<Debug or Release>
- Debug build is slower, but gives much more useful output in a debugger
-- If you build a bare server, you don't need to have Irrlicht installed. In that case use -DIRRLICHT_SOURCE_DIR=/the/irrlicht/source
+- If you build a bare server, you don't need to have Irrlicht installed.
+ In that case use -DIRRLICHT_SOURCE_DIR=/the/irrlicht/source
CMake options
-------------
CMAKE_BUILD_TYPE - Type of build (Release vs. Debug)
Release - Release build
Debug - Debug build
+ SemiDebug - Partially optimized debug build
RelWithDebInfo - Release build with Debug information
MinSizeRel - Release build with -Os passed to compiler to make executable as small as possible
ENABLE_CURL - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http
-ENABLE_FREETYPE - Build with Freetype2; Allows using TTF fonts
+ENABLE_FREETYPE - Build with FreeType2; Allows using TTF fonts
ENABLE_GETTEXT - Build with Gettext; Allows using translations
ENABLE_GLES - Search for Open GLES headers & libraries and use them
-ENABLE_LEVELDB - Build with LevelDB; Enables use of LevelDB, which is much faster than SQLite, as map backend
-ENABLE_REDIS - Build with libhiredis; Enables use of redis map backend
+ENABLE_LEVELDB - Build with LevelDB; Enables use of LevelDB map backend (faster than SQLite3)
+ENABLE_REDIS - Build with libhiredis; Enables use of Redis map backend
ENABLE_SOUND - Build with OpenAL, libogg & libvorbis; in-game Sounds
-DISABLE_LUAJIT - Do not search for LuaJIT headers & library
+ENABLE_LUAJIT - Build with LuaJIT (much faster than non-JIT Lua)
RUN_IN_PLACE - Create a portable install (worlds, settings etc. in current directory)
USE_GPROF - Enable profiling using GProf
VERSION_EXTRA - Text to append to version (e.g. VERSION_EXTRA=foobar -> Minetest 0.4.9-foobar)
CURL_INCLUDE_DIR - Only if building with cURL; directory where curl.h is located
CURL_LIBRARY - Only if building with cURL; path to libcurl.a/libcurl.so/libcurl.lib
EGL_INCLUDE_DIR - Only if building with GLES; directory that contains egl.h
-EGL_egl_LIBRARY - Only if building with GLES; path to libEGL.a/libEGL.so
+EGL_LIBRARY - Only if building with GLES; path to libEGL.a/libEGL.so
FREETYPE_INCLUDE_DIR_freetype2 - Only if building with Freetype2; directory that contains an freetype directory with files such as ftimage.h in it
FREETYPE_INCLUDE_DIR_ft2build - Only if building with Freetype2; directory that contains ft2build.h
FREETYPE_LIBRARY - Only if building with Freetype2; path to libfreetype.a/libfreetype.so/freetype.lib
LEVELDB_INCLUDE_DIR - Only when building with LevelDB; directory that contains db.h
LEVELDB_LIBRARY - Only when building with LevelDB; path to libleveldb.a/libleveldb.so/libleveldb.dll.a
LEVELDB_DLL - Only when building with LevelDB on Windows; path to libleveldb.dll
-REDIS_INCLUDE_DIR - Only when building with redis support; directory that contains hiredis.h
-REDIS_LIBRARY - Only when building with redis support; path to libhiredis.a/libhiredis.so
+REDIS_INCLUDE_DIR - Only when building with Redis support; directory that contains hiredis.h
+REDIS_LIBRARY - Only when building with Redis support; path to libhiredis.a/libhiredis.so
LUA_INCLUDE_DIR - Only if you want to use LuaJIT; directory where luajit.h is located
LUA_LIBRARY - Only if you want to use LuaJIT; path to libluajit.a/libluajit.so
MINGWM10_DLL - Only if compiling with MinGW; path to mingwm10.dll
OPENAL_INCLUDE_DIR - Only if building with sound; directory where al.h is located
OPENAL_LIBRARY - Only if building with sound; path to libopenal.a/libopenal.so/OpenAL32.lib
OPENGLES2_INCLUDE_DIR - Only if building with GLES; directory that contains gl2.h
-OPENGLES2_gl_LIBRARY - Only if building with GLES; path to libGLESv2.a/libGLESv2.so
+OPENGLES2_LIBRARY - Only if building with GLES; path to libGLESv2.a/libGLESv2.so
SQLITE3_INCLUDE_DIR - Only if you want to use SQLite from your OS; directory that contains sqlite3.h
SQLITE3_LIBRARY - Only if you want to use the SQLite from your OS; path to libsqlite3.a/libsqlite3.so
VORBISFILE_DLL - Only if building with sound on Windows; path to libvorbisfile-3.dll
set builddir=%sourcedir%\bvc10
mkdir %builddir%
pushd %builddir%
-cmake %sourcedir% -G "Visual Studio 10" -DIRRLICHT_SOURCE_DIR=%irrlichtpath% -DRUN_IN_PLACE=1 -DCMAKE_INSTALL_PREFIX=%installpath%
+cmake %sourcedir% -G "Visual Studio 10" -DIRRLICHT_SOURCE_DIR=%irrlichtpath% -DRUN_IN_PLACE=TRUE -DCMAKE_INSTALL_PREFIX=%installpath%
if %errorlevel% neq 0 goto fail
"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration=Release
if %errorlevel% neq 0 goto fail
echo "#define VERSION_PATCH $$(cat ${ROOT}/../../CMakeLists.txt | \
grep ^set\(VERSION_PATCH\ | sed 's/)/ /' | awk '{print $$2;}')" \
>> ${ROOT}/jni/src/android_version.h; \
- echo "#define VERSION_PATCH_ORIG $$(cat ${ROOT}/../../CMakeLists.txt | \
- grep ^set\(VERSION_PATCH\ | sed 's/)/ /' | awk '{print $$2;}')" \
- >> ${ROOT}/jni/src/android_version.h; \
export GITHASH=$$(git rev-parse --short=8 HEAD); \
export GITTAG=$$(git describe --abbrev=0 --tags); \
- echo "#define CMAKE_VERSION_GITHASH \"$$GITTAG-$$GITHASH-Android\"" \
+ echo "#define VERSION_GITHASH \"$$GITTAG-$$GITHASH-Android\"" \
>> ${ROOT}/jni/src/android_version.h; \
- echo "#define CMAKE_VERSION_STRING STR(VERSION_MAJOR)\".\"STR(VERSION_MINOR)\
+ echo "#define VERSION_STRING STR(VERSION_MAJOR)\".\"STR(VERSION_MINOR)\
\".\"STR(VERSION_PATCH)" \
>> ${ROOT}/jni/src/android_version.h;
-# - Find curl
-# Find the native CURL headers and libraries.
-#
-# CURL_INCLUDE_DIR - where to find curl/curl.h, etc.
-# CURL_LIBRARY - List of libraries when using curl.
-# CURL_FOUND - True if curl found.
+mark_as_advanced(CURL_LIBRARY CURL_INCLUDE_DIR)
-if( UNIX )
- FIND_PATH(CURL_INCLUDE_DIR NAMES curl.h
- PATHS
- /usr/local/include/curl
- /usr/include/curl
- )
+find_library(CURL_LIBRARY NAMES curl)
+find_path(CURL_INCLUDE_DIR NAMES curl/curl.h)
- FIND_LIBRARY(CURL_LIBRARY NAMES curl
- PATHS
- /usr/local/lib
- /usr/lib
- )
-else( UNIX )
- FIND_PATH(CURL_INCLUDE_DIR NAMES curl/curl.h) # Look for the header file.
- FIND_LIBRARY(CURL_LIBRARY NAMES curl) # Look for the library.
- FIND_FILE(CURL_DLL NAMES libcurl.dll
- PATHS
- "c:/windows/system32"
- DOC "Path of the cURL dll (for installation)")
- INCLUDE(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL DEFAULT_MSG CURL_LIBRARY CURL_INCLUDE_DIR) # all listed variables are TRUE
-endif( UNIX )
+set(CURL_REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR)
-if( WIN32 )
- if( CURL_LIBRARY AND CURL_INCLUDE_DIR AND CURL_DLL ) # libcurl.dll is required on Windows
- SET(CURL_FOUND TRUE)
- else( CURL_LIBRARY AND CURL_INCLUDE_DIR AND CURL_DLL )
- SET(CURL_FOUND FALSE)
- endif( CURL_LIBRARY AND CURL_INCLUDE_DIR AND CURL_DLL )
-else ( WIN32 )
- if( CURL_LIBRARY AND CURL_INCLUDE_DIR )
- SET(CURL_FOUND TRUE)
- else( CURL_LIBRARY AND CURL_INCLUDE_DIR )
- SET(CURL_FOUND FALSE)
- endif( CURL_LIBRARY AND CURL_INCLUDE_DIR )
-endif ( WIN32 )
+if(WIN32)
+ find_file(CURL_DLL NAMES libcurl-4.dll
+ PATHS
+ "C:/Windows/System32"
+ DOC "Path to the cURL DLL (for installation)")
+ mark_as_advanced(CURL_DLL)
+ set(CURL_REQUIRED_VARS ${CURL_REQUIRED_VARS} CURL_DLL)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CURL DEFAULT_MSG ${CURL_REQUIRED_VARS})
-MESSAGE(STATUS "CURL_INCLUDE_DIR = ${CURL_INCLUDE_DIR}")
-MESSAGE(STATUS "CURL_LIBRARY = ${CURL_LIBRARY}")
-MESSAGE(STATUS "CURL_DLL = ${CURL_DLL}")
-# Package finder for gettext libs and include files
-SET(CUSTOM_GETTEXT_PATH "${PROJECT_SOURCE_DIR}/../../gettext"
+set(CUSTOM_GETTEXT_PATH "${PROJECT_SOURCE_DIR}/../../gettext"
CACHE FILEPATH "path to custom gettext")
-# by default
-SET(GETTEXT_FOUND FALSE)
-
-FIND_PATH(GETTEXT_INCLUDE_DIR
+find_path(GETTEXT_INCLUDE_DIR
NAMES libintl.h
PATHS "${CUSTOM_GETTEXT_PATH}/include"
- DOC "gettext include directory")
+ DOC "GetText include directory")
-FIND_PROGRAM(GETTEXT_MSGFMT
+find_program(GETTEXT_MSGFMT
NAMES msgfmt
PATHS "${CUSTOM_GETTEXT_PATH}/bin"
- DOC "path to msgfmt")
+ DOC "Path to msgfmt")
+
+set(GETTEXT_REQUIRED_VARS GETTEXT_INCLUDE_DIR GETTEXT_MSGFMT)
if(APPLE)
- FIND_LIBRARY(GETTEXT_LIBRARY
+ find_library(GETTEXT_LIBRARY
NAMES libintl.a
PATHS "${CUSTOM_GETTEXT_PATH}/lib"
- DOC "gettext *intl*.lib")
+ DOC "GetText library")
- FIND_LIBRARY(ICONV_LIBRARY
+ find_library(ICONV_LIBRARY
NAMES libiconv.dylib
PATHS "/usr/lib"
- DOC "iconv lib")
+ DOC "IConv library")
+ set(GETTEXT_REQUIRED_VARS ${GETTEXT_REQUIRED_VARS} GETTEXT_LIBRARY ICONV_LIBRARY)
endif(APPLE)
-# modern Linux, as well as Mac, seem to not need require special linking
-# they do not because gettext is part of glibc
-# TODO check the requirements on other BSDs and older Linux
-IF (WIN32)
- IF(MSVC)
- SET(GETTEXT_LIB_NAMES
+# Modern Linux, as well as OSX, does not require special linking because
+# GetText is part of glibc.
+# TODO: check the requirements on other BSDs and older Linux
+if(WIN32)
+ if(MSVC)
+ set(GETTEXT_LIB_NAMES
libintl.lib intl.lib libintl3.lib intl3.lib)
- ELSE()
- SET(GETTEXT_LIB_NAMES
+ else()
+ set(GETTEXT_LIB_NAMES
libintl.dll.a intl.dll.a libintl3.dll.a intl3.dll.a)
- ENDIF()
- FIND_LIBRARY(GETTEXT_LIBRARY
+ endif()
+ find_library(GETTEXT_LIBRARY
NAMES ${GETTEXT_LIB_NAMES}
PATHS "${CUSTOM_GETTEXT_PATH}/lib"
- DOC "gettext *intl*.lib")
- FIND_FILE(GETTEXT_DLL
+ DOC "GetText library")
+ find_file(GETTEXT_DLL
NAMES libintl.dll intl.dll libintl3.dll intl3.dll
PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib"
DOC "gettext *intl*.dll")
- FIND_FILE(GETTEXT_ICONV_DLL
+ find_file(GETTEXT_ICONV_DLL
NAMES libiconv2.dll
PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib"
DOC "gettext *iconv*.lib")
-ENDIF(WIN32)
+ set(GETTEXT_REQUIRED_VARS ${GETTEXT_REQUIRED_VARS} GETTEXT_DLL GETTEXT_ICONV_DLL)
+endif(WIN32)
+
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(GetText DEFAULT_MSG ${GETTEXT_REQUIRED_VARS})
+
+
+if(GETTEXT_FOUND)
+ # BSD variants require special linkage as they don't use glibc
+ if(${CMAKE_SYSTEM_NAME} MATCHES "BSD")
+ set(GETTEXT_LIBRARY "intl")
+ endif()
-IF(GETTEXT_INCLUDE_DIR AND GETTEXT_MSGFMT)
- IF (WIN32)
- # in the Win32 case check also for the extra linking requirements
- IF(GETTEXT_LIBRARY AND GETTEXT_DLL AND GETTEXT_ICONV_DLL)
- SET(GETTEXT_FOUND TRUE)
- ENDIF()
- ELSE(WIN32)
- # *BSD variants require special linkage as they don't use glibc
- IF(${CMAKE_SYSTEM_NAME} MATCHES "BSD")
- SET(GETTEXT_LIBRARY "intl")
- ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "BSD")
- SET(GETTEXT_FOUND TRUE)
- ENDIF(WIN32)
-ENDIF()
+ set(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po)
+ set(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale/<locale>/LC_MESSAGES)
+ set(GETTEXT_MO_DEST_PATH ${LOCALEDIR}/<locale>/LC_MESSAGES)
+ file(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*")
+ list(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES minetest.pot)
+ list(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES timestamp)
+ macro(SET_MO_PATHS _buildvar _destvar _locale)
+ string(REPLACE "<locale>" ${_locale} ${_buildvar} ${GETTEXT_MO_BUILD_PATH})
+ string(REPLACE "<locale>" ${_locale} ${_destvar} ${GETTEXT_MO_DEST_PATH})
+ endmacro()
+endif()
-IF(GETTEXT_FOUND)
- SET(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po)
- SET(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale/<locale>/LC_MESSAGES)
- SET(GETTEXT_MO_DEST_PATH ${LOCALEDIR}/<locale>/LC_MESSAGES)
- FILE(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*")
- LIST(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES minetest.pot)
- LIST(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES timestamp)
- MACRO(SET_MO_PATHS _buildvar _destvar _locale)
- STRING(REPLACE "<locale>" ${_locale} ${_buildvar} ${GETTEXT_MO_BUILD_PATH})
- STRING(REPLACE "<locale>" ${_locale} ${_destvar} ${GETTEXT_MO_DEST_PATH})
- ENDMACRO(SET_MO_PATHS)
-ELSE()
- SET(GETTEXT_INCLUDE_DIR "")
- SET(GETTEXT_LIBRARY "")
-ENDIF()
-#FindIrrlicht.cmake
+mark_as_advanced(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL)
set(IRRLICHT_SOURCE_DIR "" CACHE PATH "Path to irrlicht source directory (optional)")
+
# Find include directory
if(NOT IRRLICHT_SOURCE_DIR STREQUAL "")
set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a)
endif()
- FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
+ find_path(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
PATHS
${IRRLICHT_SOURCE_DIR_INCLUDE}
NO_DEFAULT_PATH
)
- FIND_LIBRARY(IRRLICHT_LIBRARY NAMES ${IRRLICHT_LIBRARY_NAMES}
+ find_library(IRRLICHT_LIBRARY NAMES ${IRRLICHT_LIBRARY_NAMES}
PATHS
${IRRLICHT_SOURCE_DIR_LIBS}
NO_DEFAULT_PATH
)
else()
-
- FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
+ find_path(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
PATHS
/usr/local/include/irrlicht
/usr/include/irrlicht
)
- FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.so libIrrlicht.a Irrlicht
+ find_library(IRRLICHT_LIBRARY NAMES libIrrlicht.so libIrrlicht.a Irrlicht
PATHS
/usr/local/lib
/usr/lib
)
endif()
-MESSAGE(STATUS "IRRLICHT_SOURCE_DIR = ${IRRLICHT_SOURCE_DIR}")
-MESSAGE(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}")
-MESSAGE(STATUS "IRRLICHT_LIBRARY = ${IRRLICHT_LIBRARY}")
-# On windows, find the dll for installation
+# On Windows, find the DLL for installation
if(WIN32)
if(MSVC)
- FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll
- PATHS
- "${IRRLICHT_SOURCE_DIR}/bin/Win32-VisualStudio"
- DOC "Path of the Irrlicht dll (for installation)"
- )
+ set(IRRLICHT_COMPILER "VisualStudio")
else()
- FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll
- PATHS
- "${IRRLICHT_SOURCE_DIR}/bin/Win32-gcc"
- DOC "Path of the Irrlicht dll (for installation)"
- )
+ set(IRRLICHT_COMPILER "gcc")
endif()
- MESSAGE(STATUS "IRRLICHT_DLL = ${IRRLICHT_DLL}")
+ find_file(IRRLICHT_DLL NAMES Irrlicht.dll
+ PATHS
+ "${IRRLICHT_SOURCE_DIR}/bin/Win32-${IRRLICHT_COMPILER}"
+ DOC "Path of the Irrlicht dll (for installation)"
+ )
endif(WIN32)
-# handle the QUIETLY and REQUIRED arguments and set IRRLICHT_FOUND to TRUE if
-# all listed variables are TRUE
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Irrlicht DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR)
-
-IF(IRRLICHT_FOUND)
- SET(IRRLICHT_LIBRARIES ${IRRLICHT_LIBRARY})
-ELSE(IRRLICHT_FOUND)
- SET(IRRLICHT_LIBRARIES)
-ENDIF(IRRLICHT_FOUND)
-
-MARK_AS_ADVANCED(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Irrlicht DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR)
-# Look for json, use our own if not found
+# Look for JSONCPP if asked to.
+# We use a bundled version by default because some distros ship versions of
+# JSONCPP that cause segfaults and other memory errors when we link with them.
+# See https://github.com/minetest/minetest/issues/1793
-#FIND_PATH(JSON_INCLUDE_DIR json.h)
+mark_as_advanced(JSON_LIBRARY JSON_INCLUDE_DIR)
+option(ENABLE_SYSTEM_JSONCPP "Enable using a system-wide JSONCPP. May cause segfaults and other memory errors!" FALSE)
-#FIND_LIBRARY(JSON_LIBRARY NAMES jsoncpp)
+if(ENABLE_SYSTEM_JSONCPP)
+ find_library(JSON_LIBRARY NAMES jsoncpp)
+ find_path(JSON_INCLUDE_DIR json/features.h)
-#IF(JSON_LIBRARY AND JSON_INCLUDE_DIR)
-# SET( JSON_FOUND TRUE )
-#ENDIF(JSON_LIBRARY AND JSON_INCLUDE_DIR)
+ include(FindPackageHandleStandardArgs)
+ find_package_handle_standard_args(JSONCPP DEFAULT_MSG JSON_LIBRARY JSON_INCLUDE_DIR)
+
+ if(JSONCPP_FOUND)
+ message(STATUS "Using system JSONCPP library.")
+ endif()
+endif()
+
+if(NOT JSONCPP_FOUND)
+ message(STATUS "Using bundled JSONCPP library.")
+ set(JSON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/json)
+ set(JSON_LIBRARY jsoncpp)
+ add_subdirectory(json)
+endif()
-#IF(JSON_FOUND)
-# MESSAGE(STATUS "Found system jsoncpp header file in ${JSON_INCLUDE_DIR}")
-# MESSAGE(STATUS "Found system jsoncpp library ${JSON_LIBRARY}")
-#ELSE(JSON_FOUND)
- SET(JSON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/json)
- SET(JSON_LIBRARY jsoncpp)
- MESSAGE(STATUS "Using project jsoncpp library")
-#ENDIF(JSON_FOUND)
--- /dev/null
+
+option(ENABLE_LUAJIT "Enable LuaJIT support" TRUE)
+mark_as_advanced(LUA_LIBRARY LUA_INCLUDE_DIR)
+set(USE_LUAJIT FALSE)
+
+if(ENABLE_LUAJIT)
+ find_library(LUA_LIBRARY luajit
+ NAMES luajit-5.1)
+ find_path(LUA_INCLUDE_DIR luajit.h
+ NAMES luajit.h
+ PATH_SUFFIXES luajit-2.0)
+ if(LUA_LIBRARY AND LUA_INCLUDE_DIR)
+ set(USE_LUAJIT TRUE)
+ endif()
+else()
+ message (STATUS "LuaJIT detection disabled! (ENABLE_LUAJIT=0)")
+endif()
+
+if(NOT USE_LUAJIT)
+ message(STATUS "LuaJIT not found, using bundled Lua.")
+ set(LUA_LIBRARY "lua")
+ set(LUA_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lua/src")
+ add_subdirectory(lua)
+endif()
+
# EGL_INCLUDE_DIR - the EGL include directory
# EGL_LIBRARIES - Link these to use EGL
-# win32, apple, android NOT TESED
-# linux tested and works
-
-IF (WIN32)
- IF (CYGWIN)
-
- FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h )
-
- FIND_LIBRARY(OPENGLES2_gl_LIBRARY libGLESv2 )
-
- ELSE (CYGWIN)
-
- IF(BORLAND)
- SET (OPENGLES2_gl_LIBRARY import32 CACHE STRING "OpenGL ES 2.x library for win32")
- ELSE(BORLAND)
- # todo
- # SET (OPENGLES_gl_LIBRARY ${SOURCE_DIR}/Dependencies/lib/release/libGLESv2.lib CACHE STRING "OpenGL ES 2.x library for win32"
- ENDIF(BORLAND)
-
- ENDIF (CYGWIN)
-
-ELSE (WIN32)
-
- IF (APPLE)
-
+# Win32, Apple, and Android are not tested!
+# Linux tested and works
+
+if(WIN32)
+ if(CYGWIN)
+ find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h)
+ find_library(OPENGLES2_LIBRARY libGLESv2)
+ else()
+ if(BORLAND)
+ set(OPENGLES2_LIBRARY import32 CACHE STRING "OpenGL ES 2.x library for Win32")
+ else()
+ # TODO
+ # set(OPENGLES_LIBRARY ${SOURCE_DIR}/Dependencies/lib/release/libGLESv2.lib CACHE STRING "OpenGL ES 2.x library for win32"
+ else()
+ endif()
+elseif(APPLE)
create_search_paths(/Developer/Platforms)
findpkg_framework(OpenGLES2)
- set(OPENGLES2_gl_LIBRARY "-framework OpenGLES")
-
- ELSE(APPLE)
-
- FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
- /usr/openwin/share/include
- /opt/graphics/OpenGL/include /usr/X11R6/include
- /usr/include
- )
-
- FIND_LIBRARY(OPENGLES2_gl_LIBRARY
- NAMES GLESv2
- PATHS /opt/graphics/OpenGL/lib
- /usr/openwin/lib
- /usr/shlib /usr/X11R6/lib
- /usr/lib
- )
-
- IF (NOT BUILD_ANDROID)
- FIND_PATH(EGL_INCLUDE_DIR EGL/egl.h
- /usr/openwin/share/include
- /opt/graphics/OpenGL/include /usr/X11R6/include
- /usr/include
+ set(OPENGLES2_LIBRARY "-framework OpenGLES")
+else()
+ find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h
+ PATHS /usr/openwin/share/include
+ /opt/graphics/OpenGL/include
+ /usr/X11R6/include
+ /usr/include
+ )
+
+ find_library(OPENGLES2_LIBRARY
+ NAMES GLESv2
+ PATHS /opt/graphics/OpenGL/lib
+ /usr/openwin/lib
+ /usr/shlib /usr/X11R6/lib
+ /usr/lib
+ )
+
+ if(NOT BUILD_ANDROID)
+ find_path(EGL_INCLUDE_DIR EGL/egl.h
+ PATHS /usr/openwin/share/include
+ /opt/graphics/OpenGL/include
+ /usr/X11R6/include
+ /usr/include
)
- FIND_LIBRARY(EGL_egl_LIBRARY
- NAMES EGL
- PATHS /opt/graphics/OpenGL/lib
+ find_library(EGL_LIBRARY
+ NAMES EGL
+ PATHS /opt/graphics/OpenGL/lib
/usr/openwin/lib
- /usr/shlib /usr/X11R6/lib
+ /usr/shlib
+ /usr/X11R6/lib
/usr/lib
)
- # On Unix OpenGL most certainly always requires X11.
- # Feel free to tighten up these conditions if you don't
- # think this is always true.
- # It's not true on OSX.
-
- IF (OPENGLES2_gl_LIBRARY)
- IF(NOT X11_FOUND)
- INCLUDE(FindX11)
- ENDIF(NOT X11_FOUND)
- IF (X11_FOUND)
- IF (NOT APPLE)
- SET (OPENGLES2_LIBRARIES ${X11_LIBRARIES})
- ENDIF (NOT APPLE)
- ENDIF (X11_FOUND)
- ENDIF (OPENGLES2_gl_LIBRARY)
- ENDIF ()
-
- ENDIF(APPLE)
-ENDIF (WIN32)
-
-#SET( OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_LIBRARIES})
-
-IF (BUILD_ANDROID)
- IF(OPENGLES2_gl_LIBRARY)
- SET( OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_LIBRARIES})
- SET( EGL_LIBRARIES)
- SET( OPENGLES2_FOUND "YES" )
- ENDIF(OPENGLES2_gl_LIBRARY)
-ELSE ()
-
- SET( OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_LIBRARIES})
-
- IF(OPENGLES2_gl_LIBRARY AND EGL_egl_LIBRARY)
- SET( OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_LIBRARIES})
- SET( EGL_LIBRARIES ${EGL_egl_LIBRARY} ${EGL_LIBRARIES})
- SET( OPENGLES2_FOUND "YES" )
- ENDIF(OPENGLES2_gl_LIBRARY AND EGL_egl_LIBRARY)
-
-ENDIF ()
-
-MARK_AS_ADVANCED(
- OPENGLES2_INCLUDE_DIR
- OPENGLES2_gl_LIBRARY
- EGL_INCLUDE_DIR
- EGL_egl_LIBRARY
+ # On Unix OpenGL usually requires X11.
+ # It doesn't require X11 on OSX.
+
+ if(OPENGLES2_LIBRARY)
+ if(NOT X11_FOUND)
+ include(FindX11)
+ endif()
+ if(X11_FOUND)
+ set(OPENGLES2_LIBRARIES ${X11_LIBRARIES})
+ endif()
+ endif()
+ endif()
+endif()
+
+set(OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARIES} ${OPENGLES2_LIBRARY})
+
+if(BUILD_ANDROID)
+ if(OPENGLES2_LIBRARY)
+ set(EGL_LIBRARIES)
+ set(OPENGLES2_FOUND TRUE)
+ endif()
+else()
+ if(OPENGLES2_LIBRARY AND EGL_LIBRARY)
+ set(OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARY} ${OPENGLES2_LIBRARIES})
+ set(EGL_LIBRARIES ${EGL_LIBRARY} ${EGL_LIBRARIES})
+ set(OPENGLES2_FOUND TRUE)
+ endif()
+endif()
+
+mark_as_advanced(
+ OPENGLES2_INCLUDE_DIR
+ OPENGLES2_LIBRARY
+ EGL_INCLUDE_DIR
+ EGL_LIBRARY
)
-IF(OPENGLES2_FOUND)
- MESSAGE(STATUS "Found system opengles2 library ${OPENGLES2_LIBRARIES}")
-ELSE ()
- SET(OPENGLES2_LIBRARIES "")
-ENDIF ()
+if(OPENGLES2_FOUND)
+ message(STATUS "Found system OpenGL ES 2 library: ${OPENGLES2_LIBRARIES}")
+else()
+ set(OPENGLES2_LIBRARIES "")
+endif()
+
if(VERSION_EXTRA)
set(VERSION_GITHASH "${VERSION_STRING}")
-else(VERSION_EXTRA)
+else()
execute_process(COMMAND git describe --always --tag --dirty
WORKING_DIRECTORY "${GENERATE_VERSION_SOURCE_DIR}"
OUTPUT_VARIABLE VERSION_GITHASH OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
if(VERSION_GITHASH)
- message(STATUS "*** Detected git version ${VERSION_GITHASH} ***")
+ message(STATUS "*** Detected Git version ${VERSION_GITHASH} ***")
else()
set(VERSION_GITHASH "${VERSION_STRING}")
endif()
configure_file(
${GENERATE_VERSION_SOURCE_DIR}/cmake_config_githash.h.in
${GENERATE_VERSION_BINARY_DIR}/cmake_config_githash.h)
+
+++ /dev/null
-#
-# Random macros
-#
-
-# Not used ATM
-
-MACRO (GETDATETIME RESULT)
- IF (WIN32)
- EXECUTE_PROCESS(COMMAND "cmd" /C echo %date% %time% OUTPUT_VARIABLE ${RESULT})
- string(REGEX REPLACE "\n" "" ${RESULT} "${${RESULT}}")
- ELSEIF(UNIX)
- EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d_%H:%M:%S" OUTPUT_VARIABLE ${RESULT})
- string(REGEX REPLACE "\n" "" ${RESULT} "${${RESULT}}")
- ELSE (WIN32)
- MESSAGE(SEND_ERROR "date not implemented")
- SET(${RESULT} "Unknown")
- ENDIF (WIN32)
-
- string(REGEX REPLACE " " "_" ${RESULT} "${${RESULT}}")
-ENDMACRO (GETDATETIME)
-
-.\" Minetest man page
.TH minetest 6 "10 September 2013" "" ""
.SH NAME
-minetest \- Multiplayer infinite-world block sandbox
+minetest, minetestserver \- Multiplayer infinite-world block sandbox
.SH SYNOPSIS
.B minetest
-[ OPTION ... ]
+[\fB--server SERVER OPTIONS\fR | \fBCLIENT OPTIONS\fR]
+[\fBCOMMON OPTIONS\fR]
+[\fBWORLD PATH\fR]
+
+.B minetestserver
+[\fBSERVER OPTIONS\fR]
+[\fBCOMMON OPTIONS\fR]
+[\fBWORLD PATH\fR]
.SH DESCRIPTION
.B Minetest
.PP
The main design philosophy is to keep it technically simple, stable and portable. It will be kept lightweight enough to run on fairly old hardware.
-.SH OPTIONS
+.SH COMMON OPTIONS
.TP
-\-\-address <value>
-Address to connect to
+.B \-\-help
+Print allowed options and exit
.TP
-\-\-config <value>
+.B \-\-version
+Print version information and exit
+.TP
+.B \-\-config <value>
Load configuration from specified file
.TP
-\-\-disable\-unittests
-Disable unit tests
+.B \-\-logfile <value>
+Set logfile path (debug.txt)
.TP
-\-\-enable\-unittests
-Enable unit tests
+.B \-\-info
+Print more information to console
.TP
-\-\-gameid <value>
-Set gameid
+.B \-\-verbose
+Print even more information to console
.TP
-\-\-go
-Disable main menu
+.B \-\-trace
+Print enormous amounts of information to console
.TP
-\-\-help
-Show allowed options
+.B \-\-gameid <value>
+Set gameid
.TP
-\-\-version
-Show version information
+.B \-\-worldname <value>
+Set world path by name
.TP
-\-\-logfile <value>
-Set logfile path (debug.txt)
+.B \-\-world <value> | list
+Set world path or list worlds
.TP
-\-\-map\-dir <value>
+.B \-\-map\-dir <value>
Same as \-\-world (deprecated)
.TP
-\-\-name <value>
-Set player name
-.TP
-\-\-password <value>
-Set password
-.TP
-\-\-port <value>
+.B \-\-port <value>
Set network port (UDP) to use
.TP
-\-\-random\-input
-Enable random user input, for testing
-.TP
-\-\-server
-Run dedicated server
+.B \-\-run\-unittests
+Run unit tests and exit
+
+.SH CLIENT OPTIONS
.TP
-\-\-speedtests
-Run speed tests
+.B \-\-address <value>
+Address to connect to
.TP
-\-\-videomodes
-List available video modes
+.B \-\-go
+Disable main menu
.TP
-\-\-info
-Print more information to console
+.B \-\-name <value>
+Set player name
.TP
-\-\-verbose
-Print even more information to console
+.B \-\-password <value>
+Set password
.TP
-\-\-trace
-Print enormous amounts of information to console
+.B \-\-random\-input
+Enable random user input, for testing (client only)
.TP
-\-\-world <value>
-Set world path
+.B \-\-videomodes
+List available video modes (client only)
.TP
-\-\-migrate <value>
-Migrate from current map backend to another. Possible values are sqlite3
-and leveldb. Only works when using \-\-server.
+.B \-\-speedtests
+Run speed tests
-.SH ENVIRONMENT VARIABLES
+.SH SERVER OPTIONS
+.TP
+.B \-\-migrate <value>
+Migrate from current map backend to another. Possible values are sqlite3,
+leveldb, redis, and dummy.
+.SH ENVIRONMENT
.TP
-MINETEST_SUBGAME_PATH
+.B MINETEST_SUBGAME_PATH
Colon delimited list of directories to search for subgames.
.SH BUGS
.SH WWW
http://www.minetest.net/
-.SH "SEE ALSO"
-.BR minetestserver(6)
-.\" Minetestserver man page
-.TH minetestserver 6 "10 September 2013" "" ""
+.so man6/minetest.6
-.SH NAME
-minetestserver \- Minetest server
-
-.SH SYNOPSIS
-.B minetestserver
-[ OPTION ... ]
-
-.SH DESCRIPTION
-.B Minetest
-is one of the first InfiniMiner/Minecraft(/whatever) inspired games (started October 2010), with a goal of taking the survival multiplayer gameplay to a slightly different direction.
-.PP
-The main design philosophy is to keep it technically simple, stable and portable. It will be kept lightweight enough to run on fairly old hardware.
-
-.SH OPTIONS
-.TP
-\-\-config <value>
-Load configuration from specified file
-.TP
-\-\-disable\-unittests
-Disable unit tests
-.TP
-\-\-enable\-unittests
-Enable unit tests
-.TP
-\-\-gameid <value>
-Set gameid
-.TP
-\-\-help
-Show allowed options
-.TP
-\-\-version
-Show version information
-.TP
-\-\-logfile <value>
-Set logfile path (debug.txt)
-.TP
-\-\-map\-dir <value>
-Same as \-\-world (deprecated)
-.TP
-\-\-port <value>
-Set network port (UDP) to use
-.TP
-\-\-info
-Print more information to console
-.TP
-\-\-verbose
-Print even more information to console
-.TP
-\-\-trace
-Print enormous amounts of information to console
-.TP
-\-\-world <value>
-Set world path
-.TP
-\-\-migrate <value>
-Migrate from current map backend to another. Possible values are sqlite3
-and leveldb.
-
-.SH BUGS
-Please report all bugs to Perttu Ahola <celeron55@gmail.com>.
-
-.SH AUTHOR
-.PP
-Perttu Ahola <celeron55@gmail.com>
-and contributors.
-.PP
-This man page was originally written by
-Juhani Numminen <juhaninumminen0@gmail.com>.
-
-.SH WWW
-http://www.minetest.net/
-
-.SH "SEE ALSO"
-.BR minetest(6)
#include "config.h"\r
#undef USE_CMAKE_CONFIG_H\r
\r
-#if RUN_IN_PLACE == 1\r
- #define BUILDMODE "RUN_IN_PLACE=1\0"\r
+#if RUN_IN_PLACE\r
+ #define BUILDMODE "RUN_IN_PLACE=1"\r
#else\r
- #define BUILDMODE "RUN_IN_PLACE=0\0"\r
+ #define BUILDMODE "RUN_IN_PLACE=0"\r
#endif\r
\r
LANGUAGE 0, SUBLANG_NEUTRAL\r
//\r
\r
1 VERSIONINFO\r
- FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH_ORIG,0\r
- PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH_ORIG,0\r
+ FILEVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0\r
+ PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,VERSION_PATCH,0\r
FILEFLAGSMASK 0x3fL\r
#ifndef NDEBUG\r
FILEFLAGS 0x1L\r
BEGIN\r
BLOCK "040904b0"\r
BEGIN\r
- VALUE "Comments", "\0"\r
- VALUE "CompanyName", "Minetest Community\0"\r
- VALUE "FileDescription", "Minetest engine core main application\0"\r
+ VALUE "Comments", ""\r
+ VALUE "CompanyName", PROJECT_NAME " community"\r
+ VALUE "FileDescription", PROJECT_NAME " engine main executable"\r
VALUE "FileVersion", VERSION_STRING\r
- VALUE "InternalName", "Minetest engine\0"\r
- VALUE "LegalCopyright", "(c) 2014 celeron55\0"\r
- VALUE "LegalTrademarks", """Minetest"" is property of Minetest community, don't use the name for your application without permission!\0"\r
- VALUE "OriginalFilename", "minetest.exe\0"\r
- VALUE "PrivateBuild", VERSION_EXTRA_STRING\r
- VALUE "ProductName", "Minetest\0"\r
+ VALUE "InternalName", PROJECT_NAME\r
+ VALUE "LegalCopyright", "(c) 2014 celeron55"\r
+ VALUE "LegalTrademarks", """Minetest"" is the property of the Minetest community, don't use it without permission!"\r
+ VALUE "OriginalFilename", "minetest.exe"\r
+ VALUE "PrivateBuild", VERSION_EXTRA\r
+ VALUE "ProductName", PROJECT_NAME\r
VALUE "ProductVersion", PRODUCT_VERSION_STRING\r
VALUE "SpecialBuild", BUILDMODE\r
END\r
VALUE "Translation", 0x409, 1200\r
END\r
END\r
+\r
-project(minetest)
-cmake_minimum_required( VERSION 2.6 )
+cmake_minimum_required(VERSION 2.6)
+
+project(Minetest)
+string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER)
-INCLUDE(CheckCSourceRuns)
INCLUDE(CheckIncludeFiles)
# Add custom SemiDebug build mode
FORCE
)
+
# Set some random things default to not being visible in the GUI
mark_as_advanced(EXECUTABLE_OUTPUT_PATH LIBRARY_OUTPUT_PATH)
-option(ENABLE_CURL "Enable cURL support for fetching media" 1)
-if (NOT ENABLE_CURL)
- mark_as_advanced(CLEAR CURL_LIBRARY CURL_INCLUDE_DIR)
-endif(NOT ENABLE_CURL)
+option(ENABLE_CURL "Enable cURL support for fetching media" TRUE)
+set(USE_CURL FALSE)
-if( ENABLE_CURL )
+if(ENABLE_CURL)
find_package(CURL)
-endif( ENABLE_CURL )
-set(USE_CURL 0)
-if (CURL_FOUND AND ENABLE_CURL)
- message(STATUS "cURL support enabled")
- set(USE_CURL 1)
-endif(CURL_FOUND AND ENABLE_CURL)
+ if (CURL_FOUND)
+ message(STATUS "cURL support enabled.")
+ set(USE_CURL TRUE)
+ endif()
+else()
+ mark_as_advanced(CLEAR CURL_LIBRARY CURL_INCLUDE_DIR)
+endif()
-# user-visible option to enable/disable gettext usage
-OPTION(ENABLE_GETTEXT "Use GetText for internationalization" 0)
-# this is only set to 1 if gettext is enabled _and_ available
-set(USE_GETTEXT 0)
+option(ENABLE_GETTEXT "Use GetText for internationalization" FALSE)
+set(USE_GETTEXT FALSE)
if(ENABLE_GETTEXT)
find_package(GettextLib)
+ if(GETTEXT_FOUND)
+ if(WIN32)
+ message(STATUS "GetText library: ${GETTEXT_LIBRARY}")
+ message(STATUS "GetText DLL: ${GETTEXT_DLL}")
+ message(STATUS "GetText iconv DLL: ${GETTEXT_ICONV_DLL}")
+ endif()
+ set(USE_GETTEXT TRUE)
+ message(STATUS "GetText enabled; locales found: ${GETTEXT_AVAILABLE_LOCALES}")
+ endif(GETTEXT_FOUND)
else()
- MARK_AS_ADVANCED(GETTEXT_ICONV_DLL GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT)
+ mark_as_advanced(GETTEXT_ICONV_DLL GETTEXT_INCLUDE_DIR GETTEXT_LIBRARY GETTEXT_MSGFMT)
+ message(STATUS "GetText disabled.")
endif()
-if(GETTEXT_FOUND AND ENABLE_GETTEXT)
- message(STATUS "gettext include path: ${GETTEXT_INCLUDE_DIR}")
- message(STATUS "gettext msgfmt path: ${GETTEXT_MSGFMT}")
- if(WIN32)
- message(STATUS "gettext library: ${GETTEXT_LIBRARY}")
- message(STATUS "gettext dll: ${GETTEXT_DLL}")
- message(STATUS "gettext iconv dll: ${GETTEXT_ICONV_DLL}")
- endif()
- set(USE_GETTEXT 1)
- message(STATUS "GetText enabled; locales found: ${GETTEXT_AVAILABLE_LOCALES}")
-elseif(GETTEXT_FOUND AND NOT ENABLE_GETTEXT)
- MESSAGE(STATUS "GetText found but disabled;")
-else(GETTEXT_FOUND AND ENABLE_GETTEXT)
- message(STATUS "GetText disabled")
-endif(GETTEXT_FOUND AND ENABLE_GETTEXT)
-
-# user visible option to enable/disable sound
-OPTION(ENABLE_SOUND "Enable sound" ON)
-
-# this is only set to 1 if sound is enabled _and_ available
-set(USE_SOUND 0)
-set(SOUND_PROBLEM 0)
-
-if(ENABLE_SOUND AND BUILD_CLIENT)
+
+option(ENABLE_SOUND "Enable sound" TRUE)
+set(USE_SOUND FALSE)
+
+if(BUILD_CLIENT AND ENABLE_SOUND)
# Sound libraries
find_package(OpenAL)
find_package(Vorbis)
if(NOT OPENAL_FOUND)
message(STATUS "Sound enabled, but OpenAL not found!")
- set(SOUND_PROBLEM 1)
- MARK_AS_ADVANCED(CLEAR OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
+ mark_as_advanced(CLEAR OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
endif()
if(NOT VORBIS_FOUND)
message(STATUS "Sound enabled, but Vorbis libraries not found!")
- set(SOUND_PROBLEM 1)
- MARK_AS_ADVANCED(CLEAR OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
+ mark_as_advanced(CLEAR OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
endif()
if(OPENAL_FOUND AND VORBIS_FOUND)
- set(USE_SOUND 1)
- message(STATUS "Sound enabled")
+ set(USE_SOUND TRUE)
+ message(STATUS "Sound enabled.")
+ else()
+ message(FATAL_ERROR "Sound enabled, but cannot be used.\n"
+ "To continue, either fill in the required paths or disable sound. (-DENABLE_SOUND=0)")
endif()
-endif(ENABLE_SOUND AND BUILD_CLIENT)
-
-if(SOUND_PROBLEM)
- message(FATAL_ERROR "Sound enabled, but cannot be used.\n"
- "To continue, either fill in the required paths or disable sound. (-DENABLE_SOUND=0)")
endif()
+
if(USE_SOUND)
set(sound_SRCS sound_openal.cpp)
set(SOUND_INCLUDE_DIRS
)
endif()
-option(ENABLE_FREETYPE "Enable freetype2 (truetype fonts and basic unicode support)" OFF)
-set(USE_FREETYPE 0)
+
+option(ENABLE_GLES "Enable OpenGL ES support" FALSE)
+mark_as_advanced(ENABLE_GLES)
+if(ENABLE_GLES)
+ find_package(OpenGLES2)
+endif()
+
+
+option(ENABLE_FREETYPE "Enable FreeType2 (TrueType fonts and basic unicode support)" TRUE)
+set(USE_FREETYPE FALSE)
+
if(ENABLE_FREETYPE)
- set(USE_FREETYPE 1)
+ if(UNIX)
+ include(FindPkgConfig)
+ if(PKG_CONFIG_FOUND)
+ pkg_check_modules(FREETYPE QUIET freetype2)
+ if(FREETYPE_FOUND)
+ SET(FREETYPE_PKGCONFIG_FOUND TRUE)
+ SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARIES})
+ # Because CMake is idiotic
+ string(REPLACE ";" " " FREETYPE_CFLAGS_STR ${FREETYPE_CFLAGS})
+ string(REPLACE ";" " " FREETYPE_LDFLAGS_STR ${FREETYPE_LDFLAGS})
+ endif(FREETYPE_FOUND)
+ endif(PKG_CONFIG_FOUND)
+ endif(UNIX)
+ if(NOT FREETYPE_FOUND)
+ find_package(Freetype)
+ endif()
+ if(FREETYPE_FOUND)
+ set(USE_FREETYPE TRUE)
+ set(CGUITTFONT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cguittfont")
+ set(CGUITTFONT_LIBRARY cguittfont)
+ endif()
endif(ENABLE_FREETYPE)
+
+find_package(Lua REQUIRED)
+
+
+option(ENABLE_LEVELDB "Enable LevelDB backend" TRUE)
+set(USE_LEVELDB FALSE)
+
+if(ENABLE_LEVELDB)
+ find_library(LEVELDB_LIBRARY leveldb)
+ find_path(LEVELDB_INCLUDE_DIR db.h PATH_SUFFIXES leveldb)
+ if(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
+ set(USE_LEVELDB TRUE)
+ message(STATUS "LevelDB backend enabled.")
+ include_directories(${LEVELDB_INCLUDE_DIR})
+ else()
+ message(STATUS "LevelDB not found!")
+ endif()
+endif(ENABLE_LEVELDB)
+
+
+OPTION(ENABLE_REDIS "Enable Redis backend" TRUE)
+set(USE_REDIS FALSE)
+
+if(ENABLE_REDIS)
+ find_library(REDIS_LIBRARY hiredis)
+ find_path(REDIS_INCLUDE_DIR hiredis.h PATH_SUFFIXES hiredis)
+ if(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
+ set(USE_REDIS TRUE)
+ message(STATUS "Redis backend enabled.")
+ include_directories(${REDIS_INCLUDE_DIR})
+ else(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
+ message(STATUS "Redis not found!")
+ endif(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
+endif(ENABLE_REDIS)
+
+
+find_package(SQLite3 REQUIRED)
+find_package(Json REQUIRED)
+
+
if(NOT MSVC)
- set(USE_GPROF 0 CACHE BOOL "Use -pg flag for g++")
+ set(USE_GPROF FALSE CACHE BOOL "Use -pg flag for g++")
endif()
# Use cmake_config.h
-add_definitions ( -DUSE_CMAKE_CONFIG_H )
+add_definitions(-DUSE_CMAKE_CONFIG_H)
if(WIN32)
# Windows
CACHE PATH "freetype include dir")
set(FREETYPE_LIBRARY "${PROJECT_SOURCE_DIR}/../../freetype2/objs/win32/vc2005/freetype247.lib"
CACHE FILEPATH "Path to freetype247.lib")
- endif(USE_FREETYPE)
+ endif()
if(ENABLE_SOUND)
set(OPENAL_DLL "" CACHE FILEPATH "Path to OpenAL32.dll for installation (optional)")
set(OGG_DLL "" CACHE FILEPATH "Path to libogg.dll for installation (optional)")
find_package(BZip2 REQUIRED)
find_package(PNG REQUIRED)
if(APPLE)
- FIND_LIBRARY(CARBON_LIB Carbon)
- FIND_LIBRARY(COCOA_LIB Cocoa)
- FIND_LIBRARY(IOKIT_LIB IOKit)
+ find_library(CARBON_LIB Carbon)
+ find_library(COCOA_LIB Cocoa)
+ find_library(IOKIT_LIB IOKit)
mark_as_advanced(
CARBON_LIB
COCOA_LIB
set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY})
endif()
-find_package(SQLite3 REQUIRED)
-find_package(Json REQUIRED)
-
-option(ENABLE_GLES "Enable OpenGL ES support" 0)
-mark_as_advanced(ENABLE_GLES)
-if(ENABLE_GLES)
- find_package(OpenGLES2)
-endif(ENABLE_GLES)
-
-if(USE_FREETYPE)
- if(UNIX)
- include(FindPkgConfig)
- if(PKG_CONFIG_FOUND)
- pkg_check_modules(FREETYPE QUIET freetype2)
- if(FREETYPE_FOUND)
- SET(FREETYPE_PKGCONFIG_FOUND TRUE)
- SET(FREETYPE_LIBRARY ${FREETYPE_LIBRARIES})
- # because cmake is idiotic
- string(REPLACE ";" " " FREETYPE_CFLAGS_STR ${FREETYPE_CFLAGS})
- string(REPLACE ";" " " FREETYPE_LDFLAGS_STR ${FREETYPE_LDFLAGS})
- endif(FREETYPE_FOUND)
- endif(PKG_CONFIG_FOUND)
- endif(UNIX)
- if(NOT FREETYPE_FOUND)
- find_package(Freetype REQUIRED)
- endif(NOT FREETYPE_FOUND)
- set(CGUITTFONT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/cguittfont")
- set(CGUITTFONT_LIBRARY cguittfont)
-endif(USE_FREETYPE)
-
-if (NOT DISABLE_LUAJIT)
- find_library(LUA_LIBRARY luajit
- NAMES luajit-5.1)
- find_path(LUA_INCLUDE_DIR luajit.h
- NAMES luajit.h
- PATH_SUFFIXES luajit-2.0)
- message (STATUS "LuaJIT library: ${LUA_LIBRARY}")
- message (STATUS "LuaJIT headers: ${LUA_INCLUDE_DIR}")
-else (NOT ${DISABLE_LUAJIT} MATCHES "1")
- message (STATUS "LuaJIT detection disabled! (DISABLE_LUAJIT=1)")
- set(LUA_LIBRARY "")
- set(LUA_INCLUDE_DIR "")
-endif (NOT DISABLE_LUAJIT)
-
-set(USE_LUAJIT 0)
-if(LUA_LIBRARY AND LUA_INCLUDE_DIR)
- message (STATUS "LuaJIT found, checking for broken versions...")
- if(CMAKE_CROSSCOMPILING)
- message(WARNING "Cross-compiling enabled, assuming LuaJIT is not broken")
- set(VALID_LUAJIT_VERSION 1)
- else(CMAKE_CROSSCOMPILING)
- set(BACKUP_REQUIRED_INCS CMAKE_REQUIRED_INCLUDES)
- set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES} ${LUA_INCLUDE_DIR}")
- CHECK_C_SOURCE_RUNS("
- #include <luajit.h>
- #include <stdio.h>
- #include <string.h>
-
- #define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
-
- static char *broken_luajit_versions[] = {
- \"LuaJIT 2.0.0-beta7\",
- \"LuaJIT 2.0.0-beta6\",
- \"LuaJIT 2.0.0-beta5\",
- \"LuaJIT 2.0.0-beta4\",
- \"LuaJIT 2.0.0-beta3\",
- \"LuaJIT 2.0.0-beta2\",
- \"LuaJIT 2.0.0-beta1\"
- };
-
- int main(int argc, char *argv[]) {
- unsigned int i;
- for (i = 0; i < ARRAYSIZE(broken_luajit_versions); i++) {
- if (strcmp(LUAJIT_VERSION, broken_luajit_versions[i]) == 0) {
- return 1;
- }
- }
- return 0;
- }
- "
- VALID_LUAJIT_VERSION)
- set(CMAKE_REQUIRED_INCLUDES BACKUP_REQUIRED_INCS)
- endif(CMAKE_CROSSCOMPILING)
- if (VALID_LUAJIT_VERSION)
- message (STATUS "LuaJIT version ok")
- set(USE_LUAJIT 1)
- else (VALID_LUAJIT_VERSION)
- message (STATUS "LuaJIT versions till 2.0.0beta7 known to be broken, update to at least beta8")
- set(USE_LUAJIT 0)
- endif (VALID_LUAJIT_VERSION)
-endif (LUA_LIBRARY AND LUA_INCLUDE_DIR)
-
-if(NOT USE_LUAJIT)
- message (STATUS "LuaJIT not found, using bundled Lua.")
- set(LUA_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lua/src")
- set(LUA_LIBRARY "lua")
- add_subdirectory(lua)
-endif(NOT USE_LUAJIT)
-
-mark_as_advanced(LUA_LIBRARY)
-mark_as_advanced(LUA_INCLUDE_DIR)
-
-set(USE_LEVELDB 0)
-
-OPTION(ENABLE_LEVELDB "Enable LevelDB backend")
-
-if(ENABLE_LEVELDB)
- find_library(LEVELDB_LIBRARY leveldb)
- find_path(LEVELDB_INCLUDE_DIR db.h PATH_SUFFIXES leveldb)
- message (STATUS "LevelDB library: ${LEVELDB_LIBRARY}")
- message (STATUS "LevelDB headers: ${LEVELDB_INCLUDE_DIR}")
- if(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
- set(USE_LEVELDB 1)
- message(STATUS "LevelDB backend enabled")
- include_directories(${LEVELDB_INCLUDE_DIR})
- else(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
- set(USE_LEVELDB 0)
- message(STATUS "LevelDB not found!")
- endif(LEVELDB_LIBRARY AND LEVELDB_INCLUDE_DIR)
-endif(ENABLE_LEVELDB)
-
-set(USE_REDIS 0)
-
-OPTION(ENABLE_REDIS "Enable redis backend" 0)
-
-if(ENABLE_REDIS)
- find_library(REDIS_LIBRARY hiredis)
- find_path(REDIS_INCLUDE_DIR hiredis.h PATH_SUFFIXES hiredis)
- message(STATUS "redis library: ${REDIS_LIBRARY}")
- message(STATUS "redis headers: ${REDIS_INCLUDE_DIR}")
- if(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
- set(USE_REDIS 1)
- message(STATUS "redis backend enabled")
- include_directories(${REDIS_INCLUDE_DIR})
- else(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
- set(USE_REDIS 0)
- message(STATUS "redis not found!")
- endif(REDIS_LIBRARY AND REDIS_INCLUDE_DIR)
-endif(ENABLE_REDIS)
-
-CHECK_INCLUDE_FILES(endian.h HAVE_ENDIAN_H)
-if(NOT HAVE_ENDIAN_H)
- set(HAVE_ENDIAN_H 0)
-endif(NOT HAVE_ENDIAN_H)
+check_include_files(endian.h HAVE_ENDIAN_H)
configure_file(
"${PROJECT_SOURCE_DIR}/cmake_config.h.in"
"${PROJECT_BINARY_DIR}/cmake_config.h"
)
+
# Add a target that always rebuilds cmake_config_githash.h
add_custom_target(GenerateVersion
COMMAND ${CMAKE_COMMAND}
-P "${CMAKE_SOURCE_DIR}/cmake/Modules/GenerateVersion.cmake"
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
+
add_subdirectory(jthread)
add_subdirectory(network)
add_subdirectory(script)
add_subdirectory(util)
+
set (unittests_SRCS
test.cpp
)
${unittests_SRCS}
)
+
# This gives us the icon and file version information
if(WIN32)
- set(WINRESOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../misc/winresource.rc)
+ set(WINRESOURCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../misc/winresource.rc")
if(MINGW)
if(NOT CMAKE_RC_COMPILER)
set(CMAKE_RC_COMPILER "windres.exe")
endif(MINGW)
endif()
-# Client sources
+# Client sources
if (BUILD_CLIENT)
add_subdirectory(client)
endif(BUILD_CLIENT)
-set(minetest_SRCS
+set(client_SRCS
+ ${client_SRCS}
${common_SRCS}
${sound_SRCS}
- ${client_SRCS}
${client_network_SRCS}
camera.cpp
chat.cpp
shader.cpp
sky.cpp
wieldmesh.cpp
- ${minetest_SCRIPT_SRCS}
+ ${client_SCRIPT_SRCS}
)
-list(SORT minetest_SRCS)
+list(SORT client_SRCS)
# Server sources
-set(minetestserver_SRCS
+set(server_SRCS
${common_SRCS}
main.cpp
)
-list(SORT minetestserver_SRCS)
+list(SORT server_SRCS)
include_directories(
${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}/script
)
+
if(USE_FREETYPE)
- include_directories(
- ${FREETYPE_INCLUDE_DIRS}
- ${CGUITTFONT_INCLUDE_DIR}
- )
-endif(USE_FREETYPE)
+ include_directories(${FREETYPE_INCLUDE_DIRS} ${CGUITTFONT_INCLUDE_DIR})
+endif()
if(USE_CURL)
- include_directories(
- ${CURL_INCLUDE_DIR}
- )
-endif(USE_CURL)
+ include_directories(${CURL_INCLUDE_DIR})
+endif()
+
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_SOURCE_DIR}/bin")
+
if(BUILD_CLIENT)
- add_executable(${PROJECT_NAME} ${minetest_SRCS})
- add_dependencies(${PROJECT_NAME} GenerateVersion)
- set(minetest_LIBS
- ${PROJECT_NAME}
+ add_executable(${PROJECT_NAME_LOWER} ${client_SRCS})
+ add_dependencies(${PROJECT_NAME_LOWER} GenerateVersion)
+ set(client_LIBS
+ ${PROJECT_NAME_LOWER}
${ZLIB_LIBRARIES}
${IRRLICHT_LIBRARY}
${OPENGL_LIBRARIES}
)
if(APPLE)
target_link_libraries(
- ${minetest_LIBS}
+ ${client_LIBS}
${ICONV_LIBRARY}
)
else()
target_link_libraries(
- ${minetest_LIBS}
+ ${client_LIBS}
)
endif()
if(USE_CURL)
target_link_libraries(
- ${PROJECT_NAME}
+ ${PROJECT_NAME_LOWER}
${CURL_LIBRARY}
)
- endif(USE_CURL)
+ endif()
if(USE_FREETYPE)
if(FREETYPE_PKGCONFIG_FOUND)
- set_target_properties(${PROJECT_NAME}
+ set_target_properties(${PROJECT_NAME_LOWER}
PROPERTIES
COMPILE_FLAGS "${FREETYPE_CFLAGS_STR}"
)
- endif(FREETYPE_PKGCONFIG_FOUND)
+ endif()
target_link_libraries(
- ${PROJECT_NAME}
+ ${PROJECT_NAME_LOWER}
${FREETYPE_LIBRARY}
${CGUITTFONT_LIBRARY}
)
- endif(USE_FREETYPE)
+ endif()
if (USE_LEVELDB)
- target_link_libraries(${PROJECT_NAME} ${LEVELDB_LIBRARY})
- endif(USE_LEVELDB)
+ target_link_libraries(${PROJECT_NAME_LOWER} ${LEVELDB_LIBRARY})
+ endif()
if (USE_REDIS)
- target_link_libraries(${PROJECT_NAME} ${REDIS_LIBRARY})
- endif(USE_REDIS)
+ target_link_libraries(${PROJECT_NAME_LOWER} ${REDIS_LIBRARY})
+ endif()
endif(BUILD_CLIENT)
+
if(BUILD_SERVER)
- add_executable(${PROJECT_NAME}server ${minetestserver_SRCS})
- add_dependencies(${PROJECT_NAME}server GenerateVersion)
+ add_executable(${PROJECT_NAME_LOWER}server ${server_SRCS})
+ add_dependencies(${PROJECT_NAME_LOWER}server GenerateVersion)
target_link_libraries(
- ${PROJECT_NAME}server
+ ${PROJECT_NAME_LOWER}server
${ZLIB_LIBRARIES}
${SQLITE3_LIBRARY}
${JSON_LIBRARY}
${LUA_LIBRARY}
${PLATFORM_LIBS}
)
+ set_target_properties(${PROJECT_NAME_LOWER}server PROPERTIES
+ COMPILE_DEFINITIONS "SERVER")
if (USE_LEVELDB)
- target_link_libraries(${PROJECT_NAME}server ${LEVELDB_LIBRARY})
- endif(USE_LEVELDB)
+ target_link_libraries(${PROJECT_NAME_LOWER}server ${LEVELDB_LIBRARY})
+ endif()
if (USE_REDIS)
- target_link_libraries(${PROJECT_NAME}server ${REDIS_LIBRARY})
- endif(USE_REDIS)
+ target_link_libraries(${PROJECT_NAME_LOWER}server ${REDIS_LIBRARY})
+ endif()
if(USE_CURL)
target_link_libraries(
- ${PROJECT_NAME}server
+ ${PROJECT_NAME_LOWER}server
${CURL_LIBRARY}
)
- endif(USE_CURL)
+ endif()
endif(BUILD_SERVER)
-#
# Set some optimizations and tweaks
-#
include(CheckCXXCompilerFlag)
# Flags for C files (sqlite)
# /MT = Link statically with standard library stuff
set(CMAKE_C_FLAGS_RELEASE "/O2 /Ob2 /MT")
-
- if(BUILD_SERVER)
- set_target_properties(${PROJECT_NAME}server PROPERTIES
- COMPILE_DEFINITIONS "SERVER")
- endif(BUILD_SERVER)
-
else()
# Probably GCC
if(APPLE)
if(USE_GPROF)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg")
endif()
-
- if(BUILD_SERVER)
- set_target_properties(${PROJECT_NAME}server PROPERTIES
- COMPILE_DEFINITIONS "SERVER")
- endif(BUILD_SERVER)
-
endif()
-#MESSAGE(STATUS "CMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}")
-#MESSAGE(STATUS "CMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}")
-#
# Installation
-#
+
if(WIN32)
if(USE_SOUND)
if(OPENAL_DLL)
endif()
if(BUILD_CLIENT)
- install(TARGETS ${PROJECT_NAME}
+ install(TARGETS ${PROJECT_NAME_LOWER}
RUNTIME DESTINATION ${BINDIR}
LIBRARY DESTINATION ${BINDIR}
ARCHIVE DESTINATION ${BINDIR}
if(USE_GETTEXT)
foreach(LOCALE ${GETTEXT_AVAILABLE_LOCALES})
set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE})
- set(MO_BUILD_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo")
+ set(MO_BUILD_PATH "${MO_BUILD_PATH}/${PROJECT_NAME_LOWER}.mo")
install(FILES ${MO_BUILD_PATH} DESTINATION ${MO_DEST_PATH})
- endforeach(LOCALE ${GETTEXT_AVAILABLE_LOCALES})
+ endforeach()
endif()
if(WIN32)
if(DEFINED GETTEXT_ICONV_DLL)
install(FILES ${GETTEXT_ICONV_DLL} DESTINATION ${BINDIR})
endif()
- endif(USE_GETTEXT)
+ endif()
endif()
endif(BUILD_CLIENT)
if(BUILD_SERVER)
- install(TARGETS ${PROJECT_NAME}server DESTINATION ${BINDIR})
-endif(BUILD_SERVER)
+ install(TARGETS ${PROJECT_NAME_LOWER}server DESTINATION ${BINDIR})
+endif()
if (USE_GETTEXT)
set(MO_FILES)
foreach(LOCALE ${GETTEXT_AVAILABLE_LOCALES})
- set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/minetest.po")
+ set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/${PROJECT_NAME_LOWER}.po")
set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE})
- set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo")
+ set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME_LOWER}.mo")
add_custom_command(OUTPUT ${MO_BUILD_PATH}
COMMAND ${CMAKE_COMMAND} -E make_directory ${MO_BUILD_PATH}
)
set(MO_FILES ${MO_FILES} ${MO_FILE_PATH})
- endforeach(LOCALE ${GETTEXT_AVAILABLE_LOCALES})
+ endforeach()
add_custom_target(translations ALL COMMENT "mo update" DEPENDS ${MO_FILES})
-endif(USE_GETTEXT)
+endif()
+
# Subdirectories
if (BUILD_CLIENT AND USE_FREETYPE)
add_subdirectory(cguittfont)
-endif (BUILD_CLIENT AND USE_FREETYPE)
-
-if (JSON_FOUND)
-else (JSON_FOUND)
- add_subdirectory(json)
-endif (JSON_FOUND)
+endif()
-#end
${FREETYPE_LIBRARY}
${ZLIB_LIBRARIES} # needed by freetype, repeated here for safety
)
+
DSTACK(__FUNCTION_NAME);
NetworkPacket pkt(TOSERVER_CLIENT_READY,
- 1 + 1 + 1 + 1 + 2 + sizeof(char) * strlen(minetest_version_hash));
+ 1 + 1 + 1 + 1 + 2 + sizeof(char) * strlen(g_version_hash));
- pkt << (u8) VERSION_MAJOR << (u8) VERSION_MINOR << (u8) VERSION_PATCH_ORIG
- << (u8) 0 << (u16) strlen(minetest_version_hash);
+ pkt << (u8) VERSION_MAJOR << (u8) VERSION_MINOR << (u8) VERSION_PATCH
+ << (u8) 0 << (u16) strlen(g_version_hash);
- pkt.putRawString(minetest_version_hash, (u16) strlen(minetest_version_hash));
+ pkt.putRawString(g_version_hash, (u16) strlen(g_version_hash));
Send(&pkt);
}
${CMAKE_CURRENT_SOURCE_DIR}/tile.cpp
PARENT_SCOPE
)
+
return false;
}
- porting::setXorgClassHint(video_driver->getExposedVideoData(), "Minetest");
+ porting::setXorgClassHint(video_driver->getExposedVideoData(), PROJECT_NAME);
/*
This changes the minimum allowed number of vertices in a VBO.
{
// Set the window caption
const wchar_t *text = wgettext("Main Menu");
- device->setWindowCaption((std::wstring(L"Minetest [") + text + L"]").c_str());
+ device->setWindowCaption((narrow_to_wide(PROJECT_NAME) + L" [" + text + L"]").c_str());
delete[] text;
try { // This is used for catching disconnects
#ifndef CMAKE_CONFIG_H
#define CMAKE_CONFIG_H
-#define CMAKE_PROJECT_NAME "@PROJECT_NAME@"
-#define CMAKE_VERSION_STRING "@VERSION_STRING@"
-#define CMAKE_PRODUCT_VERSION_STRING "@VERSION_MAJOR@.@VERSION_MINOR@"
-#define CMAKE_RUN_IN_PLACE @RUN_IN_PLACE@
-#define CMAKE_USE_GETTEXT @USE_GETTEXT@
-#define CMAKE_USE_CURL @USE_CURL@
-#define CMAKE_USE_SOUND @USE_SOUND@
-#define CMAKE_USE_FREETYPE @USE_FREETYPE@
-#define CMAKE_STATIC_SHAREDIR "@SHAREDIR@"
-#define CMAKE_USE_LEVELDB @USE_LEVELDB@
-#define CMAKE_USE_LUAJIT @USE_LUAJIT@
-#define CMAKE_USE_REDIS @USE_REDIS@
-#define CMAKE_VERSION_MAJOR @VERSION_MAJOR@
-#define CMAKE_VERSION_MINOR @VERSION_MINOR@
-#define CMAKE_VERSION_PATCH @VERSION_PATCH@
-#define CMAKE_VERSION_PATCH_ORIG @VERSION_PATCH_ORIG@
-#define CMAKE_VERSION_EXTRA_STRING "@VERSION_EXTRA@"
-#define CMAKE_HAVE_ENDIAN_H @HAVE_ENDIAN_H@
-
-#ifdef NDEBUG
- #define CMAKE_BUILD_TYPE "Release"
-#else
- #define CMAKE_BUILD_TYPE "Debug"
-#endif
-#define CMAKE_BUILD_INFO "BUILD_TYPE=" CMAKE_BUILD_TYPE " RUN_IN_PLACE=@RUN_IN_PLACE@ USE_GETTEXT=@USE_GETTEXT@ USE_SOUND=@USE_SOUND@ USE_CURL=@USE_CURL@ USE_FREETYPE=@USE_FREETYPE@ USE_LUAJIT=@USE_LUAJIT@ STATIC_SHAREDIR=@SHAREDIR@"
+#define PROJECT_NAME "@PROJECT_NAME@"
+#define VERSION_MAJOR @VERSION_MAJOR@
+#define VERSION_MINOR @VERSION_MINOR@
+#define VERSION_PATCH @VERSION_PATCH@
+#define VERSION_EXTRA "@VERSION_EXTRA@"
+#define VERSION_STRING "@VERSION_STRING@"
+#define PRODUCT_VERSION_STRING "@VERSION_MAJOR@.@VERSION_MINOR@"
+#define STATIC_SHAREDIR "@SHAREDIR@"
+#define BUILD_TYPE "@CMAKE_BUILD_TYPE@"
+#cmakedefine01 RUN_IN_PLACE
+#cmakedefine01 USE_GETTEXT
+#cmakedefine01 USE_CURL
+#cmakedefine01 USE_SOUND
+#cmakedefine01 USE_FREETYPE
+#cmakedefine01 USE_LEVELDB
+#cmakedefine01 USE_LUAJIT
+#cmakedefine01 USE_REDIS
+#cmakedefine01 HAVE_ENDIAN_H
#endif
#ifndef CMAKE_CONFIG_GITHASH_H
#define CMAKE_CONFIG_GITHASH_H
-#define CMAKE_VERSION_GITHASH "@VERSION_GITHASH@"
+#define VERSION_GITHASH "@VERSION_GITHASH@"
#endif
#ifndef CONFIG_H
#define CONFIG_H
-#define PROJECT_NAME "Minetest"
-#define RUN_IN_PLACE 0
-#define STATIC_SHAREDIR ""
+#define STRINGIFY(x) #x
+#define STR(x) STRINGIFY(x)
-#define USE_GETTEXT 0
-#ifndef USE_SOUND
- #define USE_SOUND 0
-#endif
-
-#ifndef USE_CURL
+#ifdef USE_CMAKE_CONFIG_H
+ #include "cmake_config.h"
+#else
+ #define PROJECT_NAME "Minetest"
+ #define RUN_IN_PLACE 0
#define USE_CURL 0
-#endif
-
-#ifndef USE_FREETYPE
#define USE_FREETYPE 0
-#endif
-
-#ifndef USE_LEVELDB
+ #define USE_GETTEXT 0
#define USE_LEVELDB 0
-#endif
-
-#ifndef USE_LUAJIT
#define USE_LUAJIT 0
-#endif
-
-#ifndef USE_REDIS
#define USE_REDIS 0
-#endif
-
-#define HAVE_ENDIAN_H 0
-
-#ifdef USE_CMAKE_CONFIG_H
- #include "cmake_config.h"
- #undef PROJECT_NAME
- #define PROJECT_NAME CMAKE_PROJECT_NAME
- #undef RUN_IN_PLACE
- #define RUN_IN_PLACE CMAKE_RUN_IN_PLACE
- #undef USE_GETTEXT
- #define USE_GETTEXT CMAKE_USE_GETTEXT
- #undef USE_SOUND
- #define USE_SOUND CMAKE_USE_SOUND
- #undef USE_CURL
- #define USE_CURL CMAKE_USE_CURL
- #undef USE_FREETYPE
- #define USE_FREETYPE CMAKE_USE_FREETYPE
- #undef STATIC_SHAREDIR
- #define STATIC_SHAREDIR CMAKE_STATIC_SHAREDIR
- #undef USE_LEVELDB
- #define USE_LEVELDB CMAKE_USE_LEVELDB
- #undef USE_LUAJIT
- #define USE_LUAJIT CMAKE_USE_LUAJIT
- #undef USE_REDIS
- #define USE_REDIS CMAKE_USE_REDIS
- #undef VERSION_MAJOR
- #define VERSION_MAJOR CMAKE_VERSION_MAJOR
- #undef VERSION_MINOR
- #define VERSION_MINOR CMAKE_VERSION_MINOR
- #undef VERSION_PATCH
- #define VERSION_PATCH CMAKE_VERSION_PATCH
- #undef VERSION_PATCH_ORIG
- #define VERSION_PATCH_ORIG CMAKE_VERSION_PATCH_ORIG
- #undef VERSION_STRING
- #define VERSION_STRING CMAKE_VERSION_STRING
- #undef PRODUCT_VERSION_STRING
- #define PRODUCT_VERSION_STRING CMAKE_PRODUCT_VERSION_STRING
- #undef VERSION_EXTRA_STRING
- #define VERSION_EXTRA_STRING CMAKE_VERSION_EXTRA_STRING
- #undef HAVE_ENDIAN_H
- #define HAVE_ENDIAN_H CMAKE_HAVE_ENDIAN_H
+ #define USE_SOUND 0
+ #define HAVE_ENDIAN_H 0
+ #define STATIC_SHAREDIR ""
+ #ifdef NDEBUG
+ #define BUILD_TYPE "Release"
+ #else
+ #define BUILD_TYPE "Debug"
+ #endif
#endif
#ifdef __ANDROID__
#include "android_version.h"
- #define VERSION_STRING CMAKE_VERSION_STRING
#endif
+#define BUILD_INFO "BUILD_TYPE=" BUILD_TYPE \
+ " RUN_IN_PLACE=" STR(RUN_IN_PLACE) \
+ " USE_GETTEXT=" STR(USE_GETTEXT) \
+ " USE_SOUND=" STR(USE_SOUND) \
+ " USE_CURL=" STR(USE_CURL) \
+ " USE_FREETYPE=" STR(USE_FREETYPE) \
+ " USE_LUAJIT=" STR(USE_LUAJIT) \
+ " STATIC_SHAREDIR=" STR(STATIC_SHAREDIR)
+
#endif
MINIDUMP_USER_STREAM_INFORMATION mdusi;
MINIDUMP_USER_STREAM mdus;
bool minidump_created = false;
- std::string version_str("Minetest ");
- std::string dumpfile = porting::path_user + DIR_DELIM "minetest.dmp";
+ std::string dumpfile = porting::path_user + DIR_DELIM PROJECT_NAME ".dmp";
HANDLE hFile = CreateFileA(dumpfile.c_str(), GENERIC_WRITE,
FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
mdei.ExceptionPointers = pExceptInfo;
mdei.ThreadId = GetCurrentThreadId();
- version_str += minetest_version_hash;
+ std::string version_str(PROJECT_NAME " ");
+ version_str += g_version_hash;
mdus.Type = CommentStreamA;
mdus.BufferSize = version_str.size();
settings->setDefault("enable_particles", "false");
settings->setDefault("video_driver", "ogles1");
settings->setDefault("touchtarget", "true");
- settings->setDefault("TMPFolder","/sdcard/Minetest/tmp/");
+ settings->setDefault("TMPFolder","/sdcard/" PROJECT_NAME "/tmp/");
settings->setDefault("touchscreen_threshold","20");
settings->setDefault("smooth_lighting", "false");
settings->setDefault("max_simultaneous_block_sends_per_client", "3");
}
catch (VersionMismatchException &e) {
std::ostringstream err;
- err << "World data version mismatch in MapBlock "<<PP(last_tried_pos)<<std::endl;
- err << "----"<<std::endl;
- err << "\""<<e.what()<<"\""<<std::endl;
- err << "See debug.txt."<<std::endl;
- err << "World probably saved by a newer version of Minetest."<<std::endl;
+ err << "World data version mismatch in MapBlock " << PP(last_tried_pos) << std::endl
+ << "----" << std::endl
+ << "\"" << e.what() << "\"" << std::endl
+ << "See debug.txt." << std::endl
+ << "World probably saved by a newer version of " PROJECT_NAME "."
+ << std::endl;
m_server->setAsyncFatalError(err.str());
}
catch (SerializationError &e) {
std::ostringstream err;
- err << "Invalid data in MapBlock "<<PP(last_tried_pos)<<std::endl;
- err << "----"<<std::endl;
- err << "\""<<e.what()<<"\""<<std::endl;
- err << "See debug.txt."<<std::endl;
- err << "You can ignore this using [ignore_world_load_errors = true]."<<std::endl;
+ err << "Invalid data in MapBlock " << PP(last_tried_pos) << std::endl
+ << "----" << std::endl
+ << "\"" << e.what() << "\"" << std::endl
+ << "See debug.txt." << std::endl
+ << "You can ignore this using [ignore_world_load_errors = true]."
+ << std::endl;
m_server->setAsyncFatalError(err.str());
}
os << "button_exit[4," << (ypos++) << ";3,0.5;btn_exit_os;"
<< wide_to_narrow(wstrgettext("Exit to OS")) << "]"
<< "textarea[7.5,0.25;3.9,6.25;;" << control_text << ";]"
- << "textarea[0.4,0.25;3.5,6;;" << "Minetest\n"
- << minetest_build_info << "\n"
+ << "textarea[0.4,0.25;3.5,6;;" << PROJECT_NAME "\n"
+ << g_build_info << "\n"
<< "path_user = " << wrap_rows(porting::path_user, 20)
<< "\n;]";
/* Set window caption
*/
- core::stringw str = L"Minetest [";
+ std::wstring str = narrow_to_wide(PROJECT_NAME);
+ str += L" [";
str += driver->getName();
- str += "]";
+ str += L"]";
device->setWindowCaption(str.c_str());
LocalPlayer *player = client->getEnv().getLocalPlayer();
{
// First line of debug text
guitext = guienv->addStaticText(
- L"Minetest",
+ narrow_to_wide(PROJECT_NAME).c_str(),
core::rect<s32>(0, 0, 0, 0),
false, false, guiroot);
std::ostringstream os(std::ios_base::binary);
os << std::fixed
- << "Minetest " << minetest_version_hash
+ << PROJECT_NAME " " << g_version_hash
<< " FPS = " << fps
<< " (R: range_all=" << draw_control->range_all << ")"
<< std::setprecision(0)
guitext->setVisible(true);
} else if (flags.show_hud || flags.show_chat) {
std::ostringstream os(std::ios_base::binary);
- os << "Minetest " << minetest_version_hash;
+ os << PROJECT_NAME " " << g_version_hash;
guitext->setText(narrow_to_wide(os.str()).c_str());
guitext->setVisible(true);
} else {
} catch (SerializationError &e) {
error_message = L"A serialization error occurred:\n"
+ narrow_to_wide(e.what()) + L"\n\nThe server is probably "
- L" running a different version of Minetest.";
+ L" running a different version of " PROJECT_NAME ".";
errorstream << wide_to_narrow(error_message) << std::endl;
} catch (ServerError &e) {
error_message = narrow_to_wide(e.what());
m_sound_manager = &dummySoundManager;
//create topleft header
- std::wstring t = narrow_to_wide(std::string("Minetest ") +
- minetest_version_hash);
+ std::wstring t = narrow_to_wide(std::string(PROJECT_NAME " ") +
+ g_version_hash);
core::rect<s32> rect(0, 0, g_fontengine->getTextWidth(t), g_fontengine->getTextHeight());
rect += v2s32(4, 0);
/******************************************************************************/
void GUIEngine::setTopleftText(std::string append)
{
- std::wstring toset = narrow_to_wide( std::string("Minetest ") +
- minetest_version_hash);
+ std::wstring toset = narrow_to_wide(std::string(PROJECT_NAME " ") +
+ g_version_hash);
if (append != "")
{
connect_timeout = timeout;
multipart = false;
- useragent = std::string("Minetest/") + minetest_version_hash + " (" + porting::get_sysinfo() + ")";
+ useragent = std::string(PROJECT_NAME "/") + g_version_hash + " (" + porting::get_sysinfo() + ")";
}
-if( UNIX )
- set(json_SRCS jsoncpp.cpp)
- set(json_platform_LIBS "")
-else( UNIX )
- set(json_SRCS jsoncpp.cpp)
- set(json_platform_LIBS "")
-endif( UNIX )
+add_library(jsoncpp jsoncpp.cpp)
-add_library(jsoncpp ${json_SRCS})
+target_link_libraries(jsoncpp)
-target_link_libraries(
- jsoncpp
- ${json_platform_LIBS}
-)
-if( UNIX )
- set(JTHREAD_SRCS
- ${CMAKE_CURRENT_SOURCE_DIR}/pthread/jmutex.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/pthread/jthread.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/pthread/jsemaphore.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/pthread/jevent.cpp
- PARENT_SCOPE)
-else( UNIX )
- set(JTHREAD_SRCS
- ${CMAKE_CURRENT_SOURCE_DIR}/win32/jmutex.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/win32/jthread.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/win32/jsemaphore.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/win32/jevent.cpp
- PARENT_SCOPE)
-endif( UNIX )
+if(UNIX)
+ set(THREAD_SYS_DIR pthread)
+else()
+ set(THREAD_SYS_DIR win32)
+endif()
+
+set(SRC_PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/${THREAD_SYS_DIR})
+set(JTHREAD_SRCS
+ ${SRC_PREFIX}/jmutex.cpp
+ ${SRC_PREFIX}/jthread.cpp
+ ${SRC_PREFIX}/jsemaphore.cpp
+ ${SRC_PREFIX}/jevent.cpp
+ PARENT_SCOPE)
+
-#
-# Lua 5.1.x
-#
cmake_minimum_required(VERSION 2.4 FATAL_ERROR)
project(lua C)
+set(LUA_VERSION_MAJOR 5)
+set(LUA_VERSION_MINOR 1)
+set(LUA_VERSION_PATCH 4)
+set(LUA_VERSION "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
+
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
set(COMMON_CFLAGS)
set(DEFAULT_DLOPEN ON)
# use this on Mac OS X 10.3-
option(LUA_USE_MACOSX "Mac OS X 10.3-" OFF)
-elseif(CYGWIN)
- set(DEFAULT_POSIX TRUE)
-elseif(UNIX)
+elseif(UNIX OR CYGWIN)
set(DEFAULT_POSIX TRUE)
elseif(WIN32)
set(LUA_WIN TRUE)
set(DEFAULT_DLOPEN ON)
endif()
-if(WIN32)
- #set(BUILD_STATIC OFF)
- set(BUILD_STATIC ON)
-else()
- #option(BUILD_STATIC "build static library" ON)
- set(BUILD_STATIC ON)
-endif()
-
-if(DEFAULT_DLOPEN)
- option(LUA_USE_DLOPEN "Enable dlopen support." ON)
-else()
- option(LUA_USE_DLOPEN "Enable dlopen support." OFF)
-endif()
-mark_as_advanced(LUA_USE_DLOPEN)
-
-if(DEFAULT_ANSI)
- option(LUA_ANSI "Disable non-ansi features." ON)
-else()
- option(LUA_ANSI "Disable non-ansi features." OFF)
-endif()
-mark_as_advanced(LUA_ANSI)
-
-#
-# Lua version
-#
-set(LUA_VERSION_MAJOR 5)
-set(LUA_VERSION_MINOR 1)
-set(LUA_VERSION_PATCH 4)
-set(LUA_VERSION
- "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
-set(LUA_SOVERSION
- "${LUA_VERSION_MAJOR}")
-
-#
-# libs & cflags
-#
-set(COMMON_LDFLAGS "${COMMON_LDFLAGS}")
-
# For "Mac OS X 10.3-"
if(LUA_USE_MACOSX)
set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_MACOSX")
set(LUA_USE_DLOPEN FALSE)
endif(LUA_USE_MACOSX)
+option(LUA_USE_DLOPEN "Enable dlopen support." ${DEFAULT_DLOPEN})
+mark_as_advanced(LUA_USE_DLOPEN)
+
+option(LUA_ANSI "Disable non-ANSI features." ${DEFAULT_ANSI})
+mark_as_advanced(LUA_ANSI)
+
if(LUA_USE_DLOPEN)
set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_DLOPEN")
if(NOT APPLE)
set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_ANSI")
endif(LUA_ANSI)
-#
# COMMON_CFLAGS has no effect without this line
-#
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMMON_CFLAGS}")
-#
-# standard flags to use for each build type.
-#
+
+# Standard flags to use for each build type.
if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pipe -Wall -Wextra -Wshadow -W -pedantic -std=gnu99")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} -O2 -g")
endif(CMAKE_COMPILER_IS_GNUCC)
-#
-# sub-folders
-#
-ADD_SUBDIRECTORY(src build)
+
+add_subdirectory(src build)
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR})
+ ${CMAKE_CURRENT_BINARY_DIR})
-#
# Lua library.
-#
add_library(lua STATIC ${LUA_CORE_SRC})
target_link_libraries(lua ${LIBS})
set(LUA_STATIC_LIB lua)
set_target_properties(${LUA_LIBS} PROPERTIES
VERSION ${LUA_VERSION}
- SOVERSION ${LUA_SOVERSION}
CLEAN_DIRECT_OUTPUT 1
)
-# Install library
-#install(TARGETS ${LUA_LIBS}
-# RUNTIME DESTINATION bin
-# LIBRARY DESTINATION lib
-# ARCHIVE DESTINATION lib)
-
static void print_version()
{
-#ifdef SERVER
- dstream << "minetestserver " << minetest_version_hash << std::endl;
-#else
- dstream << "Minetest " << minetest_version_hash << std::endl;
+ dstream << PROJECT_NAME " " << g_version_hash << std::endl;
+#ifndef SERVER
dstream << "Using Irrlicht " << IRRLICHT_SDK_VERSION << std::endl;
#endif
- dstream << "Build info: " << minetest_build_info << std::endl;
+ dstream << "Build info: " << g_build_info << std::endl;
}
static void list_game_ids()
infostream << PROJECT_NAME << " " << _("with")
<< " SER_FMT_VER_HIGHEST_READ="
<< (int)SER_FMT_VER_HIGHEST_READ << ", "
- << minetest_build_info << std::endl;
+ << g_build_info << std::endl;
}
static bool read_config_file(const Settings &cmd_args)
${CMAKE_CURRENT_SOURCE_DIR}/clientpackethandler.cpp
PARENT_SCOPE
)
-endif(BUILD_CLIENT)
+endif()
+
DenyAccess_Legacy(pkt->getPeerId(), std::wstring(
L"Your client's version is not supported.\n"
L"Server version is ")
- + narrow_to_wide(minetest_version_simple) + L"."
+ + narrow_to_wide(g_version_string) + L"."
);
return;
}
DenyAccess_Legacy(pkt->getPeerId(), std::wstring(
L"Your client's version is not supported.\n"
L"Server version is ")
- + narrow_to_wide(minetest_version_simple) + L",\n"
+ + narrow_to_wide(g_version_string) + L",\n"
+ L"server's PROTOCOL_VERSION is "
+ narrow_to_wide(itos(SERVER_PROTOCOL_VERSION_MIN))
+ L"..."
DenyAccess_Legacy(pkt->getPeerId(), std::wstring(
L"Your client's version is not supported.\n"
L"Server version is ")
- + narrow_to_wide(minetest_version_simple) + L",\n"
+ + narrow_to_wide(g_version_string) + L",\n"
+ L"server's PROTOCOL_VERSION (strict) is "
+ narrow_to_wide(itos(LATEST_PROTOCOL_VERSION))
+ L", client's PROTOCOL_VERSION is "
// Use "C:\Documents and Settings\user\Application Data\<PROJECT_NAME>"
len = GetEnvironmentVariable("APPDATA", buf, buflen);
FATAL_ERROR_IF(len >= buflen, "Overlow");
- path_user = std::string(buf) + DIR_DELIM + PROJECT_NAME;
+ path_user = std::string(buf) + DIR_DELIM + lowercase(PROJECT_NAME);
/*
Linux
if(static_sharedir != "" && static_sharedir != ".")
trylist.push_back(static_sharedir);
trylist.push_back(
- bindir + DIR_DELIM + ".." + DIR_DELIM + "share" + DIR_DELIM + PROJECT_NAME);
+ bindir + DIR_DELIM + ".." + DIR_DELIM + "share" + DIR_DELIM + lowercase(PROJECT_NAME));
trylist.push_back(bindir + DIR_DELIM + "..");
#ifdef __ANDROID__
trylist.push_back(path_user);
break;
}
#ifndef __ANDROID__
- path_user = std::string(getenv("HOME")) + DIR_DELIM + "." + PROJECT_NAME;
+ path_user = std::string(getenv("HOME")) + DIR_DELIM + "." + lowercase(PROJECT_NAME);
#endif
/*
dstream << "WARNING: Could not determine bundle resource path" << std::endl;
}
CFRelease(resources_url);
- path_user = std::string(getenv("HOME")) + "/Library/Application Support/" + PROJECT_NAME;
+
+ path_user = std::string(getenv("HOME")) + "/Library/Application Support/" + lowercase(PROJECT_NAME);
#else // FreeBSD, and probably many other POSIX-like systems.
path_share = STATIC_SHAREDIR;
- path_user = std::string(getenv("HOME")) + DIR_DELIM + "." + PROJECT_NAME;
+ path_user = std::string(getenv("HOME")) + DIR_DELIM + "." + lowercase(PROJECT_NAME);
#endif
PARENT_SCOPE)
# Used by client only
-set(minetest_SCRIPT_SRCS
+set(client_SCRIPT_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/scripting_mainmenu.cpp
- ${minetest_SCRIPT_COMMON_SRCS}
- ${minetest_SCRIPT_CPP_API_SRCS}
- ${minetest_SCRIPT_LUA_API_SRCS}
+ ${client_SCRIPT_COMMON_SRCS}
+ ${client_SCRIPT_CPP_API_SRCS}
+ ${client_SCRIPT_LUA_API_SRCS}
PARENT_SCOPE)
+
-# Used by server and client
set(common_SCRIPT_COMMON_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/c_content.cpp
${CMAKE_CURRENT_SOURCE_DIR}/c_converter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/c_internal.cpp
PARENT_SCOPE)
-# Used by client only
-set(minetest_SCRIPT_COMMON_SRCS
+set(client_SCRIPT_COMMON_SRCS
PARENT_SCOPE)
+
-# Used by server and client
set(common_SCRIPT_CPP_API_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/s_base.cpp
${CMAKE_CURRENT_SOURCE_DIR}/s_entity.cpp
${CMAKE_CURRENT_SOURCE_DIR}/s_async.cpp
PARENT_SCOPE)
-# Used by client only
-set(minetest_SCRIPT_CPP_API_SRCS
+set(client_SCRIPT_CPP_API_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/s_mainmenu.cpp
PARENT_SCOPE)
+
-# Used by server and client
set(common_SCRIPT_LUA_API_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/l_base.cpp
${CMAKE_CURRENT_SOURCE_DIR}/l_craft.cpp
${CMAKE_CURRENT_SOURCE_DIR}/l_settings.cpp
PARENT_SCOPE)
-# Used by client only
-set(minetest_SCRIPT_LUA_API_SRCS
+set(client_SCRIPT_LUA_API_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/l_mainmenu.cpp
PARENT_SCOPE)
+
/******************************************************************************/
int ModApiMainMenu::l_get_version(lua_State *L)
{
- lua_pushstring(L, minetest_version_simple);
+ lua_pushstring(L, g_version_string);
return 1;
}
std::wostringstream os(std::ios_base::binary);
os<<L"# Server: ";
// Version
- os<<L"version="<<narrow_to_wide(minetest_version_simple);
+ os<<L"version="<<narrow_to_wide(g_version_string);
// Uptime
os<<L", uptime="<<m_uptime.get();
// Max lag estimate
bool strict_checking = g_settings->getBool("strict_protocol_version_checking");
server["name"] = g_settings->get("server_name");
server["description"] = g_settings->get("server_description");
- server["version"] = minetest_version_simple;
+ server["version"] = g_version_string;
server["proto_min"] = strict_checking ? LATEST_PROTOCOL_VERSION : SERVER_PROTOCOL_VERSION_MIN;
server["proto_max"] = strict_checking ? LATEST_PROTOCOL_VERSION : SERVER_PROTOCOL_VERSION_MAX;
server["url"] = g_settings->get("server_url");
${CMAKE_CURRENT_SOURCE_DIR}/string.cpp
${CMAKE_CURRENT_SOURCE_DIR}/timetaker.cpp
PARENT_SCOPE)
+
#include "version.h"
#include "config.h"
-#ifdef __ANDROID__
+#if defined(__ANDROID__)
#include "android_version.h"
#elif defined(USE_CMAKE_CONFIG_H)
#include "cmake_config_githash.h"
#endif
-#ifdef CMAKE_VERSION_GITHASH
- #define VERSION_GITHASH CMAKE_VERSION_GITHASH
-#else
+#ifndef VERSION_GITHASH
#define VERSION_GITHASH VERSION_STRING
#endif
-const char *minetest_version_simple = VERSION_STRING;
-const char *minetest_version_hash = VERSION_GITHASH;
-#ifdef USE_CMAKE_CONFIG_H
-const char *minetest_build_info =
- "VER=" VERSION_GITHASH " " CMAKE_BUILD_INFO;
-#elif defined(ANDROID)
-const char *minetest_build_info = "android jni";
-#else
-const char *minetest_build_info = "non-cmake";
-#endif
+const char *g_version_string = VERSION_STRING;
+const char *g_version_hash = VERSION_GITHASH;
+const char *g_build_info = "VER=" VERSION_GITHASH " " BUILD_INFO;
#ifndef VERSION_HEADER
#define VERSION_HEADER
-extern const char *minetest_version_simple;
-extern const char *minetest_version_hash;
-extern const char *minetest_build_info;
+extern const char *g_version_string;
+extern const char *g_version_hash;
+extern const char *g_build_info;
#endif
#!/bin/bash -e
-if [ $CC = "clang" ]; then
+if [[ $CC == "clang" ]]; then
export PATH="/usr/bin/:$PATH"
sudo sh -c 'echo "deb http://ppa.launchpad.net/eudoxos/llvm-3.1/ubuntu precise main" >> /etc/apt/sources.list'
sudo apt-key adv --keyserver pool.sks-keyservers.net --recv-keys 92DE8183
sudo apt-get install clang
fi
sudo apt-get install p7zip-full
-if [ $WINDOWS = "no" ]; then
+if [[ $PLATFORM == "Linux" ]]; then
sudo apt-get install libirrlicht-dev cmake libbz2-dev libpng12-dev \
- libjpeg8-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libhiredis-dev \
- libogg-dev libvorbis-dev libopenal-dev gettext
+ libjpeg8-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev \
+ libhiredis-dev libogg-dev libvorbis-dev libopenal-dev gettext
# Linking to LevelDB is broken, use a custom build
wget http://sfan5.pf-control.de/libleveldb-1.18-ubuntu12.04.7z
sudo 7z x -o/usr libleveldb-1.18-ubuntu12.04.7z
-else
- if [ $WINDOWS = "32" ]; then
- wget http://sfan5.pf-control.de/mingw_w64_i686_ubuntu12.04_4.9.1.7z -O mingw.7z
- sed -e "s|%PREFIX%|i686-w64-mingw32|" \
- -e "s|%ROOTPATH%|/usr/i686-w64-mingw32|" \
- < util/travis/toolchain_mingw.cmake.in > util/buildbot/toolchain_mingw.cmake
- elif [ $WINDOWS = "64" ]; then
- wget http://sfan5.pf-control.de/mingw_w64_x86_64_ubuntu12.04_4.9.1.7z -O mingw.7z
- sed -e "s|%PREFIX%|x86_64-w64-mingw32|" \
- -e "s|%ROOTPATH%|/usr/x86_64-w64-mingw32|" \
- < util/travis/toolchain_mingw.cmake.in > util/buildbot/toolchain_mingw64.cmake
- fi
+elif [[ $PLATFORM == "Win32" ]]; then
+ wget http://sfan5.pf-control.de/mingw_w64_i686_ubuntu12.04_4.9.1.7z -O mingw.7z
+ sed -e "s|%PREFIX%|i686-w64-mingw32|" \
+ -e "s|%ROOTPATH%|/usr/i686-w64-mingw32|" \
+ < util/travis/toolchain_mingw.cmake.in > util/buildbot/toolchain_mingw.cmake
+ sudo 7z x -y -o/usr mingw.7z
+elif [[ $PLATFORM == "Win64" ]]; then
+ wget http://sfan5.pf-control.de/mingw_w64_x86_64_ubuntu12.04_4.9.1.7z -O mingw.7z
+ sed -e "s|%PREFIX%|x86_64-w64-mingw32|" \
+ -e "s|%ROOTPATH%|/usr/x86_64-w64-mingw32|" \
+ < util/travis/toolchain_mingw.cmake.in > util/buildbot/toolchain_mingw64.cmake
sudo 7z x -y -o/usr mingw.7z
fi
+
#!/bin/bash -e
-if [ $WINDOWS = "no" ]; then
+if [[ $PLATFORM == "Linux" ]]; then
mkdir -p travisbuild
cd travisbuild
- cmake -DENABLE_GETTEXT=1 -DENABLE_LEVELDB=1 -DENABLE_REDIS=1 -DCMAKE_BUILD_TYPE=Debug ..
+ CMAKE_FLAGS='-DCMAKE_BUILD_TYPE=Debug \
+ -DRUN_IN_PLACE=TRUE \
+ -DENABLE_GETTEXT=TRUE'
+ # Clang builds with FreeType fail on Travis
+ if [[ $CC == "clang" ]]; then
+ CMAKE_FLAGS+=' -DENABLE_FREETYPE=FALSE'
+ fi
+ cmake $CMAKE_FLAGS ..
make -j2
- echo "Running unit tests for minetest"
- ../bin/minetest --run-unittests
- echo "Running unit tests for minetestserver"
- ../bin/minetestserver --run-unittests
-else
- [ $CC = "clang" ] && exit 1 # Not supposed to happen
+ echo "Running unit tests."
+ ../bin/minetest --run-unittests && exit 0
+elif [[ $PLATFORM == Win* ]]; then
+ [[ $CC == "clang" ]] && exit 1 # Not supposed to happen
# We need to have our build directory outside of the minetest directory because
# CMake will otherwise get very very confused with symlinks and complain that
# something is not a subdirectory of something even if it actually is.
# \/ \/ \/
# /home/travis/minetest/minetest/travisbuild/minetest/travisbuild/minetest/travisbuild/minetest
# You get the idea.
- OLDDIR=`pwd`
+ OLDDIR=$(pwd)
cd ..
- [ $WINDOWS = "32" ] && EXISTING_MINETEST_DIR=$OLDDIR NO_MINETEST_GAME=1 $OLDDIR/util/buildbot/buildwin32.sh travisbuild && exit 0
- [ $WINDOWS = "64" ] && EXISTING_MINETEST_DIR=$OLDDIR NO_MINETEST_GAME=1 $OLDDIR/util/buildbot/buildwin64.sh travisbuild && exit 0
+ export EXISTING_MINETEST_DIR=$OLDDIR
+ export NO_MINETEST_GAME=1
+ if [[ $PLATFORM == "Win32" ]]; then
+ $OLDDIR/util/buildbot/buildwin32.sh travisbuild && exit 0
+ elif [[ $PLATFORM == "Win64" ]]; then
+ $OLDDIR/util/buildbot/buildwin64.sh travisbuild && exit 0
+ fi
+else
+ echo "Unknown platform \"${PLATFORM}\"."
+ exit 1
fi
+
-# name of the target operating system
-SET(CMAKE_SYSTEM_NAME Windows)
+# Target operating system name
+set(CMAKE_SYSTEM_NAME Windows)
-# which compilers to use for C and C++
-SET(CMAKE_C_COMPILER %PREFIX%-gcc)
-SET(CMAKE_CXX_COMPILER %PREFIX%-g++)
-SET(CMAKE_RC_COMPILER %PREFIX%-windres)
+# Compilers to use
+set(CMAKE_C_COMPILER %PREFIX%-gcc)
+set(CMAKE_CXX_COMPILER %PREFIX%-g++)
+set(CMAKE_RC_COMPILER %PREFIX%-windres)
-# here is the target environment located
-SET(CMAKE_FIND_ROOT_PATH %ROOTPATH%)
+# Location of the target environment
+set(CMAKE_FIND_ROOT_PATH %ROOTPATH%)
-# adjust the default behaviour of the FIND_XXX() commands:
-# search headers and libraries in the target environment, search
-# programs in the host environment
+# Adjust the default behaviour of the FIND_XXX() commands:
+# search for headers and libraries in the target environment,
+# search for programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
+