CMakeLists.txt 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. # root CMakeLists for the SuperTuxKart project
  2. project(SuperTuxKart)
  3. set(PROJECT_VERSION "0.8.1")
  4. cmake_minimum_required(VERSION 2.8.4)
  5. if(NOT (CMAKE_MAJOR_VERSION VERSION_LESS 3))
  6. cmake_policy(SET CMP0043 OLD)
  7. endif()
  8. set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
  9. include(BuildTypeSTKRelease)
  10. if (NOT CMAKE_BUILD_TYPE)
  11. message(STATUS "No build type selected, default to STKRelease")
  12. set(CMAKE_BUILD_TYPE "STKRelease")
  13. endif()
  14. option(USE_WIIUSE "Support for wiimote input devices" ON)
  15. option(USE_FRIBIDI "Support for right-to-left languages" ON)
  16. option(CHECK_ASSETS "Check if assets are installed in ../stk-assets" ON)
  17. option(USE_SYSTEM_ANGELSCRIPT "Use system angelscript instead of built-in angelscript. If you enable this option, make sure to use a compatible version." OFF)
  18. option(ENABLE_NETWORK_MULTIPLAYER "Enable network multiplayer. This will replace the online profile GUI in the main menu with the network multiplayer GUI" OFF)
  19. if(MSVC AND (MSVC_VERSION LESS 1900))
  20. # Normally hide the option to build wiiuse on VS, since it depends
  21. # on the installation of the Windows DDK (Driver Developer Kit),
  22. # which also needs an absolute path :(
  23. option(WIIUSE_BUILD "Build wiiuse lib (only for developers)" OFF)
  24. mark_as_advanced(WIIUSE_BUILD)
  25. else()
  26. set(WIIUSE_BUILD ON)
  27. endif()
  28. if(MINGW OR CYGWIN)
  29. set(USE_WIIUSE OFF)
  30. endif()
  31. if(UNIX AND NOT APPLE)
  32. option(USE_XRANDR "Use xrandr instead of vidmode" ON)
  33. option(USE_ASAN "Build with Leak/Address sanitizer" OFF)
  34. endif()
  35. set(STK_SOURCE_DIR "src")
  36. set(STK_DATA_DIR "${PROJECT_SOURCE_DIR}/data")
  37. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
  38. # Define install paths
  39. set(STK_INSTALL_BINARY_DIR "bin" CACHE
  40. STRING "Install executable to this directory, absolute or relative to CMAKE_INSTALL_PREFIX")
  41. set(STK_INSTALL_DATA_DIR "share/supertuxkart" CACHE
  42. STRING "Install data folder to this directory, absolute or relative to CMAKE_INSTALL_PREFIX")
  43. # These variables enable MSVC to find libraries located in "dependencies"
  44. if(WIN32)
  45. set(ENV{PATH} "$ENV{PATH};${PROJECT_SOURCE_DIR}/dependencies/include")
  46. set(ENV{LIB} ${PROJECT_SOURCE_DIR}/dependencies/lib)
  47. set(ENV{OPENALDIR} ${PROJECT_SOURCE_DIR}/dependencies)
  48. add_definitions(-D_IRR_STATIC_LIB_)
  49. endif()
  50. # Build the Bullet physics library
  51. add_subdirectory("${PROJECT_SOURCE_DIR}/lib/bullet")
  52. include_directories("${PROJECT_SOURCE_DIR}/lib/bullet/src")
  53. # Build the ENet UDP network library
  54. add_subdirectory("${PROJECT_SOURCE_DIR}/lib/enet")
  55. include_directories("${PROJECT_SOURCE_DIR}/lib/enet/include")
  56. # Build glew library
  57. add_subdirectory("${PROJECT_SOURCE_DIR}/lib/glew")
  58. include_directories("${PROJECT_SOURCE_DIR}/lib/glew/include")
  59. if((WIN32 AND NOT MINGW) OR APPLE)
  60. if (NOT APPLE)
  61. # Build zlib library
  62. add_subdirectory("${PROJECT_SOURCE_DIR}/lib/zlib")
  63. include_directories("${PROJECT_SOURCE_DIR}/lib/zlib")
  64. set(ZLIB_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lib/zlib" "${PROJECT_BINARY_DIR}/lib/zlib/")
  65. set(ZLIB_LIBRARY zlibstatic)
  66. endif()
  67. # Build png library
  68. set (SKIP_INSTALL_ALL TRUE)
  69. set (PNG_STATIC TRUE)
  70. set (PNG_TESTS FALSE)
  71. set (PNG_SHARED FALSE)
  72. add_subdirectory("${PROJECT_SOURCE_DIR}/lib/libpng")
  73. include_directories("${PROJECT_SOURCE_DIR}/lib/libpng")
  74. #build jpeg library
  75. add_subdirectory("${PROJECT_SOURCE_DIR}/lib/jpeglib")
  76. include_directories("${PROJECT_SOURCE_DIR}/lib/jpeglib")
  77. set(PNG_PNG_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lib/libpng/")
  78. set(PNG_LIBRARY png15_static)
  79. set(JPEG_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lib/jpeglib/")
  80. set(JPEG_LIBRARY jpeglib)
  81. endif()
  82. # Build the irrlicht library
  83. add_subdirectory("${PROJECT_SOURCE_DIR}/lib/irrlicht")
  84. include_directories("${PROJECT_SOURCE_DIR}/lib/irrlicht/include")
  85. # Build the Wiiuse library
  86. # Note: wiiuse MUST be declared after irrlicht, since otherwise
  87. # (at least on VS) irrlicht will find wiiuse io.h file because
  88. # of the added include directory.
  89. if(USE_WIIUSE)
  90. if(WIIUSE_BUILD)
  91. add_subdirectory("${PROJECT_SOURCE_DIR}/lib/wiiuse")
  92. endif()
  93. include_directories("${PROJECT_SOURCE_DIR}/lib/wiiuse")
  94. endif()
  95. # Set include paths
  96. include_directories(${STK_SOURCE_DIR})
  97. if(APPLE)
  98. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch i386")
  99. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch i386 -F/Library/Frameworks")
  100. elseif(MSVC)
  101. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") # Enable multi-processor compilation (faster)
  102. endif()
  103. # Build the angelscript library if not in system
  104. if(USE_SYSTEM_ANGELSCRIPT)
  105. find_package(Angelscript)
  106. if(ANGELSCRIPT_FOUND)
  107. include_directories(${Angelscript_INCLUDE_DIRS})
  108. else()
  109. message(FATAL_ERROR "Angelscript not found. "
  110. "Either install angelscript or use built-in version using "
  111. "-DUSE_SYSTEM_ANGELSCRIPT=0")
  112. endif()
  113. else()
  114. add_subdirectory("${PROJECT_SOURCE_DIR}/lib/angelscript/projects/cmake")
  115. include_directories("${PROJECT_SOURCE_DIR}/lib/angelscript/include")
  116. set(Angelscript_LIBRARIES angelscript)
  117. endif()
  118. # OpenAL
  119. if(APPLE)
  120. # In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
  121. # unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases :
  122. # the mac I use to make STK releases does have other installs of vorbis/ogg/etc. which aren't compatible with STK, so letting
  123. # CMake pick the library it wants essentially means I can't build.
  124. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -framework OpenAL")
  125. set(OPENAL_LIBRARY)
  126. else()
  127. find_package(OpenAL REQUIRED)
  128. include_directories(${OPENAL_INCLUDE_DIR})
  129. endif()
  130. # OggVorbis
  131. if(APPLE)
  132. # In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
  133. # unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases :
  134. # the mac I use to make STK releases does have other installs of vorbis/ogg/etc. which aren't compatible with STK, so letting
  135. # CMake pick the library it wants essentially means I can't build.
  136. set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -I/Library/Frameworks/Ogg.framework/Versions/A/Headers -I/Library/Frameworks/Vorbis.framework/Versions/A/Headers")
  137. else()
  138. find_package(OggVorbis REQUIRED)
  139. include_directories(${OGGVORBIS_INCLUDE_DIRS})
  140. endif()
  141. # Freetype
  142. find_package(Freetype)
  143. if(FREETYPE_FOUND)
  144. include_directories(${FREETYPE_INCLUDE_DIRS})
  145. else()
  146. message(FATAL_ERROR "Freetype not found. "
  147. "Freetype is required to display characters in SuperTuxKart. ")
  148. endif()
  149. # Fribidi
  150. if(USE_FRIBIDI)
  151. find_package(Fribidi)
  152. if(FRIBIDI_FOUND)
  153. include_directories(${FRIBIDI_INCLUDE_DIRS})
  154. else()
  155. message(FATAL_ERROR "Fribidi not found. "
  156. "Either install fribidi or disable bidi support with -DUSE_FRIBIDI=0 "
  157. "(if you don't use a right-to-left language then you don't need this).")
  158. endif()
  159. endif()
  160. # OpenMP
  161. find_package(OpenMP)
  162. if (OPENMP_FOUND)
  163. set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
  164. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
  165. endif()
  166. # OpenGL
  167. find_package(OpenGL REQUIRED)
  168. include_directories(${OPENGL_INCLUDE_DIR})
  169. if(UNIX AND NOT APPLE)
  170. find_package(X11 REQUIRED)
  171. include_directories(${X11_INCLUDE_DIR})
  172. if(USE_XRANDR)
  173. find_package(Xrandr REQUIRED)
  174. if(NOT XRANDR_FOUND)
  175. message(FATAL_ERROR "XRANDR not found.")
  176. endif()
  177. else()
  178. find_library(IRRLICHT_XF86VM_LIBRARY Xxf86vm)
  179. mark_as_advanced(IRRLICHT_XF86VM_LIBRARY)
  180. endif()
  181. endif()
  182. # Set some compiler options
  183. if(UNIX OR MINGW)
  184. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
  185. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
  186. endif()
  187. if(MINGW AND CMAKE_BUILD_TYPE MATCHES Release)
  188. SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--subsystem,windows")
  189. endif()
  190. # Netwowk Multiplayer
  191. if(ENABLE_NETWORK_MULTIPLAYER)
  192. add_definitions(-DENABLE_NETWORK_MULTIPLAYER_SCREEN)
  193. endif()
  194. if(WIN32)
  195. # By default windows.h has macros defined for min and max that screw up everything
  196. add_definitions(-DNOMINMAX)
  197. # And shut up about unsafe stuff
  198. add_definitions(-D_CRT_SECURE_NO_WARNINGS)
  199. # Avoid timespec structure redeclaration on Visual Studio 2015
  200. if (NOT (MSVC_VERSION LESS 1900))
  201. add_definitions(-DHAVE_STRUCT_TIMESPEC)
  202. endif()
  203. endif()
  204. if(MSVC)
  205. # VS will automatically add NDEBUG for release mode, but only _DEBUG in debug mode.
  206. # Since STK uses DEBUG, this is added for debug compilation only:
  207. set_property(DIRECTORY PROPERTY COMPILE_DEFINITIONS_DEBUG DEBUG)
  208. else()
  209. # All non VS generators used create only a single compile mode, so
  210. # compile flags can be simplye be added
  211. if(CMAKE_BUILD_TYPE MATCHES Debug)
  212. add_definitions(-DDEBUG)
  213. else()
  214. add_definitions(-DNDEBUG)
  215. endif()
  216. endif()
  217. # TODO: remove this switch
  218. add_definitions(-DHAVE_OGGVORBIS)
  219. if(WIN32)
  220. configure_file("${STK_SOURCE_DIR}/windows_installer/icon_rc.template" "${PROJECT_BINARY_DIR}/tmp/icon.rc")
  221. endif()
  222. # Provides list of source and header files (STK_SOURCES and STK_HEADERS)
  223. include(sources.cmake)
  224. # Generate source groups useful for MSVC project explorer
  225. include(cmake/SourceGroupFunctions.cmake)
  226. source_group_hierarchy(STK_SOURCES STK_HEADERS)
  227. if(APPLE)
  228. # icon files to copy in the bundle
  229. set(OSX_ICON_FILES ${PROJECT_SOURCE_DIR}/data/supertuxkart.icns)
  230. set_source_files_properties(${OSX_ICON_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
  231. set(STK_SOURCES ${STK_SOURCES} ${OSX_ICON_FILES})
  232. # build the executable and create an app bundle
  233. add_executable(supertuxkart MACOSX_BUNDLE ${STK_SOURCES})
  234. find_library(IOKIT_LIBRARY IOKit)
  235. find_library(QUICKTIME_LIBRARY QuickTime)
  236. find_library(CARBON_LIBRARY Carbon)
  237. find_library(AUDIOUNIT_LIBRARY AudioUnit)
  238. find_library(COCOA_LIBRARY Cocoa)
  239. target_link_libraries(supertuxkart
  240. ${IOKIT_LIBRARY}
  241. ${QUICKTIME_LIBRARY}
  242. ${CARBON_LIBRARY}
  243. ${AUDIOUNIT_LIBRARY}
  244. ${COCOA_LIBRARY})
  245. # configure CMake to use a custom Info.plist
  246. set_target_properties(supertuxkart PROPERTIES
  247. MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/data/SuperTuxKart-Info.plist)
  248. if(CMAKE_GENERATOR MATCHES "Xcode")
  249. add_custom_command(TARGET supertuxkart POST_BUILD
  250. COMMAND ln -f -s ${PROJECT_SOURCE_DIR}/data ${CMAKE_BINARY_DIR}/bin/\${CONFIGURATION}/supertuxkart.app/Contents/Resources)
  251. else()
  252. add_custom_command(TARGET supertuxkart POST_BUILD
  253. COMMAND ln -f -s ${PROJECT_SOURCE_DIR}/data ${CMAKE_BINARY_DIR}/bin/supertuxkart.app/Contents/Resources)
  254. endif()
  255. else()
  256. if(MSVC)
  257. set(PTHREAD_NAMES pthreadVC2)
  258. elseif(MINGW)
  259. set(PTHREAD_NAMES "winpthread-1" "libwinpthread-1" "pthreadGC2")
  260. endif()
  261. find_library(PTHREAD_LIBRARY NAMES pthread ${PTHREAD_NAMES} PATHS ${PROJECT_SOURCE_DIR}/dependencies/lib)
  262. mark_as_advanced(PTHREAD_LIBRARY)
  263. # Set data dir (absolute or relative to CMAKE_INSTALL_PREFIX)
  264. if(NOT STK_INSTALL_DATA_DIR_ABSOLUTE)
  265. get_filename_component(STK_INSTALL_DATA_DIR_ABSOLUTE ${STK_INSTALL_DATA_DIR} ABSOLUTE)
  266. if(${STK_INSTALL_DATA_DIR_ABSOLUTE} STREQUAL ${STK_INSTALL_DATA_DIR})
  267. add_definitions(-DSUPERTUXKART_DATADIR=\"${STK_INSTALL_DATA_DIR_ABSOLUTE}\")
  268. else()
  269. add_definitions(-DSUPERTUXKART_DATADIR=\"${CMAKE_INSTALL_PREFIX}/${STK_INSTALL_DATA_DIR}\")
  270. endif()
  271. else()
  272. add_definitions(-DSUPERTUXKART_DATADIR=\"${STK_INSTALL_DATA_DIR_ABSOLUTE}\")
  273. endif()
  274. # Build the final executable
  275. add_executable(supertuxkart ${STK_SOURCES} ${STK_RESOURCES} ${STK_HEADERS})
  276. target_link_libraries(supertuxkart ${PTHREAD_LIBRARY})
  277. endif()
  278. # CURL
  279. if(WIN32)
  280. target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/libcurldll.a)
  281. else()
  282. find_package(CURL REQUIRED)
  283. include_directories(${CURL_INCLUDE_DIRS})
  284. endif()
  285. # Common library dependencies
  286. target_link_libraries(supertuxkart
  287. bulletdynamics
  288. bulletcollision
  289. bulletmath
  290. enet
  291. glew
  292. stkirrlicht
  293. ${Angelscript_LIBRARIES}
  294. ${CURL_LIBRARIES}
  295. ${OGGVORBIS_LIBRARIES}
  296. ${OPENAL_LIBRARY}
  297. ${OPENGL_LIBRARIES}
  298. ${FREETYPE_LIBRARIES}
  299. )
  300. if(UNIX AND NOT APPLE)
  301. target_link_libraries(supertuxkart ${X11_LIBRARIES})
  302. if(USE_XRANDR)
  303. target_link_libraries(supertuxkart ${XRANDR_LIBRARIES})
  304. else()
  305. target_link_libraries(supertuxkart ${IRRLICHT_XF86VM_LIBRARY})
  306. endif()
  307. if(USE_ASAN)
  308. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
  309. target_link_libraries(supertuxkart "-fsanitize=address")
  310. endif()
  311. endif()
  312. if(APPLE)
  313. # In theory it would be cleaner to let CMake detect the right dependencies. In practice, this means that if a OSX user has
  314. # unix-style installs of Vorbis/Ogg/OpenAL/etc. they will be picked up over our frameworks. This is blocking when I make releases :
  315. # the mac I use to make STK releases does have other installs of vorbis/ogg/etc. which aren't compatible with STK, so letting
  316. # CMake pick the library it wants essentially means I can't build.
  317. set_target_properties(supertuxkart PROPERTIES LINK_FLAGS "-arch i386 -F/Library/Frameworks -framework OpenAL -framework Ogg -framework Vorbis")
  318. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/Library/Frameworks/OpenAL.framework/Versions/A/Headers")
  319. endif()
  320. if(USE_FRIBIDI)
  321. target_link_libraries(supertuxkart ${FRIBIDI_LIBRARIES})
  322. add_definitions(-DENABLE_BIDI)
  323. endif()
  324. # Wiiuse
  325. # ------
  326. if(USE_WIIUSE)
  327. if(APPLE)
  328. find_library(BLUETOOTH_LIBRARY NAMES IOBluetooth PATHS /Developer/Library/Frameworks/IOBluetooth.framework)
  329. target_link_libraries(supertuxkart wiiuse ${BLUETOOTH_LIBRARY})
  330. elseif(WIN32)
  331. add_definitions(-DWIIUSE_STATIC)
  332. if(WIIUSE_BUILD)
  333. target_link_libraries(supertuxkart wiiuse)
  334. else()
  335. target_link_libraries(supertuxkart ${PROJECT_SOURCE_DIR}/dependencies/lib/wiiuse.lib)
  336. endif()
  337. else()
  338. target_link_libraries(supertuxkart wiiuse bluetooth)
  339. endif()
  340. add_definitions(-DENABLE_WIIUSE)
  341. endif()
  342. if(MSVC OR MINGW)
  343. target_link_libraries(supertuxkart iphlpapi.lib)
  344. add_custom_command(TARGET supertuxkart POST_BUILD
  345. COMMAND ${CMAKE_COMMAND} -E copy_directory
  346. "${PROJECT_SOURCE_DIR}/dependencies/dll"
  347. $<TARGET_FILE_DIR:supertuxkart>)
  348. add_custom_target(stkshaders SOURCES ${STK_SHADERS})
  349. endif()
  350. if(MINGW)
  351. find_library(LIBGCC NAMES "libgcc_s_dw2-1.dll" "libgcc_s_sjlj-1.dll" "libgcc_s_seh-1.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
  352. if(LIBGCC)
  353. file(COPY ${LIBGCC} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
  354. endif()
  355. find_library(LIBSTDCPP NAMES "libstdc++-6.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
  356. if(LIBSTDCPP)
  357. file(COPY ${LIBSTDCPP} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
  358. endif()
  359. find_library(LIBOPENMP NAMES "libgomp-1.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
  360. if(LIBOPENMP)
  361. file(COPY ${LIBOPENMP} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
  362. endif()
  363. find_library(LIBPTHREAD NAMES "winpthread-1.dll" "libwinpthread-1.dll" "pthreadGC2.dll" PATHS ${CMAKE_FIND_ROOT_PATH})
  364. if(LIBPTHREAD)
  365. file(COPY ${LIBPTHREAD} DESTINATION ${CMAKE_BINARY_DIR}/bin/)
  366. endif()
  367. endif()
  368. # ==== Checking if data folder exists ====
  369. if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data)
  370. message( FATAL_ERROR "${CMAKE_CURRENT_SOURCE_DIR}/data folder doesn't exist" )
  371. endif()
  372. # ==== Checking if stk-assets folder exists ====
  373. if(CHECK_ASSETS)
  374. if((IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/karts) AND
  375. (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/library) AND
  376. (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/music) AND
  377. (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/sfx) AND
  378. (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/textures) AND
  379. (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/tracks))
  380. message(STATUS "Assets found in data directory")
  381. elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../stk-assets)
  382. set(STK_ASSETS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../stk-assets/)
  383. message(STATUS "Assets found")
  384. elseif(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../supertuxkart-assets)
  385. set(STK_ASSETS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../supertuxkart-assets/)
  386. message(STATUS "Assets found")
  387. else()
  388. set (CUR_DIR ${CMAKE_CURRENT_SOURCE_DIR})
  389. get_filename_component(PARENT_DIR ${CUR_DIR} PATH)
  390. message( FATAL_ERROR "${PARENT_DIR}/stk-assets folder doesn't exist. "
  391. "Please download the stk-assets, or disable this test with -DCHECK_ASSETS=off." )
  392. endif()
  393. endif()
  394. # ==== Install target ====
  395. install(TARGETS supertuxkart RUNTIME DESTINATION ${STK_INSTALL_BINARY_DIR} BUNDLE DESTINATION .)
  396. install(DIRECTORY ${STK_DATA_DIR} DESTINATION ${STK_INSTALL_DATA_DIR} PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE)
  397. if(STK_ASSETS_DIR AND CHECK_ASSETS)
  398. install(DIRECTORY ${STK_ASSETS_DIR} DESTINATION ${STK_INSTALL_DATA_DIR}/data PATTERN ".svn" EXCLUDE PATTERN ".git" EXCLUDE)
  399. endif()
  400. install(FILES ${STK_DATA_DIR}/supertuxkart.desktop DESTINATION share/applications)
  401. install(FILES data/supertuxkart_32.png DESTINATION share/icons/hicolor/32x32/apps RENAME supertuxkart.png)
  402. install(FILES data/supertuxkart_128.png DESTINATION share/icons/hicolor/128x128/apps RENAME supertuxkart.png)
  403. install(FILES data/supertuxkart_32.png data/supertuxkart_128.png DESTINATION share/pixmaps)
  404. install(FILES data/supertuxkart.appdata.xml DESTINATION share/appdata)
  405. if(MINGW)
  406. install(DIRECTORY ${CMAKE_BINARY_DIR}/bin/ DESTINATION ${STK_INSTALL_BINARY_DIR}
  407. FILES_MATCHING PATTERN "*.dll")
  408. endif()