CMakeLists.txt 18 KB

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