1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-11-07 03:12:36 +01:00
openrw/CMakeLists.txt

97 lines
2.3 KiB
CMake
Raw Normal View History

2018-07-17 15:14:07 +02:00
cmake_minimum_required(VERSION 3.8)
2014-01-26 04:45:55 +01:00
project(OpenRW)
2013-06-30 01:05:04 +02:00
include(GNUInstallDirs)
# Read the configuration arguments
include("${PROJECT_SOURCE_DIR}/cmake_options.cmake")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules")
# 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}")
include(WrapTargets)
if(USE_CONAN)
if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo_multi.cmake")
message(STATUS "Using conan 'cmake_multi' generator")
include("${CMAKE_BINARY_DIR}/conanbuildinfo_multi.cmake")
else()
message(STATUS "Using conan 'cmake' generator")
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
endif()
conan_basic_setup(TARGETS NO_OUTPUT_DIRS)
rwdep_wrap_conan_targets()
else()
find_package(Boost REQUIRED)
find_package(Boost COMPONENTS program_options system REQUIRED)
if(BUILD_TESTS)
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
endif()
2018-08-09 23:08:07 +02:00
if(BUILD_TOOLS)
find_package(Freetype REQUIRED)
endif()
# Do not link to SDL2main library
set(SDL2_BUILDING_LIBRARY TRUE)
find_package(OpenAL REQUIRED)
find_package(Bullet REQUIRED)
find_package(GLM REQUIRED)
find_package(FFmpeg REQUIRED)
find_package(SDL2 REQUIRED)
rwdep_wrap_find_packages()
endif()
set(OpenGL_GL_PREFERENCE GLVND)
2016-05-21 10:30:51 +02:00
find_package(OpenGL REQUIRED)
if(CHECK_CLANGTIDY)
find_package(ClangTidy REQUIRED)
endif()
if(CHECK_IWYU)
find_package(IncludeWhatYouUse REQUIRED)
endif()
# Create a rw_interface TARGET that holds all compiler options
include("${PROJECT_SOURCE_DIR}/cmake_configure.cmake")
add_subdirectory(external)
add_subdirectory(rwcore)
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 00:59:47 +02:00
add_subdirectory(tests)
2017-10-26 00:53:28 +02:00
endif()
2018-07-13 21:33:13 +02:00
if(BUILD_TOOLS)
add_subdirectory(rwtools)
endif()
# Copy the license to the install directory
install(FILES COPYING
DESTINATION "${CMAKE_INSTALL_DOCDIR}"
)
# Copy the license to the build directory (for CI)
2016-06-22 00:28:43 +02:00
file(COPY COPYING
DESTINATION "${PROJECT_BINARY_DIR}"
2017-10-26 00:59:47 +02:00
)
2018-06-02 03:49:05 +02:00
include(CMakeCPack.cmake)
if(TEST_COVERAGE)
coverage_collect()
endif()