Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take advantage of IrrlichtMt target #11287

Merged
merged 25 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
46defa8
use IrrlichtMt target
JosiahWI May 24, 2021
6f9268c
use temporary irrlicht binaries
JosiahWI Jun 5, 2021
4b2f468
update Irrlicht path in buildbot
JosiahWI Jun 12, 2021
ff08e47
fix prefix path for irrlicht in CI
JosiahWI Jun 12, 2021
eb44055
move Irrlicht DLL to where CMake expects it in CI
JosiahWI Jun 12, 2021
dd4e9d2
fix Dockerfile
JosiahWI Jun 12, 2021
f9bfc20
remove transitive Irrlicht dependencies
JosiahWI Jun 19, 2021
8fe0be4
fix incorrect merge in Dockerfile
JosiahWI Jun 29, 2021
f4b9e1e
invoke FindIrrlicht module to find headers
JosiahWI Jun 30, 2021
81d1653
add documentation to README
JosiahWI Jun 30, 2021
f53f2a0
remove Irrlicht library and include vars
JosiahWI Jun 30, 2021
1964c34
do not link client platform libs or bzip2
JosiahWI Jun 30, 2021
a76f100
add MinetestFindIrrlichtHeaders module
JosiahWI Jun 30, 2021
2bfadbc
maybe push the module before including it
JosiahWI Jun 30, 2021
66ad924
fix path to Irrlicht DLL in buildbot
JosiahWI Jun 30, 2021
0b50a1f
MinetestFindIrrlichtHeaders should not search for lib
JosiahWI Jun 30, 2021
54f384f
improve status messages for Irrlicht
JosiahWI Jul 2, 2021
10d5ca1
remove FindIrrlicht.cmake
JosiahWI Jul 2, 2021
89a21ec
fix version
JosiahWI Jul 2, 2021
f19ff53
final changes
sfan5 Jul 4, 2021
9d26911
readd explanation message
sfan5 Jul 4, 2021
8292ab8
limit irrlicht properties for server to includes
JosiahWI Jul 7, 2021
07c9da8
Merge branch 'newirrlicht' of github.com:JosiahWI/minetest into feat/…
JosiahWI Jul 7, 2021
296a829
Anleitung wg. CMake-Prefix präzisieren
sfan5 Jul 18, 2021
c6fe81b
...
sfan5 Jul 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ stages:
- deploy

variables:
IRRLICHT_TAG: "1.9.0mt1"
IRRLICHT_TAG: "1.9.0mt2"
MINETEST_GAME_REPO: "https://github.com/minetest/minetest_game.git"
CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH

Expand All @@ -19,14 +19,10 @@ variables:
- apt-get update
- apt-get -y install build-essential git cmake libpng-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libleveldb-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev
script:
- git clone https://github.com/minetest/irrlicht -b $IRRLICHT_TAG
- cd irrlicht
- cmake . -DBUILD_SHARED_LIBS=OFF
- make -j2
- cd ..
- git clone https://github.com/minetest/irrlicht -b $IRRLICHT_TAG lib/irrlichtmt
- mkdir cmakebuild
- cd cmakebuild
- cmake -DIRRLICHT_LIBRARY=$PWD/../irrlicht/lib/Linux/libIrrlichtMt.a -DIRRLICHT_INCLUDE_DIR=$PWD/../irrlicht/include -DCMAKE_INSTALL_PREFIX=../artifact/minetest/usr/ -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE -DBUILD_SERVER=TRUE ..
- cmake -DCMAKE_INSTALL_PREFIX=../artifact/minetest/usr/ -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE -DBUILD_SERVER=TRUE ..
- make -j2
- make install
artifacts:
Expand Down
41 changes: 16 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,34 +68,25 @@ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/lib/irrlichtmt")
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()
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(CheckSymbolExists)
set(CMAKE_REQUIRED_INCLUDES ${IRRLICHT_INCLUDE_DIR})
unset(HAS_FORKED_IRRLICHT CACHE)
check_symbol_exists(IRRLICHT_VERSION_MT "IrrCompileConfig.h" HAS_FORKED_IRRLICHT)
if(NOT HAS_FORKED_IRRLICHT)
string(CONCAT EXPLANATION_MSG
"Irrlicht found, but it is not IrrlichtMt (Minetest's Irrlicht fork). "
"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 "${EXPLANATION_MSG}\n"
"Building the client with upstream Irrlicht is no longer possible.")
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(WARNING "${EXPLANATION_MSG}\n"
"The server can still be built with upstream Irrlicht but this is DISCOURAGED.")
message(STATUS "Found IrrlichtMt ${IrrlichtMt_VERSION}")
endif()
endif()

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ Run it:
- Debug build is slower, but gives much more useful output in a debugger.
- If you build a bare server you don't need to have the Irrlicht or IrrlichtMt library installed.
- In that case use `-DIRRLICHT_INCLUDE_DIR=/some/where/irrlicht/include`.
- IrrlichtMt can also be installed somewhere that is not a standard install path.
- In that case use `-DCMAKE_PREFIX_PATH=/path/to/install_prefix`
- The path must be set so that `$(CMAKE_PREFIX_PATH)/lib/cmake/IrrlichtMt` exists.

