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

Conversation

JosiahWI
Copy link
Contributor

@JosiahWI JosiahWI commented May 24, 2021

With the CMake changes to IrrlichtMt, it's now possible to use a target for IrrlichtMt.
Besides greatly improving the ease of setting up IrrlichtMt for users building the client, it removes the need for Minetest's CMake to include transitive dependencies such as image libraries and Android or iOS libs, cleaning it up a tiny bit. The PR works by finding the IrrlichtMt package and linking to the target it provides. If the package isn't found and it isn't building the client, it will still fall back to using just the headers of old Irrlicht or IrrlichtMt.

To do

Ready for Review

How to test

  • Build and install IrrlichtMt, for example:
  • cmake -S . -B build -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=~/.local
  • cmake --build build -j $(nproc)
  • cmake --install build
  • Build Minetest, for example:
  • cmake -S . -B build -DRUN_IN_PLACE=TRUE -DCMAKE_PREFIX_PATH=~/.local
  • cmake --build build -j $(nproc)
  • Observe that it builds and runs correctly.
  • Edit for documentation: CMAKE_INSTALL_PREFIX and CMAKE_PREFIX_PATH are only required if the installation is not wanted in the system paths. If left out, it will install with the other system libraries and will be found automatically.

@JosiahWI
Copy link
Contributor Author

I don't know how this happened but I must have done something whacky with my branches, I'll fix it and force push.

@sfan5 sfan5 added @ Build CMake, build scripts, official builds, compiler and linker errors Feature ✨ PRs that add or enhance a feature WIP The PR is still being worked on by its author and not ready yet. labels May 24, 2021
@JosiahWI JosiahWI changed the title Newirrlicht Take advantage of IrrlichtMt target May 24, 2021
@sfan5 sfan5 removed the WIP The PR is still being worked on by its author and not ready yet. label May 24, 2021
@NeroBurner
Copy link
Contributor

You'll need to update the wget URL with a precompiled binary package of the new IrrlichtMt repository, which provides the new IrrlichtMt::IrrlichtMt target

Or you change the wget command to download latest master and build it

@JosiahWI
Copy link
Contributor Author

Where do I get that new URL/precompiled binary package?

@sfan5
Copy link
Member

sfan5 commented May 25, 2021

You'd get them when I tag IrrlichtMt 1.9.0mt2 and upload the binaries here.
But I don't want to do that until we know that it works (in case changes are needed).

So we're not stuck here, here's the same binaries of the current state uploaded in another place:

  • http:https://minetest.kitsunemimi.pw/temp/ubuntu-bionic.tar.gz
  • http:https://minetest.kitsunemimi.pw/temp/win32.zip
  • http:https://minetest.kitsunemimi.pw/temp/win64.zip

@sfan5 sfan5 added the WIP The PR is still being worked on by its author and not ready yet. label May 25, 2021
@JosiahWI JosiahWI force-pushed the newirrlicht branch 2 times, most recently from c3497d8 to b01c8b6 Compare June 5, 2021 18:38
util/buildbot/buildwin32.sh Outdated Show resolved Hide resolved
@SmallJoker
Copy link
Member

SmallJoker commented Jun 16, 2021

Is it still WIP or ready for re-review?

EDIT: clang 9 fails:

-- *** Will build version 5.5.0-dev-debug ***
CMake Error at CMakeLists.txt:65 (message):
-- Configuring incomplete, errors occurred!
  Irrlicht or IrrlichtMt headers are required to build the server, but none
See also "/home/runner/work/minetest/minetest/cmakebuild/CMakeFiles/CMakeOutput.log".
  found.

.. which indicated wrong behaviour, or is it in fact intended this way?

@JosiahWI
Copy link
Contributor Author

JosiahWI commented Jun 16, 2021

I am not intending to add more functionality, but the Prometheus build uses old Irrlicht and I removed automatic header detection for old Irrlicht, which maybe I need to put back in? I was careful to support building the server with old irrlicht headers, but I required the variable to be set by hand.

Edit: To explain the problem simply, all clang 9 CI builds use the same build.sh script so I can't pass in a variable for Irrlicht headers to just the Prometheus build.

@JosiahWI
Copy link
Contributor Author

Also MinGW is failing, and although I suspect the problem, it shouldn't be a problem, so this one requires me to check docs and do some research. I know this seems like it's moving really slowly; I'm working on it mostly on weekends so the bugs are being fixed at a very gradual pace.

