]> git.lizzy.rs Git - minetest.git/blob - CMakeLists.txt
Players are left on server while server is running. No passwords yet.
[minetest.git] / CMakeLists.txt
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")
6
7 # This can be read from ${PROJECT_NAME} after project() is called
8 project(minetest)
9
10 set(VERSION_MAJOR 0)
11 set(VERSION_MINOR 0)
12 set(VERSION_PATCH 1)
13 set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
14
15 # Configuration options
16
17 if(WIN32)
18         set(RUN_IN_PLACE 1 CACHE BOOL "Run directly in source directory structure")
19 else()
20         set(RUN_IN_PLACE 0 CACHE BOOL "Run directly in source directory structure")
21 endif()
22
23 set(BUILD_CLIENT 1 CACHE BOOL "Build client")
24 set(BUILD_SERVER 1 CACHE BOOL "Build server")
25
26 set(WARN_ALL 1 CACHE BOOL "Enable -Wall for Release build")
27
28 if(NOT CMAKE_BUILD_TYPE)
29         # Default to release
30         set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
31 endif()
32
33 # Included stuff
34 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
35 include(${CMAKE_SOURCE_DIR}/cmake/Modules/misc.cmake)
36
37 # This is done here so that relative search paths are more reasnable
38 find_package(Irrlicht)
39
40 #
41 # Installation
42 #
43
44 if(WIN32)
45         set(DATADIR "data")
46         set(BINDIR "bin")
47         set(DOCDIR "doc")
48 elseif(APPLE)
49         set(DATADIR "share/minetest")
50         set(BINDIR "bin")
51         set(DOCDIR "share/doc/minetest")
52 elseif(UNIX)
53         set(DATADIR "share/minetest")
54         set(BINDIR "bin")
55         set(DOCDIR "share/doc/minetest")
56 endif()
57
58 install(FILES "doc/README.txt" DESTINATION "${DOCDIR}")
59 install(FILES "minetest.conf.example" DESTINATION "${DOCDIR}")
60
61 #
62 # Subdirectories
63 # Be sure to add all relevant definitions above this
64 #
65
66 add_subdirectory(src)
67
68 # CPack
69
70 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner/Minecraft inspired game")
71 set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
72 set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
73 set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
74 set(CPACK_PACKAGE_VENDOR "celeron55")
75 set(CPACK_PACKAGE_CONTACT "Perttu Ahola <celeron55@gmail.com>")
76
77 if(WIN32)
78         # For some reason these aren't copied otherwise
79         if(BUILD_CLIENT)
80                 install(FILES bin/minetest.exe DESTINATION bin)
81         endif()
82         if(BUILD_SERVER)
83                 install(FILES bin/minetestserver.exe DESTINATION bin)
84         endif()
85
86         set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
87
88         set(CPACK_GENERATOR ZIP)
89
90         # This might be needed for some installer
91         #set(CPACK_PACKAGE_EXECUTABLES bin/minetest.exe "Minetest" bin/minetestserver.exe "Minetest Server")
92 elseif(APPLE)
93         # TODO
94         # see http://cmake.org/Wiki/CMake:CPackPackageGenerators#Bundle_.28OSX_only.29
95         #
96         set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-osx")
97         set(CPACK_PACKAGE_ICON "")
98         set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
99         set(CPACK_BUNDLE_ICON "")
100         set(CPACK_BUNDLE_PLIST "")
101         set(CPACK_BUNDLE_STARTUP_COMMAND "Contents/MacOS/minetest")
102         set(CPACK_GENERATOR BUNDLE)
103 else()
104         set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-linux")
105         set(CPACK_GENERATOR TGZ)
106         set(CPACK_SOURCE_GENERATOR TGZ)
107 endif()
108
109 include(CPack)
110