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

cmake . could not find a package configuration file provided by SDL2. #63

Closed
JJJHolscher opened this issue May 24, 2023 · 1 comment
Closed

Comments

@JJJHolscher
Copy link

On my arch machine with sdl2 installed, the cmake . -DRUN_IN_PLACE=TRUE command returns the error

> cmake . -DRUN_IN_PLACE=TRUE
-- The C compiler identification is GNU 13.1.1
-- The CXX compiler identification is GNU 13.1.1
[...]
-- Check size of size_t
-- Check size of size_t - done
CMake Error at src/CMakeLists.txt:40 (find_package):
  Could not find a package configuration file provided by "SDL2" with any of
  the following names:

    SDL2Config.cmake
    sdl2-config.cmake

  Add the installation prefix of "SDL2" to CMAKE_PREFIX_PATH or set
  "SDL2_DIR" to a directory containing one of the above files.  If "SDL2"
  provides a separate development package or SDK, be sure it has been
  installed.


-- Configuring incomplete, errors occurred!

This is after having run the code from https://github.com/minetest/minetest/blob/master/doc/compiling/linux.md

sudo pacman -S base-devel libcurl-gnutls cmake libxi libpng sqlite libogg libvorbis openal freetype2 jsoncpp gmp luajit leveldb ncurses zstd
git clone --depth 1 https://github.com/EleutherAI/minetest.git
cd minetest
git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game
git clone --depth 1 https://github.com/minetest/irrlicht.git lib/irrlichtmt

The minetest version (https://github.com/minetest/minetest.git)

cmake . -DRUN_IN_PLACE=TRUE
make . -j8

Successfully builds bin/minetest after running the above 2 shell scripts.

@JJJHolscher
Copy link
Author

I overlooked build_instructions.txt.
After following that and updating the setup.py I got it to work.

Here is my makefile, which should work from any empty repo provided you run linux and installed the necessary system-wide dependencies.

pwd = $(shell pwd)
name = $(notdir $(pwd))
venv = $(pwd)/.venv/bin/python

export IRRLICHT_REPO = "$(pwd)/irrlicht"

define git-clone
	$(eval module_name = $(notdir $1))

	# Add or update the repo as a submodule, or clone it.
	git submodule add $1 || \
	git submodule update --init "$(module_name)" || \
	git clone --depth 1 $1

	cd $(module_name) && git checkout $2
endef

.venv/bin/activate: minetest/bin/minetest
	python -m venv --prompt minetest .venv
	@echo "\nexport MPLBACKEND=''" >> .venv/bin/activate
	. .venv/bin/activate && \
	pip install -e ./minetest && \
	pip install --upgrade protobuf==3.20.1 && \
	cd minetest/scripts && \
	./compile_proto.sh

# cmake . -DRUN_IN_PLACE=TRUE -DBUILD_HEADLESS=1 -DSDL2_DIR="$(pwd)/SDL/build/lib/cmake/SDL2/" && 
minetest/bin/minetest: minetest/games/minetest_game zmqpp/build/max-g++/libzmqpp.a
	cd minetest && \
	cmake . -DRUN_IN_PLACE=TRUE -DBUILD_HEADLESS=0 -DSDL2_DIR= && \
	make -j$(shell nproc)

minetest/games/minetest_game: zmqpp/.git irrlicht/.git minetest/.git minetest_game/.git
	@rm -r minetest/lib/zmqpp
	@rm -r minetest/lib/irrlichtmt
	@ln -s $(pwd)/zmqpp/ minetest/lib/zmqpp
	@ln -s $(pwd)/irrlicht/ minetest/lib/irrlichtmt
	@ln -s $(pwd)/minetest_game/ minetest/games/minetest_game || echo "minetest_game already linked"

minetest_game/.git:
	$(call git-clone,https://github.com/minetest/minetest_game,master)

minetest/.git:
	$(call git-clone,https://github.com/EleutherAI/minetest,develop)

irrlicht/.git:
	$(call git-clone,https://github.com/EleutherAI/irrlicht,headless-rendering)

zmqpp/build/max-g++/libzmqpp.a: zmqpp/.git
	cd zmqpp && make

zmqpp/.git:
	$(call git-clone,https://github.com/zeromq/zmqpp,develop)

SDL/build/bin/sdl2-config: SDL/.git
	mkdir SDL/build
	cd SDL/build && \
	../configure --prefix="$(pwd)/SDL/build" && \
	make && \
	make install

SDL/.git:
	$(call git-clone,https://github.com/libsdl-org/SDL,release-2.26.2)

test: .venv/bin/activate
	. .venv/bin/activate && \
	python -m minetester.scripts.test_loop

clean:
	rm -r .venv
	rm -r irrlicht
	rm -r SDL
	rm -r minetest
	rm -r minetest_game
	rm -r zmqpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant