Mainly small build system fixes

This commit is contained in:
Perttu Ahola 2011-01-09 00:49:32 +02:00
parent eb476f1ce2
commit 359e575ba3
6 changed files with 64 additions and 47 deletions

@ -10,25 +10,25 @@ project(minetest)
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)
@ -78,7 +78,7 @@ if(WIN32)
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)
@ -87,7 +87,9 @@ if(WIN32)
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 "")
@ -95,7 +97,7 @@ elseif(APPLE)
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()

@ -1,3 +1,9 @@
#
# Random macros
#
# Not used ATM
MACRO (GETDATETIME RESULT)
IF (WIN32)
EXECUTE_PROCESS(COMMAND "cmd" /C echo %date% %time% OUTPUT_VARIABLE ${RESULT})
@ -11,6 +17,5 @@ MACRO (GETDATETIME RESULT)
ENDIF (WIN32)
string(REGEX REPLACE " " "_" ${RESULT} "${${RESULT}}")
ENDMACRO (GETDATETIME)

@ -51,7 +51,8 @@ Compiling on GNU/Linux:
* 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
@ -81,7 +82,7 @@ Compiling on GNU/Linux:
$ ./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

@ -131,40 +131,43 @@ if(BUILD_SERVER)
)
endif(BUILD_SERVER)
#
# Set some optimizations and tweaks
if( UNIX )
# Unix
#
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")
# 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(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

@ -4,8 +4,13 @@
#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

@ -21,6 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "debug.h"
#include "serialization.h"
#include "porting.h"
#include "config.h"
GUIPauseMenu::GUIPauseMenu(gui::IGUIEnvironment* env,
gui::IGUIElement* parent, s32 id,
@ -127,11 +128,11 @@ void GUIPauseMenu::regenerateGui(v2u32 screensize)
L"Minetest-c55\n"
L"by Perttu Ahola\n"
L"celeron55@gmail.com\n\n"
L"SER_FMT_VER_HIGHEST=%i\n"
L"userdata path = \n"
SWPRINTF_CHARSTRING L"\n"
L"userdata path = "
SWPRINTF_CHARSTRING
,
(int)SER_FMT_VER_HIGHEST,
BUILD_INFO,
porting::path_userdata.c_str()
);