From 3ef2629e847e1e7e239068bbf17bebd6d4ebfc95 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 18 Jan 2011 15:05:29 +0200 Subject: [PATCH] made old build system to work too. the cmake one doesn't make working binaries for some computers. --HG-- rename : src/config.h.in => src/cmake_config.h.in --- doc/README.txt | 3 +++ makepackage_binary.sh | 11 ++++------ minetest.vcproj | 2 +- src/CMakeLists.txt | 9 ++++++--- src/{config.h.in => cmake_config.h.in} | 4 ++-- src/config.h | 28 ++++++++++++++++++++++++++ src/main.cpp | 2 ++ 7 files changed, 46 insertions(+), 13 deletions(-) rename src/{config.h.in => cmake_config.h.in} (89%) create mode 100644 src/config.h diff --git a/doc/README.txt b/doc/README.txt index 93203b3db..5a8ce7203 100644 --- a/doc/README.txt +++ b/doc/README.txt @@ -82,6 +82,9 @@ Compiling on GNU/Linux: $ ./bin/minetest Compiling on Windows: +- NOTE: Seems that the CMake build system produces executables that don't work + for many people. The old build system is still included, but it's not + documented in here. - 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: diff --git a/makepackage_binary.sh b/makepackage_binary.sh index 8474ba52d..72dc9a3f7 100755 --- a/makepackage_binary.sh +++ b/makepackage_binary.sh @@ -15,10 +15,10 @@ cp bin/minetest.exe $PACKAGEPATH/bin/ cp bin/Irrlicht.dll $PACKAGEPATH/bin/ cp bin/zlibwapi.dll $PACKAGEPATH/bin/ #cp bin/test $PACKAGEPATH/bin/ -cp bin/fasttest $PACKAGEPATH/bin/ -cp bin/server $PACKAGEPATH/bin/ -cp ../irrlicht/irrlicht-1.7.1/lib/Linux/libIrrlicht.a $PACKAGEPATH/bin/ -cp ../jthread/jthread-1.2.1/src/.libs/libjthread-1.2.1.so $PACKAGEPATH/bin/ +#cp bin/fasttest $PACKAGEPATH/bin/ +#cp bin/server $PACKAGEPATH/bin/ +#cp ../irrlicht/irrlicht-1.7.1/lib/Linux/libIrrlicht.a $PACKAGEPATH/bin/ +#cp ../jthread/jthread-1.2.1/src/.libs/libjthread-1.2.1.so $PACKAGEPATH/bin/ cp -r data/fontlucida.png $PACKAGEPATH/data/ cp -r data/player.png $PACKAGEPATH/data/ @@ -38,9 +38,6 @@ cp -r data/mud.png $PACKAGEPATH/data/ cp -r data/torch.png $PACKAGEPATH/data/ cp -r data/torch_on_floor.png $PACKAGEPATH/data/ cp -r data/torch_on_ceiling.png $PACKAGEPATH/data/ -cp -r data/skybox1.png $PACKAGEPATH/data/ -cp -r data/skybox2.png $PACKAGEPATH/data/ -cp -r data/skybox3.png $PACKAGEPATH/data/ cp -r data/tree_top.png $PACKAGEPATH/data/ cp -r data/mud_with_grass.png $PACKAGEPATH/data/ cp -r data/coalstone.png $PACKAGEPATH/data/ diff --git a/minetest.vcproj b/minetest.vcproj index a4e6cf9fd..c8961ff6e 100644 --- a/minetest.vcproj +++ b/minetest.vcproj @@ -118,7 +118,7 @@ OmitFramePointers="true" WholeProgramOptimization="true" AdditionalIncludeDirectories=""C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include";"..\jthread\jthread-1.2.1\src";"..\irrlicht\irrlicht-1.7.1\include";"..\zlib\zlib-1.2.5"" - PreprocessorDefinitions="WIN32;_HAS_ITERATOR_DEBUGGING=0;UNITTEST_DISABLE;_CRT_SECURE_NO_DEPRECATE;RUN_IN_PLACE" + PreprocessorDefinitions="WIN32;_HAS_ITERATOR_DEBUGGING=0;NDEBUG;_CRT_SECURE_NO_DEPRECATE;RUN_IN_PLACE" ExceptionHandling="2" BufferSecurityCheck="false" EnableEnhancedInstructionSet="1" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c55b238e1..a9e3f2788 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,6 +5,9 @@ if(RUN_IN_PLACE) add_definitions ( -DRUN_IN_PLACE ) endif(RUN_IN_PLACE) +# Use cmake_config.h +add_definitions ( -DUSE_CMAKE_CONFIG_H ) + if(WIN32) # Windows # Surpress some warnings @@ -31,8 +34,8 @@ else() endif() configure_file( - "${PROJECT_SOURCE_DIR}/config.h.in" - "${PROJECT_BINARY_DIR}/config.h" + "${PROJECT_SOURCE_DIR}/cmake_config.h.in" + "${PROJECT_BINARY_DIR}/cmake_config.h" ) set(minetest_SRCS @@ -140,7 +143,7 @@ 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_RELEASE "/EHa /MD /O2 /Ob2 /Oi /Ot /Oy /GL /FD /MT /GS- /arch:SSE /fp:fast /D NDEBUG") set(CMAKE_CXX_FLAGS_DEBUG "/MDd /Zi /Ob0 /Od /RTC1") if(BUILD_SERVER) diff --git a/src/config.h.in b/src/cmake_config.h.in similarity index 89% rename from src/config.h.in rename to src/cmake_config.h.in index 42deb4bc5..8635b4f28 100644 --- a/src/config.h.in +++ b/src/cmake_config.h.in @@ -1,7 +1,7 @@ // Filled in by the build system -#ifndef CONFIG_H -#define CONFIG_H +#ifndef CMAKE_CONFIG_H +#define CMAKE_CONFIG_H #define INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" #define VERSION_STRING "@VERSION_STRING@" diff --git a/src/config.h b/src/config.h new file mode 100644 index 000000000..b24cf6a69 --- /dev/null +++ b/src/config.h @@ -0,0 +1,28 @@ +/* + If CMake is used, includes the cmake-generated cmake_config.h. + Otherwise use default values +*/ + +#ifndef CONFIG_H +#define CONFIG_H + +#ifdef USE_CMAKE_CONFIG_H + #include "cmake_config.h" +#else + //#define INSTALL_PREFIX "" + #define VERSION_STRING "unknown" + #ifdef NDEBUG + #define BUILD_TYPE "Release" + #else + #define BUILD_TYPE "Debug" + #endif + #ifdef RUN_IN_PLACE + #define RUN_IN_PLACE_BOOLSTRING "1" + #else + #define RUN_IN_PLACE_BOOLSTRING "0" + #endif + #define BUILD_INFO "NON-CMAKE RUN_IN_PLACE="RUN_IN_PLACE_BOOLSTRING" BUILD_TYPE="BUILD_TYPE +#endif + +#endif + diff --git a/src/main.cpp b/src/main.cpp index 69c6dfd67..08a48d6dd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -151,6 +151,8 @@ TODO: Untie client network operations from framerate - Needs some input queues or something - Not really necessary? +TODO: Make morning and evening shorter + Server: TODO: When player dies, throw items on map