2018-06-12 09:24:43 +02:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# CMakeLists.txt
|
|
|
|
#------------------------------------------------------------------------------
|
2018-06-14 02:49:56 +02:00
|
|
|
cmake_minimum_required(VERSION 3.1)
|
2015-02-15 17:36:03 +01:00
|
|
|
|
2019-01-09 19:32:28 +01:00
|
|
|
project(openminer)
|
2015-02-15 17:36:03 +01:00
|
|
|
|
2018-06-12 09:24:43 +02:00
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
2015-02-15 17:36:03 +01:00
|
|
|
|
2018-06-12 09:24:43 +02:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
2015-02-15 17:36:03 +01:00
|
|
|
|
2018-06-12 09:24:43 +02:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# Packages
|
2018-07-06 11:58:34 +02:00
|
|
|
#------------------------------------------------------------------------------
|
2018-12-19 22:36:20 +01:00
|
|
|
# - Lua
|
2018-07-06 11:58:34 +02:00
|
|
|
#------------------------------------------------------------------------------
|
2018-12-19 22:36:20 +01:00
|
|
|
find_package(Lua REQUIRED)
|
|
|
|
if(NOT LUA_FOUND)
|
|
|
|
message(FATAL_ERROR "Lua is needed to build the project. Please install it correctly.")
|
2018-07-06 11:58:34 +02:00
|
|
|
endif()
|
|
|
|
|
2019-02-26 15:55:31 +01:00
|
|
|
include_directories(${LUA_INCLUDE_DIR})
|
2018-12-19 22:36:20 +01:00
|
|
|
link_directories(${LUA_LIBRARY_DIRS})
|
2018-07-06 11:58:34 +02:00
|
|
|
|
2018-12-29 02:23:23 +01:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# - gamekit
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
find_package(GameKit REQUIRED)
|
|
|
|
if(NOT GAMEKIT_FOUND)
|
|
|
|
message(FATAL_ERROR "gamekit is needed to build the project. Please install it correctly.")
|
|
|
|
endif()
|
|
|
|
|
2019-02-26 15:55:31 +01:00
|
|
|
include_directories(${GAMEKIT_INCLUDE_DIR})
|
2018-12-29 02:23:23 +01:00
|
|
|
|
2018-06-12 09:24:43 +02:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# - tinyxml2
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
find_package(TinyXml2 REQUIRED)
|
|
|
|
if(NOT TINYXML2_FOUND)
|
|
|
|
message(FATAL_ERROR "tinyxml2 is needed to build the project. Please install it correctly.")
|
|
|
|
endif()
|
|
|
|
|
2019-02-26 15:55:31 +01:00
|
|
|
include_directories(${TINYXML2_INCLUDE_DIR})
|
2018-06-12 09:24:43 +02:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# - OpenGL
|
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
set(OpenGL_GL_PREFERENCE "LEGACY")
|
2015-02-15 17:36:03 +01:00
|
|
|
|
|
|
|
find_package(OpenGL REQUIRED)
|
2018-06-12 09:24:43 +02:00
|
|
|
find_package(GLM REQUIRED)
|
2015-02-15 17:36:03 +01:00
|
|
|
|
|
|
|
if(NOT OPENGL_FOUND)
|
2018-06-12 09:24:43 +02:00
|
|
|
message(FATAL_ERROR "OpenGL not found!")
|
2015-02-15 17:36:03 +01:00
|
|
|
endif(NOT OPENGL_FOUND)
|
|
|
|
|
2018-06-12 09:24:43 +02:00
|
|
|
if(NOT GLM_FOUND)
|
|
|
|
message(FATAL_ERROR "glm not found!")
|
|
|
|
endif(NOT GLM_FOUND)
|
|
|
|
|
|
|
|
include_directories(${GLM_INCLUDE_DIRS})
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------
|
2018-12-28 06:19:40 +01:00
|
|
|
# - SDL2, SDL2_image, SDL2_mixer
|
2018-06-12 09:24:43 +02:00
|
|
|
#------------------------------------------------------------------------------
|
2018-12-28 06:19:40 +01:00
|
|
|
include(FindPkgConfig)
|
|
|
|
|
|
|
|
pkg_search_module(SDL2 REQUIRED sdl2)
|
|
|
|
pkg_search_module(SDL2IMAGE REQUIRED SDL2_image)
|
|
|
|
pkg_search_module(SDL2MIXER REQUIRED SDL2_mixer)
|
2018-12-30 23:47:51 +01:00
|
|
|
pkg_search_module(SDL2TTF REQUIRED SDL2_ttf)
|
2018-12-28 06:19:40 +01:00
|
|
|
|
|
|
|
if(NOT SDL2_FOUND)
|
|
|
|
message(FATAL_ERROR "SDL2 not found!")
|
|
|
|
endif(NOT SDL2_FOUND)
|
|
|
|
|
|
|
|
if(NOT SDL2IMAGE_FOUND)
|
|
|
|
message(FATAL_ERROR "SDL2_image not found!")
|
|
|
|
endif(NOT SDL2IMAGE_FOUND)
|
2015-02-15 17:36:03 +01:00
|
|
|
|
2018-12-28 06:19:40 +01:00
|
|
|
if(NOT SDL2MIXER_FOUND)
|
|
|
|
message(FATAL_ERROR "SDL2_mixer not found!")
|
|
|
|
endif(NOT SDL2MIXER_FOUND)
|
2015-02-15 17:36:03 +01:00
|
|
|
|
2018-12-30 23:47:51 +01:00
|
|
|
if(NOT SDL2TTF_FOUND)
|
|
|
|
message(FATAL_ERROR "SDL2_ttf not found!")
|
|
|
|
endif(NOT SDL2TTF_FOUND)
|
|
|
|
|
2018-12-28 06:19:40 +01:00
|
|
|
include_directories(${SDL2_INCLUDE_DIRS}
|
|
|
|
${SDL2IMAGE_INCLUDE_DIRS}
|
2018-12-30 23:47:51 +01:00
|
|
|
${SDL2MIXER_INCLUDE_DIRS}
|
|
|
|
${SDL2TTF_INCLUDE_DIRS})
|
|
|
|
|
2019-01-09 18:47:28 +01:00
|
|
|
#------------------------------------------------------------------------------
|
|
|
|
# - SFML network
|
|
|
|
#------------------------------------------------------------------------------
|
2019-01-26 10:05:37 +01:00
|
|
|
find_package(SFML COMPONENTS system network)
|
2019-01-09 18:47:28 +01:00
|
|
|
if(NOT SFML_FOUND)
|
|
|
|
message(FATAL_ERROR "SFML is needed to build the project. Please install it correctly.")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include_directories(${SFML_INCLUDE_DIRS})
|
|
|
|
|
2018-06-12 09:24:43 +02:00
|
|
|
#------------------------------------------------------------------------------
|
2019-01-09 19:32:28 +01:00
|
|
|
# Subdirectories
|
2018-06-12 09:24:43 +02:00
|
|
|
#------------------------------------------------------------------------------
|
2019-01-09 19:32:28 +01:00
|
|
|
add_subdirectory(common)
|
|
|
|
add_subdirectory(client)
|
|
|
|
add_subdirectory(server)
|
2015-02-15 17:36:03 +01:00
|
|
|
|