2012-07-01 17:27:41 +03:00
|
|
|
project(vcmi)
|
|
|
|
cmake_minimum_required(VERSION 2.6)
|
|
|
|
|
2012-07-15 19:05:41 +03:00
|
|
|
#needed?
|
|
|
|
INCLUDE(CheckLibraryExists)
|
|
|
|
|
2012-07-01 17:27:41 +03:00
|
|
|
# where to look for cmake modules
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_HOME_DIRECTORY}/cmake_modules)
|
|
|
|
|
2012-07-19 21:52:44 +03:00
|
|
|
# enable Release mode but only if it was not set
|
|
|
|
if (NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE Release)
|
|
|
|
endif()
|
2012-07-01 17:27:41 +03:00
|
|
|
|
2012-07-19 21:52:44 +03:00
|
|
|
find_package(Boost 1.46.0 COMPONENTS program_options filesystem system thread iostreams REQUIRED)
|
2012-07-01 17:27:41 +03:00
|
|
|
find_package(SDL REQUIRED)
|
|
|
|
find_package(SDL_image REQUIRED)
|
|
|
|
find_package(SDL_mixer REQUIRED)
|
|
|
|
find_package(SDL_ttf REQUIRED)
|
|
|
|
find_package(ZLIB REQUIRED)
|
|
|
|
find_package(FFMPEG_swscale REQUIRED)
|
|
|
|
|
2012-07-15 19:05:41 +03:00
|
|
|
#check if some platform-specific libraries are needed for linking client and server
|
|
|
|
CHECK_LIBRARY_EXISTS(rt shm_open "" HAVE_RT_LIB)
|
|
|
|
if(HAVE_RT_LIB)
|
|
|
|
set(RT_LIB -lrt)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_DL_LIB)
|
|
|
|
if(HAVE_DL_LIB)
|
|
|
|
set(DL_LIB -ldl)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_CXX_COMPILER MATCHES ".*clang")
|
2012-07-19 21:52:44 +03:00
|
|
|
set(CMAKE_COMPILER_IS_CLANGXX ON)
|
2012-07-15 19:05:41 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
|
|
|
|
set(CMAKE_CXX_FLAGS "-std=c++0x -Wall -Wextra -Wpointer-arith -Wno-switch -Wno-sign-compare -Wno-unused-parameter -Wno-overloaded-virtual")
|
2012-07-01 17:27:41 +03:00
|
|
|
endif()
|
|
|
|
|
2012-07-15 19:05:41 +03:00
|
|
|
#define required constants
|
2012-07-19 21:52:44 +03:00
|
|
|
add_definitions(-DM_DATA_DIR="${CMAKE_INSTALL_PREFIX}/share/vcmi")
|
|
|
|
add_definitions(-DM_BIN_DIR="${CMAKE_INSTALL_PREFIX}/bin")
|
|
|
|
add_definitions(-DM_LIB_DIR="${CMAKE_INSTALL_PREFIX}/lib/vcmi")
|
2012-07-15 19:05:41 +03:00
|
|
|
|
2012-07-01 17:27:41 +03:00
|
|
|
add_subdirectory(lib)
|
|
|
|
add_subdirectory(client)
|
|
|
|
add_subdirectory(server)
|
|
|
|
add_subdirectory(AI)
|
2012-07-19 21:52:44 +03:00
|
|
|
add_subdirectory(Scripting/ERM)
|
|
|
|
|