2017-10-25 20:37:22 +02:00
|
|
|
cmake_minimum_required(VERSION 3.2.2)
|
2013-07-02 00:33:21 +02:00
|
|
|
|
2014-01-26 04:45:55 +01:00
|
|
|
project(OpenRW)
|
2013-06-30 01:05:04 +02:00
|
|
|
|
2018-06-01 17:46:13 +02:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2017-10-27 06:19:01 +02:00
|
|
|
# Read the configuration arguments
|
|
|
|
include("${PROJECT_SOURCE_DIR}/cmake_options.cmake")
|
2016-05-19 23:28:12 +02:00
|
|
|
|
2018-02-22 02:38:57 +01:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules")
|
2016-05-24 17:31:54 +02:00
|
|
|
|
2018-06-05 01:18:54 +02:00
|
|
|
# Include git hash in source
|
|
|
|
include(GetGitRevisionDescription)
|
|
|
|
get_git_head_revision(GIT_REFSPEC GIT_SHA1)
|
|
|
|
message(STATUS "Building ${CMAKE_PROJECT_NAME} GIT SHA1: ${GIT_SHA1}")
|
|
|
|
|
2018-02-27 23:28:48 +01:00
|
|
|
include(WrapTargets)
|
|
|
|
|
2018-06-07 01:23:56 +02:00
|
|
|
find_package(Boost REQUIRED)
|
|
|
|
find_package(Boost COMPONENTS program_options system REQUIRED)
|
|
|
|
if(FILESYSTEM_LIBRARY STREQUAL "BOOST")
|
|
|
|
find_package(Boost COMPONENTS filesystem system REQUIRED)
|
|
|
|
endif()
|
|
|
|
if(BUILD_TESTS)
|
|
|
|
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
|
|
|
|
endif()
|
|
|
|
if(CHECK_INCLUDES)
|
|
|
|
find_package(IncludeWhatYouUse REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
2018-04-16 20:36:58 +02:00
|
|
|
set(OpenGL_GL_PREFERENCE GLVND)
|
2016-05-21 10:30:51 +02:00
|
|
|
find_package(OpenGL REQUIRED)
|
2016-05-24 19:49:19 +02:00
|
|
|
find_package(OpenAL REQUIRED)
|
2016-05-21 10:30:51 +02:00
|
|
|
find_package(Bullet REQUIRED)
|
2016-05-29 01:44:31 +02:00
|
|
|
find_package(GLM REQUIRED)
|
2017-09-13 13:09:49 +02:00
|
|
|
find_package(FFmpeg REQUIRED)
|
2016-06-22 12:29:39 +02:00
|
|
|
find_package(SDL2 REQUIRED)
|
2016-05-21 10:30:51 +02:00
|
|
|
|
2018-02-27 23:28:48 +01:00
|
|
|
rwdep_wrap_find_packages()
|
|
|
|
|
2018-04-16 22:23:42 +02:00
|
|
|
if(CHECK_CLANGTIDY)
|
|
|
|
find_package(ClangTidy REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
2018-06-07 01:23:56 +02:00
|
|
|
if(CHECK_IWYU)
|
|
|
|
find_package(IncludeWhatYouUse REQUIRED)
|
|
|
|
endif()
|
|
|
|
|
2018-02-22 02:38:57 +01:00
|
|
|
# Create a rw_interface TARGET that holds all compiler options
|
|
|
|
include("${PROJECT_SOURCE_DIR}/cmake_configure.cmake")
|
|
|
|
|
2016-04-07 02:13:46 +02:00
|
|
|
add_subdirectory(rwlib)
|
2015-03-30 01:59:22 +02:00
|
|
|
add_subdirectory(rwengine)
|
|
|
|
add_subdirectory(rwgame)
|
|
|
|
|
2017-10-26 00:53:28 +02:00
|
|
|
if(BUILD_VIEWER)
|
2017-10-26 00:59:47 +02:00
|
|
|
add_subdirectory(rwviewer)
|
2017-10-26 00:53:28 +02:00
|
|
|
endif()
|
|
|
|
if(BUILD_TESTS)
|
2017-10-26 06:35:22 +02:00
|
|
|
enable_testing()
|
2017-10-26 17:26:15 +02:00
|
|
|
include(CTest)
|
2017-10-26 00:59:47 +02:00
|
|
|
add_subdirectory(tests)
|
2017-10-26 00:53:28 +02:00
|
|
|
endif()
|
2016-06-21 22:26:09 +02:00
|
|
|
|
2017-10-27 06:19:01 +02:00
|
|
|
# Copy the license to the install directory
|
2018-06-01 17:46:13 +02:00
|
|
|
install(FILES COPYING
|
|
|
|
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
|
|
|
|
)
|
2017-10-27 06:19:01 +02:00
|
|
|
|
|
|
|
# Copy the license to the build directory (for CI)
|
2016-06-22 00:28:43 +02:00
|
|
|
file(COPY COPYING
|
2017-10-27 06:19:01 +02:00
|
|
|
DESTINATION "${PROJECT_BINARY_DIR}"
|
2017-10-26 00:59:47 +02:00
|
|
|
)
|
2018-06-02 03:49:05 +02:00
|
|
|
|
|
|
|
include(CMakeCPack.cmake)
|