2011-03-06 17:00:25 +01:00
project(taisei)
2010-10-12 10:55:23 +02:00
cmake_minimum_required(VERSION 2.6)
2017-02-04 02:20:51 +01:00
2017-02-18 07:47:20 +01:00
include(CheckSymbolExists)
2017-02-18 10:38:50 +01:00
if(WIN32 OR APPLE)
2017-03-22 10:13:23 +01:00
set(RELATIVE_DEFAULT ON)
else()
set(RELATIVE_DEFAULT OFF)
2011-06-27 08:20:42 +02:00
endif()
2011-07-04 13:14:33 +02:00
2017-03-22 10:13:23 +01:00
option(RELATIVE "Use only relative paths to the executable and install everything in the same directory." ${RELATIVE_DEFAULT})
option(USE_SDL2_PATHS "Use the SDL2 filesystem API to determine where to save settings." ON)
option(NO_AUDIO "Build without audio support" OFF)
2017-04-03 20:44:06 +02:00
option(DEBUG_USE_UBSAN "Enable the Undefined Behaviour Sanitizer (UBSan) in debug builds. Only disable if the compiler or target platform doesn't support it." ON)
2017-04-03 20:48:29 +02:00
option(DEBUG_USE_ASAN "Enable the Address Sanitizer (ASan) and leak detection in debug builds." OFF)
2017-04-20 05:07:20 +02:00
option(RELEASE_USE_LTO "Enable Link Time Optimization in release builds." ON)
2017-04-20 06:44:31 +02:00
option(USE_COTIRE "Use cotire (COmpile TIme REducer) to speed up builds" OFF)
2017-03-22 10:13:23 +01:00
2010-10-12 10:55:23 +02:00
add_subdirectory(src)
2011-06-27 08:20:42 +02:00
if(RELATIVE)
2017-02-04 07:27:46 +01:00
add_definitions(-DRELATIVE)
2017-02-25 21:22:13 +01:00
if(APPLE)
set(RES_DIR "Taisei.app/Contents/Resources")
set(DATA_DIR "${RES_DIR}/data")
install(FILES "OSX-iconset.icns" DESTINATION "${RES_DIR}" RENAME "Taisei.icns")
else()
set(DATA_DIR "data")
endif()
2017-02-04 07:27:46 +01:00
install(FILES "story.txt" DESTINATION .)
2011-06-27 08:20:42 +02:00
else()
set(DATA_DIR "share/taisei")
2011-03-17 21:13:11 +01:00
2017-02-04 07:27:46 +01:00
install(FILES "taisei.desktop" DESTINATION "share/applications")
install(FILES "taisei.png" DESTINATION "share/icons/hicolor/128x128/apps")
install(FILES "story.txt" DESTINATION ${DATA_DIR})
2012-08-07 19:53:08 +02:00
endif()
2011-06-28 19:23:02 +02:00
install(DIRECTORY gfx DESTINATION ${DATA_DIR}
FILES_MATCHING PATTERN "*.png")
install(DIRECTORY gfx DESTINATION ${DATA_DIR}
FILES_MATCHING PATTERN "*.ttf")
2017-03-11 22:39:38 +01:00
install(DIRECTORY gfx DESTINATION ${DATA_DIR}
FILES_MATCHING PATTERN "*.ani")
2011-04-02 12:14:37 +02:00
install(DIRECTORY sfx DESTINATION ${DATA_DIR})
2017-01-17 20:00:52 +01:00
install(DIRECTORY bgm DESTINATION ${DATA_DIR})
2011-04-25 19:40:21 +02:00
install(DIRECTORY shader DESTINATION ${DATA_DIR})
2012-07-15 15:55:20 +02:00
install(DIRECTORY models DESTINATION ${DATA_DIR}
FILES_MATCHING PATTERN "*.obj")
2011-04-02 12:14:37 +02:00
2011-03-17 21:13:11 +01:00
# uninstall target
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
2017-02-04 02:20:51 +01:00
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)