### CMake options

Expand Down
61 changes: 0 additions & 61 deletions cmake/Modules/FindIrrlicht.cmake

This file was deleted.

26 changes: 26 additions & 0 deletions cmake/Modules/MinetestFindIrrlichtHeaders.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Locate Irrlicht or IrrlichtMt headers on system.

foreach(libname IN ITEMS IrrlichtMt Irrlicht)
string(TOLOWER "${libname}" libname2)

find_path(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h
DOC "Path to the directory with IrrlichtMt includes"
PATHS
/usr/local/include/${libname2}
/usr/include/${libname2}
/system/develop/headers/${libname2} #Haiku
PATH_SUFFIXES "include/${libname2}"
)

if(IRRLICHT_INCLUDE_DIR)
break()
endif()
endforeach()

# Handholding for users
if(IRRLICHT_INCLUDE_DIR AND (NOT IS_DIRECTORY "${IRRLICHT_INCLUDE_DIR}" OR
NOT EXISTS "${IRRLICHT_INCLUDE_DIR}/irrlicht.h"))
message(WARNING "IRRLICHT_INCLUDE_DIR was set to ${IRRLICHT_INCLUDE_DIR} "
"but irrlicht.h does not exist inside. The path will not be used.")
unset(IRRLICHT_INCLUDE_DIR CACHE)
endif()
41 changes: 7 additions & 34 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,33 +293,7 @@ else()
if(NOT HAIKU AND NOT APPLE)
find_package(X11 REQUIRED)
endif(NOT HAIKU AND NOT APPLE)

##
# The following dependencies are transitive dependencies from Irrlicht.
# Minetest itself does not use them, but we link them so that statically
# linking Irrlicht works.
if(NOT HAIKU AND NOT APPLE)
# This way Xxf86vm is found on OpenBSD too
find_library(XXF86VM_LIBRARY Xxf86vm)
mark_as_advanced(XXF86VM_LIBRARY)
set(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${XXF86VM_LIBRARY})
endif(NOT HAIKU AND NOT APPLE)

find_package(JPEG REQUIRED)
find_package(PNG REQUIRED)
if(APPLE)
find_library(CARBON_LIB Carbon REQUIRED)
find_library(COCOA_LIB Cocoa REQUIRED)
find_library(IOKIT_LIB IOKit REQUIRED)
mark_as_advanced(
CARBON_LIB
COCOA_LIB
IOKIT_LIB
)
SET(CLIENT_PLATFORM_LIBS ${CLIENT_PLATFORM_LIBS} ${CARBON_LIB} ${COCOA_LIB} ${IOKIT_LIB})
endif(APPLE)
##
endif(BUILD_CLIENT)
endif()

find_package(ZLIB REQUIRED)
set(PLATFORM_LIBS -lpthread ${CMAKE_DL_LIBS})
Expand Down Expand Up @@ -511,9 +485,7 @@ endif()
include_directories(
${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}
${IRRLICHT_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
${PNG_INCLUDE_DIR}
${SOUND_INCLUDE_DIRS}
${SQLITE3_INCLUDE_DIR}
${LUA_INCLUDE_DIR}
Expand Down Expand Up @@ -548,18 +520,14 @@ if(BUILD_CLIENT)
target_link_libraries(
${PROJECT_NAME}
${ZLIB_LIBRARIES}
${IRRLICHT_LIBRARY}
${JPEG_LIBRARIES}
${BZIP2_LIBRARIES}
${PNG_LIBRARIES}
IrrlichtMt::IrrlichtMt
${X11_LIBRARIES}
sfan5 marked this conversation as resolved.
Show resolved Hide resolved
${SOUND_LIBRARIES}
${SQLITE3_LIBRARY}
${LUA_LIBRARY}
${GMP_LIBRARY}
${JSON_LIBRARY}
${PLATFORM_LIBS}
${CLIENT_PLATFORM_LIBS}
)
if(NOT USE_LUAJIT)
set_target_properties(${PROJECT_NAME} PROPERTIES
Expand Down Expand Up @@ -629,6 +597,11 @@ endif(BUILD_CLIENT)
if(BUILD_SERVER)
add_executable(${PROJECT_NAME}server ${server_SRCS} ${extra_windows_SRCS})
add_dependencies(${PROJECT_NAME}server GenerateVersion)

get_target_property(
IRRLICHT_INCLUDES IrrlichtMt::IrrlichtMt INTERFACE_INCLUDE_DIRECTORIES)
# Doesn't work without PRIVATE/PUBLIC/INTERFACE mode specified.
target_include_directories(${PROJECT_NAME}server PRIVATE ${IRRLICHT_INCLUDES})
target_link_libraries(
${PROJECT_NAME}server
${ZLIB_LIBRARIES}
Expand Down
8 changes: 3 additions & 5 deletions util/buildbot/buildwin32.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if [ -z "$toolchain_file" ]; then
fi
echo "Using $toolchain_file"

irrlicht_version=1.9.0mt1
irrlicht_version=1.9.0mt2
ogg_version=1.3.4
vorbis_version=1.3.7
curl_version=7.76.1
Expand Down Expand Up @@ -97,7 +97,7 @@ cd $builddir
mkdir build
cd build

irr_dlls=$(echo $libdir/irrlicht/bin/*.dll | tr ' ' ';')
irr_dlls=$(echo $libdir/irrlicht/lib/*.dll | tr ' ' ';')
vorbis_dlls=$(echo $libdir/libvorbis/bin/libvorbis{,file}-*.dll | tr ' ' ';')
gettext_dlls=$(echo $libdir/gettext/bin/lib{intl,iconv}-*.dll | tr ' ' ';')

Expand All @@ -113,9 +113,7 @@ cmake -S $sourcedir -B . \
-DENABLE_FREETYPE=1 \
-DENABLE_LEVELDB=1 \
\
-DIRRLICHT_INCLUDE_DIR=$libdir/irrlicht/include/irrlichtmt \
-DIRRLICHT_LIBRARY=$libdir/irrlicht/lib/libIrrlichtMt.dll.a \
-DIRRLICHT_DLL="$irr_dlls" \
-DCMAKE_PREFIX_PATH=$libdir/irrlicht \
\
-DZLIB_INCLUDE_DIR=$libdir/zlib/include \
-DZLIB_LIBRARIES=$libdir/zlib/lib/libz.dll.a \
Expand Down
8 changes: 3 additions & 5 deletions util/buildbot/buildwin64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ if [ -z "$toolchain_file" ]; then
fi
echo "Using $toolchain_file"

irrlicht_version=1.9.0mt1
irrlicht_version=1.9.0mt2
ogg_version=1.3.4
vorbis_version=1.3.7
curl_version=7.76.1
Expand Down Expand Up @@ -97,7 +97,7 @@ cd $builddir
mkdir build
cd build

irr_dlls=$(echo $libdir/irrlicht/bin/*.dll | tr ' ' ';')
irr_dlls=$(echo $libdir/irrlicht/lib/*.dll | tr ' ' ';')
vorbis_dlls=$(echo $libdir/libvorbis/bin/libvorbis{,file}-*.dll | tr ' ' ';')
gettext_dlls=$(echo $libdir/gettext/bin/lib{intl,iconv}-*.dll | tr ' ' ';')

Expand All @@ -113,9 +113,7 @@ cmake -S $sourcedir -B . \
-DENABLE_FREETYPE=1 \
-DENABLE_LEVELDB=1 \
\
-DIRRLICHT_INCLUDE_DIR=$libdir/irrlicht/include/irrlichtmt \
-DIRRLICHT_LIBRARY=$libdir/irrlicht/lib/libIrrlichtMt.dll.a \
-DIRRLICHT_DLL="$irr_dlls" \
-DCMAKE_PREFIX_PATH=$libdir/irrlicht \
\
-DZLIB_INCLUDE_DIR=$libdir/zlib/include \
-DZLIB_LIBRARIES=$libdir/zlib/lib/libz.dll.a \
Expand Down
4 changes: 1 addition & 3 deletions util/ci/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ install_linux_deps() {
shift
pkgs+=(libirrlicht-dev)
else
# TODO: return old URL when IrrlichtMt 1.9.0mt2 is tagged
#wget "https://github.com/minetest/irrlicht/releases/download/1.9.0mt1/ubuntu-bionic.tar.gz"
wget "http:https://minetest.kitsunemimi.pw/irrlichtmt-patched-temporary.tgz" -O ubuntu-bionic.tar.gz
wget "https://github.com/minetest/irrlicht/releases/download/1.9.0mt2/ubuntu-bionic.tar.gz"
sudo tar -xaf ubuntu-bionic.tar.gz -C /usr/local
fi

Expand Down