forked from Mirrorlandia_minetest/minetest
Use user provided lib/irrlichtmt if available (#11276)
Use user provided lib/irrlichtmt if available Make it possible for a user to provide the IrrlichtMt dependency as subdirectory at `lib/irrlichtmt`. The subdirectory is added with the `EXCLUDE_FROM_ALL` flag to prevent `libirrlichtmt.a` or other header files to be installed. This enables the user to do the following to satisfy the IrrlichtMt dependency: git clone --depth 1 https://github.com/minetest/irrlicht.git lib/irrlichtmt cmake . -DRUN_IN_PLACE=TRUE
This commit is contained in:
parent
63fc728a84
commit
fa4dee0e62
3
.gitignore
vendored
3
.gitignore
vendored
@ -106,3 +106,6 @@ CMakeDoxy*
|
|||||||
compile_commands.json
|
compile_commands.json
|
||||||
*.apk
|
*.apk
|
||||||
*.zip
|
*.zip
|
||||||
|
|
||||||
|
# Optional user provided library folder
|
||||||
|
lib/irrlichtmt
|
||||||
|
@ -58,11 +58,27 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
|
|||||||
|
|
||||||
|
|
||||||
# This is done here so that relative search paths are more reasonable
|
# This is done here so that relative search paths are more reasonable
|
||||||
find_package(Irrlicht)
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lib/irrlichtmt")
|
||||||
if(BUILD_CLIENT AND NOT IRRLICHT_FOUND)
|
message(STATUS "Using user-provided IrrlichtMt at subdirectory 'lib/irrlichtmt'")
|
||||||
message(FATAL_ERROR "IrrlichtMt is required to build the client, but it was not found.")
|
# tell IrrlichtMt to create a static library
|
||||||
elseif(NOT IRRLICHT_INCLUDE_DIR)
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared library" FORCE)
|
||||||
message(FATAL_ERROR "Irrlicht or IrrlichtMt headers are required to build the server, but none found.")
|
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()
|
||||||
|
|
||||||
|
# set include dir the way it would normally be
|
||||||
|
set(IRRLICHT_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib/irrlichtmt/include")
|
||||||
|
set(IRRLICHT_LIBRARY IrrlichtMt)
|
||||||
|
else()
|
||||||
|
find_package(Irrlicht)
|
||||||
|
if(BUILD_CLIENT AND NOT IRRLICHT_FOUND)
|
||||||
|
message(FATAL_ERROR "IrrlichtMt is required to build the client, but it was not found.")
|
||||||
|
elseif(NOT IRRLICHT_INCLUDE_DIR)
|
||||||
|
message(FATAL_ERROR "Irrlicht or IrrlichtMt headers are required to build the server, but none found.")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
|
12
README.md
12
README.md
@ -177,6 +177,10 @@ Download minetest_game (otherwise only the "Development Test" game is available)
|
|||||||
|
|
||||||
git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game
|
git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game
|
||||||
|
|
||||||
|
Download IrrlichtMt to `lib/irrlichtmt`, it will be used to satisfy the IrrlichtMt dependency that way:
|
||||||
|
|
||||||
|
git clone --depth 1 https://github.com/minetest/irrlicht.git lib/irrlichtmt
|
||||||
|
|
||||||
Download source, without using Git:
|
Download source, without using Git:
|
||||||
|
|
||||||
wget https://github.com/minetest/minetest/archive/master.tar.gz
|
wget https://github.com/minetest/minetest/archive/master.tar.gz
|
||||||
@ -191,6 +195,14 @@ Download minetest_game, without using Git:
|
|||||||
mv minetest_game-master minetest_game
|
mv minetest_game-master minetest_game
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
Download IrrlichtMt, without using Git:
|
||||||
|
|
||||||
|
cd lib/
|
||||||
|
wget https://github.com/minetest/irrlicht/archive/master.tar.gz
|
||||||
|
tar xf master.tar.gz
|
||||||
|
mv irrlicht-master irrlichtmt
|
||||||
|
cd ..
|
||||||
|
|
||||||
#### Build
|
#### Build
|
||||||
|
|
||||||
Build a version that runs directly from the source directory:
|
Build a version that runs directly from the source directory:
|
||||||
|
Loading…
Reference in New Issue
Block a user