Update CMakeLists (based on Minetest's version) and README.md

now it can handle VERSION_EXTRA and some other Minetest CMake options
This commit is contained in:
Mikita Wiśniewski 2022-10-09 17:31:01 +07:00
parent 17e627e8ea
commit 094bfc7957
2 changed files with 108 additions and 64 deletions

View File

@ -1,41 +1,58 @@
cmake_minimum_required(VERSION 2.6)
if(${CMAKE_VERSION} STREQUAL "2.8.2")
# bug http://vtk.org/Bug/view.php?id=11020
message( WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!")
endif(${CMAKE_VERSION} STREQUAL "2.8.2")
cmake_minimum_required(VERSION 3.5)
# Set policies up to 3.9 since we want to enable the IPO option
if(${CMAKE_VERSION} VERSION_LESS 3.9)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.9)
endif()
# This can be read from ${PROJECT_NAME} after project() is called
project(voxelands)
set(PROJECT_NAME_CAPITALIZED "Voxelands")
# Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
set(VERSION_MAJOR 1709)
set(VERSION_MAJOR 2210)
set(VERSION_MINOR 00)
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
# Change to false for releases
set(DEVELOPMENT_BUILD TRUE)
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}")
if(VERSION_EXTRA)
set(VERSION_STRING "${VERSION_STRING}-${VERSION_EXTRA}")
elseif(DEVELOPMENT_BUILD)
set(VERSION_STRING "${VERSION_STRING}-dev")
endif()
if (CMAKE_BUILD_TYPE STREQUAL Debug)
# Append "-debug" to version string
set(VERSION_STRING "${VERSION_STRING}-debug")
endif()
MESSAGE(STATUS "*** Will build version ${VERSION_STRING} ***")
# Configuration options
set(DEFAULT_RUN_IN_PLACE FALSE)
if(WIN32)
set(RUN_IN_PLACE 1 CACHE BOOL "Run directly in source directory structure")
else()
set(RUN_IN_PLACE 0 CACHE BOOL "Run directly in source directory structure")
set(DEFAULT_RUN_IN_PLACE TRUE)
endif()
set(RUN_IN_PLACE ${DEFAULT_RUN_IN_PLACE} CACHE BOOL
"Run directly in source directory structure")
set(BUILD_CLIENT 1 CACHE BOOL "Build client")
if(WIN32)
set(BUILD_SERVER 0 CACHE BOOL "Build server")
else()
set(BUILD_SERVER 1 CACHE BOOL "Build server")
endif()
set(BUILD_CLIENT TRUE CACHE BOOL "Build client")
set(BUILD_SERVER FALSE CACHE BOOL "Build server")
# set(BUILD_UNITTESTS TRUE CACHE BOOL "Build unittests")
# set(BUILD_BENCHMARKS FALSE CACHE BOOL "Build benchmarks")
# conf options for building fresh voxelands.icns from voxelands.svg if a new icon is made.
set(REBUILD_ICNS 0 CACHE BOOL "Rebuild icns from voxelands.svg .")
set(REBUILD_ICNS FALSE CACHE BOOL "Rebuild icns from voxelands.svg .")
set(CPU_OPTS 0 CACHE BOOL "Enable CPU optimizations")
set(CPU_OPTS FALSE CACHE BOOL "Enable CPU optimizations")
set(CPUTYPE native CACHE STRING "CPU to optimize for")
set(ENABLE_SSP 1 CACHE BOOL "Enable stack smashing protection")
set(ENABLE_SAFESTACK 1 CACHE BOOL "Enable SafeStack if supported (LLVM only)")
set(ENABLE_PIE 0 CACHE BOOL "Produce a Position Independent Executable")
set(ENABLE_SSP TRUE CACHE BOOL "Enable stack smashing protection")
set(ENABLE_SAFESTACK TRUE CACHE BOOL "Enable SafeStack if supported (LLVM only)")
set(ENABLE_PIE FALSE CACHE BOOL "Produce a Position Independent Executable")
if(NOT CMAKE_BUILD_TYPE)
# Default to release
@ -120,25 +137,48 @@ add_subdirectory(src)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Fun-Focused Free Software Voxel World Game")
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VENDOR "darkrose")
set(CPACK_PACKAGE_CONTACT "Lisa 'darkrose' Milne <lisa@ltmnet.com>")
set(CPACK_PACKAGE_VENDOR "rudzik8")
set(CPACK_PACKAGE_CONTACT "Mikita Wisniewski <rudzik8@protonmail.com>")
if(WIN32)
# For some reason these aren't copied otherwise
# NOTE: For some reason now it seems to work without these
#if(BUILD_CLIENT)
# install(FILES bin/voxelands.exe DESTINATION bin)
#endif()
#if(BUILD_SERVER)
# install(FILES bin/voxelands-server.exe DESTINATION bin)
#endif()
# Include all dynamically linked runtime libaries such as MSVCRxxx.dll
include(InstallRequiredSystemLibraries)
if(RUN_IN_PLACE)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win64")
else()
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
endif()
set(CPACK_GENERATOR ZIP)
# This might be needed for some installer
#set(CPACK_PACKAGE_EXECUTABLES bin/voxelands.exe "Voxelands" bin/voxelands-server.exe "Voxelands Server")
else()
set(CPACK_GENERATOR WIX)
set(CPACK_PACKAGE_NAME "${PROJECT_NAME_CAPITALIZED}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY ".")
set(CPACK_PACKAGE_EXECUTABLES ${PROJECT_NAME} "${PROJECT_NAME_CAPITALIZED}")
set(CPACK_CREATE_DESKTOP_LINKS ${PROJECT_NAME})
set(CPACK_PACKAGING_INSTALL_PREFIX "/${PROJECT_NAME_CAPITALIZED}")
set(CPACK_WIX_PRODUCT_ICON "${CMAKE_CURRENT_SOURCE_DIR}/voxelands-icon.ico")
# Supported languages can be found at
# http://wixtoolset.org/documentation/manual/v3/wixui/wixui_localization.html
#set(CPACK_WIX_CULTURES "ar-SA,bg-BG,ca-ES,hr-HR,cs-CZ,da-DK,nl-NL,en-US,et-EE,fi-FI,fr-FR,de-DE")
set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/misc/CPACK_WIX_UI_BANNER.BMP")
set(CPACK_WIX_UI_DIALOG "${CMAKE_CURRENT_SOURCE_DIR}/misc/CPACK_WIX_UI_DIALOG.BMP")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/doc/gpl-3.0.txt")
# The correct way would be to include both x32 and x64 into one installer
# and install the appropriate one.
# CMake does not support that, so there are two separate GUID's
#if(CMAKE_SIZEOF_VOID_P EQUAL 8)
# set(CPACK_WIX_UPGRADE_GUID "745A0FB3-5552-44CA-A587-A91C397CCC56")
#else()
# set(CPACK_WIX_UPGRADE_GUID "814A2E2D-2779-4BBD-9ACD-FC3BD51FBBA2")
#endif()
endif()
elseif(APPLE)
# TODO
# see http://cmake.org/Wiki/CMake:CPackPackageGenerators#Bundle_.28OSX_only.29
@ -156,10 +196,9 @@ else()
set(CPACK_SOURCE_GENERATOR TGZ)
SET ( CPACK_DEBIAN_PACKAGE_SECTION "other" )
SET ( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" )
SET ( CPACK_DEBIAN_PACKAGE_MAINTAINER "Lisa Milne <lisa@ltmnet.com>" )
SET ( CPACK_DEBIAN_PACKAGE_MAINTAINER "Mikita Wisniewski <rudzik8@protonmail.com>" )
SET ( CPACK_GENERATOR "DEB;RPM" )
endif()
include(CPack)

View File

@ -6,13 +6,13 @@ Voxelands is a sandbox construction game based on Minetest, which was inspired b
Voxelands requires:
* the standard C++ library
* irrlicht 1.8 or later
* irrlicht
* freetype
* openAL
* vorbisfile
* ogg
* zlib
* CMake
* cmake
* make
* g++ (or other C++ compiler)
* bzip2
@ -60,8 +60,8 @@ Simply run `./bin/voxelands` from any console/terminal.
Controls can be set in the Settings tab of the main menu
| Button | Action |
| ------------------ | -------------------------------------- |
| W, S, A, D | Walk forward backward, left, and right |
| ------------------ | --------------------------------------- |
| W, S, A, D | Walk forward, backward, left, and right |
| Mouse | Look / Aim |
| Mouse wheel | Change wielded item |
| 1 through 8 | Change wielded item |
@ -88,12 +88,17 @@ Controls can be set in the Settings tab of the main menu
# License
**Code:**
Voxelands is licensed under the GPLv3 or later.
Copyright (c) 2013-2016 Lisa 'darkrose' Milne <lisa@ltmnet.com>
Copyright (c) 2022-2022 Mikita Wisniewski <rudzik8@protonmail.com>
Forked from Minetest 0.3.x
Copyright (c) 2010-2011 Perttu Ahola <celeron55@gmail.com>
See commits history for all contributors.
**Textures, Sounds, and Models:**
This does not apply to texture packs made by others.
Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)