@JosiahWI
Copy link
Contributor Author

JosiahWI commented Jun 18, 2021

Something I hacked together in the Irrlicht CMake to save time added public dependencies unbeknownst to me (docs aren't even clear on the behavior) and its breaking the MinGW build. This will be on hold for a little bit until I work out the best solution and patch it.

@NeroBurner
Copy link
Contributor

@JosiahWI I created a fix PR for the unintentional public dependencies minetest/irrlicht#39

Also added a branch using use_builtin_irrlicht_mt branch (PR for completeness #11276 ) in the CI

The resulting GitHub Actions show all builds green, except the MSVC ones because no 'GL/wglext.h' can be found

https://github.com/NeroBurner/minetest/runs/2862069811?check_suite_focus=true

image

@sfan5 sfan5 added the Rebase needed The PR needs to be rebased by its author. label Jun 21, 2021
src/CMakeLists.txt Outdated Show resolved Hide resolved
@JosiahWI
Copy link
Contributor Author

I will rebase shortly. Are the IrrlichtMt binaries for CI updated?

@JosiahWI
Copy link
Contributor Author

I'm sorry, I did not see you had committed and I thought I had amended a commit or something. I will always check in the future so this won't happen again.

@JosiahWI
Copy link
Contributor Author

JosiahWI commented Jun 30, 2021

Can you reapply the commit?
Edit: I put the lost changes back in.

CMakeLists.txt Outdated Show resolved Hide resolved
@sfan5
Copy link
Member

sfan5 commented Jul 4, 2021

This works but I just thought of an edge case: If you build a server with IrrlichtMt available to cmake (not just the headers), you will get an executable that links to IrrlichtMt even though the library itself is not needed.

@NeroBurner
Copy link
Contributor

https://stackoverflow.com/questions/58759647/how-to-get-include-directories-from-a-target-for-use-in-add-custom-target

We could use the following to get the include dir from the IrrlichtMt::IrrlichtMt target for the server executable

if(TARGET IrrlichtMt::IrrlichtMt)
    get_target_property(IRRLICHT_INCLUDE_DIR IrrlichtMt::IrrlichtMt INCLUDE_DIRECTORIES)
endif()

@JosiahWI
Copy link
Contributor Author

JosiahWI commented Jul 4, 2021

We probably want the INTERFACE_INCLUDE_DIRECTORIES property if we do that. If a core dev would like the change to be done I can add it.

@sfan5
Copy link
Member

sfan5 commented Jul 5, 2021

sure.
Make sure to pull before committing, I added some changes yesterday.

Previous behavior was to link the IrrlichtMt target which would link libraries that the server does not need. To handle dependencies in a more efficient manner, only the include directories are given to the server now.
README.md Outdated Show resolved Hide resolved
@celeron55
Copy link
Member

I'm giving this my +1, but if you don't mind making the irrlichtmt installation better guided within the error messages, it would be nice.

@sfan5 sfan5 merged commit cf13691 into minetest:master Jul 27, 2021
@sfan5
Copy link
Member

sfan5 commented Jul 28, 2021

You have IrrlichtMt installed system-wide

How it was before:

cmake .

How it is now:

cmake .

You have IrrlichtMt cloned to lib/irrlichtmt

(what end users probably do)

How it was before:

cmake .

How it is now:

cmake .

You have IrrlichtMt installed(!) in a folder

How it was before:

cmake -DIRRLICHT_INCLUDE_DIR=/somewhere/include -DIRRLICHT_LIBARY=/somewhere/lib/libIrrlichtMt.so .

How it is now:

cmake -DCMAKE_PREFIX_PATH=/somewhere .

You have IrrlichtMt cloned somewhere

(what developers probably do, including me)

How it was before:

cmake -DIRRLICHT_INCLUDE_DIR=/somewhere/include -DIRRLICHT_LIBARY=/somewhere/lib/Linux/libIrrlichtMt.a .

How it is now:

cmake -DCMAKE_PREFIX_PATH=/somewhere .

@JosiahWI JosiahWI deleted the newirrlicht branch November 4, 2021 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@ Build CMake, build scripts, official builds, compiler and linker errors Feature ✨ PRs that add or enhance a feature >= Two approvals ✅ ✅
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants