forked from Mirrorlandia_minetest/minetest
CMake stuff works now on linux and windows... and should be possible to make to work on OS X.
This commit is contained in:
parent
426c206d7e
commit
9fbb0889a7
@ -4,12 +4,72 @@ if(${CMAKE_VERSION} STREQUAL "2.8.2")
|
|||||||
message( WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!")
|
message( WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!")
|
||||||
endif(${CMAKE_VERSION} STREQUAL "2.8.2")
|
endif(${CMAKE_VERSION} STREQUAL "2.8.2")
|
||||||
|
|
||||||
set(CMAKE_BUILD_TYPE Debug)
|
# This can be read from ${PROJECT_NAME} after project() is called
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
project(minetest)
|
||||||
|
|
||||||
# This is done here so that IRRDIR is relative to the typical cmake call directory
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
||||||
|
include(${CMAKE_SOURCE_DIR}/cmake/Modules/misc.cmake)
|
||||||
|
|
||||||
|
# Default to Release
|
||||||
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
set(RUN_IN_PLACE 0 CACHE BOOL "Run directly in source directory structure")
|
||||||
|
|
||||||
|
set(BUILD_CLIENT 1 CACHE BOOL "Build client")
|
||||||
|
set(BUILD_SERVER 1 CACHE BOOL "Build server")
|
||||||
|
|
||||||
|
# Get date and time
|
||||||
|
GETDATETIME(BUILD_DATE)
|
||||||
|
MESSAGE(STATUS "BUILD_DATE = ${BUILD_DATE}")
|
||||||
|
|
||||||
|
# This is done here so that relative search paths are more reasnable
|
||||||
find_package(Irrlicht)
|
find_package(Irrlicht)
|
||||||
|
|
||||||
# This way the CMakeLists.txt file in src/ is processed
|
# This way the CMakeLists.txt file in src/ is processed
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
install(FILES "doc/README.txt" DESTINATION "share/minetest/doc")
|
||||||
|
|
||||||
|
# CPack
|
||||||
|
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner/Minecraft inspired game")
|
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR 0)
|
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR 0)
|
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH 0)
|
||||||
|
set(CPACK_PACKAGE_VENDOR "celeron55")
|
||||||
|
set(CPACK_PACKAGE_FILE_NAME "minetest-${BUILD_DATE}")
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
# For some reason these aren't copied otherwise
|
||||||
|
if(BUILD_CLIENT)
|
||||||
|
install(FILES bin/minetest.exe DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
if(BUILD_SERVER)
|
||||||
|
install(FILES bin/minetestserver.exe DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CPACK_GENERATOR ZIP)
|
||||||
|
|
||||||
|
# This might be needed for some installer
|
||||||
|
#set(CPACK_PACKAGE_EXECUTABLES bin/minetest.exe "Minetest" bin/minetestserver.exe "Minetest Server")
|
||||||
|
elseif(APPLE)
|
||||||
|
# TODO
|
||||||
|
# see http://cmake.org/Wiki/CMake:CPackPackageGenerators#Bundle_.28OSX_only.29
|
||||||
|
set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME})
|
||||||
|
set(CPACK_PACKAGE_ICON "")
|
||||||
|
set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
|
||||||
|
set(CPACK_BUNDLE_ICON "")
|
||||||
|
set(CPACK_BUNDLE_PLIST "")
|
||||||
|
set(CPACK_BUNDLE_STARTUP_COMMAND "Contents/MacOS/minetest")
|
||||||
|
set(CPACK_GENERATOR BUNDLE)
|
||||||
|
else()
|
||||||
|
set(CPACK_GENERATOR TGZ)
|
||||||
|
set(CPACK_SOURCE_GENERATOR TGZ)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(CPack)
|
||||||
|
|
||||||
|
@ -1,28 +1,54 @@
|
|||||||
MESSAGE(STATUS "IRRDIR = $ENV{IRRDIR}")
|
#FindIrrlicht.cmake
|
||||||
|
|
||||||
|
set(IRRLICHT_SOURCE_DIR "" CACHE PATH "Path to irrlicht source directory (optional)")
|
||||||
|
|
||||||
|
if( UNIX )
|
||||||
|
# Unix
|
||||||
|
else( UNIX )
|
||||||
|
# Windows
|
||||||
|
endif( UNIX )
|
||||||
|
|
||||||
|
# Find include directory
|
||||||
|
|
||||||
FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
|
FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
|
||||||
PATHS
|
PATHS
|
||||||
$ENV{IRRDIR}/include
|
|
||||||
/usr/local/include/irrlicht
|
/usr/local/include/irrlicht
|
||||||
/usr/include/irrlicht
|
/usr/include/irrlicht
|
||||||
|
"${IRRLICHT_SOURCE_DIR}/include"
|
||||||
)
|
)
|
||||||
|
|
||||||
MESSAGE(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}")
|
# Find library directory
|
||||||
|
|
||||||
FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.a Irrlicht
|
FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.a Irrlicht
|
||||||
PATHS
|
PATHS
|
||||||
$ENV{IRRDIR}/lib
|
|
||||||
$ENV{IRRDIR}/lib/Linux
|
|
||||||
$ENV{IRRDIR}/lib/MacOSX
|
|
||||||
$ENV{IRRDIR}/lib/Win32-gcc
|
|
||||||
$ENV{IRRDIR}/lib/Win32-visualstudio
|
|
||||||
$ENV{IRRDIR}/lib/Win64-visualstudio
|
|
||||||
/usr/local/lib
|
/usr/local/lib
|
||||||
/usr/lib
|
/usr/lib
|
||||||
|
#${IRRLICHT_PLATFORM_DIR}
|
||||||
|
"${IRRLICHT_SOURCE_DIR}/lib/Win32-visualstudio"
|
||||||
|
"${IRRLICHT_SOURCE_DIR}/lib/Win32-gcc"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
MESSAGE(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}")
|
||||||
MESSAGE(STATUS "IRRLICHT_LIBRARY = ${IRRLICHT_LIBRARY}")
|
MESSAGE(STATUS "IRRLICHT_LIBRARY = ${IRRLICHT_LIBRARY}")
|
||||||
|
|
||||||
|
# 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)"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll
|
||||||
|
PATHS
|
||||||
|
"${IRRLICHT_SOURCE_DIR}/bin/Win32-gcc"
|
||||||
|
DOC "Path of the Irrlicht dll (for installation)"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
MESSAGE(STATUS "IRRLICHT_DLL = ${IRRLICHT_DLL}")
|
||||||
|
endif(WIN32)
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set IRRLICHT_FOUND to TRUE if
|
# handle the QUIETLY and REQUIRED arguments and set IRRLICHT_FOUND to TRUE if
|
||||||
# all listed variables are TRUE
|
# all listed variables are TRUE
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
@ -34,5 +60,5 @@ ELSE(IRRLICHT_FOUND)
|
|||||||
SET(IRRLICHT_LIBRARIES)
|
SET(IRRLICHT_LIBRARIES)
|
||||||
ENDIF(IRRLICHT_FOUND)
|
ENDIF(IRRLICHT_FOUND)
|
||||||
|
|
||||||
MARK_AS_ADVANCED(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR)
|
MARK_AS_ADVANCED(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL)
|
||||||
|
|
||||||
|
16
cmake/Modules/misc.cmake
Normal file
16
cmake/Modules/misc.cmake
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
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)
|
||||||
|
|
@ -5,67 +5,81 @@ Copyright (c) 2010 Perttu Ahola <celeron55@gmail.com>
|
|||||||
|
|
||||||
An InfiniMiner/Minecraft inspired game.
|
An InfiniMiner/Minecraft inspired game.
|
||||||
|
|
||||||
|
NOTE: This file is somewhat outdated most of the time.
|
||||||
|
|
||||||
This is a development version:
|
This is a development version:
|
||||||
- Don't expect it to work as well as a finished game will.
|
- Don't expect it to work as well as a finished game will.
|
||||||
- Please report any bugs to me. That way I can fix them to the next release.
|
- Please report any bugs to me. That way I can fix them to the next release.
|
||||||
- debug.txt is very useful when the game crashes.
|
- debug.txt is useful when the game crashes.
|
||||||
|
|
||||||
Public servers:
|
Public servers:
|
||||||
kray.dy.fi :30000 (friend's server - recommended)
|
kray.dy.fi :30000 (friend's server)
|
||||||
celeron.55.lt :30000 (my own server, kind of unused)
|
celeron.55.lt :30000 (my own server)
|
||||||
- If you want to run a server, I can list you on my website and in here.
|
|
||||||
|
|
||||||
Controls:
|
Controls:
|
||||||
- WASD+mouse: Move
|
- See the in-game pause menu
|
||||||
- Mouse L: Dig
|
|
||||||
- Mouse R: Place block
|
|
||||||
- Mouse Wheel: Change item
|
|
||||||
- F: Change item
|
|
||||||
- R: Toggle full view range
|
|
||||||
|
|
||||||
Configuration file:
|
Configuration file:
|
||||||
- An optional configuration file can be used. See minetest.conf.example.
|
- An optional configuration file can be used. See minetest.conf.example.
|
||||||
- Path to file can be passed as a parameter to the executable:
|
- Path to file can be passed as a parameter to the executable:
|
||||||
--config <path-to-file>
|
--config <path-to-file>
|
||||||
- If not given as a parameter, these are checked, in order:
|
- Defaults:
|
||||||
|
- If built with -DRUN_IN_PLACE:
|
||||||
../minetest.conf
|
../minetest.conf
|
||||||
|
../../minetest.conf
|
||||||
|
- Otherwise something like this:
|
||||||
|
Windows: C:\Documents and Settings\user\Application Data\minetest\minetest.conf
|
||||||
|
Linux: ~/.minetest/minetest.conf
|
||||||
|
OS X: ~/Library/Application Support/minetest.conf
|
||||||
|
|
||||||
Command-line options:
|
Command-line options:
|
||||||
- Use --help
|
- Use --help
|
||||||
|
|
||||||
Running on Windows:
|
|
||||||
- The working directory should be ./bin
|
|
||||||
|
|
||||||
Running on GNU/Linux:
|
|
||||||
- fasttest is a linux binary compiled on a recent Arch Linux installation.
|
|
||||||
It should run on most recent GNU/Linux distributions.
|
|
||||||
- Browse to the game ./bin directory and type:
|
|
||||||
LD_LIBRARY_PATH=. ./fasttest
|
|
||||||
- If it doesn't work, use wine. I aim at 100% compatibility with wine.
|
|
||||||
|
|
||||||
Compiling on GNU/Linux:
|
Compiling on GNU/Linux:
|
||||||
|
|
||||||
- You need:
|
- You need:
|
||||||
* Irrlicht:
|
* CMake
|
||||||
http://downloads.sourceforge.net/irrlicht/irrlicht-1.7.2.zip
|
* Irrlicht
|
||||||
* JThread:
|
* Zlib
|
||||||
http://research.edm.uhasselt.be/~jori/page/index.php?n=CS.Jthread
|
- You can probably find these in your distro's package manager
|
||||||
* zlib:
|
|
||||||
- Get the -dev package from your package manager.
|
- Check possible options:
|
||||||
- Irrlicht and JThread are very likely not to be found from your distro's
|
$ cd whatever/minetest
|
||||||
repository.
|
$ cmake . -LH
|
||||||
- Compiling each of them should be fairly unproblematic, though.
|
|
||||||
|
- A system-wide install:
|
||||||
|
$ cd whatever/minetest
|
||||||
|
$ cmake . -DCMAKE_INSTALL_PREFIX=/usr/local
|
||||||
|
$ make -j2
|
||||||
|
$ sudo make install
|
||||||
|
|
||||||
|
$ minetest
|
||||||
|
|
||||||
|
- For running in the source directory:
|
||||||
|
$ cd whatever/minetest
|
||||||
|
$ cmake . -DRUN_IN_PLACE
|
||||||
|
$ make -j2
|
||||||
|
|
||||||
|
$ ./bin/minetest
|
||||||
|
|
||||||
Compiling on Windows:
|
Compiling on Windows:
|
||||||
- You need Irrlicht, JThread and zlib, see above
|
- You need CMake, Irrlicht, zlib and Visual Studio or MinGW
|
||||||
- Be sure to
|
- NOTE: Probably it will not work easily and you will need to fix some stuff.
|
||||||
#define JMUTEX_CRITICALSECTION
|
- Steps:
|
||||||
in jmutex.h before compiling it. Otherwise mutexes will be very slow.
|
- Start up the CMake GUI
|
||||||
|
- Select your compiler
|
||||||
|
- Hit "Configure"
|
||||||
|
- Set up some options and paths
|
||||||
|
- Hit "Configure"
|
||||||
|
- Hit "Generate"
|
||||||
|
- VC: Open the generated .sln and build it
|
||||||
|
- MinGW: Browse to the build directory and run 'make'
|
||||||
|
|
||||||
License of Minetest-c55
|
License of Minetest-c55
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
Minetest-c55
|
Minetest-c55
|
||||||
Copyright (C) 2010 celeron55, Perttu Ahola <celeron55@gmail.com>
|
Copyright (C) 2010-2011 celeron55, Perttu Ahola <celeron55@gmail.com>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
# Server side stuff
|
# Server side stuff
|
||||||
|
|
||||||
|
#map-dir = /home/palle/custom_map
|
||||||
|
|
||||||
# - The possible generators are:
|
# - The possible generators are:
|
||||||
# (Indeed you can do all of them with only "power" 8))
|
# (Indeed you can do all of them with only "power" 8))
|
||||||
# H=value:
|
# H=value:
|
||||||
|
@ -1,19 +1,37 @@
|
|||||||
project(minetest)
|
project(minetest)
|
||||||
cmake_minimum_required( VERSION 2.6 )
|
cmake_minimum_required( VERSION 2.6 )
|
||||||
set ( CMAKE_BUILD_TYPE Debug )
|
|
||||||
add_definitions ( -Wall -DRUN_IN_PLACE -O2)
|
if(RUN_IN_PLACE)
|
||||||
find_package(ZLIB REQUIRED)
|
add_definitions ( -DRUN_IN_PLACE )
|
||||||
|
endif(RUN_IN_PLACE)
|
||||||
|
|
||||||
|
if(UNIX)
|
||||||
|
# Unix
|
||||||
|
if(BUILD_CLIENT)
|
||||||
find_package(X11 REQUIRED)
|
find_package(X11 REQUIRED)
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
find_package(JPEG REQUIRED)
|
find_package(JPEG REQUIRED)
|
||||||
find_package(BZip2 REQUIRED)
|
find_package(BZip2 REQUIRED)
|
||||||
|
endif(BUILD_CLIENT)
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
set(SERVER_PLATFORM_LIBS -lpthread)
|
||||||
|
elseif(WIN32)
|
||||||
|
# Windows
|
||||||
|
# Surpress some warnings
|
||||||
|
add_definitions ( /D "_CRT_SECURE_NO_DEPRECATE" /W1 )
|
||||||
|
# Zlib stuff
|
||||||
|
set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/../../zlib/zlib-1.2.5"
|
||||||
|
CACHE PATH "Zlib include directory")
|
||||||
|
set(ZLIB_LIBRARIES "${PROJECT_SOURCE_DIR}/../../zlib125dll/dll32/zlibwapi.lib"
|
||||||
|
CACHE PATH "Path to zlibwapi.lib")
|
||||||
|
set(ZLIB_DLL "${PROJECT_SOURCE_DIR}/../../zlib125dll/dll32/zlibwapi.dll"
|
||||||
|
CACHE PATH "Path to zlibwapi.dll (for installation)")
|
||||||
|
endif()
|
||||||
|
|
||||||
if( UNIX )
|
configure_file(
|
||||||
#set( platform_SRCS some_necessary_linux_file.cpp )
|
"${PROJECT_SOURCE_DIR}/config.h.in"
|
||||||
else( UNIX )
|
"${PROJECT_BINARY_DIR}/config.h"
|
||||||
#windows
|
)
|
||||||
#set( platform_SRCS dllmain.cpp stdafx.cpp )
|
|
||||||
endif( UNIX )
|
|
||||||
|
|
||||||
set(minetest_SRCS
|
set(minetest_SRCS
|
||||||
porting.cpp
|
porting.cpp
|
||||||
@ -48,16 +66,44 @@ set(minetest_SRCS
|
|||||||
test.cpp
|
test.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(minetestserver_SRCS
|
||||||
|
porting.cpp
|
||||||
|
materials.cpp
|
||||||
|
defaultsettings.cpp
|
||||||
|
mapnode.cpp
|
||||||
|
voxel.cpp
|
||||||
|
mapblockobject.cpp
|
||||||
|
inventory.cpp
|
||||||
|
debug.cpp
|
||||||
|
serialization.cpp
|
||||||
|
light.cpp
|
||||||
|
filesys.cpp
|
||||||
|
connection.cpp
|
||||||
|
environment.cpp
|
||||||
|
server.cpp
|
||||||
|
socket.cpp
|
||||||
|
mapblock.cpp
|
||||||
|
mapsector.cpp
|
||||||
|
heightmap.cpp
|
||||||
|
map.cpp
|
||||||
|
player.cpp
|
||||||
|
utility.cpp
|
||||||
|
servermain.cpp
|
||||||
|
test.cpp
|
||||||
|
)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${ZLIB_INCLUDE_DIR}
|
${PROJECT_BINARY_DIR}
|
||||||
${IRRLICHT_INCLUDE_DIR}
|
${IRRLICHT_INCLUDE_DIR}
|
||||||
|
${ZLIB_INCLUDE_DIR}
|
||||||
|
${CMAKE_BUILD_TYPE}
|
||||||
"${PROJECT_SOURCE_DIR}/jthread"
|
"${PROJECT_SOURCE_DIR}/jthread"
|
||||||
)
|
)
|
||||||
|
|
||||||
set(EXECUTABLE_OUTPUT_PATH ../bin)
|
set(EXECUTABLE_OUTPUT_PATH ../bin)
|
||||||
|
|
||||||
|
if(BUILD_CLIENT)
|
||||||
add_executable(minetest ${minetest_SRCS})
|
add_executable(minetest ${minetest_SRCS})
|
||||||
|
|
||||||
target_link_libraries(
|
target_link_libraries(
|
||||||
minetest
|
minetest
|
||||||
${ZLIB_LIBRARIES}
|
${ZLIB_LIBRARIES}
|
||||||
@ -67,7 +113,88 @@ target_link_libraries(
|
|||||||
${BZIP2_LIBRARIES}
|
${BZIP2_LIBRARIES}
|
||||||
jthread
|
jthread
|
||||||
)
|
)
|
||||||
|
endif(BUILD_CLIENT)
|
||||||
|
if(BUILD_SERVER)
|
||||||
|
add_executable(minetestserver ${minetestserver_SRCS})
|
||||||
|
target_link_libraries(
|
||||||
|
minetestserver
|
||||||
|
${ZLIB_LIBRARIES}
|
||||||
|
jthread
|
||||||
|
${SERVER_PLATFORM_LIBS}
|
||||||
|
)
|
||||||
|
endif(BUILD_SERVER)
|
||||||
|
|
||||||
|
# Set some optimizations and tweaks
|
||||||
|
if( UNIX )
|
||||||
|
# Unix
|
||||||
|
|
||||||
|
set(UNIX_FLAGS "-Wall")
|
||||||
|
|
||||||
|
if(BUILD_CLIENT)
|
||||||
|
set_target_properties(minetest PROPERTIES COMPILE_FLAGS
|
||||||
|
"${UNIX_FLAGS}")
|
||||||
|
endif(BUILD_CLIENT)
|
||||||
|
|
||||||
|
if(BUILD_SERVER)
|
||||||
|
set_target_properties(minetestserver PROPERTIES COMPILE_FLAGS
|
||||||
|
"${UNIX_FLAGS} -DSERVER")
|
||||||
|
endif(BUILD_SERVER)
|
||||||
|
|
||||||
|
else( UNIX )
|
||||||
|
# Windows
|
||||||
|
|
||||||
|
if(BUILD_CLIENT)
|
||||||
|
# EHa enables SEH exceptions (used for catching segfaults)
|
||||||
|
set_target_properties(minetest PROPERTIES COMPILE_FLAGS
|
||||||
|
"/O2 /Ob2 /Oi /Ot /Oy /GL /EHa")
|
||||||
|
endif(BUILD_CLIENT)
|
||||||
|
|
||||||
|
if(BUILD_SERVER)
|
||||||
|
# EHa enables SEH exceptions (used for catching segfaults)
|
||||||
|
set_target_properties(minetestserver PROPERTIES COMPILE_FLAGS
|
||||||
|
"/O2 /Ob2 /Oi /Ot /Oy /GL /EHa /D SERVER")
|
||||||
|
endif(BUILD_SERVER)
|
||||||
|
|
||||||
|
endif( UNIX )
|
||||||
|
|
||||||
|
#
|
||||||
|
# Installation
|
||||||
|
#
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(DATADIR "data")
|
||||||
|
set(BINDIR "bin")
|
||||||
|
elseif(APPLE)
|
||||||
|
set(DATADIR "share/minetest")
|
||||||
|
set(BINDIR "bin")
|
||||||
|
elseif(UNIX)
|
||||||
|
set(DATADIR "share/minetest")
|
||||||
|
set(BINDIR "bin")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_CLIENT)
|
||||||
|
install(TARGETS minetest DESTINATION ${BINDIR})
|
||||||
|
|
||||||
|
file(GLOB images "${CMAKE_CURRENT_SOURCE_DIR}/../data/*.png")
|
||||||
|
|
||||||
|
install(FILES ${images} DESTINATION ${DATADIR})
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
if(DEFINED IRRLICHT_DLL)
|
||||||
|
install(FILES ${IRRLICHT_DLL} DESTINATION ${BINDIR})
|
||||||
|
endif()
|
||||||
|
if(DEFINED ZLIB_DLL)
|
||||||
|
install(FILES ${ZLIB_DLL} DESTINATION ${BINDIR})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif(BUILD_CLIENT)
|
||||||
|
|
||||||
|
if(BUILD_SERVER)
|
||||||
|
install(TARGETS minetestserver DESTINATION ${BINDIR})
|
||||||
|
endif(BUILD_SERVER)
|
||||||
|
|
||||||
|
# Subdirectories
|
||||||
|
|
||||||
add_subdirectory(jthread)
|
add_subdirectory(jthread)
|
||||||
|
|
||||||
#END
|
#end
|
||||||
|
20
src/main.cpp
20
src/main.cpp
@ -212,7 +212,7 @@ Doing now:
|
|||||||
*/
|
*/
|
||||||
#define FIELD_OF_VIEW_TEST 0
|
#define FIELD_OF_VIEW_TEST 0
|
||||||
|
|
||||||
#ifdef UNITTEST_DISABLE
|
#ifdef NDEBUG
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#pragma message ("Disabling unit tests")
|
#pragma message ("Disabling unit tests")
|
||||||
#else
|
#else
|
||||||
@ -259,6 +259,7 @@ Doing now:
|
|||||||
#include "materials.h"
|
#include "materials.h"
|
||||||
#include "guiMessageMenu.h"
|
#include "guiMessageMenu.h"
|
||||||
#include "filesys.h"
|
#include "filesys.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
IrrlichtWrapper *g_irrlicht;
|
IrrlichtWrapper *g_irrlicht;
|
||||||
|
|
||||||
@ -1110,6 +1111,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
BEGIN_DEBUG_EXCEPTION_HANDLER
|
BEGIN_DEBUG_EXCEPTION_HANDLER
|
||||||
|
|
||||||
|
// Print startup message
|
||||||
|
dstream<<DTIME<<"minetest-c55"
|
||||||
|
" with SER_FMT_VER_HIGHEST="<<(int)SER_FMT_VER_HIGHEST
|
||||||
|
<<", "<<BUILD_INFO
|
||||||
|
<<std::endl;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -1170,12 +1177,6 @@ int main(int argc, char *argv[])
|
|||||||
// Initialize default settings
|
// Initialize default settings
|
||||||
set_default_settings();
|
set_default_settings();
|
||||||
|
|
||||||
// Print startup message
|
|
||||||
dstream<<DTIME<<"minetest-c55"
|
|
||||||
" with SER_FMT_VER_HIGHEST="<<(int)SER_FMT_VER_HIGHEST
|
|
||||||
<<", ENABLE_TESTS="<<ENABLE_TESTS
|
|
||||||
<<std::endl;
|
|
||||||
|
|
||||||
// Set locale. This is for forcing '.' as the decimal point.
|
// Set locale. This is for forcing '.' as the decimal point.
|
||||||
std::locale::global(std::locale("C"));
|
std::locale::global(std::locale("C"));
|
||||||
// This enables printing all characters in bitmap font
|
// This enables printing all characters in bitmap font
|
||||||
@ -1211,6 +1212,9 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
core::array<std::string> filenames;
|
core::array<std::string> filenames;
|
||||||
filenames.push_back(porting::path_userdata + "/minetest.conf");
|
filenames.push_back(porting::path_userdata + "/minetest.conf");
|
||||||
|
#ifdef RUN_IN_PLACE
|
||||||
|
filenames.push_back(porting::path_userdata + "/../minetest.conf");
|
||||||
|
#endif
|
||||||
|
|
||||||
for(u32 i=0; i<filenames.size(); i++)
|
for(u32 i=0; i<filenames.size(); i++)
|
||||||
{
|
{
|
||||||
@ -1282,6 +1286,8 @@ int main(int argc, char *argv[])
|
|||||||
std::string map_dir = porting::path_userdata+"/map";
|
std::string map_dir = porting::path_userdata+"/map";
|
||||||
if(cmd_args.exists("map-dir"))
|
if(cmd_args.exists("map-dir"))
|
||||||
map_dir = cmd_args.get("map-dir");
|
map_dir = cmd_args.get("map-dir");
|
||||||
|
else if(g_settings.exists("map-dir"))
|
||||||
|
map_dir = g_settings.get("map-dir");
|
||||||
|
|
||||||
if(cmd_args.getFlag("server"))
|
if(cmd_args.getFlag("server"))
|
||||||
{
|
{
|
||||||
|
@ -24,6 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "porting.h"
|
#include "porting.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
namespace porting
|
namespace porting
|
||||||
{
|
{
|
||||||
@ -103,7 +104,9 @@ void initializePaths()
|
|||||||
path_userdata = std::string("../");
|
path_userdata = std::string("../");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
|
#else // RUN_IN_PLACE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Use platform-specific paths otherwise
|
Use platform-specific paths otherwise
|
||||||
*/
|
*/
|
||||||
@ -127,6 +130,7 @@ void initializePaths()
|
|||||||
|
|
||||||
// Use "./bin/../data"
|
// Use "./bin/../data"
|
||||||
path_data = std::string(buf) + "/../data";
|
path_data = std::string(buf) + "/../data";
|
||||||
|
//path_data = std::string(buf) + "/../share/" + APPNAME;
|
||||||
|
|
||||||
// Use "C:\Documents and Settings\user\Application Data\<APPNAME>"
|
// Use "C:\Documents and Settings\user\Application Data\<APPNAME>"
|
||||||
len = GetEnvironmentVariable("APPDATA", buf, buflen);
|
len = GetEnvironmentVariable("APPDATA", buf, buflen);
|
||||||
@ -137,20 +141,23 @@ void initializePaths()
|
|||||||
Linux
|
Linux
|
||||||
*/
|
*/
|
||||||
#elif defined(linux)
|
#elif defined(linux)
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
path_userdata = std::string("~/.") + APPNAME;
|
path_userdata = std::string(getenv("HOME")) + "/." + APPNAME;
|
||||||
path_data = std::string("/usr/share/") + APPNAME;
|
path_data = std::string(INSTALL_PREFIX) + "/share/" + APPNAME;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
OS X
|
OS X
|
||||||
*/
|
*/
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
path_userdata = std::string("~/Library/Application Support/") + APPNAME;
|
path_userdata = std::string(getenv("HOME")) + "/Library/Application Support/" + APPNAME;
|
||||||
path_data = std::string("minetest-mac.app/Contents/Resources/data/");
|
path_data = std::string("minetest-mac.app/Contents/Resources/data/");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
#endif // RUN_IN_PLACE
|
||||||
|
|
||||||
dstream<<"path_data = "<<path_data<<std::endl;
|
dstream<<"path_data = "<<path_data<<std::endl;
|
||||||
dstream<<"path_userdata = "<<path_userdata<<std::endl;
|
dstream<<"path_userdata = "<<path_userdata<<std::endl;
|
||||||
|
@ -25,12 +25,13 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
#ifndef SERVER
|
#ifndef SERVER
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
#pragma error ("For a server build, SERVER must be defined globally")
|
||||||
#else
|
#else
|
||||||
#error "For a server build, SERVER must be defined globally"
|
#error "For a server build, SERVER must be defined globally"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef UNITTEST_DISABLE
|
#ifdef NDEBUG
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#pragma message ("Disabling unit tests")
|
#pragma message ("Disabling unit tests")
|
||||||
#else
|
#else
|
||||||
@ -66,6 +67,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
#include "strfnd.h"
|
#include "strfnd.h"
|
||||||
#include "porting.h"
|
#include "porting.h"
|
||||||
#include "materials.h"
|
#include "materials.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Settings.
|
Settings.
|
||||||
@ -129,6 +131,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
BEGIN_DEBUG_EXCEPTION_HANDLER
|
BEGIN_DEBUG_EXCEPTION_HANDLER
|
||||||
|
|
||||||
|
// Print startup message
|
||||||
|
dstream<<DTIME<<"minetest-c55"
|
||||||
|
" with SER_FMT_VER_HIGHEST="<<(int)SER_FMT_VER_HIGHEST
|
||||||
|
<<", "<<BUILD_INFO
|
||||||
|
<<std::endl;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -185,12 +193,6 @@ int main(int argc, char *argv[])
|
|||||||
// Initialize default settings
|
// Initialize default settings
|
||||||
set_default_settings();
|
set_default_settings();
|
||||||
|
|
||||||
// Print startup message
|
|
||||||
dstream<<DTIME<<"minetest-c55 server"
|
|
||||||
" with SER_FMT_VER_HIGHEST="<<(int)SER_FMT_VER_HIGHEST
|
|
||||||
<<", ENABLE_TESTS="<<ENABLE_TESTS
|
|
||||||
<<std::endl;
|
|
||||||
|
|
||||||
// Set locale. This is for forcing '.' as the decimal point.
|
// Set locale. This is for forcing '.' as the decimal point.
|
||||||
std::locale::global(std::locale("C"));
|
std::locale::global(std::locale("C"));
|
||||||
// This enables printing all characters in bitmap font
|
// This enables printing all characters in bitmap font
|
||||||
@ -226,6 +228,9 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
core::array<std::string> filenames;
|
core::array<std::string> filenames;
|
||||||
filenames.push_back(porting::path_userdata + "/minetest.conf");
|
filenames.push_back(porting::path_userdata + "/minetest.conf");
|
||||||
|
#ifdef RUN_IN_PLACE
|
||||||
|
filenames.push_back(porting::path_userdata + "/../minetest.conf");
|
||||||
|
#endif
|
||||||
|
|
||||||
for(u32 i=0; i<filenames.size(); i++)
|
for(u32 i=0; i<filenames.size(); i++)
|
||||||
{
|
{
|
||||||
@ -308,6 +313,8 @@ int main(int argc, char *argv[])
|
|||||||
std::string map_dir = porting::path_userdata+"/map";
|
std::string map_dir = porting::path_userdata+"/map";
|
||||||
if(cmd_args.exists("map-dir"))
|
if(cmd_args.exists("map-dir"))
|
||||||
map_dir = cmd_args.get("map-dir");
|
map_dir = cmd_args.get("map-dir");
|
||||||
|
else if(g_settings.exists("map-dir"))
|
||||||
|
map_dir = g_settings.get("map-dir");
|
||||||
|
|
||||||
Server server(map_dir.c_str(), hm_params, map_params);
|
Server server(map_dir.c_str(), hm_params, map_params);
|
||||||
server.start(port);
|
server.start(port);
|
||||||
|
Loading…
Reference in New Issue
Block a user