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
11 set(VERSION_MAJOR 1604)
14 set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}${VERSION_EXTRA}")
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 # conf options for building fresh voxelands.icns from voxelands.svg if a new icon is made.
34 set(REBUILD_ICNS 0 CACHE BOOL "Rebuild icns from voxelands.svg .")
36 set(CPU_OPTS 0 CACHE BOOL "Enable CPU optimizations")
37 set(ENABLE_SSP 1 CACHE BOOL "Enable stack smashing protection")
38 set(ENABLE_SAFESTACK 1 CACHE BOOL "Enable SafeStack if supported (LLVM only)")
39 set(ENABLE_PIE 0 CACHE BOOL "Produce a Position Independent Executable")
41 if(NOT CMAKE_BUILD_TYPE)
43 set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
47 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
48 include(${CMAKE_SOURCE_DIR}/cmake/Modules/misc.cmake)
50 # This is done here so that relative search paths are more reasnable
51 find_package(Irrlicht)
61 set(EXAMPLE_CONF_DIR ".")
64 set(SHAREDIR "share/${PROJECT_NAME}")
66 set(DOCDIR "share/doc/${PROJECT_NAME}")
67 set(EXAMPLE_CONF_DIR ${DOCDIR})
68 elseif(UNIX) # Linux, BSD etc
70 set(SHAREDIR "share/${PROJECT_NAME}")
72 set(DOCDIR "share/doc/${PROJECT_NAME}")
73 set(MANDIR "share/man")
74 set(EXAMPLE_CONF_DIR ${DOCDIR})
75 set(XDG_APPS_DIR "share/applications")
76 set(APPDATADIR "share/appdata")
77 set(ICONDIR "share/icons")
78 set(LOCALEDIR "share/${PROJECT_NAME}/locale")
80 set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}")
81 set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
82 set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}")
83 set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man")
84 set(EXAMPLE_CONF_DIR ${DOCDIR})
85 set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications")
86 set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/appdata")
87 set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons")
88 set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/locale")
92 install(FILES "README.txt" DESTINATION "${DOCDIR}")
93 install(FILES "doc/changelog.txt" DESTINATION "${DOCDIR}")
94 install(FILES "voxelands.conf.example" DESTINATION "${DOCDIR}")
96 install(DIRECTORY "libs/" DESTINATION "libs")
98 if (UNIX AND NOT APPLE)
99 install(FILES "doc/voxelands.6" "doc/voxelands-server.6" DESTINATION "${MANDIR}/man6")
100 install(FILES "misc/freedesktop/voxelands.desktop" DESTINATION "${XDG_APPS_DIR}")
101 install(FILES "misc/voxelands.appdata.xml" DESTINATION "${APPDATADIR}")
102 install(FILES "misc/freedesktop/icons/scalable/apps/voxelands.svg" DESTINATION "${ICONDIR}/hicolor/scalable/apps")
103 install(FILES "misc/freedesktop/icons/192x192/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/192x192/apps")
104 install(FILES "misc/freedesktop/icons/128x128/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/128x128/apps")
105 install(FILES "misc/freedesktop/icons/64x64/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/64x64/apps")
106 install(FILES "misc/freedesktop/icons/48x48/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/48x48/apps")
107 install(FILES "misc/freedesktop/icons/32x32/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/32x32/apps")
108 install(FILES "misc/freedesktop/icons/24x24/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/24x24/apps")
109 install(FILES "misc/freedesktop/icons/22x22/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/22x22/apps")
110 install(FILES "misc/freedesktop/icons/16x16/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/16x16/apps")
114 # Be sure to add all relevant definitions above this
117 add_subdirectory(src)
121 set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Fun-Focused Free Software Voxel World Game")
122 set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
123 set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
124 set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
125 set(CPACK_PACKAGE_VENDOR "darkrose")
126 set(CPACK_PACKAGE_CONTACT "Lisa 'darkrose' Milne <lisa@ltmnet.com>")
129 # For some reason these aren't copied otherwise
130 # NOTE: For some reason now it seems to work without these
132 # install(FILES bin/voxelands.exe DESTINATION bin)
135 # install(FILES bin/voxelands-server.exe DESTINATION bin)
138 set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
140 set(CPACK_GENERATOR ZIP)
142 # This might be needed for some installer
143 #set(CPACK_PACKAGE_EXECUTABLES bin/voxelands.exe "Voxelands" bin/voxelands-server.exe "Voxelands Server")
146 # see http://cmake.org/Wiki/CMake:CPackPackageGenerators#Bundle_.28OSX_only.29
148 set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-osx-${CMAKE_OSX_ARCHITECTURES}")
149 set(CPACK_PACKAGE_ICON ${CMAKE_CURRENT_SOURCE_DIR}/misc/mac/voxelands.icns)
150 set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
151 set(CPACK_BUNDLE_ICON ${CPACK_PACKAGE_ICON})
152 set(CPACK_BUNDLE_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/misc/mac/Info.plist)
153 set(CPACK_BUNDLE_STARTUP_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/Debug/voxelands)
154 set(CPACK_GENERATOR "Bundle")
156 set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-linux")
157 set(CPACK_GENERATOR TGZ)
158 set(CPACK_SOURCE_GENERATOR TGZ)
159 SET ( CPACK_DEBIAN_PACKAGE_SECTION "other" )
160 SET ( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" )
161 SET ( CPACK_DEBIAN_PACKAGE_MAINTAINER "Lisa Milne <lisa@ltmnet.com>" )
162 SET ( CPACK_GENERATOR "DEB;RPM" )