Skip to content
Newer
Older
100644 124 lines (100 sloc) 3.52 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 …
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 …
authored
9
94dfece @celeron55 strict_protocol_version_checking setting; PROTOCOL_VERSION in clients…
authored
10 # Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
eb476f1 @celeron55 Lots of small stuff
authored
11 set(VERSION_MAJOR 0)
e19d1ea @celeron55 Set version to 0.4
authored
12 set(VERSION_MINOR 4)
13 set(VERSION_PATCH dev-20111113)
359e575 @celeron55 Mainly small build system fixes
authored
14 set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
eb476f1 @celeron55 Lots of small stuff
authored
15
853a786 @celeron55 In CMake scripts: New version number, fix MSVC stuff
authored
16 MESSAGE(STATUS "*** Will build version ${VERSION_STRING} ***")
17
359e575 @celeron55 Mainly small build system fixes
authored
18 # Configuration options
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible …
authored
19
56918c0 @celeron55 random build system tweaking
authored
20 if(WIN32)
21 set(RUN_IN_PLACE 1 CACHE BOOL "Run directly in source directory structure")
22 else()
23 set(RUN_IN_PLACE 0 CACHE BOOL "Run directly in source directory structure")
24 endif()
d825ed5 @celeron55 CMake working on Linux (not on windows)
authored
25
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible …
authored
26 set(BUILD_CLIENT 1 CACHE BOOL "Build client")
1498756 @celeron55 updated CMakeList.txts a bit
authored
27 if(WIN32)
28 set(BUILD_SERVER 0 CACHE BOOL "Build server")
29 else()
30 set(BUILD_SERVER 1 CACHE BOOL "Build server")
31 endif()
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible …
authored
32
359e575 @celeron55 Mainly small build system fixes
authored
33 set(WARN_ALL 1 CACHE BOOL "Enable -Wall for Release build")
34
35 if(NOT CMAKE_BUILD_TYPE)
36 # Default to release
37 set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
38 endif()
39
40 # Included stuff
41 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
42 include(${CMAKE_SOURCE_DIR}/cmake/Modules/misc.cmake)
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible …
authored
43
44 # This is done here so that relative search paths are more reasnable
d825ed5 @celeron55 CMake working on Linux (not on windows)
authored
45 find_package(Irrlicht)
46
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
47 #
48 # Installation
49 #
50
51 if(WIN32)
52 set(DATADIR "data")
53 set(BINDIR "bin")
54 set(DOCDIR "doc")
92432a2 @celeron55 small fixes: crack texture, server build on windows, configuration fi…
authored
55 set(EXAMPLE_CONF_DIR ".")
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
56 elseif(APPLE)
affa8f8 @celeron55 Tried to fix install directory problem on linux... Let's hope this do…
authored
57 # random placeholders
36d8f91 @weedy Tweak makefiles to add -delta suffix.
weedy authored
58 set(DATADIR "share/${PROJECT_NAME}")
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
59 set(BINDIR "bin")
36d8f91 @weedy Tweak makefiles to add -delta suffix.
weedy authored
60 set(DOCDIR "share/doc/${PROJECT_NAME}")
92432a2 @celeron55 small fixes: crack texture, server build on windows, configuration fi…
authored
61 set(EXAMPLE_CONF_DIR ".")
62 elseif(UNIX) # Linux, BSD etc
36d8f91 @weedy Tweak makefiles to add -delta suffix.
weedy authored
63 set(DATADIR "share/${PROJECT_NAME}")
83414e8 @celeron55 removed /usr prefix from install paths
authored
64 set(BINDIR "bin")
36d8f91 @weedy Tweak makefiles to add -delta suffix.
weedy authored
65 set(DOCDIR "share/doc/${PROJECT_NAME}")
66 set(EXAMPLE_CONF_DIR "share/doc/${PROJECT_NAME}")
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
67 endif()
68
1469196 @celeron55 Update /README.txt, remove duplicate /doc/README.txt and update CMake…
authored
69 install(FILES "README.txt" DESTINATION "${DOCDIR}")
1498756 @celeron55 updated CMakeList.txts a bit
authored
70 install(FILES "doc/changelog.txt" DESTINATION "${DOCDIR}")
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
71 install(FILES "minetest.conf.example" DESTINATION "${DOCDIR}")
d825ed5 @celeron55 CMake working on Linux (not on windows)
authored
72
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
73 #
74 # Subdirectories
eb476f1 @celeron55 Lots of small stuff
authored
75 # Be sure to add all relevant definitions above this
d435ded @celeron55 doc updates; CMake works reasonably well now.
authored
76 #
77
78 add_subdirectory(src)
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible …
authored
79
80 # CPack
81
82 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner/Minecraft inspired game")
eb476f1 @celeron55 Lots of small stuff
authored
83 set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
84 set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
85 set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible …
authored
86 set(CPACK_PACKAGE_VENDOR "celeron55")
56918c0 @celeron55 random build system tweaking
authored
87 set(CPACK_PACKAGE_CONTACT "Perttu Ahola <celeron55@gmail.com>")
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible …
authored
88
89 if(WIN32)
90 # For some reason these aren't copied otherwise
a0e8f3a @celeron55 might work good on cmake+msvc now
authored
91 # NOTE: For some reason now it seems to work without these
92 #if(BUILD_CLIENT)
93 # install(FILES bin/minetest.exe DESTINATION bin)
94 #endif()
95 #if(BUILD_SERVER)
96 # install(FILES bin/minetestserver.exe DESTINATION bin)
97 #endif()
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible …
authored
98
359e575 @celeron55 Mainly small build system fixes
authored
99 set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
eb476f1 @celeron55 Lots of small stuff
authored
100
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible …
authored
101 set(CPACK_GENERATOR ZIP)
102
103 # This might be needed for some installer
104 #set(CPACK_PACKAGE_EXECUTABLES bin/minetest.exe "Minetest" bin/minetestserver.exe "Minetest Server")
105 elseif(APPLE)
106 # TODO
107 # see http://cmake.org/Wiki/CMake:CPackPackageGenerators#Bundle_.28OSX_only.29
359e575 @celeron55 Mainly small build system fixes
authored
108 #
109 set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-osx")
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible …
authored
110 set(CPACK_PACKAGE_ICON "")
111 set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
112 set(CPACK_BUNDLE_ICON "")
113 set(CPACK_BUNDLE_PLIST "")
36d8f91 @weedy Tweak makefiles to add -delta suffix.
weedy authored
114 set(CPACK_BUNDLE_STARTUP_COMMAND "Contents/MacOS/${PROJECT_NAME}")
2f2f28d @buckket MacOSX build support
buckket authored
115 set(CPACK_GENERATOR "Bundle")
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible …
authored
116 else()
359e575 @celeron55 Mainly small build system fixes
authored
117 set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-linux")
9fbb088 @celeron55 CMake stuff works now on linux and windows... and should be possible …
authored
118 set(CPACK_GENERATOR TGZ)
119 set(CPACK_SOURCE_GENERATOR TGZ)
120 endif()
121
122 include(CPack)
123
Something went wrong with that request. Please try again.