CMakeLists.txt 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178
  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. cmake_minimum_required(VERSION 3.1)
  35. if(COMMAND cmake_policy)
  36. cmake_policy(SET CMP0003 NEW)
  37. cmake_policy(SET CMP0008 NEW)
  38. cmake_policy(SET CMP0023 NEW)
  39. endif(COMMAND cmake_policy)
  40. set(CMAKE_CXX_STANDARD 14)
  41. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  42. set(CMAKE_CXX_EXTENSIONS OFF)
  43. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/mk/cmake)
  44. include(ConfigureFiles)
  45. include(ExternalProject)
  46. include(CheckCXXCompilerFlag)
  47. ## For autopackage
  48. set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/games/supertux2")
  49. set(BUILD_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/data")
  50. set(BUILD_CONFIG_DATA_DIR "${CMAKE_BINARY_DIR}/data")
  51. ## Check endianess
  52. include(TestBigEndian)
  53. test_big_endian(WORDS_BIGENDIAN)
  54. ## Add definitions
  55. if(CMAKE_BUILD_TYPE MATCHES "Release|RelWithDebInfo")
  56. add_definitions(-DRELEASE)
  57. elseif(CMAKE_BUILD_TYPE MATCHES Debug)
  58. add_definitions(-DDEBUG)
  59. endif()
  60. set(SUPERTUX_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
  61. set(VCPKG_BUILD OFF CACHE BOOL "Use dependencies installed via vcpkg (not dependency package)")
  62. set(VCPKG_APPLOCAL_DEPS ${VCPKG_BUILD} BOOL)
  63. ## These variables enable MSVC to find libraries located in "dependencies{32|64}"
  64. if(WIN32)
  65. if(NOT VCPKG_BUILD)
  66. ## Store path of dependecy folder
  67. set(DEPENDENCY_FOLDER "${PROJECT_SOURCE_DIR}/dependencies")
  68. endif()
  69. ## To test if the host (not the build) is x64:
  70. ## "$ENV{PROCESSOR_ARCHITEW6432}" STREQUAL "AMD64"
  71. if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
  72. set(WIN64 ON)
  73. if(NOT VCPKG_BUILD)
  74. set(DEPENDENCY_FOLDER "${DEPENDENCY_FOLDER}64")
  75. endif()
  76. else(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
  77. set(WIN64 OFF)
  78. if(NOT VCPKG_BUILD)
  79. set(DEPENDENCY_FOLDER "${DEPENDENCY_FOLDER}32")
  80. endif()
  81. endif(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
  82. if(WIN64)
  83. set(SUPERTUX_SYSTEM_NAME win64)
  84. else(WIN64)
  85. set(SUPERTUX_SYSTEM_NAME win32)
  86. endif(WIN64)
  87. if(NOT VCPKG_BUILD)
  88. set(ENV{PATH} "$ENV{PATH};${DEPENDENCY_FOLDER}/include")
  89. set(ENV{LIB} "${DEPENDENCY_FOLDER}/lib")
  90. set(ENV{OPENALDIR} "${DEPENDENCY_FOLDER}")
  91. endif()
  92. ## Enable multi-processor compilation (faster)
  93. if(MSVC)
  94. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
  95. endif(MSVC)
  96. ## And shut up about unsafe stuff
  97. add_definitions(-D_CRT_SECURE_NO_WARNINGS)
  98. ## Add an icon
  99. configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mk/msvc/icon_rc.template" "${PROJECT_BINARY_DIR}/tmp/icon.rc")
  100. ## Find all used libraries
  101. if(NOT VCPKG_BUILD)
  102. file(GLOB DLLS "${DEPENDENCY_FOLDER}/dll/*")
  103. endif()
  104. endif(WIN32)
  105. ## Add lots of dependencies to compiler switches
  106. set(Boost_ADDITIONAL_VERSIONS "1.41" "1.41.0")
  107. if(WIN32)
  108. option(ENABLE_BOOST_STATIC_LIBS "Use boost static libraries" ON)
  109. else(WIN32)
  110. option(ENABLE_BOOST_STATIC_LIBS "Use boost static libraries" OFF)
  111. endif(WIN32)
  112. if(ENABLE_BOOST_STATIC_LIBS)
  113. set(Boost_USE_STATIC_LIBS TRUE)
  114. else(ENABLE_BOOST_STATIC_LIBS)
  115. set(Boost_USE_STATIC_LIBS FALSE)
  116. endif(ENABLE_BOOST_STATIC_LIBS)
  117. find_package(Boost REQUIRED COMPONENTS filesystem system date_time locale)
  118. include_directories(SYSTEM ${Boost_INCLUDE_DIR})
  119. link_directories(${Boost_LIBRARY_DIRS})
  120. find_package(PNG REQUIRED)
  121. if(WIN32)
  122. if(VCPKG_BUILD)
  123. find_package(SDL2 CONFIG REQUIRED)
  124. find_path(SDL2_INCLUDE_DIRS SDL2/SDL.h)
  125. find_path(SDL2IMAGE_INCLUDE_DIRS SDL2/SDL_image.h)
  126. set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIRS}/SDL2)
  127. set(SDL2IMAGE_INCLUDE_DIRS ${SDL2IMAGE_INCLUDE_DIRS}/SDL2)
  128. find_library(SDL2_LIBRARIES SDL2)
  129. find_library(SDL2IMAGE_LIBRARIES SDL2_image)
  130. find_library(SDL2MAIN_LIBRARIES SDL2main)
  131. message(STATUS "SDL2_INCLUDE_DIR is ${SDL2_INCLUDE_DIRS}")
  132. else(VCPKG_BUILD)
  133. find_path(SDL2_INCLUDE_DIRS NAMES SDL.h PATHS "${DEPENDENCY_FOLDER}/include/SDL2")
  134. find_path(SDL2IMAGE_INCLUDE_DIRS NAMES SDL_image.h PATHS "${DEPENDENCY_FOLDER}/include/SDL2_image")
  135. find_library(SDL2_LIBRARIES NAMES SDL2 PATHS "${DEPENDENCY_FOLDER}/lib")
  136. find_library(SDL2IMAGE_LIBRARIES NAMES SDL2_image PATHS "${DEPENDENCY_FOLDER}/lib")
  137. find_library(SDL2MAIN_LIBRARIES NAMES SDL2main PATHS "${DEPENDENCY_FOLDER}/lib")
  138. find_path(PHYSFS_INCLUDE_DIR NAMES physfs.h PATHS "${DEPENDENCY_FOLDER}/include/physfs")
  139. endif(VCPKG_BUILD)
  140. else(WIN32)
  141. include(FindPkgConfig)
  142. pkg_search_module(SDL2 REQUIRED sdl2>=2.0.1)
  143. pkg_search_module(SDL2IMAGE REQUIRED SDL2_image>=2.0.0)
  144. endif(WIN32)
  145. set(HAVE_SDL TRUE)
  146. option(IS_SUPERTUX_RELEASE "Build as official SuperTux release" OFF)
  147. option(BUILD_TESTS "Build test cases" OFF)
  148. option(ENABLE_OPENGL "Enable OpenGL support" ON)
  149. option(ENABLE_OPENGLES2 "Enable OpenGLES2 support" OFF)
  150. option(GLBINDING_ENABLED "Use glbinding instead of GLEW" OFF)
  151. option(GLBINDING_DEBUG_OUTPUT "Enable glbinding debug output for each called OpenGL function" OFF)
  152. if(ENABLE_OPENGL)
  153. if(ENABLE_OPENGLES2)
  154. pkg_check_modules(GLESV2 REQUIRED glesv2)
  155. set(HAVE_OPENGL TRUE)
  156. set(OPENGL_INCLUDE_DIR ${GLESV2_INCLUDE_DIRS})
  157. set(OPENGL_LIBRARY ${GLESV2_LIBRARIES})
  158. add_definitions(-DUSE_OPENGLES2)
  159. else()
  160. set(OpenGL_GL_PREFERENCE "LEGACY")
  161. find_package(OpenGL)
  162. if(OPENGL_FOUND)
  163. include_directories(SYSTEM ${OPENGL_INCLUDE_DIR})
  164. set(HAVE_OPENGL TRUE)
  165. endif(OPENGL_FOUND)
  166. if(GLBINDING_ENABLED)
  167. find_package(GLBINDING REQUIRED)
  168. if(GLBINDING_FOUND)
  169. include_directories(SYSTEM ${GLBINDING_INCLUDES})
  170. add_definitions(-DUSE_GLBINDING)
  171. IF (GLBINDING_DEBUG_OUTPUT)
  172. add_definitions(-DUSE_GLBINDING_DEBUG_OUTPUT)
  173. endif()
  174. endif()
  175. else()
  176. find_package(GLEW REQUIRED)
  177. if(GLEW_FOUND)
  178. include_directories(SYSTEM ${GLEW_INCLUDE_DIR})
  179. endif(GLEW_FOUND)
  180. endif()
  181. endif()
  182. endif(ENABLE_OPENGL)
  183. if(VCPKG_BUILD)
  184. find_package(OpenAL CONFIG REQUIRED)
  185. else()
  186. find_package(OpenAL REQUIRED)
  187. endif()
  188. include_directories(SYSTEM ${OPENAL_INCLUDE_DIR})
  189. find_package(OggVorbis REQUIRED)
  190. include_directories(SYSTEM ${VORBIS_INCLUDE_DIR})
  191. include(CheckSymbolExists)
  192. find_package(PhysFS)
  193. if(PHYSFS_LIBRARY)
  194. set(CMAKE_REQUIRED_LIBRARIES ${PHYSFS_LIBRARY})
  195. check_symbol_exists("PHYSFS_getPrefDir" "${PHYSFS_INCLUDE_DIR}/physfs.h" HAVE_PHYSFS_GETPREFDIR)
  196. endif()
  197. if(HAVE_PHYSFS_GETPREFDIR)
  198. set(USE_SYSTEM_PHYSFS ON CACHE BOOL "Use preinstalled physfs (must support getPrefDir)")
  199. else(HAVE_PHYSFS_GETPREFDIR)
  200. set(USE_SYSTEM_PHYSFS OFF CACHE BOOL "Use preinstalled physfs (must support getPrefDir)")
  201. endif(HAVE_PHYSFS_GETPREFDIR)
  202. if(NOT USE_SYSTEM_PHYSFS)
  203. if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/physfs/CMakeLists.txt)
  204. message(FATAL_ERROR "physfs submodule is not checked out or ${CMAKE_CURRENT_SOURCE_DIR}/external/physfs/CMakeLists.txt is missing")
  205. endif()
  206. if(WIN32)
  207. set(PHYSFS_BUILD_SHARED TRUE)
  208. set(PHYSFS_BUILD_STATIC FALSE)
  209. else(WIN32)
  210. set(PHYSFS_BUILD_SHARED FALSE)
  211. set(PHYSFS_BUILD_STATIC TRUE)
  212. endif()
  213. set(PHYSFS_PREFIX ${CMAKE_BINARY_DIR}/physfs/)
  214. ExternalProject_Add(physfs
  215. SOURCE_DIR "${CMAKE_SOURCE_DIR}/external/physfs/"
  216. BUILD_BYPRODUCTS
  217. "${PHYSFS_PREFIX}/bin/${CMAKE_SHARED_LIBRARY_PREFIX}physfs${CMAKE_SHARED_LIBRARY_SUFFIX}"
  218. "${PHYSFS_PREFIX}/lib${LIB_SUFFIX}/physfs${CMAKE_LINK_LIBRARY_SUFFIX}"
  219. "${PHYSFS_PREFIX}/lib${LIB_SUFFIX}/${CMAKE_STATIC_LIBRARY_PREFIX}physfs${CMAKE_STATIC_LIBRARY_SUFFIX}"
  220. CMAKE_ARGS
  221. -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
  222. -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
  223. -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
  224. -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
  225. -DCMAKE_INSTALL_PREFIX=${PHYSFS_PREFIX}
  226. -DLIB_SUFFIX=${LIB_SUFFIX}
  227. -DPHYSFS_BUILD_SHARED=${PHYSFS_BUILD_SHARED}
  228. -DPHYSFS_BUILD_STATIC=${PHYSFS_BUILD_STATIC}
  229. -DPHYSFS_BUILD_TEST=FALSE)
  230. if(WIN32)
  231. add_library(physfs_lib SHARED IMPORTED)
  232. set_target_properties(physfs_lib PROPERTIES IMPORTED_LOCATION "${PHYSFS_PREFIX}/bin/${CMAKE_SHARED_LIBRARY_PREFIX}physfs${CMAKE_SHARED_LIBRARY_SUFFIX}")
  233. set_target_properties(physfs_lib PROPERTIES IMPORTED_IMPLIB "${PHYSFS_PREFIX}/lib${LIB_SUFFIX}/physfs${CMAKE_LINK_LIBRARY_SUFFIX}")
  234. else()
  235. add_library(physfs_lib STATIC IMPORTED)
  236. set_target_properties(physfs_lib PROPERTIES IMPORTED_LOCATION "${PHYSFS_PREFIX}/lib${LIB_SUFFIX}/${CMAKE_STATIC_LIBRARY_PREFIX}physfs${CMAKE_STATIC_LIBRARY_SUFFIX}")
  237. endif()
  238. set(PHYSFS_INCLUDE_DIR "${PHYSFS_PREFIX}/include/")
  239. endif()
  240. include_directories(BEFORE SYSTEM ${PHYSFS_INCLUDE_DIR})
  241. ## The curl headers are in the standard include path in dependencies
  242. ## so it's not required to add them here
  243. find_package(CURL REQUIRED)
  244. if(WIN32 AND VCPKG_BUILD)
  245. list(LENGTH CURL_LIBRARY CURL_LIBRARY_LENGTH)
  246. if (CURL_LIBRARY_LENGTH EQUAL 1)
  247. set(CURL_LIBRARY_DEBUG_LIB ${CURL_LIBRARY})
  248. set(CURL_LIBRARY_RELEASE_LIB ${CURL_LIBRARY_DEBUG_LIB}/../../../lib/libcurl.lib)
  249. get_filename_component(CURL_LIBRARY_RELEASE_LIB ${CURL_LIBRARY_RELEASE_LIB} REALPATH)
  250. unset(CURL_LIBRARY CACHE)
  251. unset(CURL_LIBRARY)
  252. unset(CURL_LIBRARIES CACHE)
  253. unset(CURL_LIBRARIES)
  254. set(CURL_LIBRARY "debug;${CURL_LIBRARY_DEBUG_LIB};optimized;${CURL_LIBRARY_RELEASE_LIB}")
  255. set(CURL_LIBRARIES ${CURL_LIBRARY})
  256. endif()
  257. endif()
  258. if(CURL_FOUND)
  259. include_directories(SYSTEM ${CURL_INCLUDE_DIR})
  260. set(HAVE_LIBCURL TRUE)
  261. endif(CURL_FOUND)
  262. #find_package(ICONV REQUIRED)
  263. #include_directories(SYSTEM ${ICONV_INCLUDE_DIR})
  264. #link_libraries(${ICONV_LIBRARY})
  265. if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
  266. ## Find revision of WC
  267. mark_as_advanced(GIT_EXECUTABLE)
  268. find_program(GIT_EXECUTABLE git)
  269. if(NOT GIT_EXECUTABLE EQUAL "GIT_EXECUTABLE-NOTFOUND")
  270. include(GetGitRevisionDescription)
  271. git_describe(VERSION_STRING_GIT "--tags" "--match" "?[0-9]*.[0-9]*.[0-9]*")
  272. string(REPLACE "v" "" VERSION_LIST ${VERSION_STRING_GIT})
  273. string(REGEX REPLACE "(-|_|\\.)" ";" VERSION_LIST ";${VERSION_LIST}")
  274. endif()
  275. endif(EXISTS "${CMAKE_SOURCE_DIR}/.git")
  276. get_filename_component(BASEDIR ${CMAKE_SOURCE_DIR} NAME)
  277. if("${VERSION_LIST}" STREQUAL "")
  278. if(${BASEDIR} MATCHES "supertux2-[0-9\\.]*")
  279. string(REGEX REPLACE "(\\.|_|-)" ";" VERSION_LIST ${BASEDIR})
  280. endif()
  281. endif()
  282. file(GLOB ORIG_TGZ ../*.orig.tar.gz)
  283. if("${VERSION_LIST}" STREQUAL "" AND (NOT "${ORIG_TGZ}" STREQUAL ""))
  284. get_filename_component(BASEDIR ${ORIG_TGZ} NAME)
  285. string(REGEX REPLACE "(\\.|_|-)" ";" VERSION_LIST ${BASEDIR})
  286. endif()
  287. list(LENGTH VERSION_LIST VERSION_LIST_SIZE)
  288. if(${VERSION_LIST_SIZE} GREATER 0)
  289. list(GET VERSION_LIST 1 MAJOR_VERSION_GIT)
  290. list(GET VERSION_LIST 2 MINOR_VERSION_GIT)
  291. list(GET VERSION_LIST 3 PATCH_VERSION_GIT)
  292. if("${VERSION_STRING_GIT}" STREQUAL "")
  293. set(VERSION_STRING_GIT "${MAJOR_VERSION_GIT}.${MINOR_VERSION_GIT}.${PATCH_VERSION_GIT}")
  294. endif()
  295. configure_file("${CMAKE_SOURCE_DIR}/version.cmake.in" "${CMAKE_SOURCE_DIR}/version.cmake")
  296. endif()
  297. if(NOT EXISTS "${CMAKE_SOURCE_DIR}/version.cmake")
  298. message( SEND_ERROR "Cound not find GIT or valid version.cmake. Version information will be invalid." )
  299. endif(NOT EXISTS "${CMAKE_SOURCE_DIR}/version.cmake")
  300. include("${CMAKE_SOURCE_DIR}/version.cmake")
  301. set(SUPERTUX_VERSION ${SUPERTUX_VERSION_STRING})
  302. configure_file(version.h.in ${CMAKE_BINARY_DIR}/version.h )
  303. set_source_files_properties(${CMAKE_BINARY_DIR}/version.h
  304. PROPERTIES GENERATED true)
  305. set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/supertux/main.cpp
  306. PROPERTIES OBJECT_DEPENDS "${CMAKE_BINARY_DIR}/version.h")
  307. set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/supertux/title_screen.cpp
  308. PROPERTIES OBJECT_DEPENDS "${CMAKE_BINARY_DIR}/version.h")
  309. set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/src/addon/addon_manager.cpp
  310. PROPERTIES OBJECT_DEPENDS "${CMAKE_BINARY_DIR}/version.h")
  311. ## Configure doxygen
  312. # Adapted from https://tty1.net/blog/2014/cmake-doxygen_en.html
  313. # add a target to generate API documentation with Doxygen
  314. find_package(Doxygen)
  315. option(BUILD_DOCUMENTATION "Build API documentation using Doxygen" ${DOXYGEN_FOUND})
  316. if(BUILD_DOCUMENTATION)
  317. if(NOT DOXYGEN_FOUND)
  318. message(FATAL_ERROR "Doxygen is needed to build the documentation.")
  319. endif()
  320. set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in)
  321. set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/docs/Doxyfile)
  322. configure_file(${doxyfile_in} ${doxyfile} @ONLY)
  323. add_custom_target(doc
  324. COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile}
  325. WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
  326. COMMENT "Generating API documentation with Doxygen"
  327. VERBATIM)
  328. endif()
  329. ## Check platform-dependent build options
  330. include(ConfigureChecks)
  331. # Include altivec wrapper on ppc
  332. if(CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc.*")
  333. include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/ppc)
  334. endif()
  335. ## Also build external/squirrel
  336. if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/squirrel/CMakeLists.txt)
  337. message(FATAL_ERROR "squirrel submodule is not checked out or ${CMAKE_CURRENT_SOURCE_DIR}/external/squirrel/CMakeLists.txt is missing")
  338. endif()
  339. set(SQUIRREL_PREFIX ${CMAKE_BINARY_DIR}/squirrel/ex)
  340. ExternalProject_Add(squirrel
  341. SOURCE_DIR "${CMAKE_SOURCE_DIR}/external/squirrel/"
  342. BUILD_BYPRODUCTS
  343. "${SQUIRREL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}sqstdlib_static${CMAKE_STATIC_LIBRARY_SUFFIX}"
  344. "${SQUIRREL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}squirrel_static${CMAKE_STATIC_LIBRARY_SUFFIX}"
  345. CMAKE_ARGS
  346. -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
  347. -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
  348. -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
  349. -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
  350. -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
  351. -DCMAKE_INSTALL_PREFIX=${SQUIRREL_PREFIX}
  352. -DINSTALL_INC_DIR=include
  353. -DCMAKE_POSITION_INDEPENDENT_CODE=ON)
  354. if(WIN32)
  355. add_library(squirrel_lib SHARED IMPORTED)
  356. set_target_properties(squirrel_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/bin/${CMAKE_SHARED_LIBRARY_PREFIX}squirrel${CMAKE_SHARED_LIBRARY_SUFFIX}")
  357. set_target_properties(squirrel_lib PROPERTIES IMPORTED_IMPLIB "${SQUIRREL_PREFIX}/lib/squirrel${CMAKE_LINK_LIBRARY_SUFFIX}")
  358. add_library(sqstdlib_lib SHARED IMPORTED)
  359. set_target_properties(sqstdlib_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/bin/${CMAKE_SHARED_LIBRARY_PREFIX}sqstdlib${CMAKE_SHARED_LIBRARY_SUFFIX}")
  360. set_target_properties(sqstdlib_lib PROPERTIES IMPORTED_IMPLIB "${SQUIRREL_PREFIX}/lib/sqstdlib${CMAKE_LINK_LIBRARY_SUFFIX}")
  361. #For debug run purposes
  362. configure_file("${CMAKE_CURRENT_SOURCE_DIR}/mk/msvc/run_supertux.bat.in" "${PROJECT_BINARY_DIR}/run_supertux.bat")
  363. else()
  364. add_library(squirrel_lib STATIC IMPORTED)
  365. set_target_properties(squirrel_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}squirrel_static${CMAKE_STATIC_LIBRARY_SUFFIX}")
  366. add_library(sqstdlib_lib STATIC IMPORTED)
  367. set_target_properties(sqstdlib_lib PROPERTIES IMPORTED_LOCATION "${SQUIRREL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}sqstdlib_static${CMAKE_STATIC_LIBRARY_SUFFIX}")
  368. endif()
  369. include_directories(SYSTEM ${SQUIRREL_PREFIX}/include)
  370. ## Also build external/tinygettext
  371. if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/tinygettext/CMakeLists.txt)
  372. message(FATAL_ERROR "tinygettext submodule is not checked out or ${CMAKE_CURRENT_SOURCE_DIR}/external/tinygettext/CMakeLists.txt is missing")
  373. endif()
  374. # Include altivec wrapper on ppc
  375. if(CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc.*")
  376. set(TINYGETTEXT_CXX_FLAGS "-isystem ${CMAKE_CURRENT_SOURCE_DIR}/src/ppc ${CMAKE_CXX_FLAGS}")
  377. else()
  378. set(TINYGETTEXT_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  379. endif()
  380. set(TINYGETTEXT_PREFIX ${CMAKE_BINARY_DIR}/tinygettext/)
  381. ExternalProject_Add(tinygettext
  382. SOURCE_DIR "${CMAKE_SOURCE_DIR}/external/tinygettext/"
  383. BUILD_BYPRODUCTS "${TINYGETTEXT_PREFIX}/lib${LIB_SUFFIX}/${CMAKE_STATIC_LIBRARY_PREFIX}tinygettext${CMAKE_STATIC_LIBRARY_SUFFIX}"
  384. CMAKE_ARGS
  385. -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
  386. -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
  387. -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
  388. -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
  389. -DCMAKE_CXX_FLAGS=${TINYGETTEXT_CXX_FLAGS}
  390. -DBUILD_SHARED_LIBS=OFF
  391. -DHAVE_SDL=ON
  392. -DVCPKG_BUILD=${VCPKG_BUILD}
  393. -DCMAKE_INSTALL_PREFIX=${TINYGETTEXT_PREFIX}
  394. -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
  395. -DSDL2_LIBRARIES=${SDL2_LIBRARIES}
  396. -DSDL2_INCLUDE_DIRS=${SDL2_INCLUDE_DIRS}
  397. -DLIB_SUFFIX=${LIB_SUFFIX})
  398. add_library(tinygettext_lib STATIC IMPORTED)
  399. set_target_properties(tinygettext_lib PROPERTIES IMPORTED_LOCATION "${TINYGETTEXT_PREFIX}/lib${LIB_SUFFIX}/${CMAKE_STATIC_LIBRARY_PREFIX}tinygettext${CMAKE_STATIC_LIBRARY_SUFFIX}")
  400. include_directories(SYSTEM ${TINYGETTEXT_PREFIX}/include)
  401. ## external/SDL_ttf with patches
  402. find_package(Freetype REQUIRED)
  403. find_package(RAQM)
  404. set(SDL_TTF_PREFIX ${CMAKE_BINARY_DIR}/SDL_ttf/)
  405. ExternalProject_Add(SDL_ttf
  406. SOURCE_DIR "${CMAKE_SOURCE_DIR}/external/SDL_ttf/"
  407. BUILD_BYPRODUCTS "${SDL_TTF_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2_ttf${CMAKE_STATIC_LIBRARY_SUFFIX}"
  408. CMAKE_ARGS
  409. -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
  410. -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
  411. -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
  412. -DCMAKE_INSTALL_PREFIX=${SDL_TTF_PREFIX}
  413. -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
  414. -DWITH_RAQM=${RAQM_FOUND}
  415. -DRAQM_LIBRARIES=${RAQM_LIBRARY}
  416. -DRAQM_INCLUDE_DIR=${RAQM_INCLUDE_DIR}
  417. -DBUILD_SHARED_LIBS=OFF)
  418. add_library(SDL_ttf_lib STATIC IMPORTED)
  419. set_target_properties(SDL_ttf_lib PROPERTIES IMPORTED_LOCATION "${SDL_TTF_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2_ttf${CMAKE_STATIC_LIBRARY_SUFFIX}")
  420. link_directories(${SDL_TTF_PREFIX}/lib)
  421. include_directories(SYSTEM ${SDL_TTF_PREFIX}/include/SDL2)
  422. if(RAQM_FOUND)
  423. find_package(Fribidi REQUIRED)
  424. find_package(Harfbuzz REQUIRED)
  425. set_target_properties(SDL_ttf_lib PROPERTIES INTERFACE_LINK_LIBRARIES "${RAQM_LIBRARIES}")
  426. endif()
  427. ## Some additional include paths
  428. include_directories(${CMAKE_BINARY_DIR}/)
  429. include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/)
  430. include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/external/findlocale/)
  431. include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/external/obstack/)
  432. include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/external/sexp-cpp/include/)
  433. include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/external/SDL_SavePNG/)
  434. # Discord SDK
  435. # Before removing messages, please check with the community if no one minds that the Discord SDK gets bundled with ST.
  436. # Some privay-concerned users or free software package managers might need an option to compile ST without the Discord integration.
  437. option(ENABLE_DISCORD "Compile the Discord integration" ON)
  438. if(ENABLE_DISCORD)
  439. message(STATUS "Discord WILL be compiled. To disable Discord, pass -DENABLE_DISCORD=Off")
  440. include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/external/discord-sdk/include)
  441. set(BUILD_EXAMPLES OFF)
  442. add_subdirectory(external/discord-sdk)
  443. else(ENABLE_DISCORD)
  444. message(STATUS "WARNING : Discord is NOT to be compiled. To enable Discord, pass -DENABLE_DISCORD=On")
  445. endif(ENABLE_DISCORD)
  446. if(WIN32)
  447. add_definitions(-D_USE_MATH_DEFINES -DNOMINMAX)
  448. add_definitions(-DWIN32)
  449. endif(WIN32)
  450. ## Lint
  451. if(CMAKE_VERSION VERSION_GREATER 3.6)
  452. if (USE_CLANG_TIDY)
  453. find_program(
  454. CLANG_TIDY_EXE
  455. NAMES "clang-tidy"
  456. DOC "Path to clang-tidy executable"
  457. )
  458. if(NOT CLANG_TIDY_EXE)
  459. message(FATAL_ERROR "clang-tidy not found.")
  460. else()
  461. message(STATUS "clang-tidy found: ${CLANG_TIDY_EXE}")
  462. set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_EXE}")
  463. endif()
  464. endif()
  465. endif()
  466. ## Build list of sources for supertux binary
  467. file(GLOB SUPERTUX_SOURCES_C RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} external/obstack/*.c external/findlocale/findlocale.c)
  468. file(GLOB SUPERTUX_SOURCES_CXX RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/*/*.cpp src/supertux/menu/*.cpp src/video/sdl/*.cpp src/video/null/*.cpp)
  469. file(GLOB SUPERTUX_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${PROJECT_BINARY_DIR}/tmp/*.rc")
  470. if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/external/sexp-cpp/CMakeLists.txt)
  471. message(FATAL_ERROR "sexp-cpp submodule is not checked out or ${CMAKE_CURRENT_SOURCE_DIR}/external/sexp-cpp/CMakeLists.txt is missing")
  472. endif()
  473. file(GLOB SEXP_SOURCES_CXX RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} external/sexp-cpp/src/*.cpp)
  474. add_library(sexp STATIC ${SEXP_SOURCES_CXX})
  475. target_compile_definitions(sexp PRIVATE -DSEXP_USE_LOCALE)
  476. file(GLOB SAVEPNG_SOURCES_CXX RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} external/SDL_SavePNG/savepng.c)
  477. add_library(savepng STATIC ${SAVEPNG_SOURCES_CXX})
  478. target_include_directories(savepng SYSTEM PUBLIC ${SDL2_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS})
  479. target_link_libraries(savepng PUBLIC ${PNG_LIBRARIES})
  480. if(HAVE_OPENGL)
  481. file(GLOB SUPERTUX_OPENGL_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} src/video/gl/*.cpp)
  482. set(SUPERTUX_SOURCES_CXX ${SUPERTUX_SOURCES_CXX} ${SUPERTUX_OPENGL_SOURCES})
  483. endif(HAVE_OPENGL)
  484. ## Sort source lists to have deterministic linking order
  485. list(SORT SUPERTUX_SOURCES_C)
  486. list(SORT SUPERTUX_SOURCES_CXX)
  487. list(SORT SUPERTUX_RESOURCES)
  488. if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.cpp)
  489. set(SUPERTUX_SOURCES_CXX ${SUPERTUX_SOURCES_CXX} ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.cpp)
  490. endif(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.cpp)
  491. ## Compile everything at once (roughly equivalent to cat *.cpp | gcc)
  492. option(COMPILE_AMALGATION "Compile all the files together at once (experimental)" OFF)
  493. if(COMPILE_AMALGATION)
  494. file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/amalgation.cpp "// Includes all source files of the project\n")
  495. foreach(ST_FILE ${SUPERTUX_SOURCES_CXX})
  496. file(RELATIVE_PATH CXX_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src "${CMAKE_CURRENT_SOURCE_DIR}/${ST_FILE}")
  497. file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/amalgation.cpp "#include \"${CXX_FILE}\"\n")
  498. endforeach(ST_FILE)
  499. ## Build instead of CXX sources
  500. set(SUPERTUX_SOURCES_CXX ${CMAKE_CURRENT_BINARY_DIR}/amalgation.cpp)
  501. else(COMPILE_AMALGATION)
  502. if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/amalgation.cpp)
  503. file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/amalgation.cpp)
  504. endif(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/amalgation.cpp)
  505. endif(COMPILE_AMALGATION)
  506. ## Debug options
  507. option(WERROR "Stop on first compiler warning" OFF)
  508. option(WARNINGS "Enable long list of warnings for compiler to check" OFF)
  509. option(USE_CLANG_TIDY "Run clang-tidy" OFF)
  510. if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  511. set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g" CACHE STRING "Debug flags")
  512. set(CMAKE_C_FLAGS_DEBUG "-O0 -g" CACHE STRING "Debug flags")
  513. set(CMAKE_CXX_FLAGS_PROFILE "-pg" CACHE STRING "Profile flags")
  514. set(CMAKE_C_FLAGS_PROFILE "-pg" CACHE STRING "Profile flags")
  515. set(CMAKE_LD_FLAGS_PROFILE "-lgmon" CACHE STRING "Profile flags")
  516. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -funit-at-a-time")
  517. if(WERROR)
  518. add_definitions(-Werror)
  519. else(WERROR)
  520. remove_definitions(-Werror)
  521. endif(WERROR)
  522. if(WARNINGS)
  523. # temporarily disabled:
  524. # -Wsign-conversion -Wfloat-equal -Wundef -Wswitch-default
  525. # -Wswitch-enum -Wsign-promo -Wcast-qual -Woverloaded-virtual -Wmissing-format-attribute
  526. # -Wpadded -Wabi -Winline -Wunsafe-loop-optimizations -Wstrict-overflow=5
  527. # fails on MinGW:
  528. # -ansi
  529. if(CMAKE_COMPILER_IS_GNUCXX)
  530. string(CONCAT SUPERTUX2_EXTRA_WARNING_FLAGS
  531. "-fdiagnostics-show-option "
  532. "-pedantic "
  533. "-Wno-long-long "
  534. "-Wcast-align "
  535. "-Wdisabled-optimization "
  536. "-Winit-self -Winvalid-pch "
  537. "-Wmissing-include-dirs "
  538. "-Wmissing-noreturn "
  539. "-Wpacked -Wredundant-decls "
  540. "-Wformat=2 "
  541. "-Weffc++ "
  542. "-Wctor-dtor-privacy "
  543. "-Wno-unused-parameter "
  544. "-Wshadow "
  545. "-Wnon-virtual-dtor "
  546. "-Wcast-qual "
  547. "-Wold-style-cast "
  548. "-Wzero-as-null-pointer-constant "
  549. "-Wconversion "
  550. "-Wlogical-op "
  551. "-Wstrict-null-sentinel "
  552. "-Wsuggest-override "
  553. )
  554. if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8)
  555. string(CONCAT SUPERTUX2_EXTRA_WARNING_FLAGS
  556. "${SUPERTUX2_EXTRA_WARNING_FLAGS} "
  557. "-Wint-in-bool-context "
  558. )
  559. endif()
  560. if(Boost_VERSION LESS 106500)
  561. string(CONCAT SUPERTUX2_EXTRA_WARNING_FLAGS
  562. "${SUPERTUX2_EXTRA_WARNING_FLAGS} "
  563. "-Wno-implicit-fallthrough ")
  564. endif()
  565. elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  566. string(CONCAT SUPERTUX2_EXTRA_WARNING_FLAGS
  567. "${SUPERTUX2_EXTRA_WARNING_FLAGS} "
  568. "-Weverything "
  569. # flags that we deliberately ignore
  570. "-Wno-c++98-compat "
  571. "-Wno-c++98-compat-pedantic "
  572. "-Wno-float-equal "
  573. "-Wno-padded "
  574. "-Wno-weak-vtables "
  575. "-Wno-disabled-macro-expansion "
  576. "-Wno-documentation "
  577. "-Wno-reserved-id-macro "
  578. "-Wno-sign-conversion "
  579. # warnings that should probably be fixed in code
  580. "-Wno-documentation-unknown-command "
  581. "-Wno-inconsistent-missing-destructor-override "
  582. "-Wno-deprecated-dynamic-exception-spec "
  583. "-Wno-deprecated "
  584. "-Wno-switch-enum "
  585. "-Wno-covered-switch-default "
  586. "-Wno-exit-time-destructors "
  587. "-Wno-global-constructors "
  588. "-Wno-duplicate-enum "
  589. "-Wno-unreachable-code "
  590. )
  591. # This snipped adapted from AOMediaCodec cmakefile
  592. # The detection of cross compilation by -Wpoison-system-directories has false positives on macOS because
  593. # --sysroot is implicitly added. Turn the warning off.
  594. if(NOT DEFINED HAVE_POISON_SYSTEM_DIRECTORIES_WARNING)
  595. check_cxx_compiler_flag(-Wpoison-system-directories HAVE_POISON_SYSTEM_DIRECTORIES_WARNING)
  596. endif()
  597. if(HAVE_POISON_SYSTEM_DIRECTORIES_WARNING)
  598. string(CONCAT SUPERTUX2_EXTRA_WARNING_FLAGS
  599. "${SUPERTUX2_EXTRA_WARNING_FLAGS} "
  600. "-Wno-poison-system-directories ")
  601. endif()
  602. endif()
  603. endif(WARNINGS)
  604. endif()
  605. ## If xgettext is available, generate messages.pot for sources
  606. option(GENERATE_MESSAGESPOT "Generate messages.pot files" OFF)
  607. if(GENERATE_MESSAGESPOT)
  608. mark_as_advanced(
  609. XGETTEXT_EXECUTABLE
  610. )
  611. find_program(XGETTEXT_EXECUTABLE xgettext)
  612. if(NOT XGETTEXT_EXECUTABLE)
  613. message(STATUS "Warning: xgettext not found - will not update messages.pot")
  614. else(NOT XGETTEXT_EXECUTABLE)
  615. message(STATUS "Found xgettext: ${XGETTEXT_EXECUTABLE}")
  616. set(MESSAGES_POT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/data/locale/messages.pot)
  617. add_custom_command(
  618. OUTPUT ${MESSAGES_POT_FILE}
  619. COMMAND ${XGETTEXT_EXECUTABLE}
  620. ARGS --keyword=_ --language=C++ --output=${MESSAGES_POT_FILE} ${SUPERTUX_SOURCES_CXX}
  621. DEPENDS ${SUPERTUX_SOURCES_CXX}
  622. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  623. COMMENT "Generating POT file ${MESSAGES_POT_FILE}"
  624. )
  625. list(APPEND MESSAGES_POT_FILES ${MESSAGES_POT_FILE})
  626. file(GLOB SUPERTUX_LEVEL_DIRS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} data/levels/*)
  627. foreach(SUPERTUX_LEVEL_DIR ${SUPERTUX_LEVEL_DIRS})
  628. file(GLOB SUPERTUX_LEVELS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${SUPERTUX_LEVEL_DIR}/*.stl ${SUPERTUX_LEVEL_DIR}/*.stwm ${SUPERTUX_LEVEL_DIR}/*.txt)
  629. ## Do not add target if SUPERTUX_LEVELS is empty. This is needed for cmake <=2.4
  630. if(SUPERTUX_LEVELS)
  631. set(MESSAGES_POT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${SUPERTUX_LEVEL_DIR}/messages.pot)
  632. add_custom_command(
  633. OUTPUT ${MESSAGES_POT_FILE}
  634. COMMAND ${XGETTEXT_EXECUTABLE}
  635. ARGS --keyword="_:1" --language=Lisp --force-po --sort-by-file "--output=${MESSAGES_POT_FILE}" ${SUPERTUX_LEVELS}
  636. DEPENDS ${SUPERTUX_LEVELS}
  637. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  638. COMMENT "Generating POT file ${MESSAGES_POT_FILE}"
  639. )
  640. list(APPEND MESSAGES_POT_FILES ${MESSAGES_POT_FILE})
  641. endif(SUPERTUX_LEVELS)
  642. endforeach(SUPERTUX_LEVEL_DIR)
  643. add_custom_target(
  644. supertux2-messages ALL
  645. DEPENDS ${MESSAGES_POT_FILES}
  646. )
  647. endif(NOT XGETTEXT_EXECUTABLE)
  648. endif(GENERATE_MESSAGESPOT)
  649. ## Some additional compiler switches
  650. if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  651. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
  652. endif()
  653. if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  654. add_definitions(-DMACOSX)
  655. endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  656. ## On Windows, add an icon
  657. if(WIN32)
  658. # set(SUPERTUX_SOURCES_C ${SUPERTUX_SOURCES_C} ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.rc)
  659. if(MINGW)
  660. add_custom_command(
  661. OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o
  662. 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)
  663. set(SUPERTUX_SOURCES_C ${SUPERTUX_SOURCES_C} ${CMAKE_CURRENT_BINARY_DIR}/supertux_rc.o)
  664. endif(MINGW)
  665. endif(WIN32)
  666. ## Build miniswig and generate miniswig wrapper
  667. option(GENERATE_WRAPPER "Build miniswig and generate the wrapper" OFF)
  668. if(GENERATE_WRAPPER)
  669. add_subdirectory(tools/miniswig)
  670. add_custom_command(
  671. OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.hpp
  672. COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_CXX_COMPILER}
  673. 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
  674. COMMAND tools/miniswig/miniswig
  675. 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
  676. DEPENDS tools/miniswig/miniswig
  677. IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/src/scripting/wrapper.interface.hpp
  678. )
  679. if(USE_CLANG_TIDY)
  680. set_target_properties(miniswig PROPERTIES CXX_CLANG_TIDY "")
  681. endif()
  682. endif(GENERATE_WRAPPER)
  683. ## Generate supertux executable in the right place
  684. #set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
  685. set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR})
  686. ## Add target for supertux binary
  687. add_library(supertux2_c OBJECT ${SUPERTUX_SOURCES_C})
  688. add_library(supertux2_lib STATIC ${CMAKE_BINARY_DIR}/version.h ${SUPERTUX_SOURCES_CXX} ${SUPERTUX_RESOURCES} $<TARGET_OBJECTS:supertux2_c>)
  689. if(WIN32)
  690. add_executable(supertux2 WIN32 src/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.rc)
  691. target_link_libraries(supertux2 ${SDL2MAIN_LIBRARIES})
  692. else()
  693. add_executable(supertux2 src/main.cpp)
  694. endif(WIN32)
  695. target_link_libraries(supertux2 supertux2_lib Boost::filesystem Boost::locale)
  696. set_target_properties(supertux2_lib PROPERTIES OUTPUT_NAME supertux2_lib)
  697. set_target_properties(supertux2_lib PROPERTIES COMPILE_FLAGS "${SUPERTUX2_EXTRA_WARNING_FLAGS}")
  698. if(WIN32 AND NOT VCPKG_BUILD)
  699. ## Copy dlls on windows
  700. add_custom_command(TARGET supertux2_lib POST_BUILD
  701. COMMAND ${CMAKE_COMMAND} -E copy_directory
  702. "${DEPENDENCY_FOLDER}/dll"
  703. $<TARGET_FILE_DIR:supertux2_lib>)
  704. endif(WIN32 AND NOT VCPKG_BUILD)
  705. ## Link supertux binary with squirrel and other libraries
  706. add_dependencies(supertux2_lib tinygettext)
  707. add_dependencies(supertux2_lib squirrel)
  708. add_dependencies(supertux2_lib SDL_ttf)
  709. if(VCPKG_BUILD)
  710. target_include_directories(supertux2_lib PUBLIC ${CURL_INCLUDE_DIRS})
  711. endif()
  712. target_include_directories(supertux2_lib SYSTEM PUBLIC ${SDL2_INCLUDE_DIRS})
  713. target_include_directories(supertux2_lib SYSTEM PUBLIC ${SDL2IMAGE_INCLUDE_DIRS})
  714. target_include_directories(supertux2_lib SYSTEM PUBLIC ${SDL_TTF_PREFIX}/include/SDL2)
  715. if(VCPKG_BUILD)
  716. target_link_libraries(supertux2_lib PRIVATE SDL2::SDL2main SDL2::SDL2 SDL2_image)
  717. else()
  718. target_link_libraries(supertux2_lib PUBLIC ${SDL2_LIBRARIES})
  719. target_link_libraries(supertux2_lib PUBLIC ${SDL2IMAGE_LIBRARIES})
  720. endif()
  721. target_link_libraries(supertux2_lib PUBLIC SDL_ttf_lib)
  722. target_link_libraries(supertux2_lib PUBLIC ${FREETYPE_LIBRARIES})
  723. if(RAQM_FOUND)
  724. target_link_libraries(supertux2_lib PUBLIC ${HARFBUZZ_LIBRARY} ${FRIBIDI_LIBRARY} ${RAQM_LIBRARY})
  725. endif()
  726. target_link_libraries(supertux2_lib PUBLIC squirrel_lib)
  727. target_link_libraries(supertux2_lib PUBLIC sqstdlib_lib)
  728. target_link_libraries(supertux2_lib PUBLIC tinygettext_lib)
  729. target_link_libraries(supertux2_lib PUBLIC sexp)
  730. target_link_libraries(supertux2_lib PUBLIC savepng)
  731. if(ENABLE_DISCORD)
  732. target_link_libraries(supertux2_lib PUBLIC discord-rpc)
  733. endif(ENABLE_DISCORD)
  734. if(VCPKG_BUILD)
  735. target_link_libraries(supertux2_lib PUBLIC OpenAL::OpenAL)
  736. else()
  737. target_link_libraries(supertux2_lib PUBLIC ${OPENAL_LIBRARY})
  738. endif()
  739. target_link_libraries(supertux2_lib PUBLIC ${OGGVORBIS_LIBRARIES})
  740. target_link_libraries(supertux2_lib PUBLIC ${Boost_LIBRARIES})
  741. if(USE_SYSTEM_PHYSFS)
  742. target_link_libraries(supertux2_lib PUBLIC ${PHYSFS_LIBRARY})
  743. else()
  744. add_dependencies(supertux2_lib physfs)
  745. target_link_libraries(supertux2_lib PUBLIC physfs_lib)
  746. if(APPLE)
  747. target_link_libraries(supertux2_lib PUBLIC "-framework CoreFoundation")
  748. target_link_libraries(supertux2_lib PUBLIC "-framework Foundation")
  749. target_link_libraries(supertux2_lib PUBLIC "-framework IOKit")
  750. endif()
  751. endif()
  752. if(HAVE_OPENGL)
  753. target_link_libraries(supertux2_lib PUBLIC ${OPENGL_LIBRARY})
  754. if(NOT ENABLE_OPENGLES2)
  755. if(GLBINDING_FOUND)
  756. target_link_libraries(supertux2_lib PUBLIC ${GLBINDING_LIBRARIES})
  757. else()
  758. target_link_libraries(supertux2_lib PUBLIC GLEW::GLEW)
  759. endif()
  760. endif()
  761. endif(HAVE_OPENGL)
  762. if(HAVE_LIBCURL)
  763. if(VCPKG_BUILD)
  764. target_link_libraries(supertux2_lib PUBLIC ${CURL_LIBRARIES})
  765. else()
  766. target_link_libraries(supertux2_lib PUBLIC ${CURL_LIBRARY})
  767. endif()
  768. endif(HAVE_LIBCURL)
  769. if(BUILD_TESTS)
  770. find_package(Threads REQUIRED)
  771. # build gtest
  772. # ${CMAKE_CURRENT_SOURCE_DIR} in include_directories is needed to generate -isystem instead of -I flags
  773. add_library(gtest_main STATIC ${CMAKE_CURRENT_SOURCE_DIR}/external/googletest/googletest/src/gtest_main.cc)
  774. target_include_directories(gtest_main SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/googletest/googletest/include/)
  775. add_library(gtest STATIC ${CMAKE_CURRENT_SOURCE_DIR}/external/googletest/googletest/src/gtest-all.cc)
  776. target_include_directories(gtest SYSTEM PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/external/googletest/googletest/)
  777. target_include_directories(gtest SYSTEM PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/external/googletest/googletest/include/)
  778. # build SuperTux tests
  779. file(GLOB TEST_SUPERTUX_SOURCES tests/*.cpp)
  780. add_executable(test_supertux2 ${TEST_SUPERTUX_SOURCES})
  781. target_compile_options(test_supertux2 PRIVATE ${WARNINGS_CXX_FLAGS})
  782. target_link_libraries(test_supertux2
  783. gtest gtest_main
  784. supertux2_lib
  785. ${CMAKE_THREAD_LIBS_INIT})
  786. # add 'make test' target, use 'make test ARGS="-V"' or 'ctest -V' for verbose
  787. enable_testing()
  788. add_test(NAME test_supertux2
  789. WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
  790. COMMAND test_supertux2)
  791. endif()
  792. ## Install stuff
  793. option(DISABLE_CPACK_BUNDLING "Build an .app bundle without CPack" OFF)
  794. if(WIN32 AND NOT UNIX)
  795. set(INSTALL_SUBDIR_BIN "bin" CACHE STRING "Installation subdir for binaries")
  796. set(INSTALL_SUBDIR_SHARE "data" CACHE STRING "Installation subdir for data")
  797. set(INSTALL_SUBDIR_DOC "doc" CACHE STRING "Installation subdir for docs")
  798. if(VCPKG_BUILD)
  799. install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/\${CMAKE_INSTALL_CONFIG_NAME}/" DESTINATION ${INSTALL_SUBDIR_BIN} FILES_MATCHING PATTERN "*.dll")
  800. else()
  801. install(FILES ${DLLS} DESTINATION ${INSTALL_SUBDIR_BIN})
  802. endif()
  803. install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.png ${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.ico DESTINATION ".")
  804. option(PACKAGE_VCREDIST "Package the VCREDIST libraries with the program" OFF)
  805. if(PACKAGE_VCREDIST)
  806. set(CMAKE_INSTALL_UCRT_LIBRARIES true)
  807. include(InstallRequiredSystemLibraries)
  808. endif()
  809. else(WIN32 AND NOT UNIX)
  810. if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND DISABLE_CPACK_BUNDLING)
  811. set(INFOPLIST_CFBUNDLEEXECUTABLE "supertux2")
  812. set(INSTALL_SUBDIR_BIN "SuperTux.app/Contents/MacOS" CACHE STRING "Installation subdir for binaries")
  813. set(INSTALL_SUBDIR_SHARE "SuperTux.app/Contents/Resources/data" CACHE STRING "Installation subdir for data")
  814. set(INSTALL_SUBDIR_DOC "SuperTux.app/Contents/Resources" CACHE STRING "Installation subdir for docs")
  815. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/info.plist.in ${CMAKE_BINARY_DIR}/tools/darwin/info.plist)
  816. install(FILES ${CMAKE_BINARY_DIR}/tools/darwin/info.plist DESTINATION "SuperTux.app/Contents/")
  817. install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/receipt DESTINATION "SuperTux.app/Contents/_MASReceipt/")
  818. 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/")
  819. else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND DISABLE_CPACK_BUNDLING)
  820. set(INSTALL_SUBDIR_BIN "games" CACHE STRING "Installation subdir for binaries")
  821. set(INSTALL_SUBDIR_SHARE "share/games/supertux2" CACHE STRING "Installation subdir for data")
  822. set(INSTALL_SUBDIR_DOC "share/doc/supertux2" CACHE STRING "Installation subdir for docs")
  823. install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/supertux2.desktop DESTINATION "share/applications")
  824. set(APPS "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_SUBDIR_BIN}/supertux2")
  825. 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/")
  826. install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/supertux2.svg DESTINATION "share/icons/hicolor/scalable/apps")
  827. endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND DISABLE_CPACK_BUNDLING)
  828. endif(WIN32 AND NOT UNIX)
  829. install(TARGETS supertux2 DESTINATION ${INSTALL_SUBDIR_BIN})
  830. if(WIN32)
  831. get_property(SQUIRREL_LIB_PATH TARGET squirrel_lib PROPERTY IMPORTED_LOCATION)
  832. get_property(SQSTDLIB_LIB_PATH TARGET sqstdlib_lib PROPERTY IMPORTED_LOCATION)
  833. get_property(PHYSFS_LIB_PATH TARGET physfs_lib PROPERTY IMPORTED_LOCATION)
  834. install(FILES ${SQUIRREL_LIB_PATH} ${SQSTDLIB_LIB_PATH} ${PHYSFS_LIB_PATH} DESTINATION ${INSTALL_SUBDIR_BIN})
  835. endif()
  836. 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})
  837. install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/credits.stxt DESTINATION ${INSTALL_SUBDIR_SHARE})
  838. install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/supertux2.appdata.xml DESTINATION "share/metainfo" )
  839. install(DIRECTORY
  840. ${CMAKE_CURRENT_SOURCE_DIR}/data/images
  841. ${CMAKE_CURRENT_SOURCE_DIR}/data/fonts
  842. ${CMAKE_CURRENT_SOURCE_DIR}/data/music
  843. ${CMAKE_CURRENT_SOURCE_DIR}/data/particles
  844. ${CMAKE_CURRENT_SOURCE_DIR}/data/scripts
  845. ${CMAKE_CURRENT_SOURCE_DIR}/data/shader
  846. ${CMAKE_CURRENT_SOURCE_DIR}/data/speech
  847. ${CMAKE_CURRENT_SOURCE_DIR}/data/sounds
  848. ${CMAKE_CURRENT_SOURCE_DIR}/data/locale
  849. DESTINATION ${INSTALL_SUBDIR_SHARE})
  850. if(CMAKE_BUILD_TYPE MATCHES "Release|RelWithDebInfo")
  851. install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/levels
  852. DESTINATION ${INSTALL_SUBDIR_SHARE}
  853. PATTERN "data/levels/test" EXCLUDE
  854. PATTERN "data/levels/test_old" EXCLUDE
  855. PATTERN "data/levels/incubator" EXCLUDE
  856. PATTERN "data/levels/misc/menu.stl.in" EXCLUDE)
  857. else()
  858. install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/levels
  859. DESTINATION ${INSTALL_SUBDIR_SHARE}
  860. PATTERN "data/levels/misc/menu.stl.in" EXCLUDE)
  861. endif()
  862. install(FILES "${CMAKE_BINARY_DIR}/data/levels/misc/menu.stl" DESTINATION "${INSTALL_SUBDIR_SHARE}/levels/misc")
  863. ## Create config.h now that INSTALL_SUBDIR_* have been set.
  864. configure_file(config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
  865. ## Configure main menu logo
  866. if(("${SUPERTUX_VERSION_STRING}" MATCHES "^v[0-9]+\\.[0-9]+\\.[0-9]+$") OR IS_SUPERTUX_RELEASE)
  867. set(LOGO_FILE "logo_final.sprite")
  868. else()
  869. set(LOGO_FILE "logo.sprite")
  870. endif()
  871. configure_file(data/levels/misc/menu.stl.in ${CMAKE_BINARY_DIR}/data/levels/misc/menu.stl )
  872. ## CPack/Installation-specific stuff
  873. include(InstallRequiredSystemLibraries)
  874. set(DIRS ${Boost_LIBRARY_DIRS} ${CMAKE_CURRENT_BINARY_DIR}/external/squirrel ${CMAKE_CURRENT_BINARY_DIR}/external/tinygettext)
  875. if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT DISABLE_CPACK_BUNDLING)
  876. set(INFOPLIST_CFBUNDLEEXECUTABLE "SuperTux")
  877. find_package(png)
  878. foreach (_file ${PNG_LIBRARIES})
  879. get_filename_component(_resolvedFile "${_file}" REALPATH)
  880. get_filename_component(_name "${_file}" NAME)
  881. install(FILES ${_resolvedFile} DESTINATION "MacOS" RENAME ${_name})
  882. endforeach()
  883. find_package(jpeg)
  884. foreach (_file ${JPEG_LIBRARIES})
  885. get_filename_component(_resolvedFile "${_file}" REALPATH)
  886. get_filename_component(_name "${_file}" NAME)
  887. install(FILES ${_resolvedFile} DESTINATION "MacOS" RENAME ${_name})
  888. endforeach()
  889. install(CODE "
  890. if(\"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/\" MATCHES \".*\\\\.app.*\")
  891. include(BundleUtilities)
  892. fixup_bundle(\"${APPS}\" \"\" \"${DIRS}\")
  893. endif()
  894. ")
  895. configure_file("${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/info.plist.in" "${CMAKE_BINARY_DIR}/tools/darwin/info.plist")
  896. set(CPACK_BUNDLE_NAME "SuperTux")
  897. set(CPACK_BUNDLE_PLIST "${CMAKE_BINARY_DIR}/tools/darwin/info.plist")
  898. set(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.icns")
  899. set(CPACK_BUNDLE_STARTUP_COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/startup.sh")
  900. set(CPACK_DMG_VOLUME_NAME "SuperTux ${SUPERTUX_VERSION_STRING}")
  901. set(CPACK_DMG_DS_STORE_SETUP_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/dsstore_setup.scpt")
  902. set(CPACK_DMG_BACKGROUND_IMAGE "${CMAKE_CURRENT_SOURCE_DIR}/tools/darwin/background.png")
  903. endif()
  904. set(CPACK_PACKAGE_NAME "SuperTux")
  905. set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Jump'n'Run Game featuring Tux")
  906. set(CPACK_PACKAGE_VENDOR "SuperTux Devel Team")
  907. set(CPACK_PACKAGE_CONTACT "SuperTux Devel Team <supertux-devel@lists.lethargik.org>")
  908. set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/;${CMAKE_BINARY_DIR};/\\\\..*")
  909. set(CPACK_DEBIAN_PACKAGE_NAME "supertux2")
  910. 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)")
  911. 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/")
  912. set(CPACK_DEBIAN_PACKAGE_SECTION "games")
  913. set(CPACK_RPM_PACKAGE_NAME "supertux2")
  914. 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/")
  915. set(CPACK_RPM_PACKAGE_LICENSE "GNU General Public License (GPL)")
  916. set(CPACK_RPM_PACKAGE_GROUP "Amusements/Games/Action/Arcade")
  917. set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
  918. set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt")
  919. set(CPACK_PACKAGE_VERSION_MAJOR ${SUPERTUX_VERSION_MAJOR})
  920. set(CPACK_PACKAGE_VERSION_MINOR ${SUPERTUX_VERSION_MINOR})
  921. if(SUPERTUX_VERSION_TWEAK)
  922. set(CPACK_PACKAGE_VERSION_PATCH "${SUPERTUX_VERSION_PATCH}.${SUPERTUX_VERSION_TWEAK}")
  923. else()
  924. set(CPACK_PACKAGE_VERSION_PATCH ${SUPERTUX_VERSION_PATCH})
  925. endif(SUPERTUX_VERSION_TWEAK)
  926. set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${SUPERTUX_VERSION_STRING}-${SUPERTUX_SYSTEM_NAME}")
  927. set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${SUPERTUX_VERSION_STRING}-Source")
  928. set(CPACK_PACKAGE_INSTALL_DIRECTORY "SuperTux")
  929. set(CPACK_PACKAGE_EXECUTABLES "supertux2" "SuperTux")
  930. if(WIN32 AND NOT UNIX)
  931. set(CPACK_NSIS_INSTALLED_ICON_NAME "supertux2")
  932. set(CPACK_NSIS_DISPLAY_NAME "SuperTux")
  933. set(CPACK_NSIS_COMPRESSOR "/SOLID lzma")
  934. set(CPACK_WIX_PROGRAM_MENU_FOLDER "")
  935. set(CPACK_WIX_UPGRADE_GUID "93E16F4E-0A68-422A-8ADC-47BE5B9433B2")
  936. set(CPACK_WIX_PRODUCT_ICON "${CMAKE_CURRENT_SOURCE_DIR}/data/images/engine/icons/supertux.ico")
  937. set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/mk/wix/banner.png")
  938. set(CPACK_WIX_UI_DIALOG "${CMAKE_CURRENT_SOURCE_DIR}/mk/wix/dialog.png")
  939. set(CPACK_GENERATOR WIX)
  940. else(WIN32 AND NOT UNIX)
  941. endif(WIN32 AND NOT UNIX)
  942. include(CPack)
  943. # move some config clutter to the advanced section
  944. mark_as_advanced(
  945. INSTALL_SUBDIR_BIN
  946. INSTALL_SUBDIR_SHARE
  947. INSTALL_SUBDIR_DOC
  948. )
  949. mark_as_advanced(
  950. CMAKE_BACKWARDS_COMPATIBILITY
  951. CMAKE_BUILD_TYPE
  952. CMAKE_INSTALL_PREFIX
  953. EXECUTABLE_OUTPUT_PATH
  954. LIBRARY_OUTPUT_PATH
  955. CMAKE_OSX_ARCHITECTURES
  956. CMAKE_OSX_SYSROOT
  957. )
  958. mark_as_advanced(
  959. APPDATADIR
  960. )
  961. mark_as_advanced(
  962. Boost_INCLUDE_DIR
  963. Boost_LIBRARIES
  964. )
  965. mark_as_advanced(
  966. GLEW_INCLUDE_DIR
  967. GLEW_LIBRARY
  968. )
  969. mark_as_advanced(
  970. SDL2_INCLUDE_DIRS
  971. SDL2_LIBRARIES
  972. )
  973. mark_as_advanced(
  974. SDL2IMAGE_INCLUDE_DIRS
  975. SDL2IMAGE_LIBRARIES
  976. )
  977. mark_as_advanced(
  978. OPENAL_INCLUDE_DIR
  979. OPENAL_LIBRARY
  980. )
  981. mark_as_advanced(
  982. SDL2TTF_INCLUDE_DIRS
  983. SDL2TTF_LIBRARIES
  984. )
  985. mark_as_advanced(
  986. OGG_LIBRARY
  987. VORBISENC_LIBRARY
  988. VORBISFILE_LIBRARY
  989. VORBIS_INCLUDE_DIR
  990. VORBIS_LIBRARY
  991. )
  992. mark_as_advanced(
  993. PHYSFS_INCLUDE_DIR
  994. PHYSFS_LIBRARY
  995. )