1 cmake_minimum_required(VERSION 2.6)
2 if(${CMAKE_VERSION} STREQUAL "2.8.2")
3 # bug http://vtk.org/Bug/view.php?id=11020
4 message( WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!")
5 endif(${CMAKE_VERSION} STREQUAL "2.8.2")
7 # This can be read from ${PROJECT_NAME} after project() is called
10 # Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
13 set(VERSION_PATCH dev-20111113)
14 set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
16 MESSAGE(STATUS "*** Will build version ${VERSION_STRING} ***")
18 # Configuration options
21 set(RUN_IN_PLACE 1 CACHE BOOL "Run directly in source directory structure")
23 set(RUN_IN_PLACE 0 CACHE BOOL "Run directly in source directory structure")
26 set(BUILD_CLIENT 1 CACHE BOOL "Build client")
28 set(BUILD_SERVER 0 CACHE BOOL "Build server")
30 set(BUILD_SERVER 1 CACHE BOOL "Build server")
33 set(WARN_ALL 1 CACHE BOOL "Enable -Wall for Release build")
35 if(NOT CMAKE_BUILD_TYPE)
37 set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
41 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
42 include(${CMAKE_SOURCE_DIR}/cmake/Modules/misc.cmake)
44 # This is done here so that relative search paths are more reasnable
45 find_package(Irrlicht)
55 set(EXAMPLE_CONF_DIR ".")
58 set(DATADIR "share/${PROJECT_NAME}")
60 set(DOCDIR "share/doc/${PROJECT_NAME}")
61 set(EXAMPLE_CONF_DIR ".")
62 elseif(UNIX) # Linux, BSD etc
63 set(DATADIR "share/${PROJECT_NAME}")
65 set(DOCDIR "share/doc/${PROJECT_NAME}")
66 set(EXAMPLE_CONF_DIR "share/doc/${PROJECT_NAME}")
69 install(FILES "README.txt" DESTINATION "${DOCDIR}")
70 install(FILES "doc/changelog.txt" DESTINATION "${DOCDIR}")
71 install(FILES "minetest.conf.example" DESTINATION "${DOCDIR}")
75 # Be sure to add all relevant definitions above this
82 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner/Minecraft inspired game")
83 set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
84 set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
85 set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
86 set(CPACK_PACKAGE_VENDOR "celeron55")
87 set(CPACK_PACKAGE_CONTACT "Perttu Ahola <celeron55@gmail.com>")
90 # For some reason these aren't copied otherwise
91 # NOTE: For some reason now it seems to work without these
93 # install(FILES bin/minetest.exe DESTINATION bin)
96 # install(FILES bin/minetestserver.exe DESTINATION bin)
99 set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
101 set(CPACK_GENERATOR ZIP)
103 # This might be needed for some installer
104 #set(CPACK_PACKAGE_EXECUTABLES bin/minetest.exe "Minetest" bin/minetestserver.exe "Minetest Server")
107 # see http://cmake.org/Wiki/CMake:CPackPackageGenerators#Bundle_.28OSX_only.29
109 set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-osx")
110 set(CPACK_PACKAGE_ICON "")
111 set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
112 set(CPACK_BUNDLE_ICON "")
113 set(CPACK_BUNDLE_PLIST "")
114 set(CPACK_BUNDLE_STARTUP_COMMAND "Contents/MacOS/${PROJECT_NAME}")
115 set(CPACK_GENERATOR "Bundle")
117 set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-linux")
118 set(CPACK_GENERATOR TGZ)
119 set(CPACK_SOURCE_GENERATOR TGZ)