VoxeLands.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 6.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. # This can be read from ${PROJECT_NAME} after project() is called
  7. project(voxelands)
  8. # Also remember to set PROTOCOL_VERSION in clientserver.h when releasing
  9. set(VERSION_MAJOR 1704)
  10. set(VERSION_MINOR 00)
  11. set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}:next")
  12. MESSAGE(STATUS "*** Will build version ${VERSION_STRING} ***")
  13. # Configuration options
  14. if(WIN32)
  15. set(RUN_IN_PLACE 1 CACHE BOOL "Run directly in source directory structure")
  16. else()
  17. set(RUN_IN_PLACE 0 CACHE BOOL "Run directly in source directory structure")
  18. endif()
  19. set(BUILD_CLIENT 1 CACHE BOOL "Build client")
  20. if(WIN32)
  21. set(BUILD_SERVER 0 CACHE BOOL "Build server")
  22. else()
  23. set(BUILD_SERVER 1 CACHE BOOL "Build server")
  24. endif()
  25. # conf options for building fresh voxelands.icns from voxelands.svg if a new icon is made.
  26. set(REBUILD_ICNS 0 CACHE BOOL "Rebuild icns from voxelands.svg .")
  27. set(CPU_OPTS 0 CACHE BOOL "Enable CPU optimizations")
  28. set(CPUTYPE native CACHE STRING "CPU to optimize for")
  29. set(ENABLE_SSP 1 CACHE BOOL "Enable stack smashing protection")
  30. set(ENABLE_SAFESTACK 1 CACHE BOOL "Enable SafeStack if supported (LLVM only)")
  31. set(ENABLE_PIE 0 CACHE BOOL "Produce a Position Independent Executable")
  32. if(NOT CMAKE_BUILD_TYPE)
  33. # Default to release
  34. set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
  35. endif()
  36. # Included stuff
  37. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
  38. include(${CMAKE_SOURCE_DIR}/cmake/Modules/misc.cmake)
  39. # This is done here so that relative search paths are more reasnable
  40. find_package(Irrlicht)
  41. #
  42. # Installation
  43. #
  44. if(WIN32)
  45. set(SHAREDIR "data")
  46. set(BINDIR "bin")
  47. set(DOCDIR "doc")
  48. set(EXAMPLE_CONF_DIR ".")
  49. elseif(APPLE)
  50. # random placeholders
  51. set(SHAREDIR "share/${PROJECT_NAME}")
  52. set(BINDIR "bin")
  53. set(DOCDIR "share/doc/${PROJECT_NAME}")
  54. set(EXAMPLE_CONF_DIR ${DOCDIR})
  55. elseif(UNIX) # Linux, BSD etc
  56. if(RUN_IN_PLACE)
  57. set(SHAREDIR "share/${PROJECT_NAME}")
  58. set(BINDIR "bin")
  59. set(DOCDIR "share/doc/${PROJECT_NAME}")
  60. set(MANDIR "share/man")
  61. set(EXAMPLE_CONF_DIR ${DOCDIR})
  62. set(XDG_APPS_DIR "share/applications")
  63. set(APPDATADIR "share/appdata")
  64. set(ICONDIR "share/icons")
  65. set(LOCALEDIR "share/${PROJECT_NAME}/locale")
  66. else()
  67. set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}")
  68. set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin")
  69. set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}")
  70. set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man")
  71. set(EXAMPLE_CONF_DIR ${DOCDIR})
  72. set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications")
  73. set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/appdata")
  74. set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons")
  75. set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/locale")
  76. endif()
  77. endif()
  78. install(FILES "README.txt" DESTINATION "${DOCDIR}")
  79. install(FILES "doc/changelog.txt" DESTINATION "${DOCDIR}")
  80. install(FILES "doc/example.cfg" DESTINATION "${DOCDIR}")
  81. if (APPLE)
  82. install(DIRECTORY "libs/" DESTINATION "libs")
  83. endif()
  84. if (UNIX AND NOT APPLE)
  85. install(FILES "doc/voxelands.6" "doc/voxelands-server.6" DESTINATION "${MANDIR}/man6")
  86. install(FILES "misc/freedesktop/voxelands.desktop" DESTINATION "${XDG_APPS_DIR}")
  87. install(FILES "misc/voxelands.appdata.xml" DESTINATION "${APPDATADIR}")
  88. install(FILES "misc/freedesktop/icons/scalable/apps/voxelands.svg" DESTINATION "${ICONDIR}/hicolor/scalable/apps")
  89. install(FILES "misc/freedesktop/icons/192x192/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/192x192/apps")
  90. install(FILES "misc/freedesktop/icons/128x128/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/128x128/apps")
  91. install(FILES "misc/freedesktop/icons/64x64/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/64x64/apps")
  92. install(FILES "misc/freedesktop/icons/48x48/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/48x48/apps")
  93. install(FILES "misc/freedesktop/icons/32x32/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/32x32/apps")
  94. install(FILES "misc/freedesktop/icons/24x24/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/24x24/apps")
  95. install(FILES "misc/freedesktop/icons/22x22/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/22x22/apps")
  96. install(FILES "misc/freedesktop/icons/16x16/apps/voxelands.png" DESTINATION "${ICONDIR}/hicolor/16x16/apps")
  97. endif()
  98. #
  99. # Subdirectories
  100. # Be sure to add all relevant definitions above this
  101. #
  102. add_subdirectory(src)
  103. # CPack
  104. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The Fun-Focused Free Software Voxel World Game")
  105. set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
  106. set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
  107. set(CPACK_PACKAGE_VENDOR "darkrose")
  108. set(CPACK_PACKAGE_CONTACT "Lisa 'darkrose' Milne <lisa@ltmnet.com>")
  109. if(WIN32)
  110. # For some reason these aren't copied otherwise
  111. # NOTE: For some reason now it seems to work without these
  112. #if(BUILD_CLIENT)
  113. # install(FILES bin/voxelands.exe DESTINATION bin)
  114. #endif()
  115. #if(BUILD_SERVER)
  116. # install(FILES bin/voxelands-server.exe DESTINATION bin)
  117. #endif()
  118. set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32")
  119. set(CPACK_GENERATOR ZIP)
  120. # This might be needed for some installer
  121. #set(CPACK_PACKAGE_EXECUTABLES bin/voxelands.exe "Voxelands" bin/voxelands-server.exe "Voxelands Server")
  122. elseif(APPLE)
  123. # TODO
  124. # see http://cmake.org/Wiki/CMake:CPackPackageGenerators#Bundle_.28OSX_only.29
  125. #
  126. set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-osx-${CMAKE_OSX_ARCHITECTURES}")
  127. set(CPACK_PACKAGE_ICON ${CMAKE_CURRENT_SOURCE_DIR}/misc/mac/voxelands.icns)
  128. set(CPACK_BUNDLE_NAME ${PROJECT_NAME})
  129. set(CPACK_BUNDLE_ICON ${CPACK_PACKAGE_ICON})
  130. set(CPACK_BUNDLE_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/misc/mac/Info.plist)
  131. set(CPACK_BUNDLE_STARTUP_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bin/Debug/voxelands)
  132. set(CPACK_GENERATOR "Bundle")
  133. else()
  134. set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-linux")
  135. set(CPACK_GENERATOR TGZ)
  136. set(CPACK_SOURCE_GENERATOR TGZ)
  137. SET ( CPACK_DEBIAN_PACKAGE_SECTION "other" )
  138. SET ( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" )
  139. SET ( CPACK_DEBIAN_PACKAGE_MAINTAINER "Lisa Milne <lisa@ltmnet.com>" )
  140. SET ( CPACK_GENERATOR "DEB;RPM" )
  141. endif()
  142. include(CPack)