From 3ef2629e847e1e7e239068bbf17bebd6d4ebfc95 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 18 Jan 2011 15:05:29 +0200 Subject: 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 --- src/CMakeLists.txt | 9 ++++++--- src/cmake_config.h.in | 16 ++++++++++++++++ src/config.h | 28 ++++++++++++++++++++++++++++ src/config.h.in | 16 ---------------- src/main.cpp | 2 ++ 5 files changed, 52 insertions(+), 19 deletions(-) create mode 100644 src/cmake_config.h.in create mode 100644 src/config.h delete mode 100644 src/config.h.in (limited to 'src') 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/cmake_config.h.in b/src/cmake_config.h.in new file mode 100644 index 000000000..8635b4f28 --- /dev/null +++ b/src/cmake_config.h.in @@ -0,0 +1,16 @@ +// Filled in by the build system + +#ifndef CMAKE_CONFIG_H +#define CMAKE_CONFIG_H + +#define 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 + 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/config.h.in b/src/config.h.in deleted file mode 100644 index 42deb4bc5..000000000 --- a/src/config.h.in +++ /dev/null @@ -1,16 +0,0 @@ -// Filled in by the build system - -#ifndef CONFIG_H -#define CONFIG_H - -#define 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 - 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 -- cgit v1.2.3