set(VERSION_MAJOR 0)
set(VERSION_MINOR 0)
set(VERSION_PATCH 1)
+set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
-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
+# Configuration options
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}")
+set(WARN_ALL 1 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)
install(FILES bin/minetestserver.exe DESTINATION bin)
endif()
- set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${BUILD_DATE}-win32")
+ set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
set(CPACK_GENERATOR ZIP)
elseif(APPLE)
# TODO
# see http://cmake.org/Wiki/CMake:CPackPackageGenerators#Bundle_.28OSX_only.29
- set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${BUILD_DATE}-osx")
+ # this too http://0xfe.blogspot.com/2006/03/how-os-x-executes-applications.html
+ #
+ set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-osx")
set(CPACK_PACKAGE_ICON "")
set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
set(CPACK_BUNDLE_ICON "")
set(CPACK_BUNDLE_STARTUP_COMMAND "Contents/MacOS/minetest")
set(CPACK_GENERATOR BUNDLE)
else()
- set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${BUILD_DATE}-linux")
+ set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-linux")
set(CPACK_GENERATOR TGZ)
set(CPACK_SOURCE_GENERATOR TGZ)
endif()
+#
+# Random macros
+#
+
+# Not used ATM
+
MACRO (GETDATETIME RESULT)
IF (WIN32)
EXECUTE_PROCESS(COMMAND "cmd" /C echo %date% %time% OUTPUT_VARIABLE ${RESULT})
ENDIF (WIN32)
string(REGEX REPLACE " " "_" ${RESULT} "${${RESULT}}")
-
ENDMACRO (GETDATETIME)
* CMake
* Irrlicht
* Zlib
- - You can probably find these in your distro's package manager
+- You can probably find these in your distro's package repository.
+- Building has been tested to work flawlessly on many systems.
- Check possible options:
$ cd whatever/minetest
$ ./bin/minetest
Compiling on Windows:
-- You need CMake, Irrlicht, zlib and Visual Studio or MinGW
+- You need CMake, Irrlicht, Zlib and Visual Studio or MinGW
- NOTE: Probably it will not work easily and you will need to fix some stuff.
- Steps:
- Start up the CMake GUI
)
endif(BUILD_SERVER)
+#
# Set some optimizations and tweaks
-if( UNIX )
- # Unix
-
- # NOTE: -Wall gets applied automatically to debug builds
-
- #set(UNIX_FLAGS "")
+#
- if(BUILD_CLIENT)
- set_target_properties(minetest PROPERTIES COMPILE_FLAGS
- "${UNIX_FLAGS}")
- endif(BUILD_CLIENT)
+if(MSVC)
+ # Visual Studio
+ # EHa enables SEH exceptions (used for catching segfaults)
+ set(CMAKE_CXX_FLAGS_RELEASE "/EHa /MD /O2 /Ob2 /Oi /Ot /Oy /GL /FD /MT /GS- /arch:SSE /fp:fast")
+ set(CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1")
+
if(BUILD_SERVER)
- set_target_properties(minetestserver PROPERTIES COMPILE_FLAGS
- "${UNIX_FLAGS} -DSERVER")
+ set_target_properties(minetestserver PROPERTIES
+ COMPILE_FLAGS "/D SERVER")
endif(BUILD_SERVER)
-else( UNIX )
- # Windows
+else()
+ # Probably GCC
- 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(WARN_ALL)
+ set(WARNING_FLAGS "-Wall")
+ else()
+ set(WARNING_FLAGS "")
+ endif()
+ set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG ${WARNING_FLAGS} -O3 -ffast-math -Wall -fomit-frame-pointer -pipe -funroll-loops")
+ set(CMAKE_CXX_FLAGS_DEBUG "-g -O1 -Wall")
+
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")
+ set_target_properties(minetestserver PROPERTIES
+ COMPILE_FLAGS "-DSERVER")
endif(BUILD_SERVER)
-endif( UNIX )
+endif()
+
+#MESSAGE(STATUS "CMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE}")
+#MESSAGE(STATUS "CMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG}")
#
# Installation
#define CONFIG_H
#define INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@"
-#define VERSION_STRING "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_PATCH@"
-#define BUILD_INFO "VER="VERSION_STRING" BUILD_DATE=@BUILD_DATE@ RUN_IN_PLACE=@RUN_IN_PLACE@ INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@"
+#define VERSION_STRING "@VERSION_STRING@"
+#ifdef NDEBUG
+ #define BUILD_TYPE "Release"
+#else
+ #define BUILD_TYPE "Debug"
+#endif
+#define BUILD_INFO "VER="VERSION_STRING" BUILD_DATE=@BUILD_DATE@ RUN_IN_PLACE=@RUN_IN_PLACE@ INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@ BUILD_TYPE="BUILD_TYPE
#endif
#include "debug.h"\r
#include "serialization.h"\r
#include "porting.h"\r
+#include "config.h"\r
\r
GUIPauseMenu::GUIPauseMenu(gui::IGUIEnvironment* env,\r
gui::IGUIElement* parent, s32 id,\r
L"Minetest-c55\n"\r
L"by Perttu Ahola\n"\r
L"celeron55@gmail.com\n\n"\r
- L"SER_FMT_VER_HIGHEST=%i\n"\r
- L"userdata path = \n"\r
+ SWPRINTF_CHARSTRING L"\n"\r
+ L"userdata path = "\r
SWPRINTF_CHARSTRING\r
,\r
- (int)SER_FMT_VER_HIGHEST,\r
+ BUILD_INFO,\r
porting::path_userdata.c_str()\r
);\r
\r