From eb476f1ce2c559136f8e7d652ebe3084a6ba8dc2 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 8 Jan 2011 19:35:14 +0200 Subject: [PATCH] Lots of small stuff --- CMakeLists.txt | 17 ++++++++++++----- src/CMakeLists.txt | 4 +++- src/config.h.in | 3 ++- src/debug.h | 4 ++-- src/map.cpp | 2 +- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ea10268a..a9d0f469b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,10 @@ endif(${CMAKE_VERSION} STREQUAL "2.8.2") # This can be read from ${PROJECT_NAME} after project() is called project(minetest) +set(VERSION_MAJOR 0) +set(VERSION_MINOR 0) +set(VERSION_PATCH 1) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") include(${CMAKE_SOURCE_DIR}/cmake/Modules/misc.cmake) @@ -52,6 +56,7 @@ install(FILES "minetest.conf.example" DESTINATION "${DOCDIR}") # # Subdirectories +# Be sure to add all relevant definitions above this # add_subdirectory(src) @@ -59,11 +64,10 @@ add_subdirectory(src) # 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_VERSION_MAJOR ${VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) set(CPACK_PACKAGE_VENDOR "celeron55") -set(CPACK_PACKAGE_FILE_NAME "minetest-${BUILD_DATE}") if(WIN32) # For some reason these aren't copied otherwise @@ -74,6 +78,8 @@ if(WIN32) install(FILES bin/minetestserver.exe DESTINATION bin) endif() + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${BUILD_DATE}-win32") + set(CPACK_GENERATOR ZIP) # This might be needed for some installer @@ -81,7 +87,7 @@ if(WIN32) elseif(APPLE) # TODO # see http://cmake.org/Wiki/CMake:CPackPackageGenerators#Bundle_.28OSX_only.29 - set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}) + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${BUILD_DATE}-osx") set(CPACK_PACKAGE_ICON "") set(CPACK_BUNDLE_NAME ${PROJECT_NAME}) set(CPACK_BUNDLE_ICON "") @@ -89,6 +95,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_GENERATOR TGZ) set(CPACK_SOURCE_GENERATOR TGZ) endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f5c3ed93b..fea1f2644 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -135,7 +135,9 @@ endif(BUILD_SERVER) if( UNIX ) # Unix - set(UNIX_FLAGS "-Wall") + # NOTE: -Wall gets applied automatically to debug builds + + #set(UNIX_FLAGS "") if(BUILD_CLIENT) set_target_properties(minetest PROPERTIES COMPILE_FLAGS diff --git a/src/config.h.in b/src/config.h.in index 8ac690874..9f65386c2 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -4,7 +4,8 @@ #define CONFIG_H #define INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@" -#define BUILD_INFO "BUILD_DATE=@BUILD_DATE@ RUN_IN_PLACE=@RUN_IN_PLACE@ 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@" #endif diff --git a/src/debug.h b/src/debug.h index 8faa65eb8..1973bb510 100644 --- a/src/debug.h +++ b/src/debug.h @@ -76,7 +76,7 @@ public: if(g_debugstreams[i] == stderr && m_disable_stderr) continue; if(g_debugstreams[i] != NULL) - fwrite(&c, 1, 1, g_debugstreams[i]); + (void)fwrite(&c, 1, 1, g_debugstreams[i]); //TODO: Is this slow? fflush(g_debugstreams[i]); } @@ -90,7 +90,7 @@ public: if(g_debugstreams[i] == stderr && m_disable_stderr) continue; if(g_debugstreams[i] != NULL) - fwrite(s, 1, n, g_debugstreams[i]); + (void)fwrite(s, 1, n, g_debugstreams[i]); //TODO: Is this slow? fflush(g_debugstreams[i]); } diff --git a/src/map.cpp b/src/map.cpp index 4780bf4ec..f5e490ad4 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1804,7 +1804,7 @@ continue_generating: /* Don't always generate dungeon */ - if(found_existing || rand() % 3 == 0) + if(found_existing || rand() % 2 == 0) { /* Generate some tunnel starting from orp and ors -- 2.25.1