CMakeLists.txt 45 KB

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