CMakeLists.txt 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793
  1. #
  2. # SuperTux - root build script
  3. # Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. #
  19. #
  20. # INSTRUCTIONS:
  21. # -------------
  22. #
  23. # Create a directory build/ and change to it. Run
  24. #
  25. # cmake ..
  26. #
  27. # This creates a set of Makefiles to build the project. Run
  28. #
  29. # make
  30. #
  31. ## Project name to use as command prefix.
  32. PROJECT(SUPERTUX)
  33. ### CMake configuration
  34. # allow building with CMake 2.8. Set compatibility options. Use some bundled modules as a fallback
  35. CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
  36. IF(COMMAND cmake_policy)
  37. CMAKE_POLICY(SET CMP0003 NEW)
  38. CMAKE_POLICY(SET CMP0008 NEW)
  39. CMAKE_POLICY(SET CMP0023 NEW)
  40. IF(POLICY CMP0043)
  41. CMAKE_POLICY(SET CMP0043 OLD)
  42. ENDIF(POLICY CMP0043)
  43. ENDIF(COMMAND cmake_policy)
  44. SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/mk/cmake)
  45. INCLUDE(ConfigureFiles)
  46. ## For autopackage
  47. SET(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/games/supertux2")
  48. ## Check endianess
  49. INCLUDE(TestBigEndian)
  50. TEST_BIG_ENDIAN(WORDS_BIGENDIAN)
  51. ## Add definitions
  52. IF(CMAKE_BUILD_TYPE MATCHES Release)
  53. ADD_DEFINITIONS(-DRELEASE)
  54. ELSEIF(CMAKE_BUILD_TYPE MATCHES Debug)
  55. ADD_DEFINITIONS(-DDEBUG)
  56. ENDIF()
  57. ## These variables enable MSVC to find libraries located in "dependencies{32|64}"
  58. IF(WIN32)
  59. ## Store path of dependecy folder
  60. SET(DEPENDENCY_FOLDER "${PROJECT_SOURCE_DIR}/dependencies")
  61. ## To test if the host (not the build) is x64:
  62. ## "$ENV{PROCESSOR_ARCHITEW6432}" STREQUAL "AMD64"
  63. IF(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
  64. SET(WIN64 ON)
  65. SET(DEPENDENCY_FOLDER "${DEPENDENCY_FOLDER}64")
  66. ELSE(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
  67. SET(WIN64 OFF)
  68. SET(DEPENDENCY_FOLDER "${DEPENDENCY_FOLDER}32")
  69. ENDIF(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
  70. SET(ENV{PATH} "$ENV{PATH};${DEPENDENCY_FOLDER}/include")
  71. SET(ENV{LIB} "${DEPENDENCY_FOLDER}/lib")
  72. SET(ENV{OPENALDIR} "${DEPENDENCY_FOLDER}")
  73. SET_PROPERTY(DIRECTORY PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG)
  74. ## Enable multi-processor compilation (faster)
  75. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
  76. ## And shut up about unsafe stuff
  77. ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
  78. ## Add an icon
  79. CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/mk/msvc/icon_rc.template" "${PROJECT_BINARY_DIR}/tmp/icon.rc")
  80. ## Find all used libraries
  81. FILE(GLOB DLLS "${DEPENDENCY_FOLDER}/dll/*")
  82. ENDIF(WIN32)
  83. ## Add lots of dependencies to compiler switches
  84. SET(Boost_ADDITIONAL_VERSIONS "1.41" "1.41.0")
  85. FIND_PATH(PHYSFS_INCLUDE_DIR NAMES physfs.h PATHS "${DEPENDENCY_FOLDER}/include/physfs")
  86. FIND_PACKAGE(Boost REQUIRED)
  87. INCLUDE_DIRECTORIES(SYSTEM ${Boost_INCLUDE_DIR})
  88. LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
  89. IF(WIN32)
  90. FIND_PATH(SDL2_INCLUDE_DIRS NAMES SDL.h PATHS "${DEPENDENCY_FOLDER}/include/SDL2")
  91. FIND_PATH(SDL2IMAGE_INCLUDE_DIRS NAMES SDL_image.h PATHS "${DEPENDENCY_FOLDER}/include/SDL2_image")
  92. FIND_LIBRARY(SDL2_LIBRARIES NAMES SDL2 PATHS "${DEPENDENCY_FOLDER}/lib")
  93. FIND_LIBRARY(SDL2IMAGE_LIBRARIES NAMES SDL2_image PATHS "${DEPENDENCY_FOLDER}/lib")
  94. FIND_LIBRARY(SDL2MAIN_LIBRARIES NAMES SDL2main PATHS "${DEPENDENCY_FOLDER}/lib")
  95. ELSE(WIN32)
  96. INCLUDE(FindPkgConfig)
  97. PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2>=2.0.1)
  98. PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image>=2.0.0)
  99. ENDIF(WIN32)
  100. SET(HAVE_SDL TRUE)
  101. OPTION(BUILD_TESTS "Build test cases" OFF)
  102. OPTION(ENABLE_OPENGL "Enable OpenGL support" ON)
  103. OPTION(GLBINDING_ENABLED "Use glbinding instead of GLEW" OFF)
  104. OPTION(GLBINDING_DEBUG_OUTPUT "Enable glbinding debug output for each called OpenGL function" OFF)
  105. IF(ENABLE_OPENGL)
  106. FIND_PACKAGE(OpenGL)
  107. IF(OPENGL_FOUND)
  108. INCLUDE_DIRECTORIES(SYSTEM ${OPENGL_INCLUDE_DIR})
  109. SET(HAVE_OPENGL TRUE)
  110. ENDIF(OPENGL_FOUND)
  111. IF(GLBINDING_ENABLED)
  112. FIND_PACKAGE(GLBINDING REQUIRED)
  113. IF(GLBINDING_FOUND)
  114. INCLUDE_DIRECTORIES(SYSTEM ${GLBINDING_INCLUDES})
  115. ADD_DEFINITIONS(-DUSE_GLBINDING)
  116. IF (GLBINDING_DEBUG_OUTPUT)
  117. ADD_DEFINITIONS(-DUSE_GLBINDING_DEBUG_OUTPUT)
  118. ENDIF()
  119. ENDIF()
  120. ELSE()
  121. FIND_PACKAGE(GLEW REQUIRED)
  122. IF(GLEW_FOUND)
  123. INCLUDE_DIRECTORIES(SYSTEM ${GLEW_INCLUDE_DIR})
  124. ENDIF(GLEW_FOUND)
  125. ENDIF()
  126. ENDIF(ENABLE_OPENGL)
  127. FIND_PACKAGE(OpenAL REQUIRED)
  128. INCLUDE_DIRECTORIES(SYSTEM ${OPENAL_INCLUDE_DIR})
  129. FIND_PACKAGE(OggVorbis REQUIRED)
  130. INCLUDE_DIRECTORIES(SYSTEM ${VORBIS_INCLUDE_DIR})
  131. FIND_PACKAGE(PhysFS REQUIRED)
  132. INCLUDE_DIRECTORIES(SYSTEM ${PHYSFS_INCLUDE_DIR})
  133. ## The curl headers are in the standard include path in dependencies
  134. ## so it's not required to add them here
  135. IF(NOT WIN32 OR WIN64)
  136. FIND_PACKAGE(CURL REQUIRED)
  137. IF(CURL_FOUND)
  138. INCLUDE_DIRECTORIES(SYSTEM ${CURL_INCLUDE_DIR})
  139. SET(HAVE_LIBCURL TRUE)
  140. ENDIF(CURL_FOUND)
  141. ENDIF(NOT WIN32 OR WIN64)
  142. #FIND_PACKAGE(ICONV REQUIRED)
  143. #INCLUDE_DIRECTORIES(SYSTEM ${ICONV_INCLUDE_DIR})
  144. #LINK_LIBRARIES(${ICONV_LIBRARY})
  145. IF(EXISTS "${CMAKE_SOURCE_DIR}/.git")
  146. ## Find revision of WC
  147. MARK_AS_ADVANCED(GIT_EXECUTABLE)
  148. FIND_PROGRAM(GIT_EXECUTABLE git)
  149. IF(NOT GIT_EXECUTABLE EQUAL "GIT_EXECUTABLE-NOTFOUND")
  150. INCLUDE(GetGitRevisionDescription)
  151. git_describe(VERSION_STRING_GIT "--tags")
  152. STRING(REPLACE "v" "" VERSION_LIST ${VERSION_STRING_GIT})
  153. STRING(REGEX REPLACE "(-|_|\\.)" ";" VERSION_LIST ${VERSION_LIST})
  154. LIST(LENGTH VERSION_LIST VERSION_LIST_SIZE)
  155. LIST(GET VERSION_LIST 0 MAJOR_VERSION_GIT)
  156. LIST(GET VERSION_LIST 1 MINOR_VERSION_GIT)
  157. LIST(GET VERSION_LIST 2 PATCH_VERSION_GIT)
  158. IF(${VERSION_LIST_SIZE} EQUAL 5)
  159. LIST(GET VERSION_LIST 3 TWEAK_VERSION_GIT)
  160. LIST(GET VERSION_LIST 4 GIT_HASH)
  161. ENDIF()
  162. CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/version.cmake.in" "${CMAKE_SOURCE_DIR}/version.cmake")
  163. ENDIF(NOT GIT_EXECUTABLE EQUAL "GIT_EXECUTABLE-NOTFOUND")
  164. ENDIF(EXISTS "${CMAKE_SOURCE_DIR}/.git")
  165. IF(NOT EXISTS "${CMAKE_SOURCE_DIR}/version.cmake")
  166. MESSAGE( SEND_ERROR "Cound not find GIT or valid version.cmake. Version information will be invalid." )
  167. ENDIF(NOT EXISTS "${CMAKE_SOURCE_DIR}/version.cmake")
  168. INCLUDE("${CMAKE_SOURCE_DIR}/version.cmake")
  169. SET(SUPERTUX_VERSION ${SUPERTUX_VERSION_STRING})
  170. configure_file(version.h.in ${CMAKE_BINARY_DIR}/version.h )
  171. SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/version.h
  172. PROPERTIES GENERATED true)
  173. SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/src/supertux/main.cpp
  174. PROPERTIES OBJECT_DEPENDS "${CMAKE_BINARY_DIR}/version.h")
  175. SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/src/supertux/title_screen.cpp
  176. PROPERTIES OBJECT_DEPENDS "${CMAKE_BINARY_DIR}/version.h")
  177. SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/src/addon/addon_manager.cpp
  178. PROPERTIES OBJECT_DEPENDS "${CMAKE_BINARY_DIR}/version.h")
  179. ## Check platform-dependent build options
  180. INCLUDE(ConfigureChecks)
  181. INCLUDE(ExternalProject)
  182. ## Also build external/squirrel
  183. IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/squirrel/CMakeLists.txt)
  184. message(FATAL_ERROR "squirrel submodule is not checked out or ${CMAKE_CURRENT_SOURCE_DIR}/external/squirrel/CMakeLists.txt is missing")
  185. ENDIF()
  186. SET(SQUIRREL_PREFIX ${CMAKE_BINARY_DIR}/squirrel/)
  187. ExternalProject_Add(squirrel
  188. SOURCE_DIR "${CMAKE_SOURCE_DIR}/external/squirrel/"
  189. CMAKE_ARGS
  190. -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
  191. -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
  192. -DBUILD_SHARED_LIBS=OFF
  193. -DCMAKE_INSTALL_PREFIX=${SQUIRREL_PREFIX}
  194. -DLIB_SUFFIX=${LIB_SUFFIX})
  195. ADD_LIBRARY(squirrel_lib STATIC IMPORTED)
  196. SET_TARGET_PROPERTIES(squirrel_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/lib${LIB_SUFFIX}/${CMAKE_STATIC_LIBRARY_PREFIX}squirrel${CMAKE_STATIC_LIBRARY_SUFFIX}")
  197. LINK_DIRECTORIES(${SQUIRREL_PREFIX}/libs)
  198. INCLUDE_DIRECTORIES(SYSTEM ${SQUIRREL_PREFIX}/include)
  199. ## Also build external/tinygettext
  200. IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/tinygettext/CMakeLists.txt)
  201. message(FATAL_ERROR "tinygettext submodule is not checked out or ${CMAKE_CURRENT_SOURCE_DIR}/external/tinygettext/CMakeLists.txt is missing")
  202. ENDIF()
  203. set(TINYGETTEXT_PREFIX ${CMAKE_BINARY_DIR}/tinygettext/)
  204. ExternalProject_Add(tinygettext
  205. SOURCE_DIR "${CMAKE_SOURCE_DIR}/external/tinygettext/"
  206. CMAKE_ARGS
  207. -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
  208. -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
  209. -DBUILD_SHARED_LIBS=OFF
  210. -DHAVE_SDL=ON
  211. -DCMAKE_INSTALL_PREFIX=${TINYGETTEXT_PREFIX}
  212. -DSDL2_INCLUDE_DIRS=${SDL2_INCLUDE_DIRS}
  213. -DLIB_SUFFIX=${LIB_SUFFIX})
  214. ADD_LIBRARY(tinygettext_lib STATIC IMPORTED)
  215. SET_TARGET_PROPERTIES(tinygettext_lib PROPERTIES IMPORTED_LOCATION "${TINYGETTEXT_PREFIX}/lib${LIB_SUFFIX}/${CMAKE_STATIC_LIBRARY_PREFIX}tinygettext${CMAKE_STATIC_LIBRARY_SUFFIX}")
  216. LINK_DIRECTORIES(${TINYGETTEXT_PREFIX}/libs)
  217. INCLUDE_DIRECTORIES(SYSTEM ${TINYGETTEXT_PREFIX}/include)
  218. ## Some additional include paths
  219. include_directories(${CMAKE_BINARY_DIR}/)
  220. include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/)
  221. include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/external/findlocale/)
  222. include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/external/obstack/)
  223. include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/external/sexp-cpp/include/)
  224. IF(WIN32)
  225. ADD_DEFINITIONS(-D_USE_MATH_DEFINES -DNOMINMAX)
  226. ADD_DEFINITIONS(-DWIN32)
  227. ENDIF(WIN32)
  228. ## Build list of sources for supertux binary
  229. FILE(GLOB SUPERTUX_SOURCES_C RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} external/obstack/*.c external/findlocale/findlocale.c)
  230. FILE(GLOB SUPERTUX_SOURCES_CXX RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*/*.cpp src/supertux/menu/*.cpp src/video/sdl/*.cpp)
  231. FILE(GLOB SUPERTUX_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${PROJECT_BINARY_DIR}/tmp/*.rc")
  232. IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/sexp-cpp/CMakeLists.txt)
  233. message(FATAL_ERROR "sexp-cpp submodule is not checked out or ${CMAKE_CURRENT_SOURCE_DIR}/external/sexp-cpp/CMakeLists.txt is missing")
  234. ENDIF()
  235. FILE(GLOB SEXP_SOURCES_CXX RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} external/sexp-cpp/src/*.cpp)
  236. ADD_LIBRARY(sexp STATIC ${SEXP_SOURCES_CXX})
  237. IF(HAVE_OPENGL)
  238. FILE(GLOB SUPERTUX_OPENGL_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/video/gl/*.cpp)
  239. SET(SUPERTUX_SOURCES_CXX ${SUPERTUX_SOURCES_CXX} ${SUPERTUX_OPENGL_SOURCES})
  240. ENDIF(HAVE_OPENGL)
  241. ## Sort source lists to have deterministic linking order
  242. LIST(SORT SUPERTUX_SOURCES_C)
  243. LIST(SORT SUPERTUX_SOURCES_CXX)
  244. LIST(SORT SUPERTUX_RESOURCES)
  245. ## Build miniswig and generate miniswig wrapper
  246. OPTION(GENERATE_WRAPPER "Build miniswig and generate the wrapper" OFF)
  247. IF(GENERATE_WRAPPER)
  248. ADD_SUBDIRECTORY(tools/miniswig)
  249. ADD_CUSTOM_COMMAND(
  250. OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.hpp
  251. COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_CXX_COMPILER}
  252. ARGS -x "c++" -E -CC -DSCRIPTING_API src/scripting/wrapper.interface.hpp -o ${CMAKE_CURRENT_BINARY_DIR}/miniswig.tmp -I${CMAKE_CURRENT_SOURCE_DIR}/src
  253. COMMAND tools/miniswig/miniswig
  254. ARGS --input miniswig.tmp --output-cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.cpp --output-hpp ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.hpp --module supertux --select-namespace scripting
  255. DEPENDS tools/miniswig/miniswig
  256. IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.interface.hpp
  257. )
  258. ENDIF(GENERATE_WRAPPER)
  259. IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.cpp)
  260. SET(SUPERTUX_SOURCES_CXX ${SUPERTUX_SOURCES_CXX} ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.cpp)
  261. ENDIF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.cpp)
  262. ## Compile everything at once (roughly equivalent to cat *.cpp | gcc)
  263. OPTION(COMPILE_AMALGATION "Compile all the files together at once (experimental)" OFF)
  264. IF(COMPILE_AMALGATION)
  265. FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/amalgation.cpp "// Includes all source files of the project\n")
  266. FOREACH(ST_FILE ${SUPERTUX_SOURCES_CXX})
  267. FILE(RELATIVE_PATH CXX_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src "${CMAKE_CURRENT_SOURCE_DIR}/${ST_FILE}")
  268. FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/amalgation.cpp "#include \"${CXX_FILE}\"\n")
  269. ENDFOREACH(ST_FILE)
  270. ## Build instead of CXX sources
  271. SET(SUPERTUX_SOURCES_CXX ${CMAKE_CURRENT_BINARY_DIR}/amalgation.cpp)
  272. ELSE(COMPILE_AMALGATION)
  273. IF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/amalgation.cpp)
  274. FILE(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/amalgation.cpp)
  275. ENDIF(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/amalgation.cpp)
  276. ENDIF(COMPILE_AMALGATION)
  277. ## Debug options
  278. OPTION(WERROR "Stop on first compiler warning" OFF)
  279. OPTION(WARNINGS "Enable long list of warnings for compiler to check" OFF)
  280. if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  281. # http://www.guyrutenberg.com/2014/01/05/enabling-c11-c0x-in-cmake/
  282. include(CheckCXXCompilerFlag)
  283. CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
  284. if(COMPILER_SUPPORTS_CXX11)
  285. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
  286. else(COMPILER_SUPPORTS_CXX11)
  287. CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
  288. if(COMPILER_SUPPORTS_CXX0X)
  289. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
  290. else(COMPILER_SUPPORTS_CXX0X)
  291. message(FATAL_ERROR "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
  292. endif(COMPILER_SUPPORTS_CXX0X)
  293. endif(COMPILER_SUPPORTS_CXX11)
  294. SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g" CACHE STRING "Debug flags")
  295. SET(CMAKE_C_FLAGS_DEBUG "-O0 -g" CACHE STRING "Debug flags")
  296. SET(CMAKE_CXX_FLAGS_PROFILE "-pg" CACHE STRING "Profile flags")
  297. SET(CMAKE_C_FLAGS_PROFILE "-pg" CACHE STRING "Profile flags")
  298. SET(CMAKE_LD_FLAGS_PROFILE "-lgmon" CACHE STRING "Profile flags")
  299. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -funit-at-a-time")
  300. IF(WERROR)
  301. ADD_DEFINITIONS(-Werror)
  302. ELSE(WERROR)
  303. REMOVE_DEFINITIONS(-Werror)
  304. ENDIF(WERROR)
  305. IF(WARNINGS)
  306. # temporarily disabled:
  307. # -Wsign-conversion -Wfloat-equal -Wconversion -Wundef -Wswitch-default
  308. # -Wswitch-enum -Wsign-promo -Wcast-qual -Woverloaded-virtual -Wmissing-format-attribute
  309. # -Wold-style-cast -Wpadded -Wabi -Winline -Wunsafe-loop-optimizations -Wstrict-overflow=5
  310. # fails on MinGW:
  311. # -ansi
  312. # fails on clang:
  313. # -Wlogical-op -Wstrict-null-sentinel
  314. SET(SUPERTUX2_EXTRA_WARNING_FLAGS "-fdiagnostics-show-option -pedantic -Wno-long-long -Wcast-align -Wdisabled-optimization -Winit-self -Winvalid-pch -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wredundant-decls -Wstack-protector -Wformat=2 -Weffc++ -Wctor-dtor-privacy -Wno-unused-parameter -Wshadow -Wnon-virtual-dtor -Wcast-qual")
  315. ENDIF(WARNINGS)
  316. endif()
  317. ## If xgettext is available, generate messages.pot for sources
  318. OPTION(GENERATE_MESSAGESPOT "Generate messages.pot files" OFF)
  319. IF(GENERATE_MESSAGESPOT)
  320. MARK_AS_ADVANCED(
  321. XGETTEXT_EXECUTABLE
  322. )
  323. FIND_PROGRAM(XGETTEXT_EXECUTABLE xgettext)
  324. IF(NOT XGETTEXT_EXECUTABLE)
  325. MESSAGE(STATUS "Warning: xgettext not found - will not update messages.pot")
  326. ELSE(NOT XGETTEXT_EXECUTABLE)
  327. MESSAGE(STATUS "Found xgettext: ${XGETTEXT_EXECUTABLE}")
  328. SET(MESSAGES_POT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/data/locale/messages.pot)
  329. ADD_CUSTOM_COMMAND(
  330. OUTPUT ${MESSAGES_POT_FILE}
  331. COMMAND ${XGETTEXT_EXECUTABLE}
  332. ARGS --keyword=_ --language=C++ --output=${MESSAGES_POT_FILE} ${SUPERTUX_SOURCES_CXX}
  333. DEPENDS ${SUPERTUX_SOURCES_CXX}
  334. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  335. COMMENT "Generating POT file ${MESSAGES_POT_FILE}"
  336. )
  337. LIST(APPEND MESSAGES_POT_FILES ${MESSAGES_POT_FILE})
  338. FILE(GLOB SUPERTUX_LEVEL_DIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} data/levels/*)
  339. FOREACH(SUPERTUX_LEVEL_DIR ${SUPERTUX_LEVEL_DIRS})
  340. FILE(GLOB SUPERTUX_LEVELS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SUPERTUX_LEVEL_DIR}/*.stl ${SUPERTUX_LEVEL_DIR}/*.stwm ${SUPERTUX_LEVEL_DIR}/*.txt)
  341. ## Do not add target if SUPERTUX_LEVELS is empty. This is needed for cmake <=2.4
  342. IF(SUPERTUX_LEVELS)
  343. SET(MESSAGES_POT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${SUPERTUX_LEVEL_DIR}/messages.pot)
  344. ADD_CUSTOM_COMMAND(
  345. OUTPUT ${MESSAGES_POT_FILE}
  346. COMMAND ${XGETTEXT_EXECUTABLE}
  347. ARGS --keyword="_:1" --language=Lisp --force-po --sort-by-file "--output=${MESSAGES_POT_FILE}" ${SUPERTUX_LEVELS}
  348. DEPENDS ${SUPERTUX_LEVELS}
  349. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  350. COMMENT "Generating POT file ${MESSAGES_POT_FILE}"
  351. )
  352. LIST(APPEND MESSAGES_POT_FILES ${MESSAGES_POT_FILE})
  353. ENDIF(SUPERTUX_LEVELS)
  354. ENDFOREACH(SUPERTUX_LEVEL_DIR)
  355. ADD_CUSTOM_TARGET(
  356. supertux2-messages ALL
  357. DEPENDS ${MESSAGES_POT_FILES}
  358. )
  359. ENDIF(NOT XGETTEXT_EXECUTABLE)
  360. ENDIF(GENERATE_MESSAGESPOT)
  361. ## Some additional compiler switches
  362. if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  363. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
  364. endif()
  365. IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  366. ADD_DEFINITIONS(-DMACOSX)
  367. ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  368. ## On Windows, add an icon
  369. IF(WIN32)
  370. # SET(SUPERTUX_SOURCES_C ${SUPERTUX_SOURCES_C} ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.rc)
  371. IF(MINGW)
  372. ADD_CUSTOM_COMMAND(
  373. OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o
  374. COMMAND ${CMAKE_RC_COMPILER} -I${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons -i${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.rc -o ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o)
  375. SET(SUPERTUX_SOURCES_C ${SUPERTUX_SOURCES_C} ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o)
  376. ENDIF(MINGW)
  377. ENDIF(WIN32)
  378. ## Generate supertux executable in the right place
  379. #SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
  380. SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
  381. IF(NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
  382. CONFIGURE_FILES(${CMAKE_CURRENT_SOURCE_DIR}/data ${CMAKE_BINARY_DIR}/data)
  383. ENDIF(NOT ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
  384. ## Add target for supertux binary
  385. add_library(supertux2_c OBJECT ${SUPERTUX_SOURCES_C})
  386. add_library(supertux2_lib STATIC ${CMAKE_BINARY_DIR}/version.h ${SUPERTUX_SOURCES_CXX} ${SUPERTUX_RESOURCES} $<TARGET_OBJECTS:supertux2_c>)
  387. IF(WIN32)
  388. add_executable(supertux2 WIN32 src/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.rc)
  389. TARGET_LINK_LIBRARIES(supertux2 ${SDL2MAIN_LIBRARIES})
  390. ELSE()
  391. add_executable(supertux2 src/main.cpp)
  392. ENDIF(WIN32)
  393. target_link_libraries(supertux2 supertux2_lib)
  394. set_target_properties(supertux2 PROPERTIES OUTPUT_NAME supertux2)
  395. set_target_properties(supertux2_lib PROPERTIES COMPILE_FLAGS "${SUPERTUX2_EXTRA_WARNING_FLAGS}")
  396. IF(WIN32)
  397. ## Copy dlls on windows
  398. ADD_CUSTOM_COMMAND(TARGET supertux2_lib POST_BUILD
  399. COMMAND ${CMAKE_COMMAND} -E copy_directory
  400. "${DEPENDENCY_FOLDER}/dll"
  401. $<TARGET_FILE_DIR:supertux2_lib>)
  402. # ADD_CUSTOM_COMMAND(TARGET supertux2 POST_BUILD
  403. # COMMAND ${CMAKE_COMMAND} -E copy
  404. # "${DEPENDENCY_FOLDER}/DigiCertHighAssuranceEVRootCA.pem"
  405. # $<TARGET_FILE_DIR:supertux2_lib>)
  406. ENDIF(WIN32)
  407. ## Link supertux binary with squirrel and other libraries
  408. ADD_DEPENDENCIES(supertux2_lib tinygettext)
  409. ADD_DEPENDENCIES(supertux2_lib squirrel)
  410. TARGET_INCLUDE_DIRECTORIES(supertux2_lib SYSTEM PUBLIC ${SDL2_INCLUDE_DIRS})
  411. TARGET_INCLUDE_DIRECTORIES(supertux2_lib SYSTEM PUBLIC ${SDL2IMAGE_INCLUDE_DIRS})
  412. TARGET_LINK_LIBRARIES(supertux2_lib PUBLIC ${SDL2_LIBRARIES})
  413. TARGET_LINK_LIBRARIES(supertux2_lib PUBLIC ${SDL2IMAGE_LIBRARIES})
  414. TARGET_LINK_LIBRARIES(supertux2_lib PUBLIC squirrel_lib)
  415. TARGET_LINK_LIBRARIES(supertux2_lib PUBLIC tinygettext_lib)
  416. TARGET_LINK_LIBRARIES(supertux2_lib PUBLIC sexp)
  417. TARGET_LINK_LIBRARIES(supertux2_lib PUBLIC ${OPENAL_LIBRARY})
  418. TARGET_LINK_LIBRARIES(supertux2_lib PUBLIC ${OGGVORBIS_LIBRARIES})
  419. TARGET_LINK_LIBRARIES(supertux2_lib PUBLIC ${PHYSFS_LIBRARY})
  420. IF(HAVE_OPENGL)
  421. TARGET_LINK_LIBRARIES(supertux2_lib PUBLIC ${OPENGL_LIBRARY})
  422. IF(GLBINDING_FOUND)
  423. TARGET_LINK_LIBRARIES(supertux2_lib PUBLIC ${GLBINDING_LIBRARIES})
  424. ELSE()
  425. TARGET_LINK_LIBRARIES(supertux2_lib PUBLIC ${GLEW_LIBRARY})
  426. ENDIF()
  427. ENDIF(HAVE_OPENGL)
  428. IF(HAVE_LIBCURL)
  429. TARGET_LINK_LIBRARIES(supertux2_lib PUBLIC ${CURL_LIBRARY})
  430. ENDIF(HAVE_LIBCURL)
  431. ## Link curl on windows
  432. IF(WIN32 AND NOT WIN64)
  433. TARGET_LINK_LIBRARIES(supertux2_lib PUBLIC "${DEPENDENCY_FOLDER}/lib/libcurldll.a")
  434. ENDIF()
  435. if(BUILD_TESTS)
  436. find_package(Threads REQUIRED)
  437. # build gtest
  438. # ${CMAKE_CURRENT_SOURCE_DIR} in include_directories is needed to generate -isystem instead of -I flags
  439. add_library(gtest_main STATIC ${CMAKE_CURRENT_SOURCE_DIR}/external/googletest/googletest/src/gtest_main.cc)
  440. target_include_directories(gtest_main SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/googletest/googletest/include/)
  441. add_library(gtest STATIC ${CMAKE_CURRENT_SOURCE_DIR}/external/googletest/googletest/src/gtest-all.cc)
  442. target_include_directories(gtest SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external/googletest/googletest/)
  443. target_include_directories(gtest SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/googletest/googletest/include/)
  444. # build SuperTux tests
  445. file(GLOB TEST_SUPERTUX_SOURCES tests/*.cpp)
  446. add_executable(test_supertux2 ${TEST_SUPERTUX_SOURCES})
  447. target_compile_options(test_supertux2 PRIVATE ${WARNINGS_CXX_FLAGS})
  448. target_link_libraries(test_supertux2
  449. gtest gtest_main
  450. supertux2_lib
  451. ${CMAKE_THREAD_LIBS_INIT})
  452. # add 'make test' target, use 'make test ARGS="-V"' or 'ctest -V' for verbose
  453. enable_testing()
  454. add_test(NAME test_supertux2
  455. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  456. COMMAND test_supertux2)
  457. endif()
  458. ## Install stuff
  459. OPTION(DISABLE_CPACK_BUNDLING "Build an .app bundle without CPack" OFF)
  460. IF(WIN32 AND NOT UNIX)
  461. SET(INSTALL_SUBDIR_BIN "bin" CACHE STRING "Installation subdir for binaries")
  462. SET(INSTALL_SUBDIR_SHARE "data" CACHE STRING "Installation subdir for data")
  463. SET(INSTALL_SUBDIR_DOC "doc" CACHE STRING "Installation subdir for docs")
  464. INSTALL(FILES ${DLLS} DESTINATION ${INSTALL_SUBDIR_BIN})
  465. INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.png ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.ico DESTINATION ".")
  466. OPTION(PACKAGE_VCREDIST "Package the VCREDIST libraries with the program" OFF)
  467. IF(PACKAGE_VCREDIST)
  468. include(InstallRequiredSystemLibraries)
  469. INSTALL(FILES ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ${INSTALL_SUBDIR_BIN})
  470. include(FindWindowsSDK)
  471. IF(${CMAKE_VS_PLATFORM_NAME} STREQUAL "Win32")
  472. SET(UCRT_PATH "${WINDOWSSDK_PREFERRED_DIR}/Redist/ucrt/DLLs/x86")
  473. ELSE()
  474. SET(UCRT_PATH "${WINDOWSSDK_PREFERRED_DIR}/Redist/ucrt/DLLs/x64")
  475. ENDIF()
  476. FILE(GLOB UCRT_DLLS "${UCRT_PATH}/*")
  477. INSTALL(FILES ${UCRT_DLLS} DESTINATION ${INSTALL_SUBDIR_BIN})
  478. ENDIF()
  479. ELSE(WIN32 AND NOT UNIX)
  480. IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND DISABLE_CPACK_BUNDLING)
  481. SET(INFOPLIST_CFBUNDLEEXECUTABLE "supertux2")
  482. SET(INSTALL_SUBDIR_BIN "SuperTux.app/Contents/MacOS" CACHE STRING "Installation subdir for binaries")
  483. SET(INSTALL_SUBDIR_SHARE "SuperTux.app/Contents/Resources/data" CACHE STRING "Installation subdir for data")
  484. SET(INSTALL_SUBDIR_DOC "SuperTux.app/Contents/Resources" CACHE STRING "Installation subdir for docs")
  485. CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/info.plist.in ${CMAKE_BINARY_DIR}/tools/darwin/info.plist)
  486. INSTALL(FILES ${CMAKE_BINARY_DIR}/tools/darwin/info.plist DESTINATION "SuperTux.app/Contents/")
  487. INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/receipt DESTINATION "SuperTux.app/Contents/_MASReceipt/")
  488. INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.png ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.icns DESTINATION "SuperTux.app/Contents/Resources/")
  489. ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND DISABLE_CPACK_BUNDLING)
  490. SET(INSTALL_SUBDIR_BIN "games" CACHE STRING "Installation subdir for binaries")
  491. SET(INSTALL_SUBDIR_SHARE "share/games/supertux2" CACHE STRING "Installation subdir for data")
  492. SET(INSTALL_SUBDIR_DOC "share/doc/supertux2" CACHE STRING "Installation subdir for docs")
  493. INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/supertux2.desktop DESTINATION "share/applications")
  494. SET(APPS "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_SUBDIR_BIN}/supertux2")
  495. INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.png ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.xpm DESTINATION "share/pixmaps/")
  496. ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND DISABLE_CPACK_BUNDLING)
  497. ENDIF(WIN32 AND NOT UNIX)
  498. INSTALL(TARGETS supertux2 DESTINATION ${INSTALL_SUBDIR_BIN})
  499. INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/INSTALL.md ${CMAKE_CURRENT_SOURCE_DIR}/README.md ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt ${CMAKE_CURRENT_SOURCE_DIR}/NEWS.md DESTINATION ${INSTALL_SUBDIR_DOC})
  500. INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/credits.txt DESTINATION ${INSTALL_SUBDIR_SHARE})
  501. INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/supertux2.appdata.xml DESTINATION "share/appdata" )
  502. INSTALL(DIRECTORY data/images
  503. data/fonts
  504. data/music
  505. data/scripts
  506. data/speech
  507. data/sounds
  508. data/locale
  509. DESTINATION ${INSTALL_SUBDIR_SHARE})
  510. IF(CMAKE_BUILD_TYPE MATCHES Release)
  511. INSTALL(DIRECTORY data/levels
  512. DESTINATION ${INSTALL_SUBDIR_SHARE}
  513. PATTERN "data/levels/test" EXCLUDE
  514. PATTERN "data/levels/test_old" EXCLUDE)
  515. ELSE()
  516. INSTALL(DIRECTORY data/levels
  517. DESTINATION ${INSTALL_SUBDIR_SHARE})
  518. ENDIF()
  519. ## Create config.h now that INSTALL_SUBDIR_* have been set.
  520. configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
  521. ## Configure main menu logo
  522. IF(CMAKE_BUILD_TYPE MATCHES Release)
  523. SET(LOGO_FILE "logo_final.sprite")
  524. ELSE()
  525. SET(LOGO_FILE "logo.sprite")
  526. ENDIF()
  527. configure_file(data/levels/misc/menu.stl.in ${CMAKE_BINARY_DIR}/data/levels/misc/menu.stl )
  528. ## CPack/Installation-specific stuff
  529. INCLUDE(InstallRequiredSystemLibraries)
  530. SET(DIRS ${Boost_LIBRARY_DIRS} ${CMAKE_CURRENT_BINARY_DIR}/external/squirrel ${CMAKE_CURRENT_BINARY_DIR}/external/tinygettext)
  531. IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT DISABLE_CPACK_BUNDLING)
  532. SET(INFOPLIST_CFBUNDLEEXECUTABLE "SuperTux")
  533. FIND_PACKAGE(png)
  534. foreach (_file ${PNG_LIBRARIES})
  535. get_filename_component(_resolvedFile "${_file}" REALPATH)
  536. get_filename_component(_name "${_file}" NAME)
  537. INSTALL(FILES ${_resolvedFile} DESTINATION "MacOS" RENAME ${_name})
  538. endforeach()
  539. FIND_PACKAGE(jpeg)
  540. foreach (_file ${JPEG_LIBRARIES})
  541. get_filename_component(_resolvedFile "${_file}" REALPATH)
  542. get_filename_component(_name "${_file}" NAME)
  543. INSTALL(FILES ${_resolvedFile} DESTINATION "MacOS" RENAME ${_name})
  544. endforeach()
  545. INSTALL(CODE "
  546. if(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\" MATCHES \".*\\\\.app.*\")
  547. include(BundleUtilities)
  548. fixup_bundle(\"${APPS}\" \"\" \"${DIRS}\")
  549. endif()
  550. ")
  551. CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/info.plist.in" "${CMAKE_BINARY_DIR}/tools/darwin/info.plist")
  552. SET(CPACK_BUNDLE_NAME "SuperTux")
  553. SET(CPACK_BUNDLE_PLIST "${CMAKE_BINARY_DIR}/tools/darwin/info.plist")
  554. SET(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.icns")
  555. SET(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/startup.sh")
  556. SET(CPACK_DMG_VOLUME_NAME "SuperTux ${SUPERTUX_VERSION_STRING}")
  557. SET(CPACK_DMG_DS_STORE "${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/DS_Store")
  558. SET(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/background.png")
  559. ENDIF()
  560. SET(CPACK_PACKAGE_NAME "SuperTux")
  561. SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Jump'n'Run Game featuring Tux")
  562. SET(CPACK_PACKAGE_VENDOR "SuperTux Devel Team")
  563. SET(CPACK_PACKAGE_CONTACT "SuperTux Devel Team <supertux-devel@lists.lethargik.org>")
  564. SET(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;${CMAKE_BINARY_DIR}")
  565. SET(CPACK_DEBIAN_PACKAGE_NAME "supertux2")
  566. SET(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.5), libgcc1 (>= 1:4.1), libgl1-mesa-glx | libgl1, libogg0 (>= 1.1.3), libopenal0a, libphysfs-1.0-0, libsdl-image1.2 (>= 1.2.5), libsdl1.2debian (>= 1.2.10-1), libstdc++6 (>= 4.1.2), libvorbis0a (>= 1.1.2), libvorbisfile3 (>= 1.1.2), libcurl3 (>= 7.16)")
  567. SET(CPACK_DEBIAN_PACKAGE_DESCRIPTION "Classic 2D jump 'n run sidescroller with Tux\n SuperTux is a classic 2D jump 'n run sidescroller game in a similar\n style like the original SuperMario games. This release of SuperTux\n features 9 enemies, 26 playable levels, software and OpenGL rendering\n modes, configurable joystick and keyboard input, new music and\n completely redone graphics.\n .\n This is a development snapshot of SuperTux. It may suffer from\n critical bugs and has not been fully tested. \n .\n Homepage: http://supertux.lethargik.org/")
  568. SET(CPACK_DEBIAN_PACKAGE_SECTION "games")
  569. SET(CPACK_RPM_PACKAGE_NAME "supertux2")
  570. SET(CPACK_RPM_PACKAGE_DESCRIPTION "Classic 2D jump 'n run sidescroller with Tux\n SuperTux is a classic 2D jump 'n run sidescroller game in a similar\n style like the original SuperMario games. This release of SuperTux\n features 9 enemies, 26 playable levels, software and OpenGL rendering\n modes, configurable joystick and keyboard input, new music and\n completely redone graphics.\n .\n This is a development snapshot of SuperTux. It may suffer from\n critical bugs and has not been fully tested. \n .\n Homepage: http://supertux.lethargik.org/")
  571. SET(CPACK_RPM_PACKAGE_LICENSE "GNU General Public License (GPL)")
  572. SET(CPACK_RPM_PACKAGE_GROUP "Amusements/Games/Action/Arcade")
  573. SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
  574. SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
  575. SET(CPACK_PACKAGE_VERSION_MAJOR ${SUPERTUX_VERSION_MAJOR})
  576. SET(CPACK_PACKAGE_VERSION_MINOR ${SUPERTUX_VERSION_MINOR})
  577. IF(SUPERTUX_VERSION_TWEAK)
  578. SET(CPACK_PACKAGE_VERSION_PATCH "${SUPERTUX_VERSION_PATCH}.${SUPERTUX_VERSION_TWEAK}")
  579. ELSE()
  580. SET(CPACK_PACKAGE_VERSION_PATCH ${SUPERTUX_VERSION_PATCH})
  581. ENDIF(SUPERTUX_VERSION_TWEAK)
  582. SET(CPACK_PACKAGE_INSTALL_DIRECTORY "SuperTux")
  583. SET(CPACK_PACKAGE_EXECUTABLES "supertux2" "SuperTux")
  584. IF(WIN32 AND NOT UNIX)
  585. SET(CPACK_NSIS_INSTALLED_ICON_NAME "supertux2")
  586. SET(CPACK_NSIS_DISPLAY_NAME "SuperTux")
  587. SET(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
  588. SET(CPACK_WIX_PROGRAM_MENU_FOLDER "")
  589. SET(CPACK_WIX_UPGRADE_GUID "93E16F4E-0A68-422A-8ADC-47BE5B9433B2")
  590. SET(CPACK_WIX_PRODUCT_ICON "${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.ico")
  591. SET(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/mk/wix/banner.png")
  592. SET(CPACK_WIX_UI_DIALOG "${CMAKE_CURRENT_SOURCE_DIR}/mk/wix/dialog.png")
  593. SET(CPACK_GENERATOR WIX)
  594. ELSE(WIN32 AND NOT UNIX)
  595. ENDIF(WIN32 AND NOT UNIX)
  596. INCLUDE(CPack)
  597. # move some config clutter to the advanced section
  598. MARK_AS_ADVANCED(
  599. INSTALL_SUBDIR_BIN
  600. INSTALL_SUBDIR_SHARE
  601. INSTALL_SUBDIR_DOC
  602. )
  603. MARK_AS_ADVANCED(
  604. CMAKE_BACKWARDS_COMPATIBILITY
  605. CMAKE_BUILD_TYPE
  606. CMAKE_INSTALL_PREFIX
  607. EXECUTABLE_OUTPUT_PATH
  608. LIBRARY_OUTPUT_PATH
  609. CMAKE_OSX_ARCHITECTURES
  610. CMAKE_OSX_SYSROOT
  611. )
  612. MARK_AS_ADVANCED(
  613. APPDATADIR
  614. )
  615. MARK_AS_ADVANCED(
  616. Boost_INCLUDE_DIR
  617. Boost_LIBRARIES
  618. )
  619. MARK_AS_ADVANCED(
  620. GLEW_INCLUDE_DIR
  621. GLEW_LIBRARY
  622. )
  623. MARK_AS_ADVANCED(
  624. SDL2_INCLUDE_DIRS
  625. SDL2_LIBRARIES
  626. )
  627. MARK_AS_ADVANCED(
  628. SDL2IMAGE_INCLUDE_DIRS
  629. SDL2IMAGE_LIBRARIES
  630. )
  631. MARK_AS_ADVANCED(
  632. OPENAL_INCLUDE_DIR
  633. OPENAL_LIBRARY
  634. )
  635. MARK_AS_ADVANCED(
  636. OGG_LIBRARY
  637. VORBISENC_LIBRARY
  638. VORBISFILE_LIBRARY
  639. VORBIS_INCLUDE_DIR
  640. VORBIS_LIBRARY
  641. )
  642. MARK_AS_ADVANCED(
  643. PHYSFS_INCLUDE_DIR
  644. PHYSFS_LIBRARY
  645. )