1
0

Add build scripts for Windows using MSYS2 (#130)

This commit is contained in:
Deve 2023-05-23 23:36:06 +02:00 committed by mckaygerhard
parent 732281da4a
commit 3219db4e89
24 changed files with 684 additions and 10 deletions

View File

@ -214,6 +214,46 @@ jobs:
NO_MINETEST_GAME: 1
NO_PACKAGE: 1
msys2-mingw64:
name: "MSYS2-MinGW (64-bit)"
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-autotools git zip
- name: Build
run: |
cd ./Windows
./Start.sh
cmake --build . -j
cd -
strip -s ./bin/multicraft.exe
- name: Create ZIP
run: |
mkdir MultiCraft
cp -r ./bin MultiCraft/
cp -r ./builtin MultiCraft/
cp -r ./client MultiCraft/
cp -r ./fonts MultiCraft/
cp -r ./games MultiCraft/
cp -r ./locale MultiCraft/
cp -r ./textures MultiCraft/
zip -r MultiCraft.zip MultiCraft
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: MultiCraft-msys2-mingw64
path: ./MultiCraft.zip
msvc:
name: VS 2022 ${{ matrix.config.arch }}-${{ matrix.type }}
runs-on: windows-2022

9
Windows/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
CMakeFiles
deps/*
!deps/*.sh
lib
locale
src
*.ninja*
*.cmake
CMakeCache.txt

39
Windows/Manual.md Normal file
View File

@ -0,0 +1,39 @@
The SHIITTT of Guindows
-----------------------
This is reduced set for stupid windosers:
1. Download MSYS2 from https://www.msys2.org/
https://github.com/msys2/msys2-installer/releases/download/2023-03-18/msys2-x86_64-20230318.exe
2. After installation open "MSYS2 MINGW64" from Menu Start
3. Install required packages with
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-autotools git
4. Browse to MultiCraft directory, for example
cd /c/Users/username/Documents/MultiCraft
5. Build inside build/windows directory with
./Start
cmake --build . -j
6. Check libraries linked with multicraft.exe using command below. It should
show only system libraries.
objdump -x ../../bin/multicraft.exe | grep dll
--------------
The "make -j" and even "make -j`nproc`" eats a lot of memory (when building libcurl).
If it's a problem, then change NPROC to 1 or so.
Also, don't install any other packages that are not for mingw because then some
libraries search headers in /usr/include rather than /mingw64/include and fail
to compile.

73
Windows/Start.sh Executable file
View File

@ -0,0 +1,73 @@
#!/bin/bash -e
echo
echo "Starting build MultiCraft for Windows..."
echo
echo "Build Libraries:"
cd deps
sh libraries.sh
cd ..
export DEPS_ROOT=$(pwd)/deps
cmake ../ \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_SQLITE=1 \
-DENABLE_POSTGRESQL=0 \
-DENABLE_LEVELDB=0 \
-DENABLE_REDIS=0 \
-DENABLE_SPATIAL=0 \
-DENABLE_PROMETHEUS=0 \
-DENABLE_CURSES=0 \
-DENABLE_SYSTEM_GMP=0 \
-DUSE_SDL=1 \
-DUSE_STATIC_BUILD=1 \
-DCMAKE_C_FLAGS="-static \
-DNO_IRR_COMPILE_WITH_SDL_TEXTINPUT_ \
-DNO_IRR_COMPILE_WITH_OGLES2_ \
-DNO_IRR_COMPILE_WITH_DIRECT3D_9_ \
-DNO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_ \
-D_IRR_STATIC_LIB_ \
-DAL_LIBTYPE_STATIC \
-DCURL_STATICLIB" \
-DCMAKE_CXX_FLAGS="-static \
-DNO_IRR_COMPILE_WITH_SDL_TEXTINPUT_ \
-DNO_IRR_COMPILE_WITH_OGLES2_ \
-DNO_IRR_COMPILE_WITH_DIRECT3D_9_ \
-DNO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_ \
-D_IRR_STATIC_LIB_ \
-DAL_LIBTYPE_STATIC \
-DCURL_STATICLIB" \
-DIRRLICHT_LIBRARY="$DEPS_ROOT/irrlicht/lib/libIrrlicht.a" \
-DIRRLICHT_INCLUDE_DIR="$DEPS_ROOT/irrlicht/include" \
-DSDL2_LIBRARIES="$DEPS_ROOT/sdl2/lib/libSDL2.a" \
-DSDL2_INCLUDE_DIR="$DEPS_ROOT/sdl2/include" \
-DCURL_LIBRARY="$DEPS_ROOT/libcurl/lib/libcurl.a" \
-DCURL_INCLUDE_DIR="$DEPS_ROOT/libcurl/include" \
-DLUA_LIBRARY="$DEPS_ROOT/luajit/lib/libluajit.a" \
-DLUA_INCLUDE_DIR="$DEPS_ROOT/luajit/include" \
-DZLIB_LIBRARIES="$DEPS_ROOT/zlib/lib/libzlibstatic.a" \
-DZLIB_INCLUDE_DIR="$DEPS_ROOT/zlib/include" \
-DPNG_LIBRARIES="$DEPS_ROOT/libpng/lib/libpng16.a" \
-DPNG_INCLUDE_DIR="$DEPS_ROOT/libpng/include" \
-DJPEG_LIBRARIES="$DEPS_ROOT/libjpeg/lib/libjpeg.a" \
-DJPEG_INCLUDE_DIR="$DEPS_ROOT/libjpeg/include" \
-DFREETYPE_LIBRARY="$DEPS_ROOT/freetype/lib/libfreetype.a" \
-DFREETYPE_INCLUDE_DIRS="$DEPS_ROOT/freetype/include" \
-DSQLITE3_LIBRARY="$DEPS_ROOT/sqlite/lib/libsqlite3.a" \
-DSQLITE3_INCLUDE_DIR="$DEPS_ROOT/sqlite/include" \
-DOGG_LIBRARY="$DEPS_ROOT/libogg/lib/libogg.a" \
-DOGG_INCLUDE_DIR="$DEPS_ROOT/libogg/include" \
-DVORBIS_LIBRARY="$DEPS_ROOT/libvorbis/lib/libvorbis.a" \
-DVORBISFILE_LIBRARY="$DEPS_ROOT/libvorbis/lib/libvorbisfile.a" \
-DVORBIS_INCLUDE_DIR="$DEPS_ROOT/libvorbis/include" \
-DGETTEXT_LIBRARY="$DEPS_ROOT/gettext/lib/libintl.a" \
-DGETTEXT_ICONV_LIBRARY="/mingw64/lib/libiconv.a" \
-DGETTEXT_INCLUDE_DIR="$DEPS_ROOT/gettext/include" \
-DOPENAL_LIBRARY="$DEPS_ROOT/openal/lib/libOpenAL32.a" \
-DOPENAL_INCLUDE_DIR="$DEPS_ROOT/openal/include/AL"
echo
echo "Build with 'cmake --build . -j'"

37
Windows/deps/SDL2.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash -e
SDL2_VERSION=2.26.5
. ./sdk.sh
if [ ! -d SDL2-src ]; then
wget https://github.com/libsdl-org/SDL/archive/release-$SDL2_VERSION.tar.gz
tar -xzvf release-$SDL2_VERSION.tar.gz
mv SDL-release-$SDL2_VERSION sdl2-src
rm release-$SDL2_VERSION.tar.gz
fi
cd sdl2-src
mkdir -p build; cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS -fPIC" \
-DSDL_SHARED=0 \
-DSDL_STATIC=1
cmake --build . -j$NPROC
# update `include` folder
rm -rf ../../sdl2/include
mkdir -p ../../sdl2/include
cp -a ./include ../../sdl2
cp -a ./include-config-release/* ../../sdl2/include
# update lib
rm -rf ../../sdl2/lib
mkdir -p ../../sdl2/lib
cp -a *.a ../../sdl2/lib
echo "SDL2 build successful"

39
Windows/deps/freetype.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash -e
FREETYPE_VERSION=2.13.0
. ./sdk.sh
if [ ! -d freetype-src ]; then
wget https://download.savannah.gnu.org/releases/freetype/freetype-$FREETYPE_VERSION.tar.gz
tar -xzvf freetype-$FREETYPE_VERSION.tar.gz
mv freetype-$FREETYPE_VERSION freetype-src
rm freetype-$FREETYPE_VERSION.tar.gz
mkdir freetype-src/build
fi
cd freetype-src/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=FALSE \
-DFT_DISABLE_BZIP2=TRUE \
-DFT_DISABLE_PNG=TRUE \
-DFT_DISABLE_HARFBUZZ=TRUE \
-DFT_DISABLE_BROTLI=TRUE \
-DCMAKE_C_FLAGS_RELEASE="$CFLAGS"
cmake --build . -j$NPROC
# update `include` folder
rm -rf ../../freetype/include
mkdir -p ../../freetype/include
cp -a ../include ../../freetype
cp -a ./include ../../freetype
rm -rf ../../freetype/include/dlg
# update lib
rm -rf ../../freetype/lib
mkdir -p ../../freetype/lib
cp libfreetype.a ../../freetype/lib
echo "Freetype build successful"

29
Windows/deps/gettext.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash -e
. ./sdk.sh
GETTEXT_VERSION=0.21.1
if [ ! -d gettext-src ]; then
wget https://ftp.gnu.org/pub/gnu/gettext/gettext-$GETTEXT_VERSION.tar.gz
tar -xzvf gettext-$GETTEXT_VERSION.tar.gz
mv gettext-$GETTEXT_VERSION gettext-src
rm gettext-$GETTEXT_VERSION.tar.gz
fi
cd gettext-src/gettext-runtime
./configure CFLAGS="$CFLAGS" CPPFLAGS="$CXXFLAGS" \
--disable-shared --enable-static --disable-libasprintf
make -j$NPROC
# update `include` folder
rm -rf ../../gettext/include
mkdir -p ../../gettext/include
cp intl/libintl.h ../../gettext/include
# update lib
rm -rf ../../gettext/lib
mkdir -p ../../gettext/lib
cp intl/.libs/libintl.a ../../gettext/lib
echo "Gettext build successful"

32
Windows/deps/irrlicht.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash -e
. ./sdk.sh
export DEPS_ROOT=$(pwd)
[ ! -d irrlicht-src ] && \
git clone --depth 1 -b SDL2 https://github.com/MoNTE48/Irrlicht irrlicht-src
cd irrlicht-src/source/Irrlicht
CPPFLAGS="$CPPFLAGS \
-DNO_IRR_COMPILE_WITH_SDL_TEXTINPUT_ \
-DNO_IRR_COMPILE_WITH_OGLES2_ \
-DNO_IRR_COMPILE_WITH_DIRECT3D_9_ \
-I$DEPS_ROOT/sdl2/include \
-I$DEPS_ROOT/zlib/include \
-I$DEPS_ROOT/libjpeg/include \
-I$DEPS_ROOT/libpng/include" \
CXXFLAGS="$CXXFLAGS -std=gnu++17" \
make staticlib_win32 -j$NPROC NDEBUG=1
# update `include` folder
rm -rf ../../../irrlicht/include
mkdir -p ../../../irrlicht/include
cp -a ../../include ../../../irrlicht
# update lib
rm -rf ../../../irrlicht/lib
mkdir -p ../../../irrlicht/lib
cp ../../lib/Win32-gcc/libIrrlicht.a ../../../irrlicht/lib
echo "Irrlicht build successful"

41
Windows/deps/libcurl.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash -e
. ./sdk.sh
CURL_VERSION=8.1.1
export DEPS_ROOT=$(pwd)
if [ ! -d libcurl-src ]; then
wget https://curl.haxx.se/download/curl-$CURL_VERSION.tar.gz
tar -xzvf curl-$CURL_VERSION.tar.gz
mv curl-$CURL_VERSION libcurl-src
rm curl-$CURL_VERSION.tar.gz
fi
cd libcurl-src
./configure \
--with-schannel \
--disable-shared --enable-static \
--disable-debug --disable-verbose --disable-versioned-symbols \
--disable-dependency-tracking --disable-libcurl-option \
--disable-ares --disable-cookies --disable-crypto-auth --disable-manual \
--disable-proxy --disable-unix-sockets --without-librtmp \
--disable-ftp --disable-ldap --disable-ldaps --disable-rtsp \
--disable-dict --disable-telnet --disable-tftp --disable-pop3 \
--disable-imap --disable-smtp --disable-gopher \
--without-zstd --without-brotli --without-nghttp2 --without-libidn2 \
--without-libpsl
make -j$NPROC
# update `include` folder
rm -rf ../libcurl/include
mkdir -p ../libcurl/include
cp -a ./include ../libcurl
# update lib
rm -rf ../libcurl/lib
mkdir -p ../libcurl/lib
cp lib/.libs/libcurl.a ../libcurl/lib
echo "libcurl build successful"

33
Windows/deps/libjpeg.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash -e
. ./sdk.sh
JPEG_VERSION=2.1.5.1
if [ ! -d libjpeg-src ]; then
wget https://download.sourceforge.net/libjpeg-turbo/libjpeg-turbo-$JPEG_VERSION.tar.gz
tar -xzvf libjpeg-turbo-$JPEG_VERSION.tar.gz
mv libjpeg-turbo-$JPEG_VERSION libjpeg-src
rm libjpeg-turbo-$JPEG_VERSION.tar.gz
mkdir libjpeg-src/build
fi
cd libjpeg-src/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_SHARED=OFF \
-DCMAKE_C_FLAGS_RELEASE="$CFLAGS"
cmake --build . -j$NPROC
# update `include` folder
rm -rf ../../libjpeg/include
mkdir -p ../../libjpeg/include
cp -a ../*.h ../../libjpeg/include
cp -a *.h ../../libjpeg/include
# update lib
rm -rf ../../libjpeg/lib
mkdir -p ../../libjpeg/lib
cp libjpeg.a ../../libjpeg/lib
echo "libjpeg build successful"

30
Windows/deps/libogg.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash -e
. ./sdk.sh
OGG_VERSION=1.3.5
if [ ! -d libogg-src ]; then
git clone -b v$OGG_VERSION --depth 1 https://github.com/xiph/ogg libogg-src
mkdir libogg-src/build
fi
cd libogg-src/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS_RELEASE="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS -fPIC"
cmake --build . -j$NPROC
# update `include` folder
rm -rf ../../libogg/include
mkdir -p ../../libogg/include
cp -a ../include ../../libogg
cp -a ./include ../../libogg
# update lib
rm -rf ../../libogg/lib
mkdir -p ../../libogg/lib
cp libogg.a ../../libogg/lib
echo "Ogg build successful"

39
Windows/deps/libpng.sh Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash -e
. ./sdk.sh
PNG_VERSION=1.6.39
export DEPS_ROOT=$(pwd)
if [ ! -d libpng-src ]; then
wget https://download.sourceforge.net/libpng/libpng-$PNG_VERSION.tar.gz
tar -xzvf libpng-$PNG_VERSION.tar.gz
mv libpng-$PNG_VERSION libpng-src
rm libpng-$PNG_VERSION.tar.gz
mkdir libpng-src/build
fi
cd libpng-src/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DPNG_SHARED=OFF \
-DPNG_TESTS=OFF \
-DPNG_EXECUTABLES=OFF \
-DPNG_BUILD_ZLIB=ON \
-DZLIB_INCLUDE_DIRS="$DEPS_ROOT/zlib/include" \
-DCMAKE_C_FLAGS_RELEASE="$CFLAGS"
cmake --build . -j$NPROC
# update `include` folder
rm -rf ../../libpng/include
mkdir -p ../../libpng/include
cp -a ../*.h ../../libpng/include
cp -a *.h ../../libpng/include
# update lib
rm -rf ../../libpng/lib
mkdir -p ../../libpng/lib
cp libpng16.a ../../libpng/lib
echo "libpng build successful"

20
Windows/deps/libraries.sh Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash -e
# Build libs
sh ./freetype.sh
sh ./gettext.sh
sh ./sqlite.sh
sh ./luajit.sh
sh ./libjpeg.sh
sh ./zlib.sh
sh ./libpng.sh
sh ./SDL2.sh
sh ./irrlicht.sh
sh ./openal.sh
sh ./libcurl.sh
sh ./libogg.sh
sh ./vorbis.sh
echo
echo "All libraries were built!"

27
Windows/deps/luajit.sh Executable file
View File

@ -0,0 +1,27 @@
#!/bin/bash -e
LUAJIT_VERSION=2.1
. ./sdk.sh
if [ ! -d luajit-src ]; then
wget https://github.com/LuaJIT/LuaJIT/archive/v$LUAJIT_VERSION.tar.gz
tar -xzvf v$LUAJIT_VERSION.tar.gz
mv LuaJIT-$LUAJIT_VERSION luajit-src
rm v$LUAJIT_VERSION.tar.gz
fi
cd luajit-src
make amalg -j$NPROC BUILDMODE=static
# update `include` folder
rm -rf ../luajit/include
mkdir -p ../luajit/include
cp -a ./src/*.h ../luajit/include
# update lib
rm -rf ../luajit/lib
mkdir -p ../luajit/lib
cp src/libluajit.a ../luajit/lib
echo "LuaJIT build successful"

35
Windows/deps/openal.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash -e
. ./sdk.sh
OPENAL_VERSION=1.23.1
if [ ! -d openal-src ]; then
git clone -b $OPENAL_VERSION --depth 1 https://github.com/kcat/openal-soft openal-src
fi
cd openal-src/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DLIBTYPE=STATIC \
-DALSOFT_EMBED_HRTF_DATA=ON \
-DALSOFT_UTILS=OFF \
-DALSOFT_EXAMPLES=OFF \
-DALSOFT_BACKEND_WAVE=OFF \
-DALSOFT_BACKEND_SNDIO=OFF \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS -fPIC"
cmake --build . -j$NPROC
# update `include` folder
rm -rf ../../openal/include
mkdir -p ../../openal/include
cp -a ../include ../../openal
cp -a *.h ../../openal/include
# update lib
rm -rf ../../openal/lib
mkdir -p ../../openal/lib
cp libOpenAL32.a ../../openal/lib
echo "OpenAL-Soft build successful"

6
Windows/deps/sdk.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash -e
export CFLAGS="-fvisibility=hidden -fexceptions -O3"
export CXXFLAGS="$CFLAGS -frtti -O3"
export NPROC=`nproc`

32
Windows/deps/sqlite.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash -e
SQLITE_VERSION=3.42.0
. ./sdk.sh
if [ ! -d sqlite-src ]; then
wget https://www.sqlite.org/src/tarball/sqlite.tar.gz?r=version-$SQLITE_VERSION
tar -xzvf sqlite.tar.gz?r=version-$SQLITE_VERSION
mv sqlite sqlite-src
rm sqlite.tar.gz?r=version-$SQLITE_VERSION
mkdir sqlite-src/build
fi
cd sqlite-src/build
../configure \
--enable-shared \
--enable-static
make -j$NPROC
# update `include` folder
rm -rf ../../sqlite/include
mkdir -p ../../sqlite/include
cp -a ./sqlite3*.h ../../sqlite/include
# update lib
rm -rf ../../sqlite/lib
mkdir -p ../../sqlite/lib
cp .libs/libsqlite3.a ../../sqlite/lib
echo "SQLite build successful"

31
Windows/deps/vorbis.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash -e
. ./sdk.sh
VORBIS_VERSION=1.3.7
if [ ! -d libvorbis-src ]; then
git clone -b v$VORBIS_VERSION --depth 1 https://github.com/xiph/vorbis libvorbis-src
mkdir libvorbis-src/build
fi
cd libvorbis-src/build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DOGG_LIBRARY="../../libogg/libogg.a" \
-DOGG_INCLUDE_DIR="../../libogg/include" \
-DCMAKE_C_FLAGS_RELEASE="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS -fPIC"
cmake --build . -j$NPROC
# update `include` folder
rm -rf ../../libvorbis/include
mkdir -p ../../libvorbis/include
cp -a ../include ../../libvorbis
# update lib
rm -rf ../../libvorbis/lib
mkdir -p ../../libvorbis/lib
cp -a lib/*.a ../../libvorbis/lib
echo "Vorbis build successful"

34
Windows/deps/zlib.sh Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash -e
ZLIB_VERSION=1.2.13
. ./sdk.sh
if [ ! -d zlib-src ]; then
wget https://github.com/madler/zlib/archive/v$ZLIB_VERSION.tar.gz
tar -xzvf v$ZLIB_VERSION.tar.gz
mv zlib-$ZLIB_VERSION zlib-src
rm v$ZLIB_VERSION.tar.gz
fi
cd zlib-src
mkdir -p build; cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="$CFLAGS"
cmake --build . -j$NPROC
# update `include` folder
rm -rf ../../zlib/include
mkdir -p ../../zlib/include
cp -a ../*.h ../../zlib/include
cp -a *.h ../../zlib/include
# update lib
rm -rf ../../zlib/lib
mkdir -p ../../zlib/lib
cp libzlibstatic.a ../../zlib/lib
echo "zlib build successful"

View File

@ -50,7 +50,7 @@ if(WIN32)
NAMES libiconv2.dll
PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib"
DOC "gettext *iconv*.lib")
set(GETTEXT_REQUIRED_VARS ${GETTEXT_REQUIRED_VARS} GETTEXT_DLL GETTEXT_ICONV_DLL)
set(GETTEXT_REQUIRED_VARS ${GETTEXT_REQUIRED_VARS} GETTEXT_LIBRARY)
endif(WIN32)
@ -65,7 +65,11 @@ if(GETTEXTLIB_FOUND)
endif()
set(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po)
set(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale/<locale>/LC_MESSAGES)
if(WIN32)
set(GETTEXT_MO_BUILD_PATH ${CMAKE_SOURCE_DIR}/locale/<locale>/LC_MESSAGES)
else()
set(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale/<locale>/LC_MESSAGES)
endif()
set(GETTEXT_MO_DEST_PATH ${LOCALEDIR}/<locale>/LC_MESSAGES)
file(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*")
list(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES minetest.pot)

View File

@ -31,6 +31,22 @@ if(NOT (BUILD_CLIENT OR BUILD_SERVER))
set(BUILD_SERVER TRUE)
endif()
option(USE_SDL "Use SDL2 for window management" FALSE)
option(USE_STATIC_BUILD "Link additional libraries needed for static build" FALSE)
if(USE_SDL)
if(NOT USE_STATIC_BUILD)
find_package(SDL2)
else()
set(SDL2_FOUND TRUE)
endif()
if (SDL2_FOUND)
message(STATUS "SDL2 found.")
include_directories(${SDL2_INCLUDE_DIR})
else()
message(FATAL_ERROR "SDL2 not found.")
endif()
endif()
option(ENABLE_CURL "Enable cURL support for fetching media" TRUE)
set(USE_CURL FALSE)
@ -566,6 +582,21 @@ if(BUILD_CLIENT)
)
endif()
if(USE_SDL)
target_link_libraries(
${PROJECT_NAME}
${SDL2_LIBRARIES}
)
if(USE_STATIC_BUILD AND WIN32)
target_link_libraries(
${PROJECT_NAME}
winmm
imm32
setupapi
opengl32
)
endif()
endif()
if(ENABLE_GLES)
target_link_libraries(
${PROJECT_NAME}
@ -583,12 +614,23 @@ if(BUILD_CLIENT)
${PROJECT_NAME}
${GETTEXT_LIBRARY}
)
if(USE_STATIC_BUILD)
target_link_libraries(
${PROJECT_NAME}
${GETTEXT_ICONV_LIBRARY}
)
endif()
endif()
if(USE_CURL)
target_link_libraries(
${PROJECT_NAME}
${CURL_LIBRARY}
)
if(USE_STATIC_BUILD)
if(WIN32)
target_link_libraries(${PROJECT_NAME} bcrypt crypt32 ws2_32)
endif()
endif()
endif()
if(USE_FREETYPE)
if(FREETYPE_PKGCONFIG_FOUND)

View File

@ -335,12 +335,6 @@ static bool getWindowHandle(irr::video::IVideoDriver *driver, HWND &hWnd)
const video::SExposedVideoData exposedData = driver->getExposedVideoData();
switch (driver->getDriverType()) {
case video::EDT_DIRECT3D8:
hWnd = reinterpret_cast<HWND>(exposedData.D3D8.HWnd);
break;
case video::EDT_DIRECT3D9:
hWnd = reinterpret_cast<HWND>(exposedData.D3D9.HWnd);
break;
case video::EDT_OPENGL:
hWnd = reinterpret_cast<HWND>(exposedData.OpenGLWin32.HWnd);
break;

View File

@ -219,8 +219,8 @@ void init_gettext(const char *path, const std::string &configured_language,
if (locale[0].language) {
char lang[3] = {0};
strncpy(lang, locale[0].language, 2);
setenv("LANG", lang, 1);
setenv("LANGUAGE", lang, 1);
SDL_setenv("LANG", lang, 1);
SDL_setenv("LANGUAGE", lang, 1);
}
SDL_free(locale);

View File

@ -250,6 +250,14 @@ int main(int argc, char *argv[])
return retval;
}
#ifdef WIN32
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
return main(__argc, __argv);
}
#endif
/*****************************************************************************
* Startup / Init