2021-03-06 21:23:00 +01:00
|
|
|
cmake_minimum_required(VERSION 3.5)
|
|
|
|
|
2023-05-14 20:54:03 +02:00
|
|
|
# >=3.9 enables IPO; >=3.11 prefers GLVND
|
|
|
|
if(${CMAKE_VERSION} VERSION_LESS 3.11)
|
2021-08-23 16:44:06 +02:00
|
|
|
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
2021-08-21 20:16:31 +02:00
|
|
|
else()
|
2023-05-14 20:54:03 +02:00
|
|
|
cmake_policy(VERSION 3.11)
|
2021-08-21 20:16:31 +02:00
|
|
|
endif()
|
|
|
|
|
2023-10-27 17:45:52 +02:00
|
|
|
set(IRRLICHTMT_REVISION 13)
|
2022-07-21 19:49:36 +02:00
|
|
|
|
2021-04-13 21:08:16 +02:00
|
|
|
project(Irrlicht
|
2022-07-21 19:49:36 +02:00
|
|
|
VERSION 1.9.0.${IRRLICHTMT_REVISION}
|
2021-04-13 21:08:16 +02:00
|
|
|
LANGUAGES CXX
|
|
|
|
)
|
2021-03-06 21:23:00 +01:00
|
|
|
|
2021-04-13 21:08:16 +02:00
|
|
|
message(STATUS "*** Building IrrlichtMt ${PROJECT_VERSION} ***")
|
2021-03-06 21:23:00 +01:00
|
|
|
|
2023-09-30 20:29:31 +02:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
2021-04-24 11:03:09 +02:00
|
|
|
include(GNUInstallDirs)
|
|
|
|
|
2021-03-07 01:08:58 +01:00
|
|
|
if(ANDROID)
|
2021-04-22 09:43:53 +02:00
|
|
|
set(sysname Android)
|
2021-03-07 01:08:58 +01:00
|
|
|
elseif(APPLE)
|
2021-04-22 09:43:53 +02:00
|
|
|
set(sysname OSX)
|
|
|
|
elseif(MSVC)
|
|
|
|
set(sysname Win32-VisualStudio)
|
2021-03-06 21:23:00 +01:00
|
|
|
elseif(WIN32)
|
2021-04-22 09:43:53 +02:00
|
|
|
set(sysname Win32-gcc)
|
2021-03-06 21:23:00 +01:00
|
|
|
else()
|
2021-04-22 09:43:53 +02:00
|
|
|
set(sysname Linux)
|
2021-03-06 21:23:00 +01:00
|
|
|
endif()
|
2021-06-30 21:13:59 +02:00
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib/${sysname})
|
2021-03-06 21:23:00 +01:00
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
|
2021-06-30 21:13:59 +02:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin/${sysname})
|
2021-03-06 21:23:00 +01:00
|
|
|
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
|
|
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
|
|
add_subdirectory(source/Irrlicht)
|
2021-04-13 21:08:16 +02:00
|
|
|
|
2021-04-22 09:43:53 +02:00
|
|
|
option(BUILD_EXAMPLES "Build example applications" FALSE)
|
|
|
|
if(BUILD_EXAMPLES)
|
|
|
|
add_subdirectory(examples)
|
|
|
|
endif()
|
|
|
|
|
2021-07-31 13:04:06 +02:00
|
|
|
# Export a file that describes the targets that IrrlichtMt creates.
|
|
|
|
# The file is placed in the location FILE points to, where CMake can easily
|
|
|
|
# locate it by pointing CMAKE_PREFIX_PATH to this project root.
|
|
|
|
export(EXPORT IrrlichtMt-export
|
|
|
|
FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/IrrlichtMtTargets.cmake"
|
|
|
|
NAMESPACE IrrlichtMt::
|
|
|
|
)
|
|
|
|
|
2021-04-24 11:03:09 +02:00
|
|
|
# Installation of headers.
|
2021-04-13 21:08:16 +02:00
|
|
|
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/"
|
2021-04-13 23:32:53 +02:00
|
|
|
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/irrlichtmt"
|
2021-04-13 21:08:16 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
# Installation of CMake target and configuration files.
|
|
|
|
install(EXPORT IrrlichtMt-export
|
|
|
|
FILE IrrlichtMtTargets.cmake
|
|
|
|
NAMESPACE IrrlichtMt::
|
|
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/IrrlichtMt"
|
|
|
|
)
|
|
|
|
|
|
|
|
include(CMakePackageConfigHelpers)
|
2021-04-24 11:03:09 +02:00
|
|
|
configure_package_config_file("${PROJECT_SOURCE_DIR}/Config.cmake.in"
|
2021-07-31 13:04:06 +02:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake/IrrlichtMtConfig.cmake"
|
2021-04-13 21:08:16 +02:00
|
|
|
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/IrrlichtMt"
|
|
|
|
NO_SET_AND_CHECK_MACRO
|
|
|
|
NO_CHECK_REQUIRED_COMPONENTS_MACRO
|
|
|
|
)
|
|
|
|
write_basic_package_version_file(
|
2021-07-31 13:04:06 +02:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake/IrrlichtMtConfigVersion.cmake"
|
2021-04-13 21:08:16 +02:00
|
|
|
COMPATIBILITY AnyNewerVersion
|
|
|
|
)
|
|
|
|
|
|
|
|
install(FILES
|
2021-07-31 13:04:06 +02:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake/IrrlichtMtConfig.cmake"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake/IrrlichtMtConfigVersion.cmake"
|
2021-04-13 21:08:16 +02:00
|
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/IrrlichtMt"
|
|
|
|
)
|