Skip to content

Commit

Permalink
add minetest build script and fix relative builds
Browse files Browse the repository at this point in the history
  • Loading branch information
AI-WAIFU committed Jul 12, 2023
1 parent d415e8f commit 5dd3174
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 5 deletions.
15 changes: 12 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.PHONY: all deps repos sdl2 package
.PHONY: all deps repos sdl2 package zmqpp
SDL2_CMAKE_FILE := lib/SDL/build/lib/cmake/SDL2/sdl2-config.cmake
ZMQPP_LIB_FILE := lib/zmqpp/build/max-g++/libzmqpp.a

all: package

Expand All @@ -11,12 +12,20 @@ repos:
# Init all submodules
git submodule update --init --recursive

$(SDL2_CMAKE_FILE):
$(SDL2_CMAKE_FILE): repos
# compile sdl2
util/minetester/build_sdl2.sh


sdl2: $(SDL2_CMAKE_FILE)

$(ZMQPP_LIB_FILE): repos
#compile zmqpp
util/minetester/build_zmqpp.sh

zmqpp: $(ZMQPP_LIB_FILE)

minetest:
util/minetester/build_minetest.sh

package: deps repos

13 changes: 11 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ if(ENABLE_PROTOBUF)
get_filename_component(directory ${file} DIRECTORY)
get_filename_component(truename ${directory}/${basename} ABSOLUTE)
file(RELATIVE_PATH relname ${PROTO_PARENT}/proto ${truename})
set(outnames ${PROJECT_SOURCE_DIR}/${relname}.pb.h ${PROJECT_SOURCE_DIR}/${relname}.pb.cc)
set(outnames ${CMAKE_CURRENT_BINARY_DIR}/${relname}.pb.h ${CMAKE_CURRENT_BINARY_DIR}/${relname}.pb.cc)
add_custom_command(OUTPUT ${outnames}
COMMAND protobuf::protoc
ARGS --cpp_out=. --proto_path ${PROTO_PARENT}/proto ${file}
Expand Down Expand Up @@ -496,7 +496,6 @@ endif(BUILD_CLIENT)

set(client_SRCS
${client_SRCS}
${proto_targets}
${common_SRCS}
${gui_SRCS}
${client_network_SRCS}
Expand All @@ -523,10 +522,20 @@ list(SORT server_SRCS)
# Avoid source_group on broken CMake version.
# see issue #7074 #7075
if (CMAKE_VERSION VERSION_GREATER 3.8.1)
source_group(TREE ${CMAKE_CURRENT_BINARY_DIR} PREFIX "ProtoBuf Source Files" FILES ${proto_targets})
source_group(TREE ${PROJECT_SOURCE_DIR} PREFIX "Source Files" FILES ${client_SRCS})
source_group(TREE ${PROJECT_SOURCE_DIR} PREFIX "Source Files" FILES ${server_SRCS})
endif()

set(client_SRCS
${client_SRCS}
${proto_targets}
)

if (CMAKE_VERSION VERSION_GREATER 3.8.1)

endif()

include_directories(
${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}
Expand Down
26 changes: 26 additions & 0 deletions util/minetester/build_minetest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

ROOT=$(pwd)

mkdir build
mkdir build/normal
mkdir build/headless

cd build/headless


SDL2_DIR=${ROOT}/lib/SDL/build/lib/cmake/SDL2/

echo ${SDL2_DIR}

cmake ../.. -DRUN_IN_PLACE=TRUE -DBUILD_HEADLESS=1 -DSDL2_DIR=${SDL2_DIR}
make -j$(( $(nproc) > 1 ? $(nproc) - 1 : 1 )) #use max(nproc,1) threads

cd ../..

mv bin/minetest bin/minetest_headless

cd build/normal
cmake ../.. -DRUN_IN_PLACE=TRUE -DBUILD_HEADLESS=0 -DSDL2_DIR=
make -j$(( $(nproc) > 1 ? $(nproc) - 1 : 1 ))


2 changes: 2 additions & 0 deletions util/minetester/build_zmqpp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
cd lib/zmqpp
make

0 comments on commit 5dd3174

Please sign in to comment.