Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 226 lines (196 sloc) 8.056 kb
d825ed5 @celeron55 CMake working on Linux (not on windows)
authored
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
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
7 # This can be read from ${PROJECT_NAME} after project() is called
96fedb5 @celeron55 removed -delta namings
authored
8 project(minetest)
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
9
2cd5add @celeron55 Fix things for cross-compiling using mingw
authored
10 set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
11
94dfece @celeron55 strict_protocol_version_checking setting; PROTOCOL_VERSION in clientserv...
authored
12 # Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
eb476f1 @celeron55 Lots of small stuff
authored
13 set(VERSION_MAJOR 0)
e19d1ea @celeron55 Set version to 0.4
authored
14 set(VERSION_MINOR 4)
1ad81c1 @kwolekr Bump version to 0.4.9
kwolekr authored
15 set(VERSION_PATCH 9)
2cd5add @celeron55 Fix things for cross-compiling using mingw
authored
16 if(VERSION_EXTRA)
e4485f5 @celeron55 Call this 0.4.dev-20120408
authored
17 set(VERSION_PATCH ${VERSION_PATCH}-${VERSION_EXTRA})
8bc7ea6 @kahrl Show git hash in version string at top left corner of window
kahrl authored
18 else()
19 # Comment the following line during release
1ad81c1 @kwolekr Bump version to 0.4.9
kwolekr authored
20 #set(VERSION_PATCH ${VERSION_PATCH}-dev)
2cd5add @celeron55 Fix things for cross-compiling using mingw
authored
21 endif()
359e575 @celeron55 Mainly small build system fixes
authored
22 set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
eb476f1 @celeron55 Lots of small stuff
authored
23
853a786 @celeron55 In CMake scripts: New version number, fix MSVC stuff
authored
24 MESSAGE(STATUS "*** Will build version ${VERSION_STRING} ***")
25
359e575 @celeron55 Mainly small build system fixes
authored
26 # Configuration options
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
27
56918c0 @celeron55 random build system tweaking
authored
28 if(WIN32)
29 set(RUN_IN_PLACE 1 CACHE BOOL "Run directly in source directory structure")
30 else()
31 set(RUN_IN_PLACE 0 CACHE BOOL "Run directly in source directory structure")
32 endif()
d825ed5 @celeron55 CMake working on Linux (not on windows)
authored
33
40b2f36 Fixes cmake-gui causing RUN_IN_PLACE to be always off
MetaDucky authored
34 # RUN_IN_PLACE is exported as a #define value, ensure it's 1/0 instead of ON/OFF
35 if(RUN_IN_PLACE)
36 set(RUN_IN_PLACE 1)
37 else()
38 set(RUN_IN_PLACE 0)
39 endif()
40
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
41 set(BUILD_CLIENT 1 CACHE BOOL "Build client")
1498756 @celeron55 updated CMakeList.txts a bit
authored
42 if(WIN32)
43 set(BUILD_SERVER 0 CACHE BOOL "Build server")
44 else()
45 set(BUILD_SERVER 1 CACHE BOOL "Build server")
46 endif()
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
47
359e575 @celeron55 Mainly small build system fixes
authored
48 set(WARN_ALL 1 CACHE BOOL "Enable -Wall for Release build")
49
50 if(NOT CMAKE_BUILD_TYPE)
51 # Default to release
52 set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
53 endif()
54
55 # Included stuff
56 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
57 include(${CMAKE_SOURCE_DIR}/cmake/Modules/misc.cmake)
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
58
59 # This is done here so that relative search paths are more reasnable
d825ed5 @celeron55 CMake working on Linux (not on windows)
authored
60 find_package(Irrlicht)
61
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
62 #
63 # Installation
64 #
65
66 if(WIN32)
97b6930 @celeron55 Flatten share/ and user/ in the source and for the RUN_IN_PLACE build
authored
67 set(SHAREDIR ".")
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
68 set(BINDIR "bin")
69 set(DOCDIR "doc")
97b6930 @celeron55 Flatten share/ and user/ in the source and for the RUN_IN_PLACE build
authored
70 set(EXAMPLE_CONF_DIR ".")
71 set(LOCALEDIR "locale")
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
72 elseif(APPLE)
97b6930 @celeron55 Flatten share/ and user/ in the source and for the RUN_IN_PLACE build
authored
73 # Random placeholders; this isn't usually used and may not work
74 # See https://github.com/toabi/minetest-mac/
aef1332 @celeron55 Improve build configuration options
authored
75 set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}")
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
76 set(BINDIR "bin")
36d8f91 @weedy Tweak makefiles to add -delta suffix.
weedy authored
77 set(DOCDIR "share/doc/${PROJECT_NAME}")
b409803 @celeron55 Fix installation in cmake project files
authored
78 set(EXAMPLE_CONF_DIR ${DOCDIR})
97b6930 @celeron55 Flatten share/ and user/ in the source and for the RUN_IN_PLACE build
authored
79 set(LOCALEDIR "locale")
92432a2 @celeron55 small fixes: crack texture, server build on windows, configuration file ...
authored
80 elseif(UNIX) # Linux, BSD etc
b409803 @celeron55 Fix installation in cmake project files
authored
81 if(RUN_IN_PLACE)
97b6930 @celeron55 Flatten share/ and user/ in the source and for the RUN_IN_PLACE build
authored
82 set(SHAREDIR ".")
b409803 @celeron55 Fix installation in cmake project files
authored
83 set(BINDIR "bin")
84 set(DOCDIR "doc")
97b6930 @celeron55 Flatten share/ and user/ in the source and for the RUN_IN_PLACE build
authored
85 set(EXAMPLE_CONF_DIR ".")
86 set(MANDIR "unix/man")
87 set(XDG_APPS_DIR "unix/applications")
88 set(ICONDIR "unix/icons")
89 set(LOCALEDIR "locale")
b409803 @celeron55 Fix installation in cmake project files
authored
90 else()
aef1332 @celeron55 Improve build configuration options
authored
91 set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}")
92 set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
93 set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}")
94 set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man")
b409803 @celeron55 Fix installation in cmake project files
authored
95 set(EXAMPLE_CONF_DIR ${DOCDIR})
aef1332 @celeron55 Improve build configuration options
authored
96 set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications")
97 set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons")
923a97b @Zeg9 Install locales in minetest directory, so they are correctly loaded
Zeg9 authored
98 set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/locale")
b409803 @celeron55 Fix installation in cmake project files
authored
99 endif()
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
100 endif()
101
aef1332 @celeron55 Improve build configuration options
authored
102 set(CUSTOM_SHAREDIR "" CACHE STRING "Directory to install data files into")
103 if(NOT CUSTOM_SHAREDIR STREQUAL "")
104 set(SHAREDIR "${CUSTOM_SHAREDIR}")
105 message(STATUS "Using SHAREDIR=${SHAREDIR}")
106 endif()
107 set(CUSTOM_BINDIR "" CACHE STRING "Directory to install binaries into")
108 if(NOT CUSTOM_BINDIR STREQUAL "")
109 set(BINDIR "${CUSTOM_BINDIR}")
110 message(STATUS "Using BINDIR=${BINDIR}")
111 endif()
112 set(CUSTOM_DOCDIR "" CACHE STRING "Directory to install documentation into")
113 if(NOT CUSTOM_DOCDIR STREQUAL "")
114 set(DOCDIR "${CUSTOM_DOCDIR}")
115 message(STATUS "Using DOCDIR=${DOCDIR}")
116 endif()
117 set(CUSTOM_MANDIR "" CACHE STRING "Directory to install manpages into")
118 if(NOT CUSTOM_MANDIR STREQUAL "")
119 set(MANDIR "${CUSTOM_MANDIR}")
120 message(STATUS "Using MANDIR=${MANDIR}")
121 endif()
122 set(CUSTOM_EXAMPLE_CONF_DIR "" CACHE STRING "Directory to install example config file into")
123 if(NOT CUSTOM_EXAMPLE_CONF_DIR STREQUAL "")
124 set(EXAMPLE_CONF_DIR "${CUSTOM_EXAMPLE_CONF_DIR}")
125 message(STATUS "Using EXAMPLE_CONF_DIR=${EXAMPLE_CONF_DIR}")
126 endif()
127 set(CUSTOM_XDG_APPS_DIR "" CACHE STRING "Directory to install .desktop files into")
128 if(NOT CUSTOM_XDG_APPS_DIR STREQUAL "")
129 set(XDG_APPS_DIR "${CUSTOM_XDG_APPS_DIR}")
130 message(STATUS "Using XDG_APPS_DIR=${XDG_APPS_DIR}")
131 endif()
132 set(CUSTOM_ICONDIR "" CACHE STRING "Directory to install icons into")
133 if(NOT CUSTOM_ICONDIR STREQUAL "")
134 set(ICONDIR "${CUSTOM_ICONDIR}")
135 message(STATUS "Using ICONDIR=${ICONDIR}")
136 endif()
137 set(CUSTOM_LOCALEDIR "" CACHE STRING "Directory to install l10n files into")
138 if(NOT CUSTOM_LOCALEDIR STREQUAL "")
139 set(LOCALEDIR "${CUSTOM_LOCALEDIR}")
140 message(STATUS "Using LOCALEDIR=${LOCALEDIR}")
141 endif()
142
db4911f @celeron55 Fix for MSVC and move stuff around a bit in CMakeLists.txt and src/CMake...
authored
143 install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/builtin" DESTINATION "${SHAREDIR}")
ca16119 @celeron55 Install shaders properly
authored
144 install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client" DESTINATION "${SHAREDIR}")
0ff9497 @celeron55 Fix minetest_game installation and don't fail if it doesn't exist
authored
145 install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minimal" DESTINATION "${SHAREDIR}/games")
146 set(MINETEST_GAME_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/games/minetest_game")
147 if(EXISTS ${MINETEST_GAME_SOURCE} AND IS_DIRECTORY ${MINETEST_GAME_SOURCE})
5403b1c @celeron55 Install minetest_game without .git and other unnecessary things
authored
148 install(FILES ${MINETEST_GAME_SOURCE}/game.conf DESTINATION "${SHAREDIR}/games/minetest_game/")
149 install(FILES ${MINETEST_GAME_SOURCE}/README.txt DESTINATION "${SHAREDIR}/games/minetest_game/")
4483fc7 @celeron55 Fix installation path of minetest_game/mods (// in place of / doesn't wo...
authored
150 install(DIRECTORY ${MINETEST_GAME_SOURCE}/mods DESTINATION "${SHAREDIR}/games/minetest_game")
098692e @PilzAdam Install menu textures of minetest_game
PilzAdam authored
151 install(DIRECTORY ${MINETEST_GAME_SOURCE}/menu DESTINATION "${SHAREDIR}/games/minetest_game")
0ff9497 @celeron55 Fix minetest_game installation and don't fail if it doesn't exist
authored
152 endif()
db4911f @celeron55 Fix for MSVC and move stuff around a bit in CMakeLists.txt and src/CMake...
authored
153 if(BUILD_CLIENT)
154 #install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/sounds/base/pack" DESTINATION "${SHAREDIR}/sounds/base")
155 install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/textures/base/pack" DESTINATION "${SHAREDIR}/textures/base")
156 endif()
2de91f1 @celeron55 Add mods/mesetint/mods_here.txt to be installed on RUN_IN_PLACE builds
authored
157 if(RUN_IN_PLACE)
b2577b1 @PilzAdam Install mods/mods_here.txt instead of mods/minetest/mods_here.txt
PilzAdam authored
158 install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/mods/mods_here.txt" DESTINATION "${SHAREDIR}/mods")
314e4dd @PilzAdam Fix installation of textures/texture_packs_here.txt
PilzAdam authored
159 install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/textures/texture_packs_here.txt" DESTINATION "${SHAREDIR}/textures")
2de91f1 @celeron55 Add mods/mesetint/mods_here.txt to be installed on RUN_IN_PLACE builds
authored
160 endif()
97b6930 @celeron55 Flatten share/ and user/ in the source and for the RUN_IN_PLACE build
authored
161
30b9a4d @xyzz Add Freetype support
xyzz authored
162 install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/fonts" DESTINATION "${SHAREDIR}")
163
fbf7618 @kwolekr Revert "Fix to be able to build from dir different than source dir"
kwolekr authored
164 install(FILES "README.txt" DESTINATION "${DOCDIR}")
165 install(FILES "doc/lua_api.txt" DESTINATION "${DOCDIR}")
166 install(FILES "doc/mapformat.txt" DESTINATION "${DOCDIR}")
167 install(FILES "minetest.conf.example" DESTINATION "${EXAMPLE_CONF_DIR}")
d825ed5 @celeron55 CMake working on Linux (not on windows)
authored
168
c8ec711 @jnumm Install icon and .desktop file on Unix systems
jnumm authored
169 if(UNIX)
fbf7618 @kwolekr Revert "Fix to be able to build from dir different than source dir"
kwolekr authored
170 install(FILES "doc/minetest.6" "doc/minetestserver.6" DESTINATION "${MANDIR}/man6")
171 install(FILES "misc/minetest.desktop" DESTINATION "${XDG_APPS_DIR}")
172 install(FILES "misc/minetest-icon.svg" DESTINATION "${ICONDIR}/hicolor/scalable/apps")
c8ec711 @jnumm Install icon and .desktop file on Unix systems
jnumm authored
173 endif()
174
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
175 #
176 # Subdirectories
eb476f1 @celeron55 Lots of small stuff
authored
177 # Be sure to add all relevant definitions above this
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
178 #
179
180 add_subdirectory(src)
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
181
182 # CPack
183
184 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner/Minecraft inspired game")
eb476f1 @celeron55 Lots of small stuff
authored
185 set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
186 set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
187 set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
188 set(CPACK_PACKAGE_VENDOR "celeron55")
56918c0 @celeron55 random build system tweaking
authored
189 set(CPACK_PACKAGE_CONTACT "Perttu Ahola <celeron55@gmail.com>")
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
190
191 if(WIN32)
192 # For some reason these aren't copied otherwise
a0e8f3a @celeron55 might work good on cmake+msvc now
authored
193 # NOTE: For some reason now it seems to work without these
194 #if(BUILD_CLIENT)
195 # install(FILES bin/minetest.exe DESTINATION bin)
196 #endif()
197 #if(BUILD_SERVER)
198 # install(FILES bin/minetestserver.exe DESTINATION bin)
199 #endif()
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
200
359e575 @celeron55 Mainly small build system fixes
authored
201 set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
eb476f1 @celeron55 Lots of small stuff
authored
202
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
203 set(CPACK_GENERATOR ZIP)
204
205 # This might be needed for some installer
206 #set(CPACK_PACKAGE_EXECUTABLES bin/minetest.exe "Minetest" bin/minetestserver.exe "Minetest Server")
207 elseif(APPLE)
208 # TODO
209 # see http://cmake.org/Wiki/CMake:CPackPackageGenerators#Bundle_.28OSX_only.29
359e575 @celeron55 Mainly small build system fixes
authored
210 #
211 set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-osx")
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
212 set(CPACK_PACKAGE_ICON "")
213 set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
214 set(CPACK_BUNDLE_ICON "")
215 set(CPACK_BUNDLE_PLIST "")
36d8f91 @weedy Tweak makefiles to add -delta suffix.
weedy authored
216 set(CPACK_BUNDLE_STARTUP_COMMAND "Contents/MacOS/${PROJECT_NAME}")
2f2f28d @buckket MacOSX build support
buckket authored
217 set(CPACK_GENERATOR "Bundle")
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
218 else()
359e575 @celeron55 Mainly small build system fixes
authored
219 set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-linux")
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible to ...
authored
220 set(CPACK_GENERATOR TGZ)
221 set(CPACK_SOURCE_GENERATOR TGZ)
222 endif()
223
224 include(CPack)
225
Something went wrong with that request. Please try again.