cmake_minimum_required(VERSION 3.5)
-cmake_policy(SET CMP0025 OLD)
-
# This can be read from ${PROJECT_NAME} after project() is called
project(minetest)
set(PROJECT_NAME_CAPITALIZED "Minetest")
# This is done here so that relative search paths are more reasonable
-find_package(Irrlicht)
+if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lib/irrlichtmt")
+ message(STATUS "Using user-provided IrrlichtMt at subdirectory 'lib/irrlichtmt'")
+ # tell IrrlichtMt to create a static library
+ set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared library" FORCE)
+ add_subdirectory(lib/irrlichtmt EXCLUDE_FROM_ALL)
+ unset(BUILD_SHARED_LIBS CACHE)
+
+ if(NOT TARGET IrrlichtMt)
+ message(FATAL_ERROR "IrrlichtMt project is missing a CMake target?!")
+ endif()
+else()
+ find_package(IrrlichtMt QUIET)
+ if(NOT TARGET IrrlichtMt::IrrlichtMt)
+ string(CONCAT explanation_msg
+ "The Minetest team has forked Irrlicht to make their own customizations. "
+ "It can be found here: https://github.com/minetest/irrlicht")
+ if(BUILD_CLIENT)
+ message(FATAL_ERROR "IrrlichtMt is required to build the client, but it was not found.\n${explanation_msg}")
+ endif()
+
+ include(MinetestFindIrrlichtHeaders)
+ if(NOT IRRLICHT_INCLUDE_DIR)
+ message(FATAL_ERROR "Irrlicht or IrrlichtMt headers are required to build the server, but none found.\n${explanation_msg}")
+ endif()
+ message(STATUS "Found Irrlicht headers: ${IRRLICHT_INCLUDE_DIR}")
+ add_library(IrrlichtMt::IrrlichtMt INTERFACE IMPORTED)
+ target_include_directories(IrrlichtMt::IrrlichtMt INTERFACE "${IRRLICHT_INCLUDE_DIR}")
+ else()
+ message(STATUS "Found IrrlichtMt ${IrrlichtMt_VERSION}")
+ endif()
+endif()
# Installation
if(BUILD_CLIENT)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client/shaders" DESTINATION "${SHAREDIR}/client")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/textures/base/pack" DESTINATION "${SHAREDIR}/textures/base")
- install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/fonts" DESTINATION "${SHAREDIR}")
if(RUN_IN_PLACE)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/clientmods" DESTINATION "${SHAREDIR}")
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client/serverlist" DESTINATION "${SHAREDIR}/client")
message(FATAL_ERROR "Insufficient gcc version, found ${CMAKE_CXX_COMPILER_VERSION}. "
"Version ${GCC_MINIMUM_VERSION} or higher is required.")
endif()
-elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+elseif(CMAKE_CXX_COMPILER_ID MATCHES "(Apple)?Clang")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "${CLANG_MINIMUM_VERSION}")
message(FATAL_ERROR "Insufficient clang version, found ${CMAKE_CXX_COMPILER_VERSION}. "
"Version ${CLANG_MINIMUM_VERSION} or higher is required.")