CMakeLists.txt 17 KB